But I Know What I Like: Abstraction is the Key to Automation
1. But I Know What I Like
Abstraction is the Key to Automation
(@dylanlacey -- Sauce Labs)
2. Preheat the oven to 375 Degrees
Cream 250g of butter and 1 cup of sugar
in a mixing bowl
Mix in 2 cups of flour and 1 cup of milk,
and combine
Mix in 2 tsp of vanilla extract
Pour into prepared tins and bake 1 hour
•
•
•
•
•
The Exhausting Reality
3. Set the Temperature Dial of the Oven to 375 Degrees Fahrenheit
Place 250g of butter into the bowl of a mixer
Place 1 cup of sugar into the same bowl
Turn the mixer onto “7”
Mix until the mixture is pale yellow
Turn the Mixer down to “1”
Add 2 cups of flour to the mixing bowl
Add 1 cup of milk to the mixing bowl
Allow the mixer to run until the mixture looks the same colour throughout
Add 2tsp of Vanilla to the mixing bowl
•
•
•
•
•
•
•
•
•
•
The Exhausting Reality
4. Set the Temperature Dial of the Oven to 375 Degrees Fahrenheit
Place a bowl on a scale
Turn the scale on by pressing the “on” button
Use a knife to cut a stick of butter into 100 slices
Place one slice into the bowl on the scale
Read the Scale
Continue to place slices of butter into the bowl until the scale reads ‘250g’
Open a container of sugar
Get a dry cup measure from the drawer
Scoop sugar from the container into the measuring cup until it reaches the top
of the cup
Draw the back of a knife across the surface of the measuring cup, allowing the
excess sugar to fall back into the canister
Place the measuring cup on the counter
Take the mixer out of the cupboard
Place the mixer on the bench
Insert the square blade into the right hand blade hole on the mixer
Insert the round blade into the left hand blade hole on the mixer
The Exhausting Reality
10. What is he talking
about?
What is a Good Abstraction?
How Abstraction makes for Automation
Abstraction of Scripts
Abstraction of Infrastructure
•
•
•
•
14. Set the Temperature Dial of the Oven to 375 Degrees Fahrenheit
Place a bowl on a scale
Turn the scale on by pressing the “on” button
Use a knife to cut a stick of butter into 100 slices
Place one slice into the bowl on the scale
Read the Scale
Continue to place slices of butter into the bowl until the scale reads ‘250g’
Open a container of sugar
Get a dry cup measure from the drawer
Scoop sugar from the container into the measuring cup until it reaches the top
of the cup
Draw the back of a knife across the surface of the measuring cup, allowing the
excess sugar to fall back into the canister
Place the measuring cup on the counter
Take the mixer out of the cupboard
Place the mixer on the bench
Insert the square blade into the right hand blade hole on the mixer
Insert the round blade into the left hand blade hole on the mixer
The Exhausting Reality
16. Go to Chucks
Drink a Lowenbrau Dunkel
Take a shot of Tequila
Drink a White Rabbit Pale Ale
Take a sip of Natural Ice
Grimace and Skoll The Rest
Wash it out with a Stein of
Wiheinstephaner
Sleep in a doorway
•
•
•
•
•
•
•
•
17. Go to Chucks
Drink a Lowenbrau Dunkel
Take a shot of Tequila
Drink a White Rabbit Pale Ale
Take a sip of Natural Ice
Grimace and Skoll The Rest
Wash it out with a Stein of
Wiheinstephaner
Sleep in a doorway
Experience Regret
•
•
•
•
•
•
•
•
•
Go to Chucks
Drink 4 Beers
Take a shot
Sleep in a doorway
Experience Regret
•
•
•
•
•
22. PageObjects are
Abstract
Methods for “Doin’ Stuff” on a page
Should return Page Objects when giving
new pages
Encapsulate functionality and provide
single-line access to tasks
Ruby has SitePrism, page_objects_gem
•
•
•
•
24. Go to Chucks
Drink a Lowenbrau Dunkel
Take a shot of Tequila
Drink a White Rabbit Pale Ale
Take a sip of Natural Ice
Grimace and Skoll The Rest
Wash it out with a Stein of
Wiheinstephaner
Sleep in a doorway
Experience Regret
•
•
•
•
•
•
•
•
•
Go to Chucks
Drink 4 Beers
Take a shot
Sleep in a doorway
Experience Regret
•
•
•
•
•
26. Capybara for Everyone!
Free, open source tool, widely used by
the Ruby Community
Able to run “headless” for JS-free testing
Able to use Selenium to drive browsers
•
•
•
36. Write Tests In
Engl“ish”
(Technically it’s ‘gherkin’)
Scenario: I am Sober
Given I am on http://en.wikipedia.org/wiki/Main_Page
When I enter "Old Fashioned" into the search box
And I click the searchButton
Then I should see "The Old Fashioned is an IBA Official Cocktail"
37. It’s not Magic
Features in Gherkin are implemented by
‘step definitions’
You/r team write the step definitions
Step definitions can be any code
Step definitions can be many programming
languages
•
•
•
•
38. That feature SUCKED
Scenario: I am Sober
Given I am on Wikipedia’s Main Page
When I search for “Old Fashioned”
Then I should see the “Old Fashioned” entry
39. Abstractions Allow
Maintenance
Given there is a user Jack
And Jack owns a brewery
And Jack has a paid account
And Jack enters his password
And Jack enters his username
When he logs in
Then I should take a shot BRITTLE
41. Don’t Hide Too MuchBackgrounds => Steps run before each feature
background:
Given Jack is a Brewer
And Jack has not paid his bill
Scenario: Jack orders something delicious
When Jack orders Woodford Reserve
Then Jack sees “Shove Off”
Scenario: Jack orders something gross
When Jack orders Tequila
Then Jack sees “This time, but pay up!”
43. Developer Facts:
Developers get really involved in their
work
We’re sorry about the time we got mad
at you for that one thing
Developers want the same thing you
want: Better Product
Y’all are as smart as them, if not smarter
(don’t tell them I said that)
•
•
•
•
44. Sell to Developers:
You’re both focused on Customer Quality
You both want to do excellent work
“My Job is to make *YOU* look good”
(Thanks, JeanAnn Harrison!)
•
•
•
45. Test + Dev with Cuke
Work together to build good tests
Devs give step support and get tests and
diagnostics
Testers give expert advice and get flexible
tools
You can use different dev & test languages
DANGER: Don’t let the devs make setup
•
•
•
•
•
47. Selenium requires
ALL THE THINGS
Chrome, Safari, Opera,
IE, Firefox
MULTIPLIED BY
Mac 10.8, Windows
XP/7/8, Linux, iOS?!
MULTIPLIED BY
Versions!
•
•
•
48. Make it someone else’s
problem
Selenium Grid
Virtual Machines
Third Party Services
•
•
•
49. Selenium Grid
CHEAP EASY FAST
To Obtain
To Operate
To Distribute
To Parallelize
To Setup
To Deploy
(EC2)
(Abstract Browsers)
50. I <3 VMs
CHEAP EASY FAST
To Run
To Replicate
To Share
To Restore
To Update
To Backup
To Duplicate
To Setup
To Destroy
(Abstract Computers)
51. Why Not Both?
Easy Parallelization
Platforms you otherwise can’t support
Significantly lower staff & infrastructure
costs
•
•
•
52. 3rd Party Services
CHEAP EASY FAST
Capacity
Xtra Features (?)
Maintenance
Integration (?)
Updating
Team Work (?)
Access To New
Paralleling (?)
CI
(Abstract Solutions)
(?) = Dependant on Provider?
55. Appium
(Abstract ...Devices?!)
Native App Automation with
Selenium
Any Selenium Webdriver Tool
No App modifications
Totally Free and Open Source!
(Mac client only ATM. Sorry >.>)
56. How to Appium
Download and Install Appium from
http://www.appium.io
Run Appium with your App
Write your tests using the Selenium
Webdriver JSON Subset:
https://github.com/appium/appium/wiki/JSON-
Wire-Protocol:-Supported-Methods
Run your tests
•
•
•
•
57. WAAAAA I Don’t
Have a Mac!
Contributes to the
Appium Project
Runs Appium in their
Cloud
Is working on
Android support
•
•
•