Source : JUnit 5, Eclipse 4.8 , Selenium
I can write up and execute Selenium script without any special test framework but I wanted to use Junit 5 (because we have depe
I had both @Test and @ParameterizedTest annotating the same method. I removed the former.
I got this error because my test needed my Spring Boot server to be running first, so that dependency injection using @Autowired would get executed. I added these annotations:
@Transactional
@ExtendWith(SpringExtension.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = Server.class)
public MyTestClass () {
...
}
This error appears when you try to use both @Test and @ParameterizedTest in the same test class. Removing @Test annotation will resolve the issue.
Annotating test class with @ExtendWith(MockitoExtension.class) worked for me
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:
WebDriver on your own -- for example, in an @BeforeAll or @BeforeEach method.WebDriver for you.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.