Changing the log result during run time after the test result is appended to…

Knowledge Base Article # Q200098

Read Prior Article Read Next Article
Summary Use the ATEasy log's Document object to modify the contents of the log dynamically at run time.
  
Login to rate article
Solution:
You can change the log result during run time (even for tests that have already completed) by utilizing the ATEasy ALog’s Document object. The Document object is consistent with the Document Object Model (DOM of the Internet Explorer) .

In the example code below, the various data members of the ALog Document object are used to modify the contents of the ATEasy test log. The Document object has access to all the text that is output to the test log.

You can modify the text of each entry in the test log by accessing the appropriate innerText property.

Use the following code to modify the log entry corresponding to the first test in the first task:

! obj is a variable of type Object

obj=Log.Document.getElementsByTagName("TABLE")

obj.item(3).cells.item(5).innerText="Some Text"

! Destroy reference to Document object
obj= Nothing


Here is an explanation of how to index the different lines of the test

obj.item(3) corresponds to the first test line in the first task and cells.item(5) corresponds with the sixth column of that particular test line (if you are using a min/max test then this means the test result).

Here are some other examples:

If you have 1 task with 2 tests then obj.item(3) will correspond with task1 test1, and obj.item(4) will correspond with task1 test2.

You have to add 1 to the obj.item index if you are crossing a task. So if you have two tasks, each with 1 test, then obj.item(3) will correspond with task1 test1, and obj.item(5) will correspond with task2 test1.

Use the View Source Log context menu to see the HTML table structure generated by ATEasy.

Note: ATEasy Log must be configured to HTML format in order to use the methods described in this article (log.PlainText=False).
Article Date 7/18/2008
Keywords ATEasy, ALog


Login to rate article

Read Prior Article Read Next Article
>