TDD, BDD, Rspec, Capybara, FactoryGirl, etc.
Testing: Getting Started
It’s tough to even know how to start. Here are some articles that can help.
- “How We Test Rails Applications” : https://robots.thoughtbot.com/how-we-test-rails-applications
- “I’m frequently asked what it takes to begin testing Rails applications. The hardest part of being a beginner is that you often don’t know the terminology or what questions you should be asking. What follows is a high-level overview of the tools we use, why we use them, and some tips to keep in mind as you are starting out.” (Josh Steiner January 14, 2014)
- “Test Driven Rails – Part 1” https://karolgalanciak.com/blog/2014/01/04/test-driven-rails-part-1/
- “Testing is still one of the hottest topics when it comes to developing maintainable and business-critical applications. Ruby on Rails community embraces the importance of writings tests, yet there are so little resources about the Test-Driven Development or Behavior-Driven Development in Rails applications from a wider perspective. How should we test our application? Which tests are valuable and which don’t provide any value? What scenarios should be included in acceptance tests?” (Karol Galanciak, Jan 4TH, 2014)
- “How I Test” : http://railscasts.com/episodes/275-how-i-test
- “Here I show how I would add tests to the password reset feature created in the previous episode. I use RSpec, Capybara, Factory Girl, and Guard to make request, model, and mailer specs.”
Testing: Next Steps
Once you understand the basics, this is how to go a bit deeper.
- “RSpec Best Practices”: http://jacopretorius.net/2013/11/rspec-best-practices.html
- “Factories not Fixtures”: http://railscasts.com/episodes/158-factories-not-fixtures-revised
- “Fixtures are external dependencies which can make tests brittle and difficult to read. In this episode I show how to use Factory Girl to generate the needed records directly in the tests.”
- “Request Specs and Capybara”: http://railscasts.com/episodes/257-request-specs-and-capybara