onatm / automated-testing-talk

Automated Testing with Cucumber and Capybara

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automated Testing with Cucumber and Capybara

OH HAI

What is Cucumber?

  • BDD Framework
  • Written in Ruby
  • Understands Gherkin Language
Feature:
  As a user I should be able to create a clone

Background:
  Given I am on SQL Clone Dashboard

Scenario: Navigate to 'Clone Destination' page
  When I click on "Clone" button
  Then I should see "Clone Destination" heading
Given(/^I am on SQL Clone Dashboard$/) do
  pending
end

When(/^I click on "([^"]*)" button$/) do |arg1|
  pending
end

Then(/^I should see "([^"]*)" heading$/) do |arg1|
  pending
end

What is Capybara?

  • Web-based test automation framework
  • Can be used with Cucumber
  • Selenium, PhantomJS, etc.
  • DSL
visit('/dashboard')
click_button('Clone')
select('DEV-ONATM', from: 'Clone Destination')
fill_in('Clone Name', with: 'Clone1')

Demo

xvfb-run -a --server-args="-screen 0 1920x1080x24" cucumber --format pretty --format html --out results.html

References

About

Automated Testing with Cucumber and Capybara

License:MIT License


Languages

Language:Ruby 75.1%Language:Gherkin 24.9%