developing a test automation strategy by brian bayer

78
test automation strategy Developing a

Upload: qaoth

Post on 15-Apr-2017

576 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Developing a test automation strategy by Brian Bayer

test automation strategyDeveloping a

Page 2: Developing a test automation strategy by Brian Bayer

why are we here?

Page 3: Developing a test automation strategy by Brian Bayer

regression testing

the greatest cost of development

Page 4: Developing a test automation strategy by Brian Bayer

regression testing

you have already paid for this at least once

Page 5: Developing a test automation strategy by Brian Bayer

why regression test?

Page 6: Developing a test automation strategy by Brian Bayer

why regression test?

quality ensures what was working, still works

Page 7: Developing a test automation strategy by Brian Bayer

why regression test?

quality

risk

moneylost revenue, market, contractual

ensures what was working, still works

deliverables, release, schedule

Page 8: Developing a test automation strategy by Brian Bayer

why regression test?

a project withoutthorough and continuous regression testing

is like a road tripwhere you do not look out the window

until the end of the trip

Page 9: Developing a test automation strategy by Brian Bayer

why automate? (vs. manual)

Page 10: Developing a test automation strategy by Brian Bayer

why automate? (vs. manual)

TimeMoney

Page 11: Developing a test automation strategy by Brian Bayer

why automate? (vs. manual)

Money

Page 12: Developing a test automation strategy by Brian Bayer

why automate? (vs. manual)

Time

Page 13: Developing a test automation strategy by Brian Bayer

automation strategywhat to consider...

tests are living specifications of the system

Page 14: Developing a test automation strategy by Brian Bayer

automation strategywhat to consider...

ARE THE TESTS GOING TO BE USED?

Page 15: Developing a test automation strategy by Brian Bayer

automation strategywhat to consider...

business needs

return on investment

organizational structure and culture

Page 16: Developing a test automation strategy by Brian Bayer

automation strategybusiness needs...

determine areas of focus of the automation

Page 17: Developing a test automation strategy by Brian Bayer

automation strategyreturn on investment...

limits and prioritizes the areas of focus of the automation

determines at which level to automate a test

determines the automation framework

Page 18: Developing a test automation strategy by Brian Bayer

determines the success or failure

determines the speed, ability & openness to change

determines the communication

determines the ability to learn

automation strategyorganization and culture...

Page 19: Developing a test automation strategy by Brian Bayer

automation strategyorganization and culture...

determines who uses and maintains the tests

determines the automation framework too

Page 20: Developing a test automation strategy by Brian Bayer

automation strategywhat else to consider...

Page 21: Developing a test automation strategy by Brian Bayer

automation strategywhat else to consider...

development process and lifecycle

maintenance of the tests

technology stacks

Page 22: Developing a test automation strategy by Brian Bayer

automation strategydevelopment process and lifecycle...

legacy (system without tests) to greenfields

Page 23: Developing a test automation strategy by Brian Bayer

automation strategydevelopment process and lifecycle...

system under test development process

methodology: waterfall agile xp ad hoc

is automation development part of the same process?

Page 24: Developing a test automation strategy by Brian Bayer

automation strategydevelopment process and lifecycle...

is the automator part of the development team?

how much access to the system developers?

Page 25: Developing a test automation strategy by Brian Bayer

automation strategymaintenance of the tests...

who and how much can they maintain?

how are the system developers involved?

Page 26: Developing a test automation strategy by Brian Bayer

automation strategymaintenance of the tests...

how timely can/must tests be maintained

what reporting needed to maintain tests

Page 27: Developing a test automation strategy by Brian Bayer

automation strategyfinally, technology stacks...

languages and technology already used

unit and integration testing

source code control, continuous integration

devops or operations

Page 28: Developing a test automation strategy by Brian Bayer

where to automate?

Page 29: Developing a test automation strategy by Brian Bayer
Page 30: Developing a test automation strategy by Brian Bayer

who is going to use the tests?

Page 31: Developing a test automation strategy by Brian Bayer

developers, maybe...

depends

Page 32: Developing a test automation strategy by Brian Bayer

where to automate?

https://msdn.microsoft.com

“Its essential point is that you should have many more low-level unit tests than high level end-to-end tests running through a GUI.” Martin Fowler

Page 33: Developing a test automation strategy by Brian Bayer

where to automate?

UNIT LEVELINTEGRATION LEVEL

GUI INTEGRATION LEVELXPtest driven development

ACCEPTANCE LEVEL BDD

Page 34: Developing a test automation strategy by Brian Bayer

ACCEPTANCE LEVEL BDD

where to automate?

acceptance testsonly if the business is engaged and

going to use them

ACCEPTANCE LEVEL BDD

Page 35: Developing a test automation strategy by Brian Bayer

where to automate?what to consider...

DRY

Page 36: Developing a test automation strategy by Brian Bayer

look for low-hanging fruit

risk-based testing

what computers do well, humans not so much

fragility of test

where to automate?what to consider...

Page 37: Developing a test automation strategy by Brian Bayer

which automation framework to use?

Page 38: Developing a test automation strategy by Brian Bayer

which automation framework to use?

Gherkin/Cucumber

Robot Framework

Selenium Webdriver

Spock/Geb

JUnit

Jasmine

TestNG

Page 39: Developing a test automation strategy by Brian Bayer

which automation framework to use?what to consider...

ORGANIZATIONAL STRUCTURE AND CULTURE

Page 40: Developing a test automation strategy by Brian Bayer

which automation framework to use?what to consider...

who is reading the tests?

who is writing and maintaining the tests?

balance of right tool with existing technology, knowledge, and ability to learn

ORGANIZATIONAL STRUCTURE AND CULTURE

Page 41: Developing a test automation strategy by Brian Bayer

which automation framework to use?what else to consider...

natural language for high level specification

goal is to develop tests NOT framework

and...

Page 42: Developing a test automation strategy by Brian Bayer

grids...

Page 43: Developing a test automation strategy by Brian Bayer

integration...

Page 44: Developing a test automation strategy by Brian Bayer
Page 45: Developing a test automation strategy by Brian Bayer

reporting...

Page 46: Developing a test automation strategy by Brian Bayer

teh sexy

Page 47: Developing a test automation strategy by Brian Bayer

gherkin/cucumber/ruby

Page 48: Developing a test automation strategy by Brian Bayer

but JRuby (JVM), Java, Groovy, JavaScript,.NET (using SpecFlow)

libraries (Selenium, Watir)

Ruby has the richest ecosystem with gems

gherkin/cucumbergenerally ruby based...

Page 49: Developing a test automation strategy by Brian Bayer

Feature: Cash Withdrawal

Scenario: Successful withdrawal from an account in credit Given my account has been credited with $100 When I withdraw $20 Then $20 should be dispensed And the balance of my account should be $80

Given /^my account has been credited with (#{CAPTURE_CASH_AMOUNT})$/ do |amount| my_account.credit(amount)end

Page 50: Developing a test automation strategy by Brian Bayer
Page 51: Developing a test automation strategy by Brian Bayer

also runs on Jython (JVM) & IronPython (.NET)

libraries (Selenium, Watir, SOAP, etc.)

keyword based

supports “given when then”

supports tabular/data driven

robot frameworkpython based...

Page 52: Developing a test automation strategy by Brian Bayer

*** Settings ***Library Selenium LibrarySuite Setup Start Selenium ServerSuite Teardown Stop Selenium ServerTest Setup Setup TestTest Teardown Close All Browsers

Page 53: Developing a test automation strategy by Brian Bayer

*** Testcases ***Login Should Succeed When the Correct Username and Password are Entered Enter Username AUser Enter Password TestPass Click the Login Button Login is Successful

*** Keywords ***Setup Test Open Browser http://zdiles.chaosnet.org/ googlechrome Maximize Browser Window

Enter Username [Arguments] ${username} Input Text uname ${username}

Login Is Successful Page Should Contain Welcome

Page 54: Developing a test automation strategy by Brian Bayer

*** Testcases ***Login Should Succeed When the Correct Username and Password are Entered Given I Enter Username AUser And I Enter Password TestPass When I Click the Login Button Then Login is Successful

given when then

Page 55: Developing a test automation strategy by Brian Bayer

spock/geb/groovy

Page 56: Developing a test automation strategy by Brian Bayer
Page 57: Developing a test automation strategy by Brian Bayer

developing in java or grails?

Page 58: Developing a test automation strategy by Brian Bayer

groovy-based browser automation tool

built on Selenium WebDriver

works with JUnit, TestNG, Spock

page models and jQuery selector syntax

spock/geb/groovygeb...

Page 59: Developing a test automation strategy by Brian Bayer

groovy-based test and specification framework

supports “given when then”

tabular/data driven

spock/geb/groovyspock...

Page 60: Developing a test automation strategy by Brian Bayer

import geb.spock.GebSpec

class GebHomepageSpec extends GebSpec {

def "can access The Book of Geb via homepage"() { given:”One is on the Geb Home Page” to GebHomePage

when: “I click the jQuery Link” highlights.jQueryLikeApi.click()

then: “I should be at the jQuery Section” highlights.jQueryLikeApi.isSelected }}

Page 61: Developing a test automation strategy by Brian Bayer

import geb.Page

class GebHomePage extends Page { static url = "http://gebish.org"

static at = { title == "Geb - Very Groovy Browser Automation" }

static content = { highlights { $("#sidebar .sidemenu").module(HighlightsModule) } sectionTitles { $("#main h1")*.text() } }}

Page 62: Developing a test automation strategy by Brian Bayer

FRAMEWOR

KS

Page 63: Developing a test automation strategy by Brian Bayer

other options...

Page 64: Developing a test automation strategy by Brian Bayer

raw Selenium (Java)

excel spreadsheet data driven scripts

script capture record/playback

flat files in source control

other options...

Page 65: Developing a test automation strategy by Brian Bayer

which automation framework to use?

the simplest thing that could possibly work

Page 66: Developing a test automation strategy by Brian Bayer

testsare specifications of the system...

Page 67: Developing a test automation strategy by Brian Bayer

how does it fit?

Page 68: Developing a test automation strategy by Brian Bayer

how does it fit...

design your approach into the organization

Page 69: Developing a test automation strategy by Brian Bayer

how does it fit...

find the gaps and tight squeezes

Page 70: Developing a test automation strategy by Brian Bayer

the specifics...

Page 71: Developing a test automation strategy by Brian Bayer

the mechanics...

Page 72: Developing a test automation strategy by Brian Bayer

so what’s left?

Page 73: Developing a test automation strategy by Brian Bayer

documentation of the strategy...

Page 74: Developing a test automation strategy by Brian Bayer

execution of the strategy...

Page 75: Developing a test automation strategy by Brian Bayer

if project management...

Page 76: Developing a test automation strategy by Brian Bayer

estimation...

Page 77: Developing a test automation strategy by Brian Bayer

resources...

Page 78: Developing a test automation strategy by Brian Bayer