Meetings/2013-06-27
What | Browser test automation with Cucumber |
---|---|
How | Local workshop + IRC, details to be decided. |
When | Thursday, June 27, 2013, 19:00 PDT (Friday, June 28 at 02:00 UTC), 2 hours |
Where |
|
Food | Pizza and drinks |
Facilitators | tbc |
Cucumber and Page Objects: Writing Great Browser Tests
editThis session will take you through every step of writing an automated test for WikiLove, a real feature on Wikipedia, from the requirements to the executable code.
We'll start by crafting a plain English description of a software feature in the form of Given/When/Then statements for Cucumber.
Then we will turn that plain English description of the software feature into an executable test using the Page Object design pattern.
There will be kittens.
Programming knowledge is not required, although programming experience is helpful when we turn to implementing our Cucumber scenarios.
Agenda:
- Discussion: create some Cucumber test scenarios for a particular Wikipedia feature.
- Setup: install Ruby and prerequisites for Cucumber/Page Object tests.
- Tech demo: Cucumber makes it easy to write the test steps.
- Tech demo: create the Page Object for the test.
- Finish: watch the tests run on your local machine, and check the test into the real Wikipedia repository
Setting up for testing
edit- Create a user on beta labs if you don't already have one: http://en.wikipedia.beta.wmflabs.org/
- On github download the code as a zip file from https://github.com/wikimedia/qa-browsertests/archive/master.zip or get it from https://github.com/wikimedia/qa-browsertests
- In the /browsertests/config directory in your downloaded code:
- Edit line 1 of /browsertests/config/config.yml to change
mediawiki_username: Selenium_user
tomediawiki_username: YOUR_USER_NAME
- Create a file 'secret.yml' in the same directory /browsertests/config/secret.yml. Edit secret.yml to show
mediawiki_password: YOUR_USER_PASSWORD
- Edit line 1 of /browsertests/config/config.yml to change
Setting up Ruby
edit- Check that you have Ruby version 1.9.x or higher:
$ ruby --version ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
- Install Ruby 1.9.x or higher if you don't already have it
- for *nix systems use RVM
$ \curl -L https://get.rvm.io | bash -s stable
- for Windows use http://rubyinstaller.org/
- for *nix systems use RVM
- then do:
$ cd qa-browsertests $ gem update --system $ gem install bundler $ bundle install
- In new terminals you may need to do
source ~/.rvm/scripts/rvm
to use RVM properly
- In new terminals you may need to do
Run a test
editIf everything is set up properly, from a command line in the /browsertests directory, do
$ bundle exec cucumber features/wikilove.feature
and watch our test run in Firefox on your computer. Kittens!
Hack
edit- As a group, improve the existing Cucumber scenarios
- As a group, make a new Cucumber Scenario
- Make the new tests run!