pom.xml中引入junit为什么无法使用@Test,@After @Before注解?

问题:

   pom文件明明引入了unit,为什么还是用不了?






配置如下:






<dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
</dependency>







原因:上述scope配置了Junit可用的位置,test表示只能在src下的test文件夹下面才可以使用
解决办法:去掉scope配置就可以了

おすすめ

転載: blog.csdn.net/baidu_41833099/article/details/121418596