Interesting process. Generally looks good...
...what are the issues? You haven't indicated.
Did you see the MHT report ? The last 2 page in pdf file. They are mixed up.
We have the projectItems
First the projectItem - NBAPBUD is run and it has errors. So on logerror event handler is called. in this onlogerror event handler we stop the NBAPBUD projectitem from running further. Then we are trying to export the MHT report to the hard disk . When we open the MHT report - it is missing the error information .
Now when the the next projectItem is run -NBAJOBS is run - it has errors and so on logerror event handler is called. So we stop the testItem from running further and exprt the MHT report to the hard disk. When we open the MHT report - it containhe report about NBAPBUD - which is previous projectItem and the NBAJOBS
My expected result is
When the first projectITem is Run - NBAPBUD - we should see the MHT report for NBAPBUD.
When the second projectItem is Run - NBAJOBS - we should see the MHT report for NBAJOBS.
OK, before I go any further, 2 things:
1) It's probably a good idea that, for a different issue, to start a new thread. That will help other folks having the same issue to find your thread and either comment or read your solution.
2) I don't do this for a living so, expecting the document to explain the issue means you're expecting me to sit down and do a full analysis of what you're doing to determine "Hey, there's a problem here!" Best rule of thumb: Declare the problem in the OP and provide screenshots and documentation for evidence.
That said... you're code has
Log.SaveResultsAs(outFile, lsMHT, 2)
While the parameters after outfile are optional, I think you might want to actually expand to all 4 parameters so that the "2" at the end is properly indicating the scope. Change to
Log.SaveResultsAs(outFile, lsMHT, false, 2)
and see if that corrects.
The log scope SHOULD handle it. If it's not, then it sounds like something you should message the SmartBear support staff. I seem to remember that someone else reported a similar issue and there may be a patch that you can apply.
According to the support team
I've tried reproducing the behavior on my side, and it looks like the SaveResultsAs function cannot export the current test item log. I contacted our developers to find out what they think about the situation - whether it's a bug or a known limitation.