4
votes

Using jmeter 3.3 I am sending some request to my website an on assertion KO I am sending an email.

For this I added an IF controller with this condition:

!${JMeterThread.last_sample_ok}

inside my if I triggers an email using SMTP Sampler.

Please How can I send the name of the sampler HTTP Request inside the email title?

Thank you

1

1 Answers

6
votes

Given you have setup like:

  • Your sampler
    • Assertion
  • If Controller
    • SMTP Sampler

You can get Your sampler name using __groovy() function like

${__groovy(ctx.getPreviousSampler().getName(),)}

Demo:

JMeter Groovy Previous Sampler Name

More information: Apache Groovy - Why and How You Should Use It