I am writing a program that sets up a graphical interface for running JUnit test scripts that use Selenium WebDriver in Java. The GUI sets up the JUnit test queue in the background (or, as I suppose). In the GUI, I want to use the โstop testโ button, which will stop all future JUnit tests that are still in the queue, but I want to do this in a timely manner. I currently have a code that will stop all tests, but if there are 190 tests in the queue, to stop a singular test in the queue from running, which is not timely, and is not suitable for consumers if you think that many tests
Field field = JUnitCore.class.getDeclaredField("fNotifier"); field.setAccessible(true); RunNotifier runNotifier = (RunNotifier) field.get(runner); runNotifier.pleaseStop();
Is there a way to clear the JUnit test queue or a specific thread to close that will stop scripts from executing without killing the GUI?
java multithreading junit selenium webdriver
Brent thoenen
source share