Urgent.News

What's breaking now, across thousands of outlets.

Tech

Tenía 100% de cobertura y aun así se cayó producción

Hoy buena parte del código que entra a mis proyectos lo escribe un modelo. No es un experimento, es cómo trabajamos. Y eso me trajo una pregunta que antes casi no me hacía, porque el código lo escribía yo y más o menos sabía dónde estaban los huecos: si no escribí esto, ¿cómo sé que sirve? La respuesta obvia es "mido cobertura". Yo la mido. Y una vez tuve todo en verde mientras la página se caía…

Original Spanish Read in English

The article discusses the importance of code coverage in software development, but also highlights the limitations and potential pitfalls of relying solely on this metric. The author explains how they calculate code coverage by excluding certain generated files and patterns, such as freezed, json_serializable, constants, theme, DI, and routing.

They argue that these generated files do not require manual testing since they are produced by the code generation process, and testing them would be redundant. The author also mentions the misinterpretation of code coverage, where people assume that a high percentage means everything has been tested, which is not necessarily true.

They provide examples of tests that achieve 100% coverage but do not actually verify anything meaningful. The author emphasizes the need for tests to not only cover lines of code but also verify the correctness of the implemented functionality. They conclude by stating that while code coverage is a useful metric, it should not be the sole focus, and developers should prioritize testing critical paths and verifying actual behavior rather than just achieving high coverage numbers.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Motorola Razr Fold Review

Motorola packs it all in for this foldable, providing great screens, cameras, performance and features, even if it does end up a bit expensive.

More from Tuesday 4 August →