Writing tests for tests [message #1279291] |
Fri, 28 March 2014 14:22 |
|
I'm trying to write an end-to-end test fixture using the Eclipse PDE JUnit runner to verify that a sample launch is running successfully. The following should fail:
public void testTestRunner() throws Exception {
// given
TestTestRunListener testListener = new TestTestRunListener();
JUnitCore.addTestRunListener(testListener);
ILaunchConfiguration configuration = launchManager.getLaunchConfiguration(project.getFile("test.launch"));
BlockingProgressMonitor monitor = new BlockingProgressMonitor();
// when
configuration.launch(ILaunchManager.RUN_MODE, monitor);
// then
monitor.blockUntilDone();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
}
assertFalse(testListener.incomplete());
assertTrue(testListener.launchSuccessful());
}
Note: not all code included for brevity, you can assume a simple implementation for BlockingProgressMonitor and TestTestRunListener.
I deliberately wrote a test fixture in the example project so it would fail with ane error but the unit test launch never seems to finish successfully, and seems stuck in "undefined" state.
How are other people writing JUnit PDE tests for their customised launches? Without mocking? Is the above not working due to threading issues with Mac OS X?
|
|
|
Powered by
FUDForum. Page generated in 0.03019 seconds