Ruby Video
Talks
Speakers
Events
Topics
Leaderboard
Sign in
Talks
Speakers
Events
Topics
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Wild test suites often contain inefficient or ineffective tests. Working with a code base full of these beasts is frustrating and time consuming. This safari will help you identify and hunt down common testing anti-patterns. Afterwards you'll know how to approach a test suite full of beasts without losing your mind or your life. Help us caption & translate this video! http://amara.org/v/FGbq/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the presentation titled "Going on a Testing Anti-Pattern Safari," Aja Hammerly addresses the challenges faced by developers when dealing with ineffective test suites filled with common testing anti-patterns. Aja begins by establishing what makes an effective test, emphasizing two metrics: tests should be trustworthy and simple. The talk is structured around four broad categories of anti-patterns: pointless tests, wasted time and effort, false positives and negatives, and inefficient tests. **Key Points Discussed:** - **Pointless Tests:** Lack of tests is highlighted as a major problem. Aja stresses that tests are essential for maintaining the integrity of code, comparing it to driving too fast without confirming your route. - **Ineffective Test Running:** Aja identifies not running existing tests as a significant waste, advocating for continuous integration (CI) practices to ensure tests are executed consistently. - **Testing Others' Code:** It is discouraged to write tests for established libraries, since those should already be tested by their authors. Instead, Aja encourages testing the integration of libraries with provided examples. - **False Positives/Negatives:** These create distrust in test suites and can stem from poor test design, such as relying on time-sensitive tests or hard-coded values. Aja recommends using methods that normalize tests across different environments. - **Order-Dependent Tests:** Tests should be independent, and their order should not affect outcomes. Randomizing test execution can help uncover hidden dependencies. - **Testing Should Fail Correctly:** It's crucial for tests to include meaningful assertions to avoid passing without verifying behavior. - **Inefficient Tests:** Aja discusses how external dependencies, like network calls or complicated setups, can slow tests down and disrupt development. Mocking is recommended to alleviate these issues. **Significant Examples:** - Aja provides practical code examples throughout, illustrating how to avoid anti-patterns like testing Active Record functionality unnecessarily, using "assert nothing raised," and the dangers of date-dependent tests. - A discussion about the importance of refactoring for clarity and organization in tests is also included, urging developers to adopt best practices in their test writing. **Conclusions:** Aja concludes that developers must actively work to eliminate common anti-patterns to create simple, reliable, and efficient tests. The key takeaways emphasize the value of maintaining a healthy testing culture, running all tests, and refactoring tests for clarity and performance. This presentation serves as a guide for developers looking to refine their testing strategies and ensure robust software functionality.
Suggest modifications
Cancel