Killing Running Tests


FEST-Swing provides support for killing an already running test suite. This feature was kindly contributed by Simeon H.K. Fitch:

From Simeon: "Let's say you're running a pretty big FEST-Swing test, one that takes a couple minutes to run. In the middle of it, a Skype call comes in. You need to answer the call, but you currently don't own the mouse! Eventually, some frantic combination of Alt, Ctrl, Cmd, Tab, Esc, F1-12, gets the window buried, and you can accept the call, but you want something more "decisive" to kill the test run."

EmergencyAbortListener implements this feature. After registering this listener in your test, you can terminate your test using the key combination 'Ctrl + Shift + A'. The key combination can be configured too.

The following example shows to use this listener in a TestNG test:

  private EmergencyAbortListener listener;  

  @BeforeMethod public void setUp() {
    listener = EmergencyAbortListener.registerInToolkit();
    // set up your test fixture.
  }

  @AfterMethod public void tearDown() {
    listener.unregister();  
    // clean up resources.
  }

Changing the default key combination for aborting test:

 listener = EmergencyAbortListener.registerInToolkit()
                                  .keyCombination(key(VK_C).modifiers(SHIFT_MASK));



Javadocs

Reports

edit SideBar