jenkinsjmeterjenkins-pipelinejmeter-maven-plugin

How to make the performance trend visible/available with jenkins pipeline on Jenkins when using jmeter-maven-plugin for running the jmeter tests?


I'm trying to create add build step in jenkins pipeline to make performace reports visible and below is the code snippet

But my problem is that the file name the plugin generates is not fixed (yyyymmdd is prepended). ex: 20210723-jmeter-resultFile.csv

Could someone suggest?

stage('Execute Jmeter') {
        post{
            always{
                dir("/target/jmeter/results/"){
                    sh 'pwd'
                      perfReport '20210723-jmeter-resultFile.csv'
                }
            
            }
        }
        }

Solution

    1. You can remove this "prepended" timstamp by adding the next lines to your pom.xml file:

      <configuration>
          <testResultsTimestamp>false</testResultsTimestamp>
      </configuration>
      
    2. You can calculate the current timestamp in the pipeline like:

      def reportFileName = new Date().format('yyyyMMdd') + '-jmeter-resultFile.csv'
      
    3. You can use Ant FileSet style expression to specify path(s) to the result file(s) like:

      perfReport '**/*.csv'
      

    More information: How to Use the Jenkins Performance Plugin