How to Modify ATEasy HTML Test Log Tests Table

Knowledge Base Article # Q200305

Read Prior Article
Summary Example of modifying HTML Test Log in order to add a new column for a time stamp to the tests tables for MinMax and Other test types.

This article is a step by step walk-through on how to change TestExec's HTML output log using FormatLogString(), GetLogString(), and SetLogString(). In this example, a new column for a time stamp will be added for the MinMax and Other test types.
It is recommended to only make modifications to the System File (as shown here) or to create another driver. It is not recommended to modify the TestExec driver, that way, you can update ATEasy to new version not worrying about losing your changes or the needing to re-merge your work.

Using FormatLogString to Change the Format of a Test Type

1. Insert the TestExec driver to your project.

Insert TestExec to your project.
Figure 1: Insert TestExec to your project.


2.  In the System.OnEndTest() event use the GetLongString() procedure to find the original header and test strings.

GetLogString() in System.OnEndTest.
Figure 2: GetLogString() in System.OnEndTest.


The HTML strings for the header and tests are traced to the Debug Log:

The header string.
Figure 3: The header string for Min/Max tests.


The test string.
Figure 4: A test string.


3. Both strings need to be modified to add a new column for the time stamp. After adding the columns, assign the strings to variables sHeader and sTest in the System.OnInitProgram() event.

The modified strings assigned to sHeader and sTest.
Figure 5: The modified strings assigned to sHeader and sTest.


Note:
  • In this example the strings were separated into different lines for readability. Leaving the string as one line is also valid.
  • Put a backslash before each of the inner quotations to use quotation marks inside of a string declaration. Ie: sString="Bob said "hello" to Joe." becomes sString="Bob said \"hello\" to Joe."
  • In sTest the word "TestFinishTime" is used as a placeholder. It will come in handy later, where it will be replaced with the actual time that the test completed.
  • The data in the sTest string need to be replaced by the appropriate field parameters. For more information on the field parameters, use the ATEasy Help (F1) and search for "FormatLogString" in the Index tab.

4. In the System.OnInitProgram() event use the FormatLogString() procedure to change the format of Min/Max tests. Be sure to use "atestTypeMinMax" as the input for the enTestType parameter to specify the Min/Max test. Additional information on the FormatLogString() procedure can be found in the ATEasy Help (F1) by searching for "FormatLogString" in the Index tab.

The System.OnInitProgram() event should look like the following:

FormatLogString in System.OnInitProgram().
Figure 6: FormatLogString in System.OnInitProgram().


Using the GetLogString() and SetLogString() Procedures to Change the Log Test Table

5. Go back to the System.OnEndTest() event. At the end of every test, get the current log string, replace "TestFinishTime" with the actual test completion time, and then set this new string as the next log string. The steps to do this are as follows:
a. Add a new variable called sLogString.
b. Call GetLogString(aLogStringCalcTestStatus) and assign the return string to sLogString.
c. Use the Replace procedure to replace "TestFinishTime" with the time returned from the STime() procedure.
d. Use the SetLogString procedure to set the next log string.

Figure 7 below shows what the System.OnEndTest() event should look like.

System.OnEndTest() event.
Figure 7: System.OnEndTest() event.


6. Run the project and TestExec to see the new format for Min/Max tests.

TestExec with time stamps added to Min/Max tests.
Figure 8: TestExec with time stamps added to Min/Max tests.


Repeat to Modify the Format of Another Test Type

7. Steps 2 through 4 can be repeated for another test type. Figure 9 below shows what the System.OnInitProgram() event looks like after repeating steps 2 through 4 for the "Other" test type. Use "atestTypeOther" for the enTestType parameter in FormatLogString to specify the changes are for the test type "Other".

System.OnInitProgram() event with Other test type modified.
Figure 9: System.OnInitProgram() event with Other test type modified.


Tests of type Min/Max and Other now have a time stamp column.

Tests of type Min/Max and Other have a time stamp column added.
Figure 10: Tests of type Min/Max and Other have a time stamp column added.


Download

DownloadClick here to download the example project used in this article as a .ZIP.
Article Date 2/24/2017 10:51:57 AM     Updated: 2/24/2017 10:56:20 AM
Keywords TestExec Test Exec HTML Log FormatLogString GetLogString SetLogString

0 ratings | 0 out of 5
Read Prior Article