I am running Jenkins on my local machine from port 8080, the pipeline is connected to my GitHub through the plugin and I have confirmed that Jenkins can see my Jenkinsfile on my repo. There is a step in my Jenkinsfile to run a cucumber feature
pipeline {
agent any
stages {
stage('Build & Run Cucumber Tests') {
steps {
dir ('DeltaFlight'){
// For Maven projects:
sh 'mvn clean test -Dcucumber.optioms="@login"'
// For Gradle projects:
// sh './gradlew clean test -Dcucumber.filter.tags="@your_tag"'
}
}
}
stage('Publish Cucumber Reports') {
steps {
// Ensure the Cucumber reports plugin is installed in Jenkins
cucumber buildStatus: 'UNSTABLE', fileIncludePattern: '**/*.json'
}
}
}
}
But when it gets to the step
dir ('DeltaFlight'){
// For Maven projects:
sh 'mvn clean test -Dcucumber.optioms="@login"'
// For Gradle projects:
// sh './gradlew clean test -Dcucumber.filter.tags="@your_tag"'
}
I get the error
Cannot run program "sh" (in directory "C:\ProgramData\Jenkins.jenkins\workspace\Selenium2withGit\DeltaFlight"):
which is my local file not system not GitHub.
Here is a picture of the Jenkins error
and here is my GitHub file structure
I want to run the feature file in my GitHub LoginPageNCS.feature not my local machine.
The error msg contains:
Cannot run program "sh" ... CreateProcess error ... The system cannot find the file specified
Usually there is no sh
on Windows (though, IIRC, Jenkins came with its own internal sh
package in the past. But that might be wrong remembrance or might have changed.) So, try it with bat
rather than sh
or install MSYS and and add its \bin
folder to your PATH
.
BTW, please consider Discourage screenshots of code and/or errors.