pipelineUnit
pipelineUnit copied to clipboard
tests.job.CIPipelineTest > validate shell command[0] FAILED
sorry i am a noob with this frameowrk, any help in identifying the below issue is appreciated!
Unit Test cases fail with below error when three double quotes are used along with sh in Jenkinsfile
problem is when i use three double quotes without which i cannot get the value of groovy variable
Jenkinsfile Stage
stage('duration') { steps{ withCredentials([string(credentialsId: 'GH_TOKEN', variable: 'GH_TOKEN'), usernamePassword(credentialsId: '', passwordVariable: 'dbpassword', usernameVariable: 'dbuser')]) { script { currentBuild.displayName = "$ghprbPullId" sh """ echo ${currentBuild.durationString.replace(' and counting', '')} > duration.txt cat duration.txt """ } } } }
Error from Unit test case
tests.job.CIPipelineTest > validate the pipeline FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:18
tests.job.CIPipelineTest > validate shell command[0] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[1] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[2] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[3] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[4] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[5] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[6] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[7] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[8] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
tests.job.CIPipelineTest > validate shell command[9] FAILED org.codehaus.groovy.control.MultipleCompilationErrorsException at CIPipelineTest.groovy:34
11 tests completed, 11 failed :test FAILED
@macg33zr can you help ?