Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Our Ruby world is becoming increasingly service oriented. Even in trivial applications, we often glue on multiple services ranging from Twitter to AWS. Services can, however, be confusing to test. Many questions arise such as: How thoroughly should I test a service? Should I stub out responses or consume an API in test mode? How do I know a service is returning what I believe it returns? In this talk, I answer these questions and more so that you may test services more effectively. I am an independent consultant who slings Ruby code for a variety of clients. In the past, I have worked as a developer at thoughtbot and ZURB. I was developing on the web back when marquees were cool. Help us caption & translate this video! http://amara.org/v/FG1F/
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 his talk at RailsConf 2014, Neal Kemp addresses the challenges of testing services in the Ruby programming environment, where applications frequently interact with external APIs such as Twitter and AWS, alongside internal services. This session focuses not only on the necessity and methods of testing these services but also on the common pitfalls developers might encounter. ### Key Points Discussed: - **Introduction to Services**: Kemp categorizes services into two types: external services (like public APIs) and internal services (where HTTP requests are made to other repositories). He emphasizes services' critical roles in scaling and speeding up app development. - **Importance of Testing Services**: Testing is framed as essential because services often constitute important features within an application, such as payment processing or data retrieval. An untested service can lead to significant application failures (e.g., a malfunctioning Stripe integration affecting billing processes). - **Challenges From Real-World Examples**: Kemp shares personal anecdotes regarding difficulties faced while working with both internal APIs, which suffered from inconsistent responses, and external APIs, which lacked proper documentation and versioning. He underscores these issues with examples including undocumented bugs that caused failures during production. - **Best Practices for Testing Services**: - **Airplane Mode Analogy**: He advises to 'turn on airplane mode' in tests, meaning no real network requests should be sent during testing. This helps avoid unreliable tests due to network failures. - **Stubbing Techniques**: Kemp discusses the need to stub out requests using libraries like WebMock, providing a way to simulate API calls without making actual network requests. He shares a simple implementation using RSpec and how to easily set up and configure the testing environment. - **Using Mock Services**: Recommendations include leveraging existing gems that include mock services or employing tools like VCR, which records HTTP interactions for reuse in tests, eliminating the need for real requests during builds. - **Dynamic Testing with Shamrack**: He explains Shamrack for creating dynamic mock services, allowing greater flexibility in testing responses. - **Conclusion and Recommendations**: Testing services is crucial in modern development workflows, and developers should determine the best approach based on project needs, emphasizing the importance of recording responses and avoiding the pitfalls of external dependencies. ### Takeaways: - Developing confidence in service interactions through thorough testing can lead to more reliable applications. - The right tools and techniques can streamline service testing processes, helping developers efficiently quality-check their integration points. - The audience is encouraged to stay informed about future best practices, emphasizing the importance of maintaining test reliability. Kemp closes by inviting further discussion through email or social media, indicating his openness for question and collaborative conversation on the topic.
Suggest modifications
Cancel