Home / Companies / Semaphore / Blog / Post Details
Content Deep Dive

TDD Antipatterns: The Free Ride

Blog post from Semaphore

Post Details
Company
Date Published
Author
Marko Anastasov
Word Count
713
Language
English
Hacker News Points
-
Summary

The text discusses common anti-patterns in Test-Driven Development (TDD) by highlighting specific issues with writing test cases, using examples from Ruby code. It critiques the practice of adding multiple assertions to a single test case, which can lead to vague descriptions and obscure the root cause of test failures, thus defeating the purpose of a short feedback loop. The text illustrates this with a "feedback form" test case for events, showing how it can be improved by separating different expectations into distinct test contexts. It also addresses the problem of using different test values in a single test case, suggesting that separating test scenarios makes the output clearer and the feedback more informative. The discussion includes examples of testing city name slugs to demonstrate how tests can be more explicit and readable, enhancing their effectiveness.