DEV Community

Discussion on: The three A’s of Unit Testing

Collapse
 
fijiwebdesign profile image
Gabirieli Lalasava

Very true. For a trivial example it seems ok but in a real world scenario you're adding uncertainty.

If the test breaks, now you can't tell if the production code or the test has the error.
The test should have concrete values so you don't have to test the test.

If creating the concrete result is too complex, it's better to run the test once and take a snapshot of the result. Inspect that it is correct and use that snapshot against the production code in future runs.