Junit5的依赖添加及RunWith(SpringJUnit4ClassRunner.class)注解使用

首先Junit5依赖应该配置为

<dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>RELEASE</version>
    </dependency>

其次在Junit5中无发使用RunWith注解,应用以下配置

@ExtendWith(SpringExtension.class)

Junit5其它部分注解变化:

Before>>BeforeEach

After>>AfterEach

Ignore>>Disabled

........

猜你喜欢

转载自www.cnblogs.com/mingsucess/p/11770763.html