- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
因此,我尝试使用 @IfProfileValue
分离测试以在我的 CI 管道上运行。
我只是把这个注释放在我的一个测试类上,我还没有定义值。我只是想检查当我运行 mvn test
时,surefire 会忽略这个测试。
出于某种原因,测试被提取并执行。
@IfProfileValue(name = "test-profile", value = "something")
@RunWith(Parameterized.class)
@SpringBootTest
@WebAppConfiguration
public class MyTest {
最佳答案
要使测试使用 Spring 上下文,您需要使用 SpringRunner
运行它们。在您的示例中,您使用了 Parameterized
runner,这使得测试忽略 Spring 上下文,因此 IfProfileValue
注释被忽略。
关于Spring @IfProfileValue 应该忽略测试类,但事实并非如此,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49799718/
因此,我尝试使用 @IfProfileValue 分离测试以在我的 CI 管道上运行。 我只是把这个注释放在我的一个测试类上,我还没有定义值。我只是想检查当我运行 mvn test 时,surefir
作为 Is there any way to conditionally ignore a test with JUnit of Spring? 的跟进,如果我想用 @IfProfileValue 来
在大多数广泛使用 Spring 的项目中,有一些测试使用 @IfProfileValue 将其标记为集成测试、性能测试或类似测试。当你用 maven 运行它们时,你会做这样的事情: mvn insta
你好,我有一个 springboot 应用程序,有两种可能的 spring 配置文件,一种与环境配置相关(dev、prod、staging...),另一种带有模拟的某些远程服务,我们称之为remote
令人困惑的是 @IfProfileValue 与 @Profile 或 @ActiveProfiles 无关。 @Profile 测试配置文件是否处于 Activity 状态,@ActiveProfi
我将 junit5 与 spring-starter-test 一起使用,为了运行 spring 测试,我需要使用 @ExtendWith而不是 @RunWith .然而@IfProfileValue
我是一名优秀的程序员,十分优秀!