serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
721 stars 517 forks source link

Appium parallel mobile test using serenity-cucumber-junit runs the tests sequentially rather than parallel #1876

Closed Joekannan closed 2 years ago

Joekannan commented 4 years ago

Hello All,

I am trying to achieve parallel automation in serenity framework for my native mobile app. My tests are running sequentially in alternate devices rather than running in parallel.It looks weird and am not sure what is wrong in my set up.. Appreciating your timely help.

I have attached my test log here.

Below is my serenity properties:

serenity.project.name = "Mobile App" webdriver.driver=appium manage.appium.servers = true webdriver.timeouts.implicitlywait = 10000 appium.automationName=uiautomator2 appium.platformName = Android appium.deviceNames = 0516055xxxxxxxx102,ad0xxxxxxxxxxx8ea20f appium.app = .//mob-qa-twlapp//Serenity_Framework//src//test//resources//APK//test.apk appium.appActivity = nz.co.xxxxxxxxxxxxxxxxx appium.appPackage = nz.co.xxxxxxxxxxxxxxxxxxxxxxxx appium.newCommandTimeout = 500 appium.allowTestPackages = true appium.chromedriverExecutable = .//Working_Repo//Serenity_Framework//src//test//resources//BrowserDrivers//chromedriver_2.43.exe appium.autoAcceptAlerts = true appium.fullReset=true serenity.batch.count=2 serenity.batch.number=2

My POM.XML:

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<groupId>com.TWG.Mobile</groupId>
<artifactId>serenityFrameWork</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Serenity project using Cucumber and WebDriver</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <serenity.version>2.0.40</serenity.version>
    <serenity.maven.version>2.0.40</serenity.maven.version>
    <serenity.cucumber.version>1.9.38</serenity.cucumber.version>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <webdriver.driver>appium</webdriver.driver>
</properties>

<repositories>
  <repository>
    <snapshots>
        <enabled>false</enabled>
    </snapshots>
    <id>central</id>
    <name>bintray</name>
    <url>http://jcenter.bintray.com</url>
  </repository>
</repositories>

<pluginRepositories>
  <pluginRepository>
    <snapshots>
    <enabled>false</enabled>
    </snapshots>
    <id>central</id>
    <name>bintray-plugins</name>
    <url>http://jcenter.bintray.com</url>
  </pluginRepository>
</pluginRepositories>

<dependencies>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>${serenity.version}</version>
        <!--Added for parallel testing:Start Here  -->
        <scope>test</scope>
        <!--Added for parallel testing:End Here  -->
        <!-- <scope>compile</scope> -->
    </dependency>
    <!-- <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>7.0.0</version>
    </dependency> -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>${serenity.cucumber.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>${serenity.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.7</version>
        <scope>test</scope>
    </dependency>
    <!-- <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency> -->
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>1.7.0</version>
        <scope>test</scope>
    </dependency>  
    <dependency>
        <groupId>com.saucelabs</groupId>
        <artifactId>saucerest</artifactId>
        <version>1.0.23</version>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/com.applitools/eyes-common-java4 -->
    <dependency>
        <groupId>com.applitools</groupId>
        <artifactId>eyes-appium-java4</artifactId>
        <version>4.2.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>3.0.0-M3</version>
            <configuration>
                <includes>
                     <!-- <include>**/*.java</include> -->
                     <!--Added for parallel testing:Start Here  -->
                     <include>**/*Test.java</include>
                    <include>**/Test*.java</include>
                    <include>**/When*.java</include>
                    <include>**/*Story.java</include>
                    <!--Added for parallel testing:End Here  -->
                </includes>
                <argLine>-Xmx512m</argLine>
                <!--Added for parallel testing:Start Here  -->
                <parallel>classes</parallel>
                <threadCount>2</threadCount>
                <!--Added for parallel testing:End Here  -->
                <systemPropertyVariables>
                    <webdriver.driver>${webdriver.driver}</webdriver.driver>
                </systemPropertyVariables>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.version}</version>
            <dependencies>
                 <dependency>
                    <groupId>net.serenity-bdd</groupId>
                    <artifactId>serenity-core</artifactId>
                    <version>${serenity.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

emrebaygul commented 4 years ago

I want it to work in parallel at the same time. Doesn't it work at the same time ? @Joekannan @wakaleo

wakaleo commented 4 years ago

You should ask this question on https://gitter.im/serenity-bdd/serenity-core, there are a lot of active Appium users there.

Joekannan commented 4 years ago

I want it to work in parallel at the same time. Doesn't it work at the same time ? @Joekannan @wakaleo

Unfortunately, I couldn't achieve parallelism in Serenity for Mobile app. I have been advised to use Selenium Grid using jvm plugin by @ihostage . Still I am trying my best to achieve this.