Cucumber is a tool that executes plain-text functional descriptions as automated tests.
Cucumber is intended to be used for acceptance tests. Cucumber steps include checks for
rendering and redirection and also view content — in other words,
full coverage is still maintained.
1) Define feature scenario in cucumber for what my end goal is for the functionality
2) Start implementing each step of the feature scenario
3) For each part of functionality required that is in a model, BDD that with rspec
4) repeat until functionality is complete
That way you have Integration testing covered for an end to end request in your application, and each part of your model can be built and tested in isolation as well using rspec or test unit.
The only downside I’ve seen with cucumber so far is, since it’s full
stack, you need to get your data setup correctly. For my project the
data relationship are complex so I’ve had to resort to some heavy handed
data manipulation in the setup (e.g. Model.delete_all).
RSpec is a behavior driven development (BDD) framework for the Ruby programming language, inspired by JBehave.
Difference between Rspec or Cucumber?
Cucumber to drive the main features and RSpec to flush out
more difficult cases. Just today I got into the cycle of:
Cucumber is intended to be used for acceptance tests, and rspec for unit tests.
You should be using both. Well either that or cucumber and test unit.
Cucumber takes care of your integration/acceptance testing, and rspec/test unit should take care of your model unit tests. A typical workflow for me with this is,