+ All Categories
Home > Documents > AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 ›...

AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 ›...

Date post: 07-Jun-2020
Category:
Upload: others
View: 8 times
Download: 0 times
Share this document with a friend
21
AUTOMATING USER INTERFACE TESTS WITH BDD Jose Badeau, Dietmar Stoll, ESGroup AG itemis Schweiz GmbH
Transcript
Page 1: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

AUTOMATING USER INTERFACE TESTSWITH BDD

Jose Badeau, Dietmar Stoll,

ESGroup AGitemis Schweiz GmbH

Page 2: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

MOTIVATIONImprove test automation efficiencyReduce technical know-how for automation

Page 3: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

EXAMPLE LOGIN STORY

Page 4: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

WIREFRAME/MOCKUPDesigned by business analysts

Page 5: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

Test Login

Step 1: Navigate to the Login screenStep 2: Enter "admin" into the Login fieldStep 3: Enter "admin" into the Password fieldStep 4: Check Automatic LoginStep 5: Click the Sign In button

Assert 1: You are on the Home PageAssert 2: The title is "Welcome, Java Hipster!"

...

TEST SPECIFICATIONWritten by test writers

Page 6: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

APPLICATION CODEImplemented by app developer

<input type="text" id="username"><input type="password" id="password"><input type="checkbox" id="rememberMe"><button type="submit" id="signIn">Authenticate</button>

Page 7: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

TEST CODEImplemented by test or app developer

class LoginFeature {

public void loginWithAdminUser() {

driver.get("http://eclipse-finance-day/login"); WebElement element = driver.findElement(By.id("user")); element.sendKeys("admin"); element = driver.findElement(By.id("password")); element.sendKeys("admin"); element = driver.findElement(By.id("automaticLogin")); element.check(); element = driver.findElement(By.id("signIn")); element.submit();

Assert.true(driver.getTitle(), "Welcome, Java Hipster!"); }}

Page 8: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

WIREFRAME/MOCKUPAutomatic login element is removed

Page 9: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

ARTIFACT UPDATESCase Wireframe Test spec Test code App code Test Result1 ✔ ✗ ✗ ✔ runtime fail2 ✔ ✔ ✗ ✔ runtime fail...

Page 10: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

OUR APPROACH

Page 11: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

BEHAVIOR DRIVEN DEVELOPMENT (BDD)Stakeholder and business-value orientedTextual test descriptions

Page 12: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

Feature Login

As a registered userI want to loginIn order to use the application

Scenario Authenticate with admin user

Given I am on the Login screenwhen I type "admin" into the Login textfieldand I type "admin" into the Password textfieldand I check the AutomaticLogin checkboxand I click the Authenticate buttonthen I am on the Home screenand the Title label contains "Welcome, Java Hipster!"

Scenario ......

BDD

Page 13: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

Feature Login

As a registered userI want to loginIn order to use the application

Scenario Authenticate with admin user

Given I am on the Login screenwhen I type "admin" into the Login textfieldand I type "admin" into the Password textfieldand I check the AutomaticLogin checkboxand I click the Authenticate buttonthen I am on the Home screenand the Title label contains "Welcome, Java Hipster!"

Scenario ......

BDD DSL

Page 14: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

LINK THE ARTIFACTS

Page 15: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

CODE GENERATOR

Page 16: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

DEMOLet's go!

Page 17: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

PROSSeparation of Concerns

Wireframe - Business AnalystBDD DSL - Test WriterMapping - App Developer

Detect breaking tests at development timeSelf documenting, clearly readable testsEncourages reuseGenerate test code for multiple drivers e.g. Jubula, ToscaAbility to integrate with vendor testing stack and processeslike agile, TDD, waterfall

Page 18: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

CONSTest writers have to learn BDD DSLBusiness analysts must keep wireframes up to date

Page 19: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

FUTUREOpen sourceWeb-based wireframesIntegrate perceptual diff support (already partially available)Migrate to Gherkin syntaxAdditional generators (TOSCA, JUBULA, QTP)

Page 20: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

info at esgroup.chinfo at itemis-schweiz.ch

QUESTIONS?

Page 21: AUTOMATING USER INTERFACE TESTS WITH BDDwiki.eclipse.org › images › 1 › 18 › Automating_user_interface...BEHAVIOR DRIVEN DEVELOPMENT (BDD) Stakeholder and business-value oriented

TOOLS USEDWireframesketcherXtextGeb/SpockJHipster


Recommended