How to call on_start before each testcase, like setup in unittest?
See original GitHub issueFeature request
Setup method like unittest
Expected behavior
Method on_start
only run once, but my testcase require different parameter recieved from an HTTP response.
If I get this variable with on_start
, then only first test can pass; and if I call the get_parameter
method in testcase, it will makes testresult inaccurate for the time waiting for response.
Actual behavior
Is there any method like setup
with unittest
(I didn’t find in document), or any suggests that can solve this scene?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
c# - How to unit test a .NET middleware that uses Response ...
I am not finding a way to unit test this middleware, as it uses the OnStarting callback and I can't imagine how to...
Read more >Android — How to test a Service - Medium
Recently i worked on a project where i had to test a service, and id like to share with you all how to...
Read more >How to Write Effective Unit Tests in Java - Twilio
Create a new Java class called Validator.java inside the ... There will remain only a single method call on this class for each...
Read more >Unit Testing with Robolectric | CodePath Android Cliffnotes
(Mac and Linux users only) => There is a known issue that needs to be addressed so that tests can be located properly....
Read more >Learning State & Shared Flows with Unit Tests
We send an item to a state flow by calling the emit method on the flow. Here is a unit test where we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There’s no built in way to do that, but you can override the run task method, as done here for example https://github.com/SvenskaSpel/locust-plugins/blob/bf4097eb3a04580de886b5b138151a6b0d21660e/locust_plugins/__init__.py#L209
similar feature is already implemented and the code has landed in master. see: https://docs.locust.io/en/latest/writing-a-locustfile.html#setups-teardowns-on-start-and-on-stop