I am using smtp sampler in Jmeter to send email. The issue that I am having is: it is sending email for each thread group. If I have number of thread =5, ill be getting 5 emails. How can I send one email with attached report for large number of threads?
2 Answers
use tearDown thread group, in short it is more like junit
's @AfterClass
method....
A special type of ThreadGroup that can be utilized to perform Post-Test Actions. The behavior of these threads is exactly like a normal Thread Group element. The difference is that these type of threads execute after the test has finished executing its regular Thread Groups.
You can use If Controller and __threadNum() function to trigger the request which sends the email only for specific thread.
__threadNum() function basically returns current virtual user number (1 for first, 2 for second, etc.) so if you put the following line into the If Controller's "Condition" area:
${__threadNum} == 3
The children of the If Controller will be executed only for virtual user number 3.
Demo: