Forum Discussion
Dmitry_Nikolaev
Staff
16 years agoHi Carsten,
I am sending you the code which you can use to count errors and warnings:
function GetSum(sType);
var tempFolder, xDoc, wrnC, errC;
begin
tempFolder := aqEnvironment.GetEnvironmentVariable('temp')+'\'+IntToStr(Random(10000))+'\';
aqFileSystem.CreateFolder(tempFolder);
Log.SaveResultsAs(tempFolder, lsXML);
xDoc := Sys.OleObject('MSXML2.DOMDocument.4.0');
xDoc.load(tempFolder + 'Description.tcLog');
//Warning count
wrnC := VarToInteger(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="warning count"]/@value').text);
//Error count
errC := VarToInteger(xDoc.selectSingleNode('Nodes/Node[@name="root"]/Prp[@name="error count"]/@value').text);
aqFileSystem.DeleteFolder(tempFolder, True);
case sType of
'w': result := IntToStr(wrnC);
'e': result := IntToStr(errC);
else
result := 'Wrong parameter';
end;
end;
procedure PostSum;
begin
Log.Message('Warning count: ' + GetSum('w'));
end;
Note that if you run a project, you need to get the summary of errors and warnings using the GetSum function in a routine (in this case, it is PostSum) set as the last test item of the project. If you run a project suite, you need to add a project to the end of the test item list of the project suite. This project should contain the only test item calling the routine that uses the GetSum function.