JUnitCore.runClasses() and @Test(timeout)
See original GitHub issueHello I have the following code:
public class While {
public static void whileTrue (){
while (true) {}
}
}
import org.junit.Test;
public class WhileTest {
@Test(timeout = 1000)
public void testWhileTrue() {
While.whileTrue();
}
}
import org.junit.runner.JUnitCore;
public class RunTests {
public static void main(String[] args) {
JUnitCore.runClasses(WhileTest.class);
}
}
By running the main-method I expected, that the test-method terminat after 1000 ms. But nothing terminat. Is this a bug or is there something wrong by using the runClasses-method?
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
using runClasses(), JUnit tests not shutting down after timing ...
It seems that a timeout should cause junit to terminate. The test has already failed, why is it still running the code? It...
Read more >TimeoutTest xref - JUnit 5
1 package org.junit.tests.running.methods; 2 3 import static org.hamcrest. ... 36 @Test 37 public void failureWithTimeout() throws Exception { 38 JUnitCore ...
Read more >JUnit - Different ways to run tests using JUnitCore - LogicBig
JUnitCore class is very useful to run tests from command line or programmatically. In this tutorial we will go through various ways to...
Read more >JUnitCore.runClasses - Selenium at Fingertips
In this blogpost, we will learn how to create a Test Suite using JUnit, and execute multiple test cases using JUnit annotations, classes...
Read more >JUnit JUnitCore Example - HowToDoInJava
JUnit JUnitCore examples to run test classes in seperately one by one or run all tests in one go. Learn to use JUnitCore...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The extra thread for timed test ist ok, but i expected, that junit kill all created threads when its finished
I found out, that the main-thread terminat, but there is a new thread with the test. This thread not terminat.