Upload
techwellpresentations
View
270
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Many organizations are introducing test automation only to discover it is more difficult than they anticipated. The fact is that good test automation requires good coding practices. Good test automation requires good design. To do anything else will lead to spaghetti code that is hard to maintain or update. If you’re new to coding or new to automation, it is difficult to know where to begin. Join Cheezy as he describes and demonstrates lessons he has learned while helping numerous organizations adopt test automation. Cheezy shows the patterns he uses to keep automation code simple and clean, and demonstrates techniques you can use to make your automation code more maintainable. Finally, Cheezy writes code (without a net) to implement these patterns, taking them from theory to implementation.
Citation preview
T3
Test Automation
5/8/2014 9:45:00 AM
Patterns of Automation: Simplify
Your Test Code
Presented by:
Jeff Morgan
LeanDog
Brought to you by:
340 Corporate Way, Suite 300, Orange Park, FL 32073
888-268-8770 ∙ 904-278-0524 ∙ [email protected] ∙ www.sqe.com
Jeff Morgan
LeanDog
Chief technology officer and a cofounder of LeanDog, Jeff “Cheezy” Morgan has been teaching classes and coaching teams on agile and lean techniques since early 2004. Most of his work has focused on the engineering practices used by developers and testers. For the past few years Cheezy has experienced great success and recognition for his work focused on helping teams adopt Acceptance Test Driven Development using Cucumber. He has authored several popular Ruby gems used by software testers and the book Cucumber & Cheese-A Testers Workshop.
Copyright 2012 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Life is good
Why Automate?
Manual Testing (not ET)
1
Manual Testing (not ET)
11.5
Manual Testing (not ET)
11.5
2.2
Manual Testing (not ET)
11.5
2.23.0
4.0
5.36.4
Test What?
Test What?• Functionality
Test What?• Functionality
• Cross-Browser
Test What?• Functionality
• Cross-Browser
• Responsive Design
Test What?• Functionality
• Cross-Browser
• Responsive Design
• Mobile Devices
Test What?• Functionality
• Cross-Browser
• Responsive Design
• Mobile Devices
• Security
Test What?• Functionality
• Cross-Browser
• Responsive Design
• Mobile Devices
• Security
• Accessibility
Test What?• Functionality
• Cross-Browser
• Responsive Design
• Mobile Devices
• Security
• Accessibility
• Load and Performance
Allows time to Explore• Functionality
• Cross-Browser
• Responsive Design
• Mobile Devices
• Security
• Accessibility
• Load and Performance
What are Patterns?
Pattern
A pattern, apart from the term's use to mean "Template"[a], is a discernible regularity in the world or in a manmade design. As such, the elements of a pattern repeat in a predictable manner.! - Wikipedia
Specification by Example
Development Artifacts
User Story with
Acceptance Criteria
Code with Unit Tests
Automated Tests
Specification Implementation Verification
Development Artifacts
User Story with
Acceptance Criteria
Code with Unit Tests
Automated Tests
Specification Implementation Verification
Duplication
Difference between requirement and test
is data!
Addition Function
Addition Function
Requirement: Addition equals
sum of numbers
Addition Function
Requirement: Addition equals
sum of numbers
Examples: 3 + 4 = 7 3 + -1 = 2
etc.
Let’s see it!
Did you notice I never said click or enter text?
Acceptance Test Driven Development
ReworkCode Test
Story 1
ReworkCode Test
Code Test
Story 1
Story 2
ReworkCode Test
Story 1
Story 2
CStory 1
Test
Code TestStory 2
C
ReworkCode Test
Story 1
Story 2
CStory 1
TestStory 2
C
CStory 1
Test
Code TestStory 2
C
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Test Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Test Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Test Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Test Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Test Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
?
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Done
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Done
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Ready Development Review Done
Product Owner
Developer Tester
Done Done
Code Test
CodeTest
CodeTest
Developer
Tester
Test Drive Code With PairCodeTest
Developer
Tester
Test Drive Code With Pair
CodeTest
Developer
Tester
Test Drive Code With Pair
Automate Acceptance TestsCodeTest
Developer
Tester
Test Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Make Acceptance Tests Pass
Test Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Make Acceptance Tests PassTest Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Make Acceptance Tests PassTest Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Exploratory Testing
Make Acceptance Tests PassTest Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Exploratory Testing
Make Acceptance Tests Pass
Talk
Test Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Exploratory Testing
Make Acceptance Tests Pass
Talk
Test Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Exploratory Testing
Make Acceptance Tests Pass
TalkPrevent Defects
Test Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Exploratory Testing
Make Acceptance Tests Pass
Talk Prevent Defects
Test Drive Code With Pair
Automate Acceptance Tests
CodeTest
Developer
Tester
Exploratory Testing
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Creation Elaboration Validation WIP
Product Owner
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Creation Elaboration Validation WIP
Product Owner
Tester
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Creation Elaboration Validation WIP
Product Owner
Tester
Developer
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Creation Elaboration Validation WIP
Product Owner
Tester
Developer
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
Creation Elaboration Validation WIP
Product Owner
Tester
Developer
Progressive
Elaboration
Page Object
Tests break when application changes
!
How easy to fix?
Learn from the development community
Learn from the development community
Let’s see it!
Default Data
A lot of Data
A lot of Data
Sorry Data, I don’t care about most of you!
Let’s see it!
Test Data Management
Why did you tests fail? Did somebody mess with your data?
Test beginsInsert data needed for
this testTest
executesTest removes
data
BestRepeat for next test
Test beginsInsert data needed for
this testTest
executesTest removes
data
BestRepeat for next test
Another optionInsert all
data necessary for all tests
Execute all tests
Remove all data
Test beginsInsert data needed for
this testTest
executesTest removes
data
BestRepeat for next test
Another optionInsert all
data necessary for all tests
Execute all tests
Remove all data
Yet another optionRecondition data from last test
execution
Execute all tests
Do not repeat dataDo not repeat data
Do not repeat dataDo not repeat data
Do not repeat dataDo not repeat dataDo not repeat data
Route Navigation
Navigating routes is something we do all the time
Let’s see it!
Above All
Keep the code clean
And
Do not Automate too much!
Copyright 2013 LeanDog, Inc. All Rights Reserved. Do not copy or distribute without permission.
[email protected] @chzy
Thank You