How to replace @ParameterizedTest with RetryingTest?

83 Views Asked by At

I have a test:

@ParameterizedTest
@MethodSource("getTestData")
fun fooTest(
    arg1: Int,
    arg2: Int,
    arg3: String,
) { 
    ...

It communicates with quite unstable test container (I can't make it more stable).

So from time to time it fails

Based on this

I've added dependency:

testImplementation("org.junit-pioneer:junit-pioneer:2.2.0")

and rewrote it it with:

@RetryingTest(maxAttempts = 3, minSuccess = 1, suspendForMs = 1000)
@MethodSource("getTestData")
fun fooTest(
    arg1: Int,
    arg2: Int,
    arg3: String,
) { 
    ...

but looks like it doesn't see @MethodSource annotation:

Test execution #3 (of up to 3 with at least 1 successes) failed ~> test fails - see cause for details (2 failures)
    org.opentest4j.TestAbortedException: No ParameterResolver registered for parameter [int arg1] in method ...
Test execution #1 (of up to 3) failed ~> will retry in 1000 ms...
    org.opentest4j.TestAbortedException: No ParameterResolver registered for parameter [int arg1] in method ...
Test execution #2 (of up to 3) failed ~> will retry in 1000 ms...
org.gradle.internal.exceptions.DefaultMultiCauseException: Test execution #3 (of up to 3 with at least 1 successes) failed ~> test fails - see cause for details (2 failures)
    org.opentest4j.TestAbortedException: No ParameterResolver registered for parameter [int arg1] in method ...
Test execution #1 (of up to 3) failed ~> will retry in 1000 ms...
    org.opentest4j.TestAbortedException: No ParameterResolver registered for parameter [int arg1] in method ....
Test execution #2 (of up to 3) failed ~> will retry in 1000 ms..

.

Is there way to fix it ?

P.S. I've found existing question but there are no correct answer

1

There are 1 best solutions below

0
gstackoverflow On