Ruby Video
Talks
Speakers
Events
Topics
Leaderboard
Sign in
Talks
Speakers
Events
Topics
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Writing a Test Framework From Scratch by Ryan Davis Assertions (or expectations) are the most important part of any test framework. How are they written? What happens when one fails? How does a test communicate its results? Past talks have shown how test frameworks work from the very top: how they find, load, select, and run tests. Instead of reading code from the top, we’ll write code from scratch starting with assertions and building up a full test framework. By the end, you’ll know how every square inch of your testing framework works. Help us caption & translate this video! http://amara.org/v/IMZw/
Date
Summary
Markdown supported
In the video titled 'Writing a Test Framework From Scratch', Ryan Davis delivers a code-heavy tutorial on creating a test framework, emphasizing the significance of assertions as the foundational unit of testing. Key points discussed include: - **Introduction to Test Frameworks**: Ryan, known as the author of MiniTest, introduces the topic of building testing libraries from scratch, focusing on a hands-on approach rather than a theoretical walkthrough. - **Assertions as Building Blocks**: The talk begins with the fundamental concept of assertions, explaining that the simplest assertion checks if an expression is truthy, which forms the bedrock of any testing framework. - **Handling Assertions**: Ryan discusses the decision to raise exceptions for failed assertions, advocating for immediate feedback to the user during test failures. He then refines error reporting to ensure useful messaging that indicates where the actual failure occurred. - **Creating Additional Assertions**: He demonstrates how various assertions, such as equality checks and floating-point comparisons, can be built upon the initial assertion framework, thus expanding its capabilities. - **Independent Test Cases**: The importance of organizing tests so they remain independent from one another is highlighted. Ryan illustrates using methods to ensure that tests are structured without interference from shared states. - **Organizational Techniques**: By employing classes, Davis shows how to group tests logically while maintaining efficient execution. He emphasizes the need for organized naming conventions to enhance clarity within the framework. - **Execution and Reporting**: The framework allows for running tests and reporting results, including a method for visual feedback indicating successful test runs. This provides developers with a clearer understanding of the overall test suite performance. - **Refinements in Code Structure**: Ryan highlights the need for clean code, separating exception handling from test runs to improve maintainability and readability. - **Maintaining Independence Across Tests**: He concludes with a strategy for ensuring each test runs independently, recommending random order execution to prevent dependencies affecting results. In conclusion, by the end of the video, viewers are equipped with an understanding of how to incrementally build a simplified test framework. Ryan also mentions his upcoming book that further explores MiniTest, urging viewers to engage with him for more insights.
Suggest modifications
Cancel