Talk delivered by Craig Smith at Agile 2013 in Nashville, USA on 8 August 2013.
Automated software testing is a key enabler for teams wanting to build high quality software that can be progressively enhanced and continuously released. To ensure development practices are sustainable, automated testing must be treated as a first-class citizen and not all approaches are created equal. Some approaches can accumulate technical debt, cause duplication of effort and even team dysfunctions.
The seven deadly sins of automated software testing are a set of common anti-patterns that have been found to erode the value of automated testing resulting in long term maintenance issues and ultimately affecting the ability of development teams to respond to change and continuously deliver.
Taking the classic seven sins (Gluttony, Sloth, Lust, Envy, Rage, Pride, Greed) as they might be applied to test automation we will discuss how to identify each automated sin and more importantly provide guidance on recommended solutions and how to avoid them in the first place.
12. How Management
Would Like To See
Testing
Image: http://us.123rf.com/400wm/400/400/dotshock/dotshock1012/dotshock101200006/8437158-internet-network-server-room-with-computers-racks-and-digital-receiver-for-digital-tv.jpg
14. Software is a Series of Loops
Image: http://2.bp.blogspot.com/_4G2ptSlZZn0/R9nRjimkLII/AAAAAAAAAqA/tzYJjRyhLkk/s400/brekky05011049.jpg
15. End to end automated tests and cover 10 conditions per
test, manual covers 1 condition per test
Automated tests cover all high priority business flows,
manual tests mostly cover lower priority flows
Metrics need context!
% Regression test cases automated
Automated Manual
Discussion:
How Much
Automated
Testing Is
Enough?
16. Manual vs Automated…
A Flawed Comparison
Image: http://fvhs.com/wp-content/uploads/2012/11/Screen-shot-2012-11-15-at-7.49.37-AM.png
17. Testing is more than a series
of merely repeatable actions
Image: http://cdn.themis-media.com/media/global/images/library/deriv/71/71335.jpg
21. Regression testing –
assessing current state
Automation of test support
activities
Ideal Automation Targets
Data generation / sub-setting
Load generation
Non-functional testing -
performance, security, ...)
Deterministic problems
Big data problems
Image: http://media.merchantcircle.com/30134145/mobile%20target_full.png
22. Common “Envy” Symptoms
Relying on automation as
the basis for all testing
activities
All tests are built by
developers
Absence of code reviews
Absence of exploratory
testing
Absence of user testing
Image: http://snappedshot.com/turbo/sites/default/files/styles/large/public/robot-doctor.JPG
23. Approach: Desired Role
Automation:
I work with developers to
automate tests that
provide business value
and identify system risks
Collaboration:
I work with analysts and SMEs to
ensure that testable acceptance
criteria are created for all stories
Strategy & Planning:
I am involved in the project at all
stages to ensure that testing
provides the greatest value and
quality objectives are achieved
Tools & Techniques:
I use both manual and
automated techniques using
the preferred testing tools
based on the situation
Architecture:
I have an understanding of the
system architecture and can create
tests that verify individual
components and the system as a
whole
Development:
I take an interest in
development practices
and monitor code quality
metrics
Estimating:
I am involved in developing
estimates for projects at a story
level, for tools and
infrastructure and also for
deployment/release activities
Reporting:
I provide metrics that give
insight into project health
and system quality
Agile:
I understand Agile project
delivery and the differences
between testing in the different
phases of an phase
Qualifications & Training:
I have recognised qualifications
in testing and continually
update and maintain my skills
Recruitment & Development:
I am attracted to the organisation
because testing is a cool career path
that offers heaps of opportunities
and a way of continually developing
my skills
Community & Teams:
I am part of a community
of testers that are
embedded within teams
but share common values
25. “Envy” Lessons Learned
Avoid comparison between
manual and automated
testing - both are needed
Distinguish between the
automation and the process
that is being automated
Use automation to provide a
baseline
Use automation in
conjunction with manual
techniques
Image: http://idahoptv.org/dialogue4kids/images/season10/robots/bookbot.gif
32. Underlying commercial tools
technology often not compatible
with development tool chain
Incompatible Technology
Special file formats or
databases
Lack of version control for tests
and/or cannot be versioned
within the software
Not easily combined with
Continuous Integration
Image: http://virtualmarketingofficer.com/wp-content/uploads/2009/06/square-peg.jpg
Not easily adapted or extended
by the developers
33. Common “Gluttony” Symptoms
A commercial tool forms
the basis of a testing
strategy
Only certain teams or
individuals can
access a tool or run tests
Developers have not been
consulted in the selection
of a testing tools
“We always use <insert
tool-name> for testing!”
Image: http://resources2.news.com.au/images/2008/09/02/va1237328073953/burger-6230645.gif
36. “Gluttony” Lessons Learned
Favour open software tools
where ever possible
Use tools that can easily be
supported by the
development team and play
nicely with existing
development tool chain
Ensure any commercial
tools can be executed in a
command-line mode so it
can be automated
Image: https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-prn1/p480x480/9346_506859889386718_1005343687_n.jpg
Educate!
37. •User interface forms the basis
for all testing
Lust
User interface forms the basis for all testing…
Image: http://stuficionado.net/wp-content/uploads/2012/11/computer_hug.jpeg
38. Traditionally Test via the UI
Image: http://stovallorganizing.com/wp-content/uploads/2013/04/Turtleing.jpg
42. F Fast
I Isolated
R Repeatable
S Self Verifying
T Timely
FIRST Test Properties
Image: http://www.moto-choice.com/PRImages/EditorImages/148330-bathurst-finish-2.jpg
43. Common “Lust” Symptoms
Testers cannot draw the
application or system
architecture
Large proportion of tests
are run through the UI
Testers have limited
technical skills
No collaboration with
developers
Intent of tests is unclear
Image: http://snappedshot.com/turbo/sites/default/files/styles/large/public/robot-doctor.JPG
46. Approach: Use
UI Tools for
Right Purpose
Use tools like Selenium
sparingly, good for
exploratory testing
Only use tools like
HTMLUnit or scrape
screens when no other
options available
47. “Lust” Lessons Learned
Limit the investment in
automated tests that are
executed through the user
interface
Collaborate with developers
Focus investment in
automation at lowest
possible level with clear test
intent
Ensure automation gives
fast feedback
Image: http://foodcandy.com/wp-content/uploads/2013/03/flowers-and-chocolate1.jpg
48. Pride
Too proud to
collaborate
when creating
tests
Pride
Too proud to collaborate when creating tests…
Image: http://latimesblogs.latimes.com/.a/6a00d8341c630a53ef0120a955baf0970b-600wi
57. Common “Pride” Symptoms
Automated tests are being
built in isolation from team
Intent of tests is unclear
or not matched to quality
Poor automation design
(abstraction,
encapsulation, ...)
Maintainability or
compatibility issues
Image: http://farm8.staticflickr.com/7120/7683912508_b23c4c9ff0_b.jpg
58. Approach:
Defining Quality
Quality
Advocates
What does quality mean
to the different roles in
the team?
Quality
Taxonomy
What are quality
attributes?
Quality
Prioritisation
How do we know what
quality attributes to
include?
Quality
Tradeoff Risks
What are risks with the
quality attributes we
are trading off?
Quality
Measurement
How do we test and
measure quality?
Success
Sliders
How does quality relate
to the sliders?
Quality
Definition
What does quality
mean?
Next Steps How do we apply
quality to our work
1
2
3
4
5
6
7
8
61. “Pride” Lessons Learned
Collaborate to create good
tests and avoid duplication
Limit the investment in UI
based automated tests
Collaborate with developers
to ensure good technical
practices (encapsulation,
abstraction, reuse, ... )
Test code = Production
code
Image: https://c479107.ssl.cf2.rackcdn.com/files/7178/article/width668/rfwyhksh-1327469166-1327469251.jpg
62. Sloth
Too lazy to properly maintain automated tests…
Image: http://photos.pcpro.co.uk/blogs/wp-content/uploads/2011/06/Asleep-at-computer.jpg
65. Discussion:
How often
are you
red?
How do you
know?
Who cares?
Image: http://www.eriding.net/media/photos/environment/traffic/070328_jbean_mp_environment_traffic_0135.jpg
69. Common “Sloth” Symptoms
Test suite has not been recently
run - state is unknown
Continuous Integration history
shows consistent failures
following
development changes / release
Test suite requires manual
intervention
Duplication within automation
code
Image: http://commons.wikimedia.org/wiki/File:Cairns_Australia_Beer_Run.jpg
Small changes trigger a
cascade of failures
71. “Sloth” Lessons Learned
Ensure automated tests are
executed using a Continuous
Integration environment
Ensure tests are always
runnable - even if the system in
not being actively developed
Make test results visible -
create transparency of system
health
Ensure collaboration between
developers and testers
Image: http://1.bp.blogspot.com/_yEAvQXpDW6I/S-8HgogJWpI/AAAAAAAAAY0/phpZuCfP610/s400/Linea%2520Berocca.jpg
80. “Rage” Lessons Learned
Treat automated tests with
the same importance as
production code
Review, refactor, improve ...
Apply a “Stop the line”
approach to test failure
Eliminate (quarantine)
unreliable tests
Image: http://us.123rf.com/400wm/400/400/edma/edma0907/edma090700217/5226661-businessman-doing-yoga-exercises-in-a-city-park.jpg
Ensure collaboration with
developers
85. New Software
Test Engineer
Role
New Graduates,
Recruits, Consultants
& Partners
BA
SME
Other
Up
Skill
Assessment
Current Test Analysts
Capable + Current Skills +
Desire
Capable + Desire
Not Capable + No Desire
Not Capable + Desire
**Assessment = Technical Test + Interview**
Approach:
Assist & Assess
88. “Greed” Lessons Learned
Ensure the reasons for
automation are clear
and are NOT based
purely on saving
money/headcount
Ensure business case
for automation
includes costs for
ongoing maintenance
Image: http://resources3.news.com.au/images/2010/12/02/1225964/296651-piggy-bank-and-coins-chart.jpg
91. Tests are NOT executed on a regular basis
State of current defects is unknown
Functional testing occurs regularly
All testers can execute the functional tests
Production verification testing is used to ensure success
A majority of functional tests have been automated
Exploratory testing forms part of test execution
Customers verify implemented features prior to deployment
A majority of non-functional tests (performance, reliability, ...) are
completed prior to deployment, many are automated
Testers pair with developers to automate tests
Customers verify implemented features as they are completed
Functional and non-functional testing occurs continuously within
development iterations
Developers and testers are performing test first practices
-1
1
2
3
4
Discussion: Test Execution
93. Envy Flawed comparison of manual testing & automation
Gluttony Over indulging on commercial test tools
Lust User interface forms the basis for all testing
Pride Too proud to collaborate when creating tests
Sloth Too lazy to maintain automated tests
Rage Frustration with slow, brittle or unreliable tests
Greed Trying to cut costs through automation
7 Deadly Sins