Answer the question
In order to leave comments, you need to log in
How to implement the ability to stop a JUnit-Selenium test while it is running?
Imagine the most common test written in java, Junit + Selenium. When passing this test, it is necessary to implement the possibility of stopping its execution (for example, by pressing a button), while the driver should not be closed, and continuing the execution (for example, by pressing the same button).
Are there any ideas how to do this?
The only thing that comes to my mind is the idea to raise a second thread that will listen to a button press. But how do you stop the test?
Answer the question
In order to leave comments, you need to log in
EMNIP Selenium will forcibly close the browser fairly quickly by timeout. and in order to follow the button, it is enough to turn the test into a (secretly) graphical application - the choice of the hall - SWT or Swing or JavaFx - it will be no different from the console one except for a bunch of additional dependencies - do you have an example? i have both SWT and JAvaFx apps and Selenium tests in my git repo - it's usually rare for anyone to cross a hedgehog with a snake...
this will stop the test not at an arbitrary point, but where it will
(new CustomDialog(shell)).open();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question