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 7871671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:58:30+00:00 2026-06-03T01:58:30+00:00

Suppose I want to manually run from my IDE (Intellij IDEA, or eclipse) 4000

  • 0

Suppose I want to manually run from my IDE (Intellij IDEA, or eclipse) 4000 JUnit tests; the first 1000 tests run pretty smoothly (say they take 3 minutes all 1000) but the test 1001 takes alone over 30 minutes.
Is there a way I can skip the test 1001 (while it’s still running) and to let the test 1002 (and the others) keep going. I do not want to @Ignore the test 1001 and rerun the suite because I already have the answer for tests 1-1000; also I do not want to select tests 1001-4000 because it takes too much time.

I would some kind of button – Skip Current Test – which can be pressed when the test is running.

In case such feature does not exist, an enhancement for it needs to be done by the IDE developers or by JUnit developers?

  • 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-03T01:58:33+00:00Added an answer on June 3, 2026 at 1:58 am

    What you’re asking for is to stop executing your code while it is in mid test. You can’t stop executing a current test without having hooks in your code to allow it. Your best solution is to use Categories as others have suggested.

    Basically, JUnit executes all of the @Before methods (including @Rules), then your @Test method, then the @After methods (again, including @Rules). Even assuming that JUnit had a mechanism for stopping execution of it’s bits of the code (which it doesn’t), most of the time is spent in your code. So to ‘skip’ a test which has already started requires you to modify your test code (and potentially the code that it’s testing) in order that you can cleanly stop it. Cleanly stopping an executing thread is a question in itself [*].

    So what are your options?

    1. Run the tests in parallel, then you don’t have to wait as long for the tests to finish. This may work, but parallelizing the tests may well be a lot of work.

    2. Stop execution of the tests, and fix the one that’s you’re working on. Most IDEs have an option to kill the JVM in which the tests are running. This is definitely the easiest option.

    3. Implement your own test runner, which runs the test in a separate thread. This test runner then either waits for the thread to finish executing, or checks a flag somewhere which would be a signal for it to stop. This sounds complicated, because you need t manage your threads but also to set the flag in a running jvm. Maybe creating a file somewhere? This runner would then fail the currently running test, and you could move on to the next. Please note that ‘stopping’ a test midway may leave stuff in an inconsistent state, or you may end up executing stuff in parallel.

    There are parallel JUnit runners out there, and I don’t think you’re going to get much help from IDE developers (at least in the short term). Also, look at TestNG, which allows stuff to be run in parallel.

    For using categories, one solution I use is to run the long running tests separately using maven surefire or similar, not through the IDE. This involves checking out the source code somewhere else on my machine and building there.

    [*]: Java, how to stop threads, Regarding stopping of a thread

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

Sidebar

Related Questions

Suppose I specify I want my worker role to run on a 4-cores virtual
Suppose I want to put objects that identify a server into a stl set
Suppose I want to execute code, for example value += 5 inside a namespace
Suppose I want to make a Web application which uses a fixed width and
Suppose you want to dynamically add to a HTML menu, where the menu HTML
Suppose we want to find out what will be the color property of particular
Suppose I want to implement an interpreter for a functional language. I would like
Suppose we want two constructors for a class representing complex numbers: Complex (double re,
Suppose I want to replace occurrences of foo with oof: $s = abc foo
Suppose I want to transfer just a portion of a file over FTP -

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.