Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Follow publication

Code Smell 52 — Fragile Tests

Maximiliano Contieri
Dev Genius
Published in
2 min readJan 4, 2021

Photo by Jilbert Ebrahimi on Unsplash

Problems

  • Determinism
  • Confidence loss
  • Wasted time

Solutions

  1. Test should be in full control. There should be no space for erratic behavior and degrees of freedom.
  2. Remove all tests coupling.

Examples

Fragile, Intermittent, Sporadic or Erratic tests are common in many organizations.

Nevertheless, they mine the developers trust.

We must avoid them.

Sample Code

Wrong

Right

Detection

Detection can be done with test run statistics.

It is very hard to put some test in maintenance since we are removing a safety net.

More Info

Tags

  • Coupling
  • Determinism

Conclusion

Fragile tests show system coupling and not deterministic or erratic behavior.

Developers spend lots of time and effort fighting against this false positives.

The amateur software engineer is always in search of magic.

Grady Booch

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Published in Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Written by Maximiliano Contieri

I’m a senior software engineer specialized in declarative designs. S.O.L.I.D. and agile methodologies fan. Maximilianocontieri.com

No responses yet

Write a response