JUnit tests pass in Eclipse but fail in Maven Surefire

前端 未结 17 1969
臣服心动
臣服心动 2020-11-29 17:28

I have written some JUnit tests using JUnit 4 and spring-test libraries. When I run the tests inside Eclipse then run fine and pass. But when I run them using Maven (during

17条回答
  •  眼角桃花
    2020-11-29 17:51

    I had a similar problem, the annotation @Autowired in the test code did not work under using the Maven command line while it worked fine in Eclipse. I just update my JUnit version from 4.4 to 4.9 and the problem was solved.

    
        junitjunit
        4.9
    
    

提交回复
热议问题