My Automated Testing Journey

AS
by Alister Scott1 view·Updated Jun 7, 2011
Powered by AI

Need to present on this topic?

Create your own polished presentation in minutes. Just describe what you need.

Free to try, no credit card required

Transcript

Difficult to understand what the coverage

(either business or code) is

Slightly better

Can build page model

to represent

Scenario: Free Shipping

Given I am on the Beautiful Tea home page

When I search for ‘Byron Breakfast’ tea

Then I see the page for ‘Byron Breakfast’ tea

When I add 10 x ‘Byron Breakfast’ tea to my cart

Then I see 10 x ‘Byron Breakfast’ tea in my cart

Sold as 'anyone

can do automation'

Still writing

steps

not

specifications

provides some business

visibility into tests

but is the most dangerous:

specifying scripts but not using code:

incredibly hard to refactor

Scenario: Free Shipping

Given I open a browser

And I go to "beautifultea.com"

When I enter "byron breakfast" in "search"

And I click "Search"

Then I should see byron breakfast tea

When I enter "20" into "quantity"

And I click "Add to Cart"

Then I should see the cart

Action Word

Continous Integration

developers need access

watir, webdriver & selenium shine

Continous Integration

QTP, RFT etc. doesn't work -> prohibitive cost

won't run on non Windows machines

Cucumber

heavy weight

Feature: Beautiful Tea Shipping Costs

Allows you to specify

tests in english

And execute them

Continous Integration

  • Australian customers pay GST
  • Overseas customers don’t pay GST
  • Australian customers get free shipping for orders $100 and above
  • ●Overseas customers all pay the same shipping rate regardless of order size

members of team integrate work frequently

run automated tests for rapid feedback

Scenario Outline: Calculate GST and shipping rate

Moving from test scripts

to specifications

Given the customer is from <customer’s country>

When the customer’s order totals <order total>

Then the customer <pays GST>

And they are charged <shipping rate>

Examples

Less coupled to implementation

Focussed on business specifications

More resilient to change

Easier to read

Easier for business to understand

An Automated Testing Journey

Alister Scott

ThoughtWorks Australia

watirmelon.com

Specifications make sense

Living Documentation

Easy to understand

Easy to test

Sample QTP

Executable specifications

become single source of truth

Used for support issues

Used for system enhancement/improvement

What the business pays for

Dim TBrowser : Set TBrowser=Browser("name:=Beautiful Tea.*")

Dim TPage : Set TPage=TBrowser.Page("title:=Beautiful Tea.*")

URL="http://www.beautifultea.com"

SystemUtil.run "iexplore",URL

TPage.WebEdit("name:=Search").Set "Byron Breakfast"

TPage.WebButton("name:=Search","index:=0").Click

Specifications as contracts

Combine with personas

Business Driven

Sample Watir

process_row(action, param1, param2 ...)

Page Objects

http://www.centrelink.gov.au/internet/internet.nsf/payments/baby_bonus_iat.htm

b = Watir::Browser.new

b.goto "www.beautifultea.com"

b.text_field(:name => "Search").set "Byron Breakfast"

b.button(:name => "Search").click

b.title.should == "Search Results"

Allows you to specify

elements in pages

Nice neat step definitions

more business focussed:

easier to understand

...but can be hard to read:

forced use of rows & columns

Lots of tools make this possible

ThoughtWorks Twist

No page objects

contains business logic

but version controlling

spreadsheets is hard

can't diff/merge etc.

Given I open a browser

@browser = Watir::Browser.new

Small change in application

means lots of changes in scripts

Cucumber

When I go to "beautifultea.com"

@browser.goto "beautifultea.com"

SpecFlow

Questions?

When I enter 'byron' in search

FitNesse

@browser.text_field(:xpath,

"//img[@src='3.jpg']/../").set "byron"

alscott@thoughtworks.com

Concordion

Page Objects

Given I am on the Beautiful Tea homepage

Scripts are written in code:

non-technical users can't understand

@homepage = BeautifulTeaHome.new

When I search for 'Byron Breakfast' tea

@homepage.search_for 'Byron Breakfast'

Then I should the page for 'Byron Breakfast' tea

@resultspage.title.should == 'Byron Breakfast tea'