sebaslogen / CleanGUITestArchitecture

Sample project of Android GUI test automation using Espresso, Cucumber and the Page Object Pattern
MIT License
137 stars 31 forks source link

JENIKS: GRADLE: TESTNG: CUCUMBER FEATURE File: testrunner is faling on jekins pipeline only #31

Open jayboyi opened 2 years ago

jayboyi commented 2 years ago

Hi, i have moved to gradle framework from maven. while running our test with gradle on local machine its getting success but while running the same on jekins with gradle commands i'm facing error on the testng cucumber as below

Gradle suite > Gradle test > regressionSuite.TestRunner.feature[0](Address Verification) FAILED cucumber.runtime.CucumberException at TestRunner.java:64 Caused by: java.lang.AssertionError at Assert.java:94

lines of the code at those lines is as follows: @Test(groups = "cucumber", description = "Runs Cucumber Feature", dataProvider = "features") public void feature(CucumberFeatureWrapper cucumberFeature) throws IOException { testNGCucumberRunner.runCucumber(cucumberFeature.getCucumberFeature()); }

Not able to find the root cause of this issue

commands using on Jekins file are: sh """

        ls -ltr
        pwd
        echo "gateway is ${gatewayname}"
        chmod 777 ./gradlew
        ./gradlew clean assemble
        ./gradlew test -Dcucumber.options="--tags @$gatewayname"

        """
sebaslogen commented 2 years ago

My only suggestion would be to try to figure out the differences between your local execution environment and the one in Jenkins, like gradle version, Java version, etc.

jayboyi commented 2 years ago

i'm not able to find those.. any hint.. and the command ./gradlew test i -Dcucumber.options="--tags @$gatewayname" is not running. If i see the Jenkins gradle commands it's starting the test with + ./gradlew build . But i gave above command to run tag wise... here my tag is SDT but its starting the very first feature file on the test run and failing with exception.

gateway is SDT

BUILD SUCCESSFUL in 4s 2 actionable tasks: 1 executed, 1 up-to-date

Task :compileTestJava Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details.

Task :processTestResources Task :testClasses Task :test

Gradle suite > Gradle test > regressionSuite.TestRunner.feature[0](Address Verification) FAILED cucumber.runtime.CucumberException at TestRunner.java:64 Caused by: java.lang.AssertionError at Assert.java:94

1 test completed, 1 failed