How to modify the ATEasy Test Log output

Knowledge Base Article # Q200188

Read Prior Article Read Next Article
Summary How to modify the ATEasy Test Log output
  
Login to rate article
This article covers the following Log file subjects:

  • How to set the Log format to HTML or Text
  • How to modify the ATEasy Log strings
  • How to change the TestLog Company Logo
  • How to change the position of the TestLog Company Logo
  • How to add additional information to the TestLog

Note:
An ATEasy application (Q200188.zip) that demonstrates how to adjust the various TestLog settings, shown here, can be downloaded by clicking on this link DownloadQ200188.zip

Setting the ATEasy Log Format

The ATEasy Log format can be set to either HTML or Text as follows:
  • In the ATEasy Menu go to the Tools..Options. In the Log tab check the "Use the HTML format as default" box to set the output to HTML. If the box is not checked the output will be Text mode.
  • In the Test Executive similar example exist in the Options, Customize or Users forms.
  • The format can also be changed at runtime by setting the PlainText property of the internal variable Log. The PlainText property can be used to set a value that determines whether the log file will be displayed and opened as either text or HTML. It can also be used to check if the log file is set to HTML or Text mode. See ALog control, PlainText and "Log Window, Using the Log, TestLog, and DebugLog Internal Variables" in ATEasy Help for more information:
Example
!Adding the following statement to the System.OnInitSystem() event
!sets the log format to plain text
Log.PlainText=True


How to modify ATEasy Log strings

The following example shows how to remove the Signature line from the ATEasy TestLog output. Similiar approaches can be used to modify/remove other log string components. Note: The code shown in this example is given in the ModifyTestLogFooter() System procedure in the accompanying ATEasy application.

The following example is written around three ATEasy procedures
1) GetLogString()
2) Replace()
3) SetLogString()

1) GetLogString(): While ATEasy is executing Event procedures GetLogString() retrieves the current Log string. The contents of the Log string for the different Event procedures are shown below. See ATEasy Help for more information.
Module EventGetLogString() returns
OnInitSystemThe application top header includes the company logo
OnInitProgram / Program.OnInitThe serial number and the start time.
OnInitTask The task header.
OnEndTestThe test log line (MIN/MAX, RESULT, etc.), including the test table header if required.
OnEndProgram / Program.OnEndThe stopped time, elapsed time, UUT status, Signature


2) Replace(): Replace() returns a string in which a specified substring has been replaced with another substring. See ATEasy Help for more information.

3) SetLogString(): This procedure is used to set the next log string used by ATEasy. Setting the log string inside a test will cause ATEasy to output the string after the OnEndTest event is called. See ATEasy Help for more information.

As you can see from Item1 above, to modify the Signature line the following code will need to be added to the System.OnEndProgram() event or if the Test Excutive driver is being used it will need to be added to the beginning of the TestExec.OnEndProgram() event:

Example
s:string! String used to store the Log string
sSub:string! String used to store the line to be removed

s=GetLogString()            ! Get the current log string
if Log.PlainText=TRUE then  ! Check to see which log format is being used
   !If the log format is Plain Text then remove this line
   sSub="Signature    : ...................."
else
   !If the log format is HTML then remove this line
   sSub="<TR><TD width=15% align=left>Signature<TD width=85% "  \  
       "align=left>: __________________________________"
endif
s=Replace(s, sSub,"",,,True)! Remove the string sSub from the original log string
SetLogString(s)             ! Set the new log string


How to change the TestLog Company Logo

Note: See ChangeCompanyLogo() System procedure in the accompanying ATEasy application

There are two ways of replacing the company logo:
  • The quick solution is to save your company logo to the same size as the built in image (103x44) and copy it to C:\Program Files\ATEasy\CompanyLogo.gif.
  • Alternatively, you can change the default Company Logo file location. To do this you will need to change the HTML header that is output to the test log after OnInitSystem is called. You can do that by calling GetLogString(), modifying the return string with your own file location and then calling SetLogString().
    To view the original string you can right click on your log window and select View Source. Then look for CompanyLogo.gif, you will need to modify the table around it.

Notes:
  • 1) If your company logo file is larger than 103x44 you will have to change the Right and Left Width values to adjust the location of the logo
    2) If you are using the Test Exec you will need to use the following command to set the string (instead of Get/SetLogString):
TestExec Log Set InitialString()


Example:
s        :string  ! String used to store the Log string
sSub       :string  ! String used to store the line to be removed
sFileLoc  :string  ! String used to store new Logo image file location

s=GetLogString()            ! Get the current log string
sSub="C:\\Program Files\\ATEasy\\CompanyLogo.gif" !This is the default Logo image file location
s=Replace(s, sSub,sFileLoc,,,True)   ! Add in the new Logo location
SetLogString(s)             ! Set the new log string


How to change the position of the TestLog Company Logo

Note: See ChangeCompanyLogo() System procedure in the accompanying ATEasy application.
As before you will need to change the HTML header that is output to the test log after OnInitSystem is called. You can do that by calling GetLogString(), modifying the return string with your new settings and then calling SetLogString(). To view the original string you can right click on your log window and select View Source. Then look for your company logo image filename, you will need to modify the table arround it.
The logo can be shifted horizontally adjusting the LEFT and RIGHT Width settings and by using the HSPACE attribute.

Example:
s       :string  ! String used to store the Log string
sSub      :string  ! String used to store the line to be removed
sNewStr:string  ! String used to store new Logo position

s=GetLogString()            ! Get the current log string
sSub="<TD Width=65% ALIGN=LEFT>: <TD ALIGN=RIGHT WIDTH=20% ROWSPAN=4> " \
           "<IMG SRC=\"File:C:\\Program Files\\ATEasy\\CompanyLogo.gif\">"
sNewStr="<TD Width=20%ALIGN=LEFT>:<TD ALIGN=RIGHT WIDTH=40%ROWSPAN=4>"  \  
          "<IMG SRC=\"File:C:\\Program Files\\ATEasy\\CompanyLogo.gif\"HSPACE=100>"
s=Replace(s, sSub,sNewStr,,,True)! Add in the new Logo position in the Test Log
SetLogString(s)             ! Set the new log string


How to insert additional information to the TestLog

Additional information can be added to the TestLog by using the Append() procedure. This statement appends a message to the log string that ATEasy generates. For example, running an Append statement from a test will print its message after test results instead of ahead of them. See ATEasy Help for more information.

Example:
DMM Measure (TestResult)
if (TestResult<Test.min)
    Append "Result too low - check circuit X"
elseif (TestResult>Test.max)
    Append "Result too high - check circuit Y"
endif
Article Date 2/8/2010 , 6/1/2021
Keywords ATEasy, Log, PlainText, GetLogString(), SetLogString()


Login to rate article

1 ratings | 5 out of 5
Read Prior Article Read Next Article
>