How to jmeter testreport sent mail
To generate a test report and send it via email using JMeter, you can follow these steps:
Step 1: Configure JMeter to generate a test report
- In your JMeter test plan, go to the "Test Plan" tree and right-click on the "Test Plan" node.
- Select "Add" > "Listener" > "Aggregate Report" to add an Aggregate Report listener to your test plan.
- Configure the Aggregate Report listener to generate a report in the format you prefer (e.g., CSV, XML, etc.).
Step 2: Configure JMeter to send the test report via email
- In your JMeter test plan, go to the "Test Plan" tree and right-click on the "Test Plan" node.
- Select "Add" > "Post-Processor" > "SMTP Sampler" to add an SMTP Sampler to your test plan.
- Configure the SMTP Sampler to send an email with the test report attached.
Here's an example of how to configure the SMTP Sampler:
- Server: your email server's hostname or IP address
- Port: the port number used by your email server (e.g., 25, 587, etc.)
- Username: your email username
- Password: your email password
- From: the email address that will be used as the sender
- To: the email address that will receive the test report
- Subject: the subject line of the email
- Body: the body of the email (optional)
- Attachment: the test report file generated by the Aggregate Report listener
Step 3: Run your JMeter test
- Run your JMeter test by clicking the "Start" button or by using the command-line option
-t
followed by the name of your test plan. - JMeter will execute your test and generate a test report.
- The SMTP Sampler will send the test report via email to the specified email address.
Example JMeter configuration file
Here's an example JMeter configuration file (jmeter.properties
) that demonstrates how to configure JMeter to generate a test report and send it via email:
# Aggregate Report listener configuration
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.request_header=false
jmeter.save.saveservice.response_header=false
jmeter.save.saveservice.response_data=false
jmeter.save.saveservice.assertions=false
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.failed=true
jmeter.save.saveservice.error=true
# SMTP Sampler configuration
jmeter.smtp.server=smtp.example.com
jmeter.smtp.port=587
jmeter.smtp.username=myemailusername
jmeter.smtp.password=mypassword
[email protected]
[email protected]
jmeter.smtp.subject=JMeter Test Report
jmeter.smtp.body=This is a test report generated by JMeter.
jmeter.smtp.attachment=jmeter-results.csv
In this example, the Aggregate Report listener is configured to generate a CSV file named jmeter-results.csv
. The SMTP Sampler is configured to send an email with the test report attached to the specified email address.