ddikman / cucumber-web-tests

This project is a super tiny start at using Capybara & Cucumber with Ruby to write easily maintainable tests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Web testing with Cucumber and Capybara

This project is a small example to show how web testing can be automated with Cucumber and Capybara.

test results in command line

Setup

rvm install 2.6.0
bundle install

rvm is the Ruby Version Manager and helps you keep your environment clean.

Run

cucumber features

executing tests

Reporting

By default cucumber reports to the console. You can change this by using a reporter

cucumber features --format html > report.html

Example of html report

Add more tests

Create a new x.feature file in the features folder and then add in a scenario.

Then run cucumber -d to get example step definitions, paste and modify these into step definitions.

Using Capybara

Capybara isn't just a cute animal, it's also a framework for driving UI tests with Selenium. Check out the cheat sheet for a quick guide into how to use it.

Headless tests

Tests are only useful when they are being run continously. This repository relies on Github Actions to run tests on commit. Read more on how to run selenium headless (without UI) in a continous integration environment like Github Actions.

About

This project is a super tiny start at using Capybara & Cucumber with Ruby to write easily maintainable tests.


Languages

Language:Ruby 75.1%Language:Gherkin 18.7%Language:Shell 6.3%