HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How to export Cucumber Reports via Jenkins Pipeline

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
cucumberreportsjenkinsviaexporthowpipeline

Problem

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?

Solution

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.

Code Snippets

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

    archive "cucumber-html-reports/*"
}

Context

StackExchange DevOps Q#1329, answer score: 3

Revisions (0)

No revisions yet.