Can someone explain the difference between these two platforms?
Are both part of BDD
but why should I use one or other, or both together?
bddcapybaracucumberrubygemstesting
Can someone explain the difference between these two platforms?
Are both part of BDD
but why should I use one or other, or both together?
Best Answer
Capybara is a tool that interacts with a website the way a human would (like visiting a url, clicking a link, typing text into a form and submitting it). It is used to emulate a user's flow through a website. With Capybara you can write something like this:
Cucumber is a tool to write human-readable tests that are mapped into code. With it, you can rewrite the above example like this:
The almost plain-text interpretation is useful to pass around non-developers but also need some code mapped into it to actually work (the step definitions).
Usually you will use Capybara if you're testing a website and use Cucumber if you need to share those tests with non-developers. These two conditions are independent so you can use one without the other or both or none.
PS: in the code snippet there is some RSpec as well. This is needed because Cucumber or Capybara by themselves cannot test something. They rely on RSpec, Test::Unit or minitest to do the actual "Pass or Fail" work.