User3091 User3091 - 3 years ago 92
MySQL Question

Add summary report results to database in JMETER

Is there any way I can add the summary report results which are generated at the end of the test in JMETER to the database ? I have created a table in in database. In this table I want to store the summary results. I am using Mysql database. How can I do this ?

Thankyou.

Answer Source

You can do it as follows:

  1. Download MySQL JDBC Driver and drop it to /lib folder of your JMeter installation
  2. Restart JMeter to pick the .jar up
  3. Add Summary Report listener to your Test Plan.
  4. Configure it to save results to some file, i.e. c:\jmeter\results.csv
  5. Add tearDown Thread Group to your Test Plan
  6. Add JDBC Connection Configuration and provide:

    • Variable Name Bound to Pool: anything meaningful, i.e. results
    • Database URL: i.e. jdbc:mysql://localhost:3306/YOUR_DATABASE_NAME_HERE
    • Database Driver Class: com.mysql.jdbc.Driver
    • Credentials
  7. Add JDBC Sampler and configure it as follows:

    • Variable Name: something which matches Variable Name in JDBC Connection Configuration, i.e. results
    • Query Type: Update Statement
    • Query: load data local infile 'c:\jmeter\results.csv' into table YOUR_TABLE_NAME_HERE fields terminated by ',' enclosed by '"' lines terminated by '\n';

This way you will be able to get results inserted automatically.

References:

Just in case if you don't know how to create a table for results with query like:

create table test (timeStamp varchar(255),elapsed varchar(255),label varchar(255),responseCode varchar(255),responseMessage varchar(255),threadName varchar(255),dataType varchar(255),success varchar(255),bytes varchar(255),grpThreads varchar(255),allThreads varchar(255),Latency varchar(255) );

See MySQL CREATE TABLE Syntax documentation for more information.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download