I'm having a very similar problem.
I had created an event handler for OnStopTest, but it was executing after every test item and slowing down the test execution tremendously.
What I'm doing now is using the same function call and just making it the last test item run. This works fine, unless I want to manually stop the test execution. In that case, my last test item doesn't run and I don't get my log file.
So, what I need now is an event that triggers when the stop option is selected in test complete or test execute. It looked for a while like the Manual OnStopTest might do the trick, but it seems that's only for manual testing or when stepping through a teset scriptt.
Regards, Curt Hicks
function GeneralEvents_OnStopTest() {
Log.Message("Before saving results"); // Timestamp before calling Log.SaveResultsAs
if (!Log.SaveResultsAs("c:\\TestCompleteLogs", 1, true))
Log.Error("Unable to save test log");
Log.Message("After saving results"); // Timestamp after calling Log.SaveResultsAs }
}