83得票3回答
SpringRunner与SpringBootTest的区别

在单元测试中,@RunWith(SpringRunner.class) 和 @SpringBootTest 有什么不同? 你能解释一下它们各自的用例吗?

45得票7回答
如何在多个SpringBootTests之间重复使用Testcontainers?

我正在使用TestContainers和Spring Boot运行存储库的单元测试,例如:@Testcontainers @ExtendWith(SpringExtension.class) @ActiveProfiles("itest") @SpringBootTest(classes = ...

40得票5回答
SpringBootTest:没有可用的类型为'org.springframework.test.web.servlet.MockMvc'的合格bean。

嘿,我开始学习使用Spring Boot Test框架进行Spring Boot JUnit测试。在创建测试用例时,我遇到了以下问题。 Hey,我开始学习使用Spring Boot Test框架进行Spring Boot JUnit测试。在创建测试用例时,我遇到了以下问题。 impor...

38得票3回答
junit-vintage-engine和junit-jupiter-engine之间的区别是什么?

这是一个双重问题: junit-vintage-engine和junit-jupiter-engine之间有什么区别? SpringBoot启动器项目排除了junit-vintage-engine。这是为了强制使用junit-jupiter-engine吗? 以下是由Spring In...

34得票4回答
在@SpringbootTest中缺少/actuator/prometheus。

我正在使用Spring Boot 2.4.0,并添加了以下依赖项以启用Prometheus指标:<dependency> <groupId>org.springframework.boot</groupId> <arti...

31得票9回答
JUnit的@TestMethodOrder注释无法工作

我有一个关于下面的集成测试的问题import org.junit.jupiter.api.Order; import org.junit.jupiter.api.TestMethodOrder; import org.junit.jupiter.api.MethodOrderer.OrderA...

31得票3回答
SpringApplicationConfiguration未找到:spring-boot-starter-test的内容错误?

在Maven中遇到编译错误:[INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ----------------------------...

29得票2回答
使用Spring嵌入式Kafka测试@KafkaListener

我正在尝试为我使用Spring Boot 2.x开发的Kafka监听器编写单元测试。由于这是一个单元测试,因此我不想启动完整的Kafka服务器或Zookeeper实例。因此,我决定使用Spring Embedded Kafka。 我的监听器定义非常基本。@Component public c...

28得票9回答
由于缺少ReactiveWebServerFactory bean,无法启动ReactiveWebApplicationContext。

我有一个新的Spring Boot应用程序,我正在尝试启动它。我收到的错误信息是:org.springframework.context.ApplicationContextException: Unable to start reactive web server; nested excep...