Can someone please clarify using a SIMPLE user story the full slice of what Cucumber would be used for and what RSpec would be used for? I purchased the RSpec book the other day and have been going through it. The author seems to be quite vague at times.
What I'm thinking of if the user story is something like (please excuse the syntax incorrectness, this is just so you get the point):
When a user enters an invalid telephone number then they get a message saying "Invalid Telephone Number"
If I write out all the code for Cucumber to check for this and then write the rspec stuff, I'm basically duplicating my test. Is there a scenario to explain how the cucumber test should be different from the rspec test?
I feel like you would be duplicating tests on both levels all the time.
If there is no definitive answer on this, I'm going to begin to think the Cucumber people just didn't want to step on the RSpec people's toes.
Please help. I feel like my head is about to explode.
Thanks!
It might be of use to look into the screencasts at BDDCasts.com. They walk you through creating the stories and specs for an app. It really helped me. Also own the rspec book, but was still confused. You might even want to just check out their source on github.
For me it goes like this:
Cucumber to test what the user will see. (Full stack test)
Rspec to test everything else. (Model, controller)
Cucumber is used to explain (make a description) of a part (story) of the application rather than unit tests or behaviour tests (which is the focus of RSpec)
So, IMHO Cucumber tests (stories) do not substitute for RSpec tests.
The RSpec tests tend to drive development of the models and controllers, and the stories tend to drive development of the views.
From your description it seems like you are using cucumber to both test the stories and the behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With