Forum Discussion

Monsignor's avatar
14 years ago

Why does TestComplete keep changing status image name

I want to parse TestComplele 7 logs programmatically. Specifically, I want to get names and statuses (success\failure\warning) of each test.



According to manual, I use the following command to get test run logs:

Log["SaveResultsAs"] ("PathToMyFolder", 1);




This creates a bunch of files and folders, including XMLs which can be parsed by my script. Here is an example of such an XML:

<ProjectLog>

      <ProjectLogItem id="0" pid="-1" nety="False">

            <Status>805039D.gif</Status>

            <No>1</No>

            <Name><![CDATA[Script Test Log [cTaStoring\cTaStoring_Start]]]></Name>

            <StartTime>13.04.2012 12:26:15</StartTime>

            <EndTime>13.04.2012 12:27:47</EndTime>

            <RunTime>0:01:32</RunTime>

            <Details></Details>

            <Messages/>

      </ProjectLogItem>

      <ProjectLogItem id="1" pid="-1" nety="False">

            <Status>905039C.gif</Status>

            <No>2</No>

            <Name><![CDATA[AutomaticStoring]]></Name>

            <StartTime>13.04.2012 12:27:47</StartTime>

            <EndTime>13.04.2012 12:30:42</EndTime>

            <RunTime>0:02:55</RunTime>

            <Details></Details>

            <Messages/>

      </ProjectLogItem>

</ProjectLog>




As you can see, I can get almost everything I want, but the most valuable piece of data, the status of a test is written as a file name of a picture showing the corresponding icon! E.g. 805039D.gif contains a checkmark and 905039C.gif contains an exclamation mark.



It would be easy to hardcode these names in my scripts, but the problem is that they change constantly!



Questions:

1. Why have they decided to use image names instead of some enumeration to output statuses?

2. Why on earth do icons change their names?

3. How to get the statuses of tests?

1 Reply


  • Hi Roman,



    When you export the test log to a folder manually, TestComplete exports the results to a collection of HTML, XML, image and other helper files. This operation is equal to the 'Log["SaveResultsAs"] ("PathToMyFolder", lsHTML)' method. By default, you export your test log results to the XML format. It's equal to the lsXML LogFormat value. To learn about the difference between the lsHTML and lsXML LogFormat values, see the Log.SaveResultsAs article.



    In the exported 'root.xml' file in your 'PathToMyFolder' parameter, you can find something like this:

    <LogData name="Script Test Log [Unit1\Main]" status="0">...</LogData>




    By analyzing the value of the status attribute, you can find out whether a test run was successful:



    0: the test run was successful;

    1: there were warnings;

    2: the test failed.



    Please refer to the 'Exported Results Structure' article for details.



    BTW, the latest version of the product is TestComplete 8.70.