This code will only work when activating test from the runner. (it will not run when running test from eclipse)
The more problematic issue: after the code above is activated, execution will stop in the next time the test makes a report (report.report(...)), so you need to embed report calls in your test code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I might have seen this sort of question in the forum, but I did not see any
clear answer.
Lets assume I have a ping thread to a server , and the main thread that does
something else for ever.
I would like the main thread ( = the entire test ) to fail/stop in case of a
failure on the ping thread.
I know that I can report a failure via the monitor thread, but the main will
continue forever.
Is there a way to generate some sort of an Event and catch it then stop the
test ?
Is there another way? ( I saw the yes/no J option ion window )
Thanks,
Yossi.
Here is a possible solution, I haven't tried it, but it should work.
In your thread activate this code:
if (ListenerstManager.getInstance() instanceof ListenerstManager) {
((ListenerstManager)ListenerstManager.getInstance()).gracefulStop();
}
Pay attention to the following limitations:
Thanks Golan,
I'll give it a try.
/Yossi.
When running from maven the provided solution doesn't work.
Is there any solution?