Bruce
Bruce

Reputation: 1678

JUnit set timeout from command line

In JUnit3 and JUnit4, when I run tests from command line, is there a way to pass an option so I can specify timeout for every test case?

Note that we have to use command line, so the answers should NOT be using annotation (@Test(timeout=1000)), but it should be something like:

JUnit3:

java junit.textui.TestRunner --timeout=1000 TestClass1 [TestClass2, ...]

JUnit4:

java org.junit.runner.JUnitCore --timeout=1000 TestClass1 [TestClass2, ...]

Upvotes: 4

Views: 423

Answers (1)

Bruce
Bruce

Reputation: 1678

After doing the research into junit 3&4 source code I have to accept that what I want is not possible. The command only accepts test classes as arguments, so no other options can be passed to it to specify timeout.

Upvotes: 5

Related Questions