等同于 JUnit5 的 @RunWith(JUnitPlatform.class)
Equivalent for @RunWith(JUnitPlatform.class) for JUnit5
在我的项目中,我正在做一些清理工作,并决定将所有内容移至 JUnit5。
直到这次,我一直在使用
@RunWith(JUnitPlatform.class)
现在我想把它迁移到@ExtendWith。 JUnitPlatform.class 在 JUnit5 中是否有任何等价物?
使用 junit 5 时不再需要它。
在 junit documentation 中指出:
使用 @RunWith(JUnitPlatform.class) 注释 class 允许它 运行 与支持 JUnit 4 但尚不直接支持 JUnit 平台的 IDE 和构建系统一起使用。
既然您要迁移到 junit 5,我想您的构建 system/IDE 支持它。因此,您不再需要注释。
从 https://www.baeldung.com/junit-5-runwith 的内容开始,JUnit4 @RunWith
在 JUnit5 中已被 @ExtendWith
取代
在我的项目中,我正在做一些清理工作,并决定将所有内容移至 JUnit5。
直到这次,我一直在使用
@RunWith(JUnitPlatform.class)
现在我想把它迁移到@ExtendWith。 JUnitPlatform.class 在 JUnit5 中是否有任何等价物?
使用 junit 5 时不再需要它。
在 junit documentation 中指出:
使用 @RunWith(JUnitPlatform.class) 注释 class 允许它 运行 与支持 JUnit 4 但尚不直接支持 JUnit 平台的 IDE 和构建系统一起使用。
既然您要迁移到 junit 5,我想您的构建 system/IDE 支持它。因此,您不再需要注释。
JUnit4 @RunWith
在 JUnit5 中已被 @ExtendWith
取代