Junit 5 - No ParameterResolver registered for parameter
I had both @Test
and @ParameterizedTest
annotating the same method. I removed the former.
As Marc Philipp mentioned in his comment, you need to ensure that JUnit Jupiter can instantiate your test class.
For your particular scenario, you'll need to remove your custom constructor that accepts a WebDriver
.
Then you have two options:
- Create the
WebDriver
on your own -- for example, in an@BeforeAll
or@BeforeEach
method. - Use an extension such as Selenium Jupiter to help manage the
WebDriver
for you.
This error appears when you try to use both @Test
and @ParameterizedTest
in the same test class. Removing @Test
annotation will resolve the issue.
I also got ParameterResolutionException
with JUnit 5.
org.junit.jupiter.api.extension.ParameterResolutionException:
No ParameterResolver registered for parameter [int[] arg0] in constructor (public my_package.MyClass(int[]))
I had written @Test
methods inside the class I was testing.
This error could be fixed in two ways:
1) Either replacing import org.junit.jupiter.api.Test
with import org.junit.Test
, or
2) Writing tests in a separate TestClass.