Auto Flush JMeter Test Result to File

Q

How to force JMeter to automatically flush test result to file immediately after each sampler is executed? I need to send the test result file to database in the tear down thread.

✍: FYIcenter.com

A

You can follow this tutorial to change JMeter configuration to automatically flush test result to file.

1. Open \fyicenter\jmeter\bin\jmeter.properties in an editor. Then find and update the following setting as shown below:

# AutoFlush on each line written in XML or CSV output
# Setting this to true will result in less test results data loss in 
# case of Crash but with impact on performances, particularly for 
# intensive tests (low or no pauses)
# Since JMeter 2.10, this is false by default
#jmeter.save.saveservice.autoflush=false

jmeter.save.saveservice.autoflush=true

2. You may change the following setting to automatically replace existing test result file, each time you run the test plan:

# Used to control what happens when you start a test and 
# have listeners that could overwrite existing result files 
# Possible values:
# ASK : Ask user
# APPEND : Append results to existing file
# DELETE : Delete existing file and start a new file
#resultcollector.action_if_file_exists=ASK

resultcollector.action_if_file_exists=DELETE

3. Restart JMeter and open "\fyicenter\First-Load-Test-5.jmx". And run it again.

4. Click "Send Result to MySQL" in the "View Result Tree" screen. Then open the "Response Data" tab. You see the query result:

200 updates

Now you can query the database to review test results:

mysql> select timeStamp, elapsed, label, success 
   from jmeter_test_result order by timeStamp desc limit 0,10;
   
+---------------+---------+----------+---------+
| timeStamp     | elapsed | label    | success |
+---------------+---------+----------+---------+
| 1510970705770 |     365 | Google   | true    |
| 1510970705666 |     457 | Google   | true    |
| 1510970704232 |    1537 | Facebook | true    |
| 1510970704171 |    1494 | Facebook | true    |
| 1510970703802 |     430 | Google   | true    |
| 1510970703730 |     441 | Google   | true    |
| 1510970703708 |     453 | Google   | true    |
| 1510970703675 |     468 | Google   | true    |
| 1510970703637 |     496 | Google   | true    |
| 1510970703574 |     515 | Google   | true    |
+---------------+---------+----------+---------+
10 rows in set (0.15 sec)

 

Convert JMeter Timestamp to Date and Time

Load Test Result to MySQL Automatically

Saving Test Results to MySQL Database

⇑⇑ Apache JMeter Tutorials

2017-11-18, 348👍, 0💬