TransWikia.com

What are Jenkins plugins to monitor and handle flaky tests?

Software Quality Assurance & Testing Asked on October 25, 2021

A flaky test is a test which could fail or pass for the same configuration.

What are the plugins that you use to identify and handle flaky tests on Jenkins?

So far I have found the following two

  • Flaky Test Handler Plugin: This plugin is designed to handle flaky tests, including re-running failed tests, aggregate and report flaky tests statistics and so on.
  • Test Results Analyzer Plugin: Displays a matrix subsequent runs of the same tests, so you can identify which tests are ocassionaly red.

One Answer

Sorry if this is not the answer you want to hear but: Tests 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 handle 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

Answered by Amias on October 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP