Alex Rivera | Logout

Cucumber/Capybara vs Selenium?

Asked 2012-07-05T17:23:08.543
17

The other day I was showing one of the testers at my company some tests I had written in cucumber (2 features, 5 scenarios). Then he asked me question that I could not answer:

How is this better than selenium or any other functionality test recording tool?

I understand that cucumber is a different technology and it's placed at a different level of testing, but I can't understand why I should bother to write and maintain Cucumber/Capybara tests.

Can someone give me a reasonable explanation for using Cucumber/Capybara instead of just Selenium?

Edit
Report

1 Answer

10

Cucumber isn't only a testing tool. Besides testing Cucumber features also take a role of documentation, a mechanism to collaborate with stakeholders and requirements storage (if you write them in declarative style).

You don't have to use Cucumber with Capybara. You can use selenium directly. But Capybara has the same high-level API for all supporting drivers. It's more high-level than Selenium's and allows to write tests a bit faster. You don't have to change code when you switch from one driver to another.

Tests built using test recording tools are generally much worse. Selenium IDE may produce valid programming code but it's not good-looking and thus quiet difficult to maintain.

answered 2012-07-05T18:04:51.457

Your Answer