You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
:white_check_mark:**Haz:**The Traditional Coverage metric often lies: It may show you 100% code coverage, but none of your functions, even not one, return the right response. How come? it simply measures over which lines of code the test visited, but it doesn’t check if the tests actually tested anything — asserted for the right response. Like someone who’s traveling for business and showing his passport stamps — this doesn’t prove any work done, only that he visited few airports and hotels.
1581
+
:white_check_mark:**Haz:**La métrica de cobertura tradicional a menudo miente: puede mostrarle una cobertura de código del 100%, pero ninguna de sus funciones, ni siquiera una, devuelve la respuesta correcta. ¿Cómo? simplemente mide sobre qué líneas de código se paso en los test, pero no verifica si laos test realmente han comprobado algo - asercionando la respuesta correcta. Como alguien que viaja por negocios y muestra su pasaporte, esto no prueba que haya realizado ningun trabajo, solo que ha visitado ciertos aeropuertos y hoteles.
1582
1582
1583
-
Mutation-based testing is here to help by measuring the amount of code that was actually TESTED not just VISITED. [Stryker](https://stryker-mutator.io/)is a JavaScript library for mutation testing and the implementation is really neat:
1583
+
Los test basados en mutaciones nos ayudan midiendo la cantidad de código que en realidad se TESTEÓ, no solo VISITADO. [Stryker](https://stryker-mutator.io/) es una libreria JavaScript para test de mutación y la implementación es realmente clara:
1584
1584
1585
-
(1) it intentionally changes the code and “plants bugs”. For example the code newOrder.price===0 becomes newOrder.price!=0. This “bugs” are called mutations
1585
+
(1) cambia intencionalmente el código y "planta bugs". Por ejemplo, el código newOrder.price=== 0 se convierte en newOrder.price! = 0. Estos "bugs" se llaman mutaciones.
1586
1586
1587
-
(2) it runs the tests, if all succeed then we have a problem — the tests didn’t serve their purpose of discovering bugs, the mutations are so-called survived. If the tests failed, then great, the mutations were killed.
1587
+
(2) ejecuta los test, si todo va bien, entonces tenemos un problema - los test no cumplen su propósito de descubrir bugs, las mutaciones se denominan supervivientes. Si los test fallaron, entonces genial, las mutaciones fueron asesinadas.
1588
1588
1589
-
Knowing that all or most of the mutations were killed gives much higher confidence than traditional coverage and the setup time is similar
1589
+
Saber que todas o la mayoría de las mutaciones fueron asesinadas da mucha más confianza que la cobertura tradicional y el tiempo de configuración es muy similar
1590
1590
<br/>
1591
1591
1592
-
❌ **De lo contrario:**You’ll be fooled to believe that 85% coverage means your test will detect bugs in 85% of your code
1592
+
❌ **De lo contrario:**Te engañas si crees que una cobertura del 85% significa que tus test detectarán errores en el 85% de tu código
1593
1593
1594
1594
<br/>
1595
1595
1596
1596
<details><summary>✏ <b>Código de Ejemplo</b></summary>
1597
1597
1598
1598
<br/>
1599
1599
1600
-
### :thumbsdown: Ejemplo Anti Patrón: 100% coverage, 0% testing
1600
+
### :thumbsdown: Ejemplo Anti Patrón: 100% de cobertura, 0% testeado
}); //Triggers 100% code coverage, but it doesn't check anything
1615
+
}); //Genera un 100% cobertura de código, pero no comprueba nada
1616
1616
```
1617
1617
1618
1618
<br/>
1619
1619
1620
-
### :clap: Ejemplo de cómo hacerlo correctamente: Stryker reports, a tool for mutation testing, detects and counts the amount of code that is not tested (Mutations)
1620
+
### :clap: Ejemplo de cómo hacerlo correctamente: Los reportes de Stryker, una herramienta para test de mutación, detecta y cuenta la cantidad de código que no se testea (Mutaciones)
1621
1621
1622
-
")
1622
+
")
0 commit comments