2

I am generating an extent report every time my regression suite runs. The project folder structure is ProjectFolder/Results. I am running the regression suite from Jenkins job. So whenever the regression suite is executed, a folder is created under the Results folder with the name Regression_YYYYMMDDHHMMSS. The YYYYMMDDHHMMSS is the current time-stamp. Then the extent report is saved here. I want to set HTML Publisher as Post Build action. In this how do I set the path of the folder (Results/Regression_YYYYMMDDHHMMSS) as the path is dynamic

Please suggest the steps.

  • Any idea around this? any suggestions pls. – user2356679 Oct 10 '17 at 4:36
1

Well one can extract file name at run time and rename/copy it to some unique value and then publish the report E.g

//Get the folder name of the report and remove the newline while is appened by sh
REPORT_NAME = sh (label: 'GetLatestResultFileName', returnStdout: true, script: 'ls -t results | head -n1').trim()

Validating if we have extracted right folder name
sh "echo $REPORT_NAME"
sh "ls results/$REPORT_NAME"

//Choose a unique name for folder. for me HTMLReport was. unique in my result folder and was not gono be used by my gatling test 
sh "cp -rf results/$REPORT_NAME results/HTMLReport"

//Finally publish this report using HTML publisher
publishHTML([allowMissing: false, alwaysLinkToLastBuild: false, includes: '**/*.html', keepAll: true, reportDir: 'results/HTMLReport', reportFiles: 'index.html', reportName: 'GatlingLatestReport', reportTitles: ''])

//Cleanup
sh "rm  -rf results/HTMLReport"

| improve this answer | |
  • Good idea , thanks. – djangofan 14 hours ago

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.