Process Overview
Technical Overview
Selenium Webdriver and Protractor
Test development - three asset types
Feature files
Feature: Some terse yet descriptive text of what is desired
In order to realize a named business value
As an explicit system actor
I want to gain some beneficial outcome which furthers the goal
Scenario: Some determinable business situation
Given some precondition
And some other precondition
When some action by the actor
And some other action
And yet another action
Then some testable outcome is achieved
And something else we can check happens too
Scenario: A different situation
...Scenario Outline: Eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |Feature: Multiple site support
Background:
Given a global administrator named "Greg"
And a blog named "Greg's anti-tax rants"
And a customer named "Wilson"
And a blog named "Expensive Therapy" owned by "Wilson"
Scenario: Wilson posts to his own blog
Given I am logged in as Wilson
When I try to post to "Expensive Therapy"
Then I should see "Your article was published."
Scenario: Greg posts to a client's blog
Given I am logged in as Greg
When I try to post to "Expensive Therapy"
Then I should see "Your article was published."Feature gherkin examples
Page objects
Page object example
/**
* @class Page object for the site search page
*/
var siteNameSearch = function siteNameSearch() {
// get some environment config, and configure browser
var environment = browser.params.environment.siteName;
var pageUtils = require('../../PageUtils.js');
pageUtils.configureBrowser(browser, environment);
// targets for scenario keywords
this.searchField = element(by.id('q'));
this.searchButtonLink = element(by.css('.someclass button'));
// load page
this.get = function () {
return browser.get(environment.siteHostPrefix + '/page-path');
};
// field to check on load
this.loadCheck = element(by.cssContainingText('.bootstrap-title h1', 'Page Title'));
this.waitForLoaded = function () {
return browser.wait((function (_this) {
return function () {
return _this.loadCheck.isPresent();
};
})(this), environment.maxPageLoadTime);
};
};
module.exports = {
"class": siteNameSearch,
name: 'siteNameSearch'
};Step definitions
Step definition examples
(function() {
module.exports = function() {
this.World = require('cukefarm').World;
this.When(/^I delete all cookies$/, function() {
return browser.manage().deleteAllCookies();
});
}
}).call(this);(function() {
module.exports = function() {
this.World = require('cukefarm').World;
this.Then(/^the "([^"]*)" should not be present$/, function(el) {
this.el = this.transform.stringToVariableName(el);
return this.expect(this.currentPage[this.el].isPresent()).to.eventually.equal(false);
});
}
}).call(this);These are quite low level. Over time should ideally have business language steps such as 'Given I am logged in to ...'
Reporting and test results
Test creation workflow
Common issues
Debugging tests
Some best practices
Next steps