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:
- Why have they decided to use image names instead of some enumeration
to output statuses? - Why on earth do icons change their names?
- How to get the statuses of tests?
I was most annoyed by the same issue. So I wrote this in C# to solve it:
I would get the Length of the file that the image refers to, then
So if the file it refers to is 610 in length, then pass, etc…