2

I have created a test project(maven) for testing performance of a REST API. I am using Jmeter plugin

Here is my pom snippet

<build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>2.5.0</version>
                <executions>
                    <execution>
                        <id>jmeter-tests</id>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <resultsDirectory>/tmp/jmeter</resultsDirectory>
                </configuration>
            </plugin>
        </plugins>
 </build>

I have a JenkinsFile in my project like this

pipeline {
   agent any

environment {
    BRANCH_NAME = "${env.PIPELINE_BRANCH_NAME}"
}

stages {
    stage('SCM checkout') {
        steps {
           .......
        }
    }

    stage('Execute Jmeter tests') {
        steps {
            echo '****************************************\r*** Execute Jmeter tests'
            withMaven(jdk: 'JDK 8', maven: 'aer Maven 3') {
                sh 'mvn jmeter:jmeter'
                performanceReport parsers: [[$class: 'JMeterParser', glob: '/tmp/jmeter/**/*.jtl']], sourceDataFiles: "/tmp/jmeter/*.jtl", modePerformancePerTestCase: true, failBuildIfNoResultFile:true
            }
        }
    }
  }
}

With this when I trigger the build on Jenkins, build is successfull and I see this in the console output

.......
[INFO] Creating summariser <summary>
[INFO] Created the tree successfully using /mypath/....../testFiles/mytest.jmx
[INFO] Starting the test @ Fri Aug 24 21:51:37 CEST 2018 (1535140297393)
[INFO] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
[INFO] summary =      0 in 00:00:00 = ******/s Avg:     0 Min: 9223372036854775807 Max: -9223372036854775808 Err:     0 (0.00%)
[INFO] Tidying up ...    @ Fri Aug 24 21:51:40 CEST 2018 (1535140300073)
[INFO] ... end of run
[INFO] Completed Test: /global/otdci/apps/build_server/jenkins/jobs/SCMAER/jobs/SCMAER-TEST-performancetesting/workspace/target/jmeter/testFiles/MaterialGroup.jmx
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.012 s
[INFO] Finished at: 2018-08-24T21:51:40+02:00
[INFO] Final Memory: 20M/615M
[INFO] ---------------------------------------------

The problem with this is, It doesn't do anything. Performace Trend graph doesn't show anything.

If I run the same project on my local machine, it works perfectly fine. I see something like this in the logs which confirms this. And also the output file generated(.jtl file) is correct.

[INFO] Starting the test @ Fri Aug 24 22:02:21 CEST 2018 (1535140941482)
[INFO] Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
[INFO] summary +    177 in 00:00:08 =   21.2/s Avg:   184 Min:   117 Max:  1366 Err:     0 (0.00%) Active: 5 Started: 5 Finished: 0
[INFO] summary +    910 in 00:00:30 =   30.4/s Avg:   165 Min:   115 Max:  3205 Err:     0 (0.00%) Active: 5 Started: 5 Finished: 0
[INFO] summary =   1087 in 00:00:38 =   28.4/s Avg:   168 Min:   115 Max:  3205 Err:     0 (0.00%)
[INFO] summary +    964 in 00:00:30 =   32.1/s Avg:   154 Min:   110 Max:  3193 Err:     0 (0.00%) Active: 5 Started: 5 Finished: 0
[INFO] summary =   2051 in 00:01:08 =   30.0/s Avg:   162 Min:   110 Max:  3205 Err:     0 (0.00%)
[INFO] summary +    966 in 00:00:30 =   32.1/s Avg:   156 Min:   113 Max:  3199 Err:     0 (0.00%) Active: 5 Started: 5 Finished: 0
[INFO] summary =   3017 in 00:01:38 =   30.7/s Avg:   160 Min:   110 Max:  3205 Err:     0 (0.00%)
[INFO] summary +    948 in 00:00:30 =   31.7/s Avg:   157 Min:   114 Max:  3194 Err:     0 (0.00%) Active: 5 Started: 5 Finished: 0
[INFO] summary =   3965 in 00:02:08 =   30.9/s Avg:   159 Min:   110 Max:  3205 Err:     0 (0.00%)
[INFO] summary +    862 in 00:00:30 =   28.6/s Avg:   170 Min:   115 Max:  3226 Err:     0 (0.00%) Active: 5 Started: 5 Finished: 0
[INFO] summary =   4827 in 00:02:38 =   30.5/s Avg:   161 Min:   110 Max:  3226 Err:     0 (0.00%)
[INFO] summary +    185 in 00:00:06 =   30.1/s Avg:   178 Min:   115 Max:  3191 Err:     0 (0.00%) Active: 0 Started: 5 Finished: 5
[INFO] summary =   5012 in 00:02:45 =   30.5/s Avg:   162 Min:   110 Max:  3226 Err:     0 (0.00%)
[INFO] Tidying up ...    @ Fri Aug 24 22:05:06 CEST 2018 (1535141106249)
[INFO] ... end of run

Here is a snippet for my test plan

enter image description here Any Idea why isn't it running on Jenkins? any pointers to debug this?

Ardesco
  • 7,281
  • 26
  • 49
pvpkiran
  • 25,582
  • 8
  • 87
  • 134

1 Answers1

0

For anyone who is facing the same issue. Here is the solution and how I found it.

Firtly the issue was very simple. In my test plan(jmx) I was using a csv file as 'CSV Data Set Config'. I had put something like this

inputFiles\materialstamm.csv

this was woking fine on my local machine because, I was running on windows. And It didn't work on Jenkins because it was a Unix machine. After I changed this to

inputFiles/materialstamm.csv

My jenkins build started running correctly.

Now coming to the point of finding out the issue. This was very hard because, Jmeter didn't report anything in the build process. Even when I enabled maven debug.

Since It could not load my dataset(through csv file) it was just skipping through this and assuming no data and Ended up with Success status for the build but without any report/result.

The trick was to look for Jmeter log files. Jmeter generated log files under ..../workspace/target/jmeter/logs/testplanname.log.

But I did not had console access to jenkins machine and also I didn't see workspace folder by default on Jenkins UI. This answer helped me to get workspace folder. When I checked the log there, it was clearly visible because jmeter threw an exception saying it could not find the csv file.

pvpkiran
  • 25,582
  • 8
  • 87
  • 134