I agree with Dmitri, use Taurus as a wrapper. It will easily do what you want and is easy to implement.
Regards, Lisa JM Waugh Test Engineer CIO Software & Development Experience 1 704 907 7008 Mobile 1 720 342 5373 Office [email protected] IBM From: Dmitri T <[email protected]> Date: Thursday, September 8, 2022 at 11:36 AM To: JMeter Users List <[email protected]>, Rita Sousa <[email protected]> Subject: [EXTERNAL] Re: Failing tests based on the average time of a specific request It's definitely not possible with any built-in component, I can think of the following options: Read the .jtl results file in the tearDown Thread Group with JSR223 Sampler, calculate the average response time and fail this sampler (you might ZjQcmQRYFpfptBannerStart This Message Is From an External Sender This message came from outside your organization. ZjQcmQRYFpfptBannerEnd It's definitely not possible with any built-in component, I can think of the following options: 1. Read the .jtl results file in the tearDown Thread Group with JSR223 Sampler<https://www.blazemeter.com/blog/apache-groovy>, calculate the average response time and fail this sampler (you might need to set jmeter.save.saveservice.autoflush property to true) 2. Use AutoStop Listener plugin and then in the pipeline compare the anticipated duration with the actual duration failing the test if the actual was shorter 3. You can consider switching to running your tests using Taurus<https://gettaurus.org/> tool as a wrapper, it provides Pass/Fail Criteria subsystem<https://gettaurus.org/docs/PassFail/> which can return non-zero exit status code if the defined criteria are not met so it's kind of continuous integration friendly Rita Sousa wrote: Hi all, I’m developing some performance tests for a product in my company. Until now I have been using duration assertions to do this, where I want the test to fail when a specific request takes more than a certain amount of time. This was achieved by putting the duration assertion directly below the request I need. Now the requirements have changed, where I want a test to fail only if the average of time is more than the assertion. In my case I use 20 users, so the test will run 20 times, and I would like to fail/pass the test only after the 20 users have finished and I can check the average time for that specific request. Manually, I can do that looking at a Summary or Aggregate report, but I have all tests running in a pipeline and I would like to have JMeter fail/pass the test using this criteria on its own. I looked at BeanShell and Java scripting, but I can’t seem to access the results in the Summary Report to achieve my goal, even after looking at the JMeter API. I’m not sure if I’m missing something or if this simply isn’t possible. Is there something I’m missing? Or is there a different solution that I’m not getting at? I appreciate any help in advance! Kind regards, Rita Sousa Senior Quality Manager T: +351214460090<tel:+351214460090> M: +351916333973<tel:+351916333973> My working hours: 8:00 am to 2:00 pm - Lisbon time [cid:[email protected]] UNIT4 Portugal Unipessoal LDA Rua Dr. António Loureiro Borges, 9 - 11º, 1495-131, Algés - Lisbon, Portugal This message and any attachment(s) are intended only for the use of the named recipient and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law. If you are not the intended recipient, please notify the sender by return e-mail and delete this message from your system. Do not disclose the contents of this document to any other persons. Violation of this notice may be unlawful. Please note that internet communications are not secure and e-mails are susceptible to change. Thank you for your cooperation.
