-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow to rerun flaky tests #1992
Comments
@tinganho are those false positives intended? |
Sorry should be false negative. NOT false positive. The tests are not meant to fail, but sometimes due to network issues they do. |
@tinganho Why is network connectivity an issue? Can you post a scenario? Are you not mocking/stubbing modules that aren't SUT? |
What's SUT? I personally don't think stubbing and mocking things are good. It takes long time and doesn't really represent the real object at all the times. One scenario I have right now, is a service that uploads images to amazon S3. The upload stalls sometimes. I also, think Mocha should be agnostic to what testing strategy any developers try to implement. |
SUT is system under test. So what are you testing here?
Even if you set a max fail rate of 3...if for some reason S3 is down at the time you ran your test then your suite just failed even though it should have passed (assuming everything else works). I'm probably getting ahead of myself here since I don't know if you're writing unit tests or e2e, but you get the idea. |
I'm testing a service. Where one of them forwards an upload of a picture to S3. I thought I explained it on my last comment? I have also seen testing locally in webdriver also generates false negatives.
@rodoabad I have used mocking and stubbing in almost all my projects in many years. Though, I recently discovered that it just better to not mock and stub things, because it is such a big overhead. I think it is up to every developer to choose what kind of testing strategy they choose or not choose to implement. Mocha should thus, be agnostic to which testing strategy you prefer. Even though you change the state of your S3 service you can revert it with an
Yes, this is one of the downside. It's not a perfect solution I'm suggesting. Though I think this rarely happens. It's not unit testing, or it depends on your definition, I'm testing the direct output of an HTTP request. But I hope that you are not suggesting me to mock and stub things. I think it is really up to each developer to choose its testing strategy. I have been involved in really complex project where mocking and stubbing things would make you pull your hair off. I have been contributing a lot to the TypeScript project and there they just test the direct compiled output. No need to mock and stub things. |
@chenchaoyi maybe it is duplicate. A project owner can close this issue if they want and just put a comment on how they want to proceed. I could submit a PR. But I think the API interface need to be resolved first. |
@tinganho No, I'm not suggesting that you change your testing methods. Everyone has their own style that they follow. So I'm not sure why you think I'm even trying to do that. I just wanted to have some context. |
Some test suites are very flaky. Flaky means it can generate false negatives for some tests. An example, is if we query an external web service and the network, one in every 100 times the socket hangs up. It would generate a false positive.
My proposal is have an CLI option:
that defaults to 0.
Also you can set this for a specific test suite and all its children suites:
I have PR ready, if this sounds interesting enough for you. But for me, I cannot use Mocha without it. My test suite generates false negatives in nearly every run.
The text was updated successfully, but these errors were encountered: