Reputation: 4787
I am beginning at Ruby and i read about different test methods/frameworks: unit test (MiniTest::unit now with the latest Ruby version), Rspec, Cucumber and Capybara. But I don't fully grasp what's the main "value" of each of them, differentiating from the other ones and if I could/should be using a mix of all of them to ensure our app is well tested?
Upvotes: 0
Views: 758
Reputation: 11444
I personally use RSpec
for functional testing and capybara
/cucumber
for integration testing. RSpec
is great for writing tests to make sure my classes perform as I expect them to. Cucumber
is great (along with Capybara, or webrat) for making sure my views perform the way I expect them to.
Testing is a huge asset to writing Rails apps. It's amazing how often I'll change something and my tests catch that there's an unexpected side effect to that change. It also helps you resolve bugs by being able to duplicate them in a test and making the test pass, causing the bug to be resolved.
So: rspec
(and FactoryGirl
) for making sure my classes do what they're supposed to and cucumber
to make sure my user interacts with the web site in the manner I intended.
Upvotes: 1