Java 基于maven轮廓的cucumber标签
我正在尝试基于变量@tags运行特定的小黄瓜场景(如果可能的话)。例如,如果我的配置文件是“dev”,我想运行场景1,如果配置文件是“qa”,我想运行场景2。 我可以在java类中获得概要文件值。我还可以在命令行中传递标记,并按照前面提到的那样运行它。但这不是我想要的。例如:Java 基于maven轮廓的cucumber标签,java,maven,cucumber,cucumber-jvm,gherkin,Java,Maven,Cucumber,Cucumber Jvm,Gherkin,我正在尝试基于变量@tags运行特定的小黄瓜场景(如果可能的话)。例如,如果我的配置文件是“dev”,我想运行场景1,如果配置文件是“qa”,我想运行场景2。 我可以在java类中获得概要文件值。我还可以在命令行中传递标记,并按照前面提到的那样运行它。但这不是我想要的。例如: @QA Scenario:I do x and check y Given I do abc Then the response is 200 @DEV Scenario:I do y and check x
@QA
Scenario:I do x and check y
Given I do abc
Then the response is 200
@DEV
Scenario:I do y and check x
Given I do cde
Then the response is 500
我在java类中得到的概要文件值如下
System.getProperty("myprofile");
如何根据我的配置文件设置cucumber的标记,以便在特定环境中运行特定测试?基本上,我不希望在命令行中传递标记,而是希望根据我的配置文件进行设置。可能吗?如果没有,最好的方法是什么?我使用maven profile实现了这一点。在每个配置文件中,将Cumber选项设置为
<profiles>
<profile>
<id>development</id>
<properties>
<cucumber.options>
--tags @myTags
</cucumber.options>
<properties>
</profile>
............
</profiles>
发展
--tags@myTags
............
然后在构建插件中将其作为系统属性变量传递为
<build>
<plugins>
<plugin>
<configuration>
<systemPropertyVariables>
<cucumber.options>${cucumber.options}</cucumber.options>
</systemPropertyVariables>
</configuration>
<plugin>
</plugins>
</build>
${cumber.options}
我也有同样的需要。我想这就是我们需要的。它列在这里的个人资料下