Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Fake It While You Make It by Kevin Murphy "We all write code to interface with external systems, like a web service or a message queue. Can you confidently write tests without requiring the system as a dependency? How can you shield users of your code from the inner workings of the interface? Explore one attempt to answer these questions. There's no shortage of tools at your disposal to solve these problems. This talk will introduce some available options, provide guidance on when one approach may be more appropriate than another, and discuss how to use these tools together to ease the testing process." __________ "Kevin spent more time investigating, refactoring, and rewriting tests for the project that prompted this talk than he did writing the actual implementation. Kevin lives near Boston, where he is a Software Developer at The Gnar Company."
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 this presentation titled 'Fake It While You Make It', Kevin Murphy discusses approaches to testing software that interacts with third-party dependencies such as APIs. He emphasizes the importance of writing reliable tests without depending on the actual system behavior during testing. Key points covered include: - **Understanding Third-Party Dependencies**: Murphy introduces the topic by drawing an analogy with weather conditions and the need for accurate external information for applications. - **Testing Challenges**: He outlines common challenges faced when writing tests that depend on real-time data, such as API failures, network issues, and rate limits. These dependencies can result in slow and unreliable tests. - **Testing Strategies**: Murphy explains various strategies for handling dependencies, including: - **Stubbing**: Using tools like WebMock to simulate responses from an API without making actual calls, allowing tests to pass consistently without external dependencies. - **Fakes**: Creating local versions of external services which return expected responses to match real APIs, thus allowing for interaction testing without the variability of real access. - **Fixtures**: Utilizing libraries like VCR to record actual API responses and replay them during tests which can aid in providing accurate historical responses but may lead to staleness over time. - **Decoupling Logic**: He advocates for separating business logic from API interaction logic by building dedicated classes that handle dependencies effectively, such as an API client that can handle requests and responses separately from business concerns. - **Test Mode Implementation**: Kevin introduces the concept of a 'test mode' which allows developers to control test conditions by simulating various temperatures, thus enabling reliable testing without relying on external systems. In conclusion, Murphy emphasizes the necessity of building layers of abstraction between business logic and external dependencies, allowing developers to test components independently of changing external systems. This method not only ensures more stable tests but also enhances maintainability and clarity in the codebase. Overall, the session serves as a valuable guideline for handling third-party dependencies in software development.
Suggest modifications
Cancel