Forum Discussion

jmcpeek's avatar
jmcpeek
Contributor
12 years ago

OnStopTest not the last action?

I have seen several times in developing tests and now my users have noticed that there are errors that appear in the log that occur after the OnStopTest event fires. The test starts, does a bunch of overhead things, then launches a browser. To test this, I'm closing the browser after it opens. This causes the test to fail and OnStopTest to be called. Below is the sub in its entirety. The log in TC has the CPU usage line and then the error. The log file that I'm saving out does not have the error, implying the error isn't being written until after OnStopTest has executed. Has anyone else seen this? Any ideas on how to handle it?






    log.event "Overall CPU Usage: " & sys.CPUUsage & "%"


    if projectsuite.variables.notifyEmail then


        call emailNotification("stop","")


    end if


    call log.saveresultsas(projectsuite.variables.runLogFolder & "results",1)

2 Replies

  • I think I figured out my problem. In my OnLogError event, I have it checking for certain text and have the test stop if it doesn't find it in the error string. There, I'm stopping the test by calling runner.stop. It looks like runner.stop ruins everything. When I comment out that line, the OnStopTest statement runs as expected and save the log as the last step.



    Now I just need to figure out how to stop the test gracefully when it's not an error I know about. I haven't had any luck with varying combinations of Stop on Error, Stop on Exception checkboxes.