I need a tets based exit function. Some of my functions use exit from test (exittest) but this approach is dangerous for some test cases. For example in the beginning of the test I change some system config file, then run a function and re-change the config file to its original case. When running the test if that function gets error and exits from test inside function code, rest of the test do not run. But end of thetest contains some functions that has to run.
I would like to use custom error function per test. Is there a way to make this without returning false/true from functuions ? Here is what I'm actually trying to do, I want to set a standard error function my test automation, that a different function should run after an errors ccour in that function. Is there any simple way of doing this?
There is an initialize() and finalize() method in QTP. I'm thinking that in finalize() you can check err.number for anything other than zero. You could do your clean up in finalize() depending on the err.number. I have not tried this. I don't know if the err object travels into the finalize() code.