如何在不同的iOS和Android设备(Appium)上并行执行黄瓜功能文件?

时间:2017-09-08 13:57:00

标签: android ios appium cucumber-jvm cucumber-java

我正在研究Cucumber-Appium Framework。

我想在不同的Android或iOS设备上运行我的所有功能文件。

我已经使用Selenium Grid进行并行执行,但它不起作用。 现在,我想使用Cucumber-jvm-parallel插件。

有人可以协助我实现这个目标吗?另请注意配置。

2 个答案:

答案 0 :(得分:0)

我建议将Cucumber-jvm-parallel插件与Maven-failsafe插件结合使用。 你需要决定 - A)如果您想针对所有设备类型运行所有测试(详尽的覆盖范围) B)制作子集&用黄瓜标签标记它们 @ Android_Regression,@ iOS_Regression,@ Android_Smoke,@ iOS_Smoke等。 C)您可以决定编写测试应该执行的设备类型,或者将设备分配保留在中心位置。然后在该设备上运行选定的测试。

样本设置:

  <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/cucumber-parallel/</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>

                          <strict>true</strict>
                        <!-- CucumberOptions.monochrome property -->
                        <monochrome>true</monochrome>
                        <!-- The tags to run, maps to CucumberOptions.tags property. Default is no tags. -->


                        <tags>
                            <tag>

                                @ios_e2e,
                                @android_smoke
                            </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>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) -->
                        <!--
                        <!-- Specify a custom package name for generated sources. Default is no package.-->
                        <packageName>com.example</packageName>

                    </configuration>
                </execution>
            </executions>
        </plugin>

答案 1 :(得分:0)

我建议尝试使用qaf gherkin client。您将获得所有并行线程安全会话和强大的configuration管理。例如,使用QAF,您需要做的就是:

<suite name="AUT Test Automation" verbose="0" parallel="true">
  <test name="Mobile Web Tests on IPhone">
        <parameter name="driver.name" value="iphoneDriver" />           
        ...
  </test>
  <test name="Mobile Web Tests on android">
        <parameter name="driver.name" value="androidDriver"/>                      
        ...
  </test>