question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add a way to repeat all test suit

See original GitHub issue

Currently, the JUnit has the option of using the @RepeatedTest to allow a test to run multiple times.

Using the JITWatch, we can see how the application is behaving, so using the test suit would be a great way to get this information. However, running the tests one time each we cannot give the JIT enough time to really optimize.

In summary, to achieve this, now I’m replacing all @Test() with @RepeatedTest(4500) and running the test suit via console, like:

mvn package -DskipTests
java -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly -XX:+LogCompilation -XX:LogFile=mylogfile.log  -jar ~/Downloads/junit-platform-console-standalone-1.8.0-M1.jar --class-path "..." --scan-classpath

This way, after running the test suit, I get the “mylogfile.log” with a lot of JIT decisions. I’d like to know if would be of use to have an extension or an annotation that could be easy to add that could repeat all the tests instead of having to do a search and replace in the test suit.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
nipafxcommented, May 4, 2021

I recommend to open an issue with Junit 5 because adding an option --repeat n to the launcher sounds like it deserves a discussion (there seems to be some benefit and I assume it would be quite easy to implement).

I’ll go ahead and mark this issue as blocked until that discussion was resolved (or it was stated that it can’t be had there).

1reaction
nipafxcommented, May 3, 2021

Hi @Thihup, I’m not sure whether this is possible in general. Actually, I’d be surprised if it worked for all cases, but it may work for many (e.g. the @Test annotated ones).

That said, I think this would be a nice feature for junit-platform. To run the entire suite repeatedly for a fixed number of times or even until aborted. Have you checked whether junit-platform-console-standalone has such a parameter? Maybe @sormuras can help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Use JUnit 5 Annotation @RepeatedTest With Examples
In this Tutorial, we will Understand the Feature of Repeating a Test Multiple Times using JUnit 5 Annotation @RepeatedTest With Examples.
Read more >
How can i make a test case repeat X number of times
Look at Test Suite Collections. You can add the one test case multiple times to the list and change the Execution mode to...
Read more >
Repeat a test with different data - Azure Test Plans
In this article. You add parameters to your manual test to repeat the test with different test data. For example, you can test...
Read more >
A Guide to @RepeatedTest in Junit 5 - Baeldung
Learn different ways of using and configuring the @RepeatedTest ... Creating a repeated test is simple – just add the @RepeatedTest ...
Read more >
How to repeat a test running only once Global Set-Up/Tear ...
Why does my Bazel test report failure when all individual tests are passing? 1 · How to add prerequisite check in a googletest...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found