DEV Community

David Adamo Jr.
David Adamo Jr.

Posted on • Originally published at davidadamojr.com

2 1

Are your Tests Necessary and Useful?

Some automated tests are unnecessary or problematic.

For each automated test you write, ask yourself:

  • Does this test offer any additional test coverage that is not already addressed by some other existing test?

  • Which defect(s) do I expect this test to find or prevent?

  • When this test fails, would I be able to easily determine what went wrong based on the test execution report?

  • Can I reduce the scope of this test so that it integrates fewer components during its execution?

  • Am I testing a private method directly? If so, can I modify my test or refactor my code and test through a public method instead?

Each test should exist for a good reason, and not merely to tick a box in a checklist. The effectiveness of your testing is dictated primarily by the quality of the tests you have. The number of tests that you do or do not have matters much less than you think.

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (1)

Collapse
 
andrewbaisden profile image
Andrew Baisden

Wise words.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more