streamline selenium testing with page flow navigation

Post on 29-Nov-2014

654 Views

Category:

Technology

9 Downloads

Preview:

Click to see full reader

DESCRIPTION

Join us to learn how to significantly reduce the time needed to write and maintain Selenium tests by using page flows to encapsulate the navigational elements in your application. We'll show you how common, multi-page UI actions in Selenium tests can be abstracted into page flows. With a page flow, developers can cut to the chase in a testing scenario, bypassing the setup often needed to navigate to the beginning of your testable action. Leave knowing what you need to add a high value, low maintenance Selenium test suite to your arsenal.

TRANSCRIPT

Streamline lenium Testingwith Page Flow navigation

Ted Husted, NimbleUser, Release Engineer@tedhusted

Derek Hansen, NimbleUser, Lead Engineer@nimblederek

Safe harborSafe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Source code license - BSD2Copyright (c) 2013, NimbleUser

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or

other materials provided with the distribution.

Neither the name of NimbleUser nor the names of its contributors may be used to endorse or promote products derived from this software without

specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,

BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT

SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL

DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS

INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING

NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE

https://bitbucket.org/nimbleams/open-nu-selenium

Ted HustedRelease Engineer, NimbleUser@tedhusted

Derek HansenLead Engineer, NimbleUser@nimblederek

hands up

unit test Apex code?

test Visualforce page workflows?

use other test tools for Visualforce pages?

run Selenium tests?

Selenium in action

(self-running demo)

why automate UI testing?

why not automate UI testing?

why use Selenium?

just do it

public void testNew() throws Exception {

driver.get("http://www.test.com");

driver.findElementBy(How.ID,"loginForm:tbUsername").sendKeys(“J.Doe”);

driver.findElementBy(How.ID,"loginForm:tbPassword").sendKeys(“Sup3rDup3r”).submit();

// ...

}

public void testNew() throws Exception {driver.get("http://www.test.com");driver.findElementBy(How.ID,”loginForm:tbUsername").sendKeys(“jackbenimble");

driver.findElementBy(How.ID,”loginForm:btnLogin").submit();

driver.findElementBy(How.ID,”adminHomeForm:_activitynew").submit();

driver.findElementBy(How.ID,”addEditEventForm:_IDcancel").submit();

driver.findElementBy(How.ID,”adminHomeForm:_activityold").submit();

//...

Page Objects

Page Flows

// You can enter your usernamepublic LoginPage typeUsername(String username) { // No other method enters a username driver.findElement(usernameLocator).sendKeys(username); return this;}

public HomePage loginAs(String username, String password) { typeUsername(username); typePassword(password); return submitLogin();}

Page Objects

Page Flows

public ResultPage searchFor(String text) { driver.findElement("q")

.sendKeys(text) .submit(); return new ResultPage(driver, false);}

public SearchPage(WebDriver driver, Boolean doNav) {this.driver = driver;

if (doNav) this.driver.get("http://google.com/");}

}

public SearchPage() {@FindBy(how = How.NAME, using = "q")private WebElement searchBox;

public void searchFor(String text) { searchBox.sendKeys(text).submit();}

public SearchPage(WebDriver driver) {driver.get(Where.SEARCH_PAGE);PageFactory.initElements(driver, this);

}}

WebElementvoid clear() void click()WebElement findElement(By by)List findElements(By by)String getAttribute(String name)String getCssValues()Point getLocation()Dimension getSize()String getTagName()String getText();boolean isEnabled()boolean isSelected()void sendKeys(CharSequence keysToSend)void submit()

(show and tell)

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>ams-pkg-test</groupId> <artifactId>ams-pkg-test</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>ams-pkg-test</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies>

<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.35.0</version></dependency><dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope></dependency>

</dependencies></project>

Maven plays well with others

Ted Husted

Release Engineer@tedhusted

Derek Hansen

Lead Engineer,@nimblederek

All about NimbleUser

Nimble AMS is an enterprise Association Management System built by NimbleUser on Force.com. Nimble AMS revolutionizes the traditional AMS model with Chatter, Sites, Apps, Mobile, Social, and more.

2004 - 2006 - 2008 - 2011 - 2014

top related