-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
How to handle API calls in a row in Locust ? #2658
Comments
What do you mean "the api call hangs until the time running out"? I recommend running the test in a debugger or adding some print statements. a)
Another way to do it is just to call on start directly:
|
In the middle my Locust running, if the response1 failure happened, and I had it "return", then till the end of this locust running, I don't see any extra response1 or response2 calls are made. Thanks for the tips, I will give a try. Thanks. Jack |
This issue was closed because it has been stalled for 10 days with no activity. This does not necessarily mean that the issue is bad, but it most likely means that nobody is willing to take the time to fix it. If you have found Locust useful, then consider contributing a fix yourself! |
Prerequisites
Description
In my test case, I am trying to make multiple API calls in a sequence, where the current API call's URL value is from the previous call's response body
Here is my current code:
If I was to have it executed with limited users, everything executed smoothly, since I did not hit the failure in the response1 API call.
If I was to have it executed with extra users, in some running session, the first API call hits the failure, and return back 400 code. In my current code, I was doing "return", which hopes the current session to be stopped, and a new one would be started. But I don't see it happens. What I have noticed is, all the API call hangs until the time running out.
So I have tried this instead of "return",
raise StopUser("1st API call fails!")
I do see the tests are keep going, and the 2nd API calls are being executed until the time-out. But In the locust "number of user" diagram, I am getting this,
As if it decrease the number of users, to make the testing moving .
So I guess my question are,
A) Is "return" the correct solution in such case ?
B) If I was to use StopUser(..), is there a way for me to spawn a new user on the fly ?
C) Any better solutions for my case ?
Thanks,
Jack
The text was updated successfully, but these errors were encountered: