Apache JMeter and Load Testing

Running test plans using Non-GUI mode

My manager suddenly turned her head towards me in a weekly meeting, “Maybe you can take over the performance testing?” “Oh, sure, I will try!” I answered immediately. Then I got 2 jmx files from my coworker. “Those are the only thing left by the former engineer. She left without any formal knowledge transfer sessions. Here is the email. I don’t have time to do this.” She said those sentences without any emotions, and I could see silent complaining from her eyes.

After spent several days, I was more familiar with this tool, and I started to use the GUI tool to run tests for a couple of thousand times. There is a really intuitive graph plotting tool, that has the response time of each HTTP requests changing over time.

And then, it’s hours and hours wait…

“Why the error rate is so high?” The developer lead asked me in the meeting, surprisingly. “Well, there are lots of bad requests… 400” I answered without too much confidence.

“Hm, then I think it’s because you were act like a single user trying to edit the same file at the same time. The system doesn’t allow this operation.” He responded quickly. “OK…” I was tying to digest his reasoning.

Then my mentor replied “Ok, I think I know the issue. We need to run multiple JMeter scripts at the same time to pretend to be multiple users, but in each script, tasks being edit should be different.”

The day after, I didn’t ask my mentor to show me how to do it — I searched on line. Thanks for the Internet, there are many existing similar problems and solutions.

Here are the details:

To run a simple Jmeter test script (in windows command prompt):

1 Go to the Jmeter bin folder, for example: …\apache-jmeter-5.0\bin

2 Run command: jmeter -n -t jmxFileName.jmx -l resultReportName.jtl

Optional:

To save a report after test: -e -l …\resultReportName.jtl (The file name shouldn’t exist before test run. )

To run two JMeter scripts at the same time,

we can use batch script in windows environment like below:

start jmeter -n -t C:\performance\apache-jmeter-5.0\bin\LoadTest\EditClose_task1.jmx -l result1.jtl

start jmeter -n -t C:\performance\apache-jmeter-5.0\bin\LoadTest\EditClose_task2.jmx -l result2.jtl