4

I'm using the Cucumber Reports Plugin for Jenkins and I want to be able to export the HTML reports so they can be posted on an external portal. I can see that there is a folder named cucumber-html-reports in the build directory in Jenkins, but how do I access this? Is there some way to access these files from within a pipeline?

2
  • Many Thanks for your response. May I know how to execute this code as in whether i have to feed it in jenkins job or i have to create a file with any specific extension and run? node('master') { dir("../builds/${BUILD_NUMBER}/") { sh "cp -r cucumber-html-reports $WORKSPACE" } archive "cucumber-html-reports/*" } Please help Commented Jan 17, 2019 at 16:15
  • @AnkitSuhane That script is a Jenkins scripted pipeline (jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline), but it could be executed as a Shell step and an Archive step in a regular freestyle build. Commented Mar 12, 2019 at 3:44

2 Answers 2

3

Working off what @chupasaurus said, here's what I came up with:

node('master') {
    dir("../builds/${BUILD_NUMBER}/") {
        sh "cp -r cucumber-html-reports $WORKSPACE"
    }

    archive "cucumber-html-reports/*"
}

Obviously all this does is archive the report for that build, but you can easily extend this to copy it somewhere else where it can be hosted or manipulated. Just make sure you put this after the Cucumber Reports plugin step.

1

You should add export script (bash script which does exporting html files produced to the place they belong) after Cucumber Reports plugin step, as it should be used by job runned either solely or by pipeline.

2
  • Can you explain further? What export script? Commented Jun 11, 2017 at 4:52
  • @lawnmowerlatte added to answer. Commented Jun 12, 2017 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.