【发布时间】:2014-03-24 14:35:34
【问题描述】:
我已经开始为我的 Spring 应用程序使用黄瓜测试。我通过传递 JVM 参数 spring.profiles.active=testProfile 来设置活动 Spring 配置文件。
有没有办法以编程方式做到这一点?比如:
@RunWith(Cucumber.class)
@Cucumber.Options(...)
@ActiveProfiles("testProfile")
public class MyCucumberTest
使用黄瓜 1.1.6
【问题讨论】:
-
简单地放入一个静态块怎么样。公共类 MyCucumberTest{static{System.setproperty("spring.profiles.active","testProfile")}}