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?

  • 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 – Ankit Suhane Jan 17 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. – lawnmowerlatte Mar 12 at 3:44
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.

  • Can you explain further? What export script? – lawnmowerlatte Jun 11 '17 at 4:52
  • @lawnmowerlatte added to answer. – chupasaurus Jun 12 '17 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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