Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listening for Errors and Throughput to Dynamically Stop the Test #287

Open
Farahala opened this issue Dec 5, 2024 · 12 comments
Open

Listening for Errors and Throughput to Dynamically Stop the Test #287

Farahala opened this issue Dec 5, 2024 · 12 comments
Labels
question Further information is requested

Comments

@Farahala
Copy link

Farahala commented Dec 5, 2024

loading the jmx by using DslTestPlan testPlan = DslTestPlan.fromJmx(jmxFilePath);

is there is way to listen on error and throughput while running the script to check once the run start if the throughput or error rate from the beginning is high then stop the test and terminate .
I need to check that while the script is running not after it finished and then check the results .

@rabelenda
Copy link
Contributor

Have you try adding autostop to the loaded test plan?

@Farahala
Copy link
Author

Farahala commented Dec 5, 2024

Yes in the loaded .JMX file there is @ AutoStop Listener but it check on the error rate only and I need to check also the Throughput while running

@rabelenda
Copy link
Contributor

The autostop element currently allows to check conditions on connectionTime, sampleTime, latencyTime, errors, samples, received and sent bytes. For times you can check max, mean, min and percentiles and for the rest you can check perSecond and total, all being able to specify a period of evaluation and checking with different comparators. For throughput for example you can use samples and perSecond, or samples total and then specify a period of time for evaluation (for example if you want to measure per minute, hour, etc). You can check all available methods and options using any IDE.

@rabelenda rabelenda added the question Further information is requested label Dec 5, 2024
@Farahala
Copy link
Author

Farahala commented Dec 5, 2024

yes , this is if iam building the test plan form the beginning using the jmtereDSL , but what if iam loading an existing jmxfile that was already created by Jmeter GUI Previously which have JMeter AutoStop Plugin that just check on response time and error rate.
is there is a way to use the autostop
when I load the .jmxfile using : DslTestPlan testPlan = DslTestPlan.fromJmx(jmxFilePath)
for ex : can it be used like this : DslTestPlan testPlan = DslTestPlan(fromJmx(".jmxfilepath"),autoStop() .when(errors().total().greaterThan(0L))).run(); ? or is there is any alternative ways

@rabelenda
Copy link
Contributor

yes. Modifying existing autostop would be treaky, but you can add a new one as the example you gave.

@Farahala
Copy link
Author

Farahala commented Dec 5, 2024

oki , so how I can add a new one ? you mean to make a custom element like [wrapper]https://abstracta.github.io/jmeter-java-dsl/guide/#custom-or-yet-not-supported-test-elements or there is any other way you mean ?

@rabelenda
Copy link
Contributor

rabelenda commented Dec 5, 2024 via email

@Farahala
Copy link
Author

Farahala commented Dec 6, 2024

First, thank you for your response and support. Let me try to break down the issue I'm encountering.

When I tried using autoStop() like this:

DslTestPlan testPlan = DslTestPlan.fromJmx("filepath");
autoStop().when(errors().percent().greaterThan(10.0));
testPlan.run();

  1. It doesn't work because the problem lies in the order of operations and how the autoStop configuration is applied. I am calling autoStop() after building the DslTestPlan and before running the test, which is not correct. If I understand correctly, autoStop needs to be integrated during the build process.

I also tried this:
DslTestPlan testPlan = new DslTestPlan(
fromJmx("filepath"),
autoStop()
.when(errors().percent().greaterThan(10.0))
).run();

  1. This also doesn't work because the issue lies in passing autoStop() and other elements as arguments to the DslTestPlan constructor, which is incorrect. The DslTestPlan constructor expects a list of TestPlanChild elements (e.g., thread groups, controllers), not a TestPlanStats object (returned by .run()) or the autoStop configuration directly.

So my question is:
Is there a way to use autoStop() with DslTestPlan.fromJmx()? What is the correct order or structure to achieve this?

Thanks again for your continued support!

@rabelenda
Copy link
Contributor

rabelenda commented Dec 9, 2024 via email

@Farahala
Copy link
Author

Farahala commented Dec 9, 2024

Yes , I got it , it works now with children method thanks , this will check as aggerate , is there is a way to check on each sampler or this will need to be customized ?

@rabelenda
Copy link
Contributor

You can filter by sampler name in auto stop conditions if you want to check each sampler stats.

@Farahala
Copy link
Author

oki , got it , thanks alot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants