Cucumber html reports in Jenkins

Afternoon all, I was after some assistance please with cucumber reporting in Jenkins. So I have a post build action which incorporates the cucumber reports plugin. This in turn creates a nice html page in the builds folder in jenkins.

However the issue I have is that I then want to take this html report and attach it to an email I am generating with the test results in, using the Editable Email Notification plugin. The issue I have is that the root folder for adding any attachements via this plugin is the workspace folder.

However, from what I can see nothing gets generated in my workspace folder; instead it goes here: C:\Users\ my name .jenkins\jobs\feedback_firefox\builds\69\cucumber-html-reports

I was wondering if anyone had any advice. My thinking is that I have 2 options but I’m not sure how best to action them:

  1. Is there a way for the cucumber reports to be written directly to the workspace folder? This means I then have access to the html report directly from that folder
  2. If ‘1’ does isn’t viable am I able to somehow copy the report from the folder where the reports are initially written to, over to the workspace folder?

Hi @tilston1001,
Are you using https://github.com/damianszczepanik/cucumber-reporting?

If yes, then:

  1. There is a way to configure the directory where the reports should be written. The documentation should provide that configuration information
  2. Why do you want to send the reports by email? All you need to do is bookmark the CI job name url and latest reports will be seen automatically. In fact, the cucumber-reporting plugin can also navigate between test run reports.

Hope this helps.

Regards, Anand

1 Like

Hi Anand, many thanks for your response.

  1. Do you know where the configuration information is? Unless I am missing something, I cannot find anywhere in the ‘Cucumber reports’ post build action which allows me to change the directory
  2. The reason for me wanting to send the reports by email is that there is a wider distribution team who would like to have high level knowledge of the test/pass criteria for our tests, but might not have access to Jenkins.

Many thanks for your help

Andy

How are you invoking your post build action to generate the html report?
Is there a config parameter to set the outputDirectory?

Hi Alex, I’m invoking the post build action by utilising the cucumber reporting plugin which gives me the ability to add the below as a post build action

I’m assuming there must be a config somewhere but it’s not immediately obvious to me. I’ve managed to get around it by adding a shell script, once the reports are generated, to move them to the workspace folder. From here, the editable email plugin from where I attach the emails can then locate the html files as they have to be in at least the root level of the workspace directory

  1. You need to set your report directory (json / xml) to a specific location. This can be configured for junit / testng.
  2. For cucumber-reports, the Usage section in the repo has configuration details. One of the parameter is the reports directory where the .json files can be found
  3. In CI configuration, you should specify where this custom directory is for the cucumber-reporting plugin to load it up correctly. If you are using Jenkinsfile (pipeline-as-code), then add a new stage for publishing reports in that (as show below):

Jenkins File:

{
stage(“Publish Reports”) {
echo "***** Publish Reports ***"
step([
$class: ‘CucumberReportPublisher’,
failedFeaturesNumber: 0,
failedScenariosNumber: 0,
failedStepsNumber: 0,
fileExcludePattern: ‘’,
fileIncludePattern: '
/*.json’,
jsonReportDirectory: ‘testrun/reports’,
parallelTesting: true,
pendingStepsNumber: 0,
skippedStepsNumber: 0,
trendsLimit: 0,
undefinedStepsNumber: 0,
classifications: runClassifications
])
}
}

Your json reports path property looks suspicious- it is an absolute path from the root of your drive. I think it should be relative to your workspace / build directory.