Our customers have been loving the ability to write and execute (simple English) Cucumber Automated Testing Scripts for a while now. Cucumber has been one of the primary frameworks for BDD and its benefits are clearly proven by the fact that many new automation technologies like Calabash are actively using it.
At 3Qi, we’ve actively used and promoted Cucumber for several years now, and in addition to its many benefits that have been promoted by the community, the big one our customers have realized is the fact that all stakeholders (Business, Dev & QA) can understand, quantify and agree upon test coverage right from the onset. This is a big deal in the enterprise since, historically, some of this has been a “black box” (no pun intended!).
As part of Awetest, we have defined a core set of Cucumber steps that account for the bulk of the interactions in most web applications. Our Cucumber steps use the Watir WebDriver API under the covers to drive the browsers but this complexity has been abstracted out so that users can build simple automated testing scripts without having to go in and write custom libraries in the initial phases of their automation buildout.
Below is a cheat sheet, a listing of all the predefined Cucumber steps that ship with Awetest. We are constantly adding and updating this library and you can always find more details at http://awetest.zendesk.com
Opening a browser:
These are standard commands for launching a browser. You can specify a browser or you can simply say “new browser” which will launch the browser you selected at run time in Awetest.
1 2 3 4 5 6 7 8 9 |
When /^I open a browser$/i When /^I open a new browser$/i Given /^I open a F?f?irefox B?b?rowser$/i Given /^I open Firefox$/ Given /^I open a C?c?hrome B?b?rowser$/i Given /^I open Chrome$/ When /^I open an IE B?b?rowser$/i Given /^I open an I?i?nternet E?e?xplorer B?b?rowser$/i Given /^I open Internet Explorer$/i |
Defining Library:
Awetest supports both Classic Watir and Watir WebDriver and you can choose the library you want to use directly in the script.
1 2 3 4 |
Given /^I run with Watir$/ Given /^I run with Classic Watir$/ Open a browser with watir-webdriver Given /^I run with Watir-webdriver$/i |
Navigation:
This is standard navigation to a specific URL. You can also specify environments in Awetest directly which will be used by the scripts at Run time.
1 2 3 |
Then /^I navigate to the environment url$/ Then /^I go to the url "(.*?)"$/ Then /^I go to the (URL|url)$/ |
Clicking on an image/text:
1 |
Then /^I click "(.*?)"$/ |
Interacting with button/radio/check box:
1 2 |
Then /^I click the button "(.*?)"$/ Then /^I click the "?(.*?)"? with "(.*?)" "(.*?)"$/ |
Inputting data into text field:
1 2 |
And /^I enter "(.*?)" in text field with "?(.*?)"? "(.*?)"$/ And /^I enter the value for "(.*?)" in text field with "?(.*?)"? "(.*?)"$/ |
Selecting from the target list:
1 2 3 |
And /^I select the value "(.*?)" in select list with "?(.*?)"? "(.*?)"$/ And /^I select the option "(.*?)" in select list with "?(.*?)"? "(.*?)"$/ And /^I select the value for "(.*?)" in select list with "?(.*?)"? "(.*?)"$/ |
Checking the value in a text box:
1 2 |
Then /^I check that the "?(.*?)"? with "?(.*?)"? "(.*?)" contains "(.*?)"$/ Then /^I check that the text field with "?(.*?)"? "(.*?)" contains the value for "(.*?)"$/ |
Text validation:
1 2 |
Then /^I should see "(.*?)"$/ Then /^I should not see "(.*?)"$/ |
Filling in a text box:
1 |
Then /^I fill in "(.*?)" with "(.*?)"$/ |
Using Binding.pry to debug:
1 |
Then /^let me debug$|^pry$|^execute binding.pry$/ do |
Implicit & Explicit Waits:
1 2 |
When /^I wait (d+) seconds?$/ When /^I wait until "?(.*?)"? with "?(.*?)"? "(.*?)" is ready$/ |
Interacting with browser alert:
1 |
And /^I click "(.*?)" in the browser alert$/ |
Closing the browser:
1 |
And /^I close the browser$/ |
Special Cases:
1 2 3 4 5 |
When(/^I should see "([^"]*)" but proceed if not present$/) Given /^I load data spreadsheet "(.*?)" for "(.*?)"$/ Then /^I load @login from spreadsheet$/ Then /^I load @var from spreadsheet$/ And /^I take a screenshot$/ |
Cucumber continues to be a big draw for enterprise customers. In addition to the natural language (simple english) syntax, Awetest customers love the fact that they can use the same steps and feature files (Cucumber scripts) to execute their cross browser and mobile tests.