concept Capybara in category software development

This is an excerpt from Manning's book Writing Great Specifications: Using Specification by Example and Gherkin.
In this appendix, you’ve used Cucumber to write unit tests because they’re short and easy to learn. But in the testing community, Cucumber is typically associated with using Capybara for an end-to-end system testing.
Capybara—An integration testing tool for web applications. Capybara helps you test web applications by simulating how a real user would interact with your app.
You can even configure Capybara to run Firefox or Chrome on your machine as a test driver in order to watch Cucumber click over the simulated user interface when it tests the system. The main benefit is that such tests check the system end to end, forcing it to integrate different elements such as the domain layer, API calls, and the user interface. The main drawback is that end-to-end testing is slow and performance heavy. In the banking example, the unit tests took 0.011 seconds; a single end-to-end integration test can take up to 30 seconds, depending on how many screens you want to test in a single run.
We won’t be analyzing a Capybara end-to-end example in this appendix. To do so, you’d need to create a fully working web application—a task that’s definitely beyond the scope of this book. Besides, other resources such as The Cucumber Book, referenced earlier, can help you learn more about end-to-end testing. What you can do, though, is rewrite one step definition to see what a test using Capybara looks like.
Listing A.19. When step rewritten to use Capybara
When(/^she deposits \$(\d+)$/) do |arg1| click_link "Deposit" find("input#deposit", match: :first).set arg1 click_button "Deposit" endCapybara provides a new set of methods such as click_link, find, and click_button that you can use to interact with the user interface.
As of version 5.1, Ruby on Rails has Capybara working out of the box as the default solution for system tests. You get a Capybara wrapper that’s preconfigured for Chrome and enhanced to provide failure screenshots as part of Action Dispatch. Different frameworks in other programming languages have their own equivalents of Capybara.
Even if your language doesn’t provide something like Capybara, you can use the original Ruby version and write Cucumber tests in Ruby that will check your application written in any other language. This is possible because Capybara only interacts with the user interface, so you only have to run a web server behind the scenes that can serve a simulation of your web application. As long as you do that, you’ll be fine.