FinalFive
FinalFive

Reputation: 1485

Cucumber app with gradle runs fine locally but fails on Jenkins

When i run my cucumber based project it behaves as though it cannot find the Steps classes - I can tell because the log on Jenkins is offering code snippets for implementation.

I'm using Gradle and I know there are issues with cucumber-jvm.

The relevant part of the build file:

task cucumber(type: JavaExec) {
    dependsOn assemble, compileTestJava
    main = "cucumber.api.cli.Main"
    classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
    args = ['-f', 'pretty', '--glue', 'steps', 'src/test/resources']
    systemProperties = System.getProperties()
}

I can't see why running the same command (./gradlew clean cucumber) via Jenkins fails?

Here's the output from Jenkins:

+ ./gradlew -Dapk=/Users/rakesh/workspace1/AcmeApp_4_10_Tiles/bin/AcmeApp_4_10_Tiles.apk clean cucumber
:clean
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:assemble
:compileTestJava
:cucumber
Feature: Thrid party request for the Landing page.
  TODO: additional requests for box connection
...

You can implement missing steps with the snippets below:

@Given("^the user chooses not to login$")
...

BUILD SUCCESSFUL

Total time: 8.074 secs
$ /Users/rakesh/Apps/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb disconnect emulator-5812
[android] Stopping Android emulator
[android] Archiving emulator log
$ /Users/rakesh/Apps/adt-bundle-mac-x86_64-20131030/sdk/platform-tools/adb kill-server
Finished: SUCCESS

Upvotes: 1

Views: 1419

Answers (2)

Warm_up
Warm_up

Reputation: 61

I would also like to mention that sometimes this problem occurs,if there are dependencies missing in build.gradle.

In my case,the following statement was missing in main task in build.gradle..

dependsOn assemble, compileTestJava

Adding this,resolved the issue.

Upvotes: 2

FinalFive
FinalFive

Reputation: 1485

I solved the problem and it had nothing to do with cucumber, gradle or Jenkins! I had renamed the steps classes (case change) which completely confused subversion and the java step classes were actually missing!!

Upvotes: 1

Related Questions