简体   繁体   中英

How to execute cucumber feature file parallel on different iOS and Android devices (Appium)?

I am working on Cucumber-Appium Framework.

I would like to run my all Feature files on different Android or iOS devices.

I have already used Selenium Grid for Parallel execution but, it doesn't work. Now, I want to use Cucumber-jvm-parallel plugin.

Can somebody assist me to achieve this? Also please mention configuration.

I will suggest to use Cucumber-jvm-parallel plugin in conjunction with Maven-failsafe plugin. You need to decide- A) If you want to run all of your tests against all of device types (Exhaustive coverage) B) Make subset & tag them using cucumber-tags @Android_Regression , @iOS_Regression, @Android_Smoke, @iOS_Smoke etc.. C) You can decide to write what type of device the test should execute against Or keep the device allocation at the central place & then run chosen tests on that device.

Sample set-up:

  <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>

I would suggest to try using qaf gherkin client . You will get all parallel thread safe sessions and strong configuration management. For example, with QAF all you need to do is:

<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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM