selenium-webdriverjunitcucumberappiumautomation-testing

Cucumber.io test scenarios are running in parallel not in sequence


I am using cucumber.io for my Automation Test framework (Java + Selenium + Appium) and we have multiple scenarios and features, and I want to execute all at once. Note, when I run feature by feature it works fine without errors and it runs in random sequence. When I run from IDE (e.g. Intelli J, Visual Studio Code, or Eclipse) tests are running in sequence at a random order and it's all passing. But when I run it from terminal and specify a tag like this

-Dcucumber.options="--tags @TagToRun"

It execute scenarios from different features in parallel which lead to errors in Appium; most commonly Error creating a session. I assume it leads to this error since in my @AfterClass I specify to quit drivers and then quit Appium service. How can I run all scenarios in different features in sequence not in parallel?


Solution

  • It seems like tests were running it parallel, which caused the issue. This was fixed by configuring maven-surefire-plugin plugin to run only one test.

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
             <parallel>none</parallel>
             <threadCount>1</threadCount>
        </configuration>
    </plugin>