Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8104875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:59:52+00:00 2026-06-05T23:59:52+00:00

It seems that runClasses() doesn’t terminate the code being tested even after the test

  • 0

It seems that runClasses() doesn’t terminate the code being tested even after the test times out and fails.

An SSCCE:

import org.junit.Test;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;

class Main {
    public static void main(String[] args) {
        Class<?>[] classes = { PublicTest.class };
        Result result = JUnitCore.runClasses(classes);
        System.out.println("Num tests: " + result.getRunCount());
        System.out.println("Time: " + result.getRunTime());
        System.out.println("Failure: " + result.getFailures().get(0));
    }
}

Test class:

import org.junit.Test;

public class PublicTest {
    @Test(timeout=10)
    public void loop() {
        while(true) {}
    }
}

How do I get the code to terminate?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:59:53+00:00Added an answer on June 5, 2026 at 11:59 pm

    JUnitCore at some point indeed does create a new thread that is never finishing. The main() implementation of JUnit avoids getting stuck by calling System.exit() when it has completed its work. That seems a little untidy to me, but might be the best solution for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seems that even after unchecking the option in the PyDev/Debug preferenecs pane to launch
It seems that HTMLCollection and NodeList is undefined in ie6/7,and following code will result
It seems that the onmouseout event in the .izberiLokacija class is being triggered by
It seems that if require_once is called within function, the included file doesn't extend
It seems that Google only offers code to embed the +1 button. However, there
It seems that following code is wrong, as on the first call the code
It seems that this should be simple, but I'm having trouble figuring out how
It seems that when I run the following code: #include <stdio.h> #include <stdlib.h> int
It seems that YUI is very focused on providing all the same code for
It seems that C# 3 hit me without me even noticing, could you guys

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.