Sorry if this is not the answer you want to hear but: should not be flakey

If your test doesn’t run to completion then you should consider spitting it up into smaller pieces or changing your orchestration to increase stability. Its more important to maintain confidence in tests than it is to have more coverage.

Having flakey tests can waste a lot of test resources and block build chains from running in CI/CD environments.

The Flakey test plugin can help with this but its really better to quarantine these tests and diagnose the issues because you really can’t trust a pass for this.

Some of the main causes of flakey tests are :

  1. Waiting – try to use exception handlers instead of waiting for fixed periods of time as they can finish sooner as well but don’t get messed up when a previous delay extends too far.

  2. Not failing – its better to declare a failure when things don’t work , in a test you should not be trying to the problem (unless you are mocking part of an application that does this specifically and then you should maintain that contract). Its a classic error that people who write code for applications not tests do.

  3. Communication – when you have a flakey test you should communicate this with the developers and get them to help resolve it, usually i do a pair session with developer and we can resolve or at least encapsulate the flakey behaviour. Often this is just because a dependency was not upto date or not delivered in time , this can be hard to find out if you don’t keep communicating with the devs.

If you find this situation happens a lot it might be worth setting up 3 amigos meetings to ensure you don’t end up working on tasks that are not ready. https://www.agilealliance.org/glossary/three-amigos



Source link https://sqa.stackexchange.com/questions/27045/what-are---to--and-handle--tests

LEAVE A REPLY

Please enter your comment!
Please enter your name here