Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Tests are supposed to save us money. How is it, then, that many times they become millstones around our necks, gradually morphing into fragile, breakable things that raise the cost of change? We write too many tests and we test the wrong kinds of things. This talk strips away the veil and offers simple, practical guidelines for choosing what to test and how to test it. Finding the right testing balance isn't magic, it's a magic trick; come and learn the secret of writing stable tests that protect your application at the lowest possible cost. Help us caption & translate this video! http://amara.org/v/FGa6/
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 talk "The Magic Tricks of Testing" by Sandi Metz at Rails Conf 2013, the speaker explores the complexities and pitfalls of software testing. She addresses a common dilemma in the programming community, where tests often become burdensome, mismanaged, and costly rather than serving their intended purpose of ensuring code stability and reliability. Metz aims to simplify testing strategies by sharing effective methods for writing tests that are not only efficient but also maintainable. Key points discussed include: - **Common Frustrations with Testing**: Metz acknowledges that many developers express a distaste for their tests, citing reasons such as productivity loss due to slow tests and frequent failures after minor code changes. This often leads to a cycle where developers either write too few tests or none at all. - **Goals of Unit Testing**: Good unit tests should be thorough, stable, fast, and minimal. This requires a clear understanding of the application’s architecture, including the identification of messages exchanged between objects. - **Types of Messages**: Metz categorizes messages as incoming (queries and commands) and outgoing, explaining the significance of understanding these distinctions for effective testing. Each category has specific rules governing how they should be tested. - **Testing Strategies**: Metz provides a grid for unit testing best practices that outlines when to use specific types of assertions based on the nature of messages. For example, she emphasizes that - Incoming query messages should be tested by asserting their return values and without binding them to internal implementations. - Command messages invoke side effects and should be tested by asserting the expected changes they cause, not just the messages sent. - **Minimizing Redundancy**: By focusing on the minimal set of tests necessary for coverage, developers can avoid unnecessary complexity in their testing suites. - **Embracing Mocks**: The use of mocks is discussed as a means to streamline tests, enabling rapid feedback and refactoring without the risk of cascading failures due to extensive dependencies. - **Caveats and Practical Advice**: Metz underscores the importance of aligning tests with the actual responsibilities in the codebase and being cautious of over-specifying tests that can hinder code evolution. - **Final Takeaways**: By applying the right strategies, developers can transform their approach to testing, making it a supportive ally in their development process instead of a hindrance. She encourages sustained focus on simplicity amidst complexity, promising that with practice, tests can become reliable tools in software development rather than a source of frustration.
Suggest modifications
Cancel