Cucumber-JVM을 사용하는 Java 기반 모바일 자동화 프레임 워크 개발의 경우. 오이를 통과하는 오이 주자 &에 cucumber-jvm-parallel-plugin을 사용합니다. 니펫 :Maven/Java 런타임에서 paramers (오이 태그)를 Maven 프로파일을 사용하여 오이 - jvm-parallel-plugin으로 전달하는 방법
이제<plugin>
<groupId>com.github.temyers</groupId>
<artifactId>cucumber-jvm-parallel-plugin</artifactId>
<version>4.2.0</version>
<executions>
<execution>
<id>generateRunners</id>
<phase>generate-test-sources</phase>
<!--<phase>validate</phase>-->
<goals>
<goal>generateRunners</goal>
</goals>
<configuration>
<!-- Mandatory -->
<!-- List of package names to scan for glue code. -->
<glue>
<package>stepDefs</package>
<!--<package>com.example.other</package>-->
</glue>
<!-- These are optional, with the default values -->
<!-- Where to output the generated tests -->
<outputDirectory>${project.build.directory}/cucumber-parallel/html</outputDirectory>
<!-- The directory, which must be in the root of the runtime classpath, containing your feature files. -->
<featuresDirectory>src/main/resources/features/</featuresDirectory>
<!-- Directory where the cucumber report files shall be written -->
<!--<cucumberOutputDir>target/cucumber-parallel</cucumberOutputDir>-->
<cucumberOutputDir>target</cucumberOutputDir>
<!-- List of cucumber plugins. When none are provided the json formatter is used. For more
advanced usage see section about configuring cucumber plugins -->
<format>json,html,rerun</format>
<!--<plugins>-->
<!--<plugin>-->
<!--<name>json</name>-->
<!--</plugin>-->
<!--<plugin>-->
<!--<name>com.example.CustomHtmlFormatter</name>-->
<!--<extension>html</extension>-->
<!--</plugin>-->
<!--</plugins>-->
<!-- CucumberOptions.strict property -->
<strict>true</strict>
<!-- CucumberOptions.monochrome property -->
<monochrome>true</monochrome>
<!-- The tags to run, maps to CucumberOptions.tags property. Default is no tags. -->
<tag>
<!--${test.tag},-->
@ios_e2e,
@android,
@cover2,
@ios_cover1
</tag>
</tags>
<!-- Generate TestNG runners instead of JUnit ones. -->
<useTestNG>false</useTestNG>
<!-- The naming scheme to use for the generated test classes. One of 'simple' or 'feature-title' -->
<namingScheme>simple</namingScheme>
<!-- The class naming pattern to use. Only required/used if naming scheme is 'pattern'.-->
<!--<namingPattern>**/Parallel*IT.class</namingPattern>-->
<namingPattern>Parallel{c}IT</namingPattern>
<!-- One of [SCENARIO, FEATURE]. SCENARIO generates one runner per scenario. FEATURE generates a runner per feature. -->
<!--<parallelScheme>SCENARIO</parallelScheme>-->
<parallelScheme>FEATURE</parallelScheme> <!--Using Feature for accomodating Scenario Outline -->
<!-- Specify a custom template for the generated sources (this is a path relative to the project base directory) -->
<!--<customVmTemplate>src/test/resources/cucumber-custom-runner.vm</customVmTemplate>-->
<!-- Specify a custom package name for generated sources. Default is no package.-->
<packageName>com.example</packageName>
</configuration>
</execution>
</executions>
</plugin>
위의 태그 섹션에서 우리는 동적 매개 변수를 전달하고 싶습니다. 런타임 매개 변수/메이븐 매개 변수/메이븐 프로파일 등. 즉, 아래에서 시도했지만 작동하지 않습니다.
<profile>
<id>TestSuite1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<app.config>//src//test//java//envConfig//localGridConfig.properties</app.config>
<test.tag>@android</test.tag>
</properties>
</profile>
Reference to populating parameter to maven on Stackoverflow another discussion
친절
당신은-Dmaven.plugin.property.name=value
를 사용하여 명령 줄에서 플러그인 재산 어떤 받는다는 전달할 수
런타임시 나는 mvn clean verify -Ducucumber.options = "- tags @sometag"를 사용합니다. 하지만 Jenkins에서 실행하려면 mvn clean verify -Ducucumber.options = - tags @sometag를 사용해야합니다. – user2451016