Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Writing tests for tests(How do you write working tests for JUnit Launches?)
Writing tests for tests [message #1279291] Fri, 28 March 2014 14:22
Ricardo Gladwell is currently offline Ricardo Gladwell
Messages: 12
Registered: July 2009
Location: London, UK
Junior Member

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?
Previous Topic:Runtime failure to resolve plugin that is in manifest.mf
Next Topic:Quick Fix Event
Goto Forum:
  


Current Time: Thu Oct 30 16:57:35 GMT 2014

Powered by FUDForum. Page generated in 0.01575 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software