Run a single test multiple times using maven
Asked Answered
T

1

8

I have a TestNG unit test that is intermittently failing. Is there a way to run a single unit test multiple times using the surefire plugin? If not, are there any suggestions on the best way to handle this?

Tipstaff answered 20/3, 2013 at 19:0 Comment(6)
create a new test method with a loop that calls your original method...Beeswing
I don't know your code or project but i would first try to understand (and correct) why the tests fails intermittently... A test that you cannot rely on is very odd behaviour.Ensheathe
+1 to Lucas (though I don't seem to have a comment voting button right now). Also, of course, intermittent failures are a serious code smell - I'd recommend spending less time on test design and more time on figuring out why your test is failing.Saar
Does @Test(invocationCount=50) work with surefire plugin?Herd
@CPerkins. I hear ya with the code smell, but the problem ended up being in the test.Tipstaff
@Tipstaff interesting. Incidentally, it's ok here to accept your own answer since it will give later questioners the answer they seek rather than having to read comments.Saar
T
6

Once way I found is:

@Test(invocationCount = 100)
Tipstaff answered 20/3, 2013 at 19:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.