Junit 5 - No ParameterResolver registered for parameter

后端 未结 6 3210
长情又很酷
长情又很酷 2021-02-05 01:41

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

6条回答
  •  囚心锁ツ
    2021-02-05 02:01

    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 () {
    ...
    
    }
    

提交回复
热议问题