Maven + Cucumber-jvm - How to run different subset of the features depending on environment

巧了我就是萌 提交于 2019-12-05 18:50:19

Eventually, I figured out how to pass cucumber the tag configuration when working with profiles:

<profiles>
    <profile>
        <id>environment_dev</id>
        <activation>
            <property>
                <name>environment</name>
                <value>dev</value>
            </property>
            <activeByDefault>true</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <groups>${test-groups}</groups>
                        <systemPropertyVariables>
                             <cucumber.options>--tags @dev</cucumber.options>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </build>

With this I can invoke mvn test -Dtest-groups=cucumber -Denvironment=dev to limit the scenarios/features that I want to run depending on the environment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!