Page 1 of 1

pause a test from a thread outside

Posted: Mon Aug 11, 2014 8:16 am
by agrimm
Hi Community,
i have written a piece of code in program.cs to restart the program to test in a thread outside the current test. Now i have the problem, that those restart actions have to be executed completely before the main test continues. Actually both tests are running parallel and it could be, that some actions are failing cause of timeouts.
So it would be nice to pause the main test execution, run the restart actions from inside the thread and then continue with the main test. Is there maybe a Ranorex Funktion available?

Thanks in advance

Re: pause a test from a thread outside

Posted: Wed Aug 13, 2014 9:05 am
by Support Team
Hi agrimm,

Unfortunately Ranorex does not provide a method/action to pause the main thread since Ranorex is designed to run in a single threaded mode. I’m not exactly sure how your tests look like but it shouldn’t be a problem to restart the AUT (Application Under Test) before starting your test, e.g., within the “Program.cs”. Even if your test contains a few steps before restarting your AUT, just shift the “restart”-code snippet to a “UserCodeModule” and call it as a part of your test.

Please feel free to correct me and try to rephrase your question if I’m wrong at any point.

Regards,
Robert

Re: pause a test from a thread outside

Posted: Thu Aug 14, 2014 2:39 pm
by agrimm
Hi Robert,
the problem is that i don´t know, when the program crashes (or better, in which iteration of the test). That´s where this thread should watch permanently and restart the program from outside if necessary, so that the (main) ranorex test could continue. An integration into a specified usercode module couldn´t be the right place for that restart routine, right?

Now the actual situation is, that the ranorex test continues with it´s work and runs into timeouts, because the application doesn´t respond (logically..., it´s crashed). That´s why i asked for a pause option in ranorex that i could use to freeze the main process, until the thread has has restarted the program.

Any other thoughts to design such an workarround are welcome.

Many thanks

Re: pause a test from a thread outside

Posted: Thu Aug 14, 2014 2:59 pm
by krstcs
I would suggest that if your AUT is crashing, you should NOT continue the test. How do you guarantee the state/stability of the test after it continues? I don't think you can, and that means the test run becomes invalid because all data points after the crash are suspect.

You should get the crash fixed. Your tests should not be written to take unexpected or abnormal behavior into account unless you are doing specific, negative testing. Even the popup watcher should be used VERY sparingly.

All tests should have known inputs, known actions and expected results. If you are getting crashes, that is an UNEXPECTED result and should not be allowed to continue without being fixed.



One thing you CAN do is to use a Continuous Integration system like Jenkins to run your tests. I have mine setup so that if a test fails in my regression set, the whole set is run 1 more time to make sure it wasn't a transient issue. But even that should be a warning that there is something not right.

Re: pause a test from a thread outside

Posted: Mon Aug 18, 2014 11:46 am
by agrimm
That´s true, normally i would call the test as failed.
But in this case where the test runs over a couple of hours, an exception handling is needed, and the information about the following testcases are still usable.

Since i really got no idea how to react properly, i would log the whole situation in the first place and leave it as it is.

So far, thanks for your comments.