spring-boot - Junit5-木星所有测试套件@BeforeAll @AfterAll 不工作
问题描述
之前和之后的方法在 JUnitPlatform 中不起作用。
代码如下。
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.platform.suite.api.SelectClasses;
import org.junit.runner.RunWith;
@RunWith(JUnitPlatform.class)
@SelectClasses({
MyControllerTest.class
})
public class AdminAppTest {
@BeforeAll
public static void setUp() {
System.out.println("setting up");
}
@AfterAll
public static void tearDown() {
System.out.println("tearing down");
}
}
我只想在方法之前和之后运行。
谢谢
解决方案
推荐阅读
- sql - 选择类别请求期间的sql动态列
- php - 如何启用opencart Seo Url
- ios - 如何从标签栏打开侧边菜单
- python - 为什么我的文本在屏幕上运行而不是在 Python 终端中运行?
- c# - 如何在 C# 中减去两种不同类型的两个数量 - 十进制和双精度?
- docker - docker可以从环境变量中读取凭据吗?
- c# - 在 c# 中处理麦克风输入
- javascript - React 组件渲染两次,不使用状态钩子的函数组件只渲染一次
- java - JavaFx 中的 TranslateX、LayoutX 和 ScaleX 之间的区别?
- javascript - javascript数组由两个键混合