Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse cant run JUnit tests with "Failures First" when using @RunWith{AllTests.class}
Eclipse cant run JUnit tests with "Failures First" when using @RunWith{AllTests.class} [message #1000311] Mon, 14 January 2013 13:54
Tobias Bertelsen is currently offline Tobias BertelsenFriend
Messages: 25
Registered: October 2011
Junior Member
Hi There.

I have two different test suites, StaticSuite and DynamicSuite
@RunWith(Suite.class)
@SuiteClasses({
  PassingTests.class, // Contains only a passing test.
  FailingTests.class  // Contains a passing and a failing test.
})
public class StaticSuite {
}


@RunWith(AllTests.class)
public class DynamicSuite{
  public static TestSuite suite() {
    final TestSuite suite = new TestSuite();
    suite.addTest(new JUnit4TestAdapter(PassingTests.class));
    suite.addTest(new JUnit4TestAdapter(FailingTests.class));
    return suite;
  }
}


Running the entire suite normally works fine, but when I select "Rerun Test - Failures First" I have a problem with the DynamicSuite. The tests in the DynamicSuite are executed in the normal order and not reordered as they are supposed to. When doing the exact same thing with the StaticSuite everything works as expected.

Do anybody know a fix to this, or is this a bug I should file?

More detailed info:
Everything in the run configuration is identical apart from the suite. I execute the suites as plugin tests, since I'm working in an OSGi environment.

When running the DynamicSuite normally, the test methods are ordered randomly from time to time. The order of test classes resembles the order of the addTest calls. When running with "Failures First" I see the exact same thing, i.e., PassingTests is executed first, and methods is executed in random order.

When running the StaticSuite normally, classes and test methods are ordered as they appear in the suite or class respectively.

I'm working on a project with 50+ test fragments. I want to create a solution, where we calculates suites at runtime, instead of manually maintaining them.
My approach is inspired by this post http://www.modumind.com/2008/06/12/running-unit-tests-for-rcp-and-osgi-applications/
Previous Topic:Remove Project History (Indigo)
Next Topic:Problems rerunning specific tests with dynamically generated TestSuite
Goto Forum:
  


Current Time: Fri Mar 29 11:19:46 GMT 2024

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

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

Back to the top