Several log paths when exporting logs from test execute command line.
Hi,
When executing tests from test execute I can see that there is an parameter to export the logs to a given location in the mht file format. However, is it possible to define two paths? I'm interested in separating the failed and passed test cases with two folders.
Br
Fredrik
The Log.SaveResultsAs method, which you are referencing, doesn't distinguish between passed and failed within the method itself. You'll need to do a bit more work.
Just thinking over what you want, basically, you want an export of the log for a particular test case (say a project test item) and, depending upon whether or not it is passed or failed, redirect that export to a different folder.
At the start, you would need to put some or event handler in your "OnStopTest" event to check the test case and see if it is passed or failed. There are various ways this can be done, not limited to having a project variable that would store the status of the last test case and going all the way up to event handlers on the OnLogError or OnLogWarning events to update that variable or some such thing. Then, in your OnStopTest handler, based upon how you determine if a case is passed or failed, you could call Log.SaveResultsAs with the LogScope parameter set to lesCurrentTestItem.
This is assuming that, in your project architecture, a test case = a test item. If they don't, then you're not going to be able to do that kind of separation as easily. You may need to resort to writing your own logging functions to write things out to file.