0
votes

I am using jmeter for functional testing and have 2 different jmx. The first jmx has all APIs automated and the second jmx is used to send the html report (generated using Ant-Jmeter task) through SMTP sampler.

Now, I want to send the count of Total, Pass, Fail sample counts in the same email by parsing the jtl file generated by first jmx.

Here is what I can see in the jtl file, s="true" and s="false". I want count of the same and save it as property to use it further in SMTP sampler. Example in jtl:

<sample t="2" it="0" lt="2" ct="0" ts="1565592433268" s="false" lb="Verify Latest Patch" rc="200" rm="OK" tn="Tenant_Login 3-1" dt="text" by="9" sby="0" ng="1" na="1">

Any help will be appreciated.

1

1 Answers

1
votes
  1. Add the next line to user.properties file:

    jmeter.save.saveservice.autoflush=true
    

    it will instruct JMeter to immediately write results to file as soon as they're available

  2. Add tearDown Thread Group to your Test Plan
  3. Add HTTP Request sampler to the TearDown Thread Group
  4. Configure it as follows:

    • Protocol: file
    • Path: `location of your .jtl result file

      enter image description here

  5. Add XPath Extractor as a child of the HTTP Request sampler

  6. Configure it as follows:

    • Reference Name: anything meaningful, i.e. successCount
    • XPath query: count(//sample[@s='true'])

      enter image description here

  7. That's it, now you should be able to refer the successful samples count as ${successCount} where required