Your Automated Execution Does Not Have to be Flaky

Alan Richardson
Alan RichardsonImprove your Agile, Technical & Exploratory Testing ✔ Consultant ♦ Selenium WebDriver ♦ Trainer ♦ Coach ♦ Speaker♦Author
Your Automated Execution Does Not
Have to be Flaky
Eurostar Webinars Feb 2018
Alan Richardson
www.eviltester.com/flaky
www.compendiumdev.co.uk
@eviltester
@EvilTester 1
Have you experienced flaky test automation? In this webinar, Alan
Richardson plans to convince you that you haven't. Instead you
have experienced the result of not resolving the causes of
Intermittent execution. Alan will explore some common causes and
solutions of intermittent behaviour. Why? So you never say the
phrase, "flaky tests", ever again.
@EvilTester 2
Flaky Test Automation is Normal
@EvilTester 3
Flaky Test Automation is Normal
Because we have normalized Flaky Test
Automation
"Our Tests are Flaky"
"Some tests fail Randomly"
@EvilTester 4
"There is nothing so absurd that it has
not been said by some philosopher."
Cicero, On Divination, Book II chapter LVIII, section 119 ﴾44 BC﴿
"Truth happens to an idea. It becomes
true, is made true by events."
William James, Lecture VI, Pragmatism's Conception of Truth,
Pragmatism: A New Name for Some Old Ways of Thinking ﴾1907﴿
@EvilTester 5
How to Normalize Flaky Test Automation
We all know these Test Automation Truths
"GUI Automation is Flaky"
"We have to live with 'flakiness'"
"We shouldn't automate at the GUI"
"We can only remove flakiness under the GUI"
"Flaky Tests" blames the tests. Not good enough.
@EvilTester 6
It isn't even the "Tests"
We don't automate Tests
We automate the execution of steps in a workflow or process
We automate the execution of a System
We add condition assertions during that execution
We don't have flaky Tests ‐ we have automated execution that fails.
Sometimes on the steps, sometimes on the assertions.
@EvilTester 7
'Flakiness' does not reside at a 'level'
I have seen 'flakiness'
in Unit Tests
in API Tests
in Integration Tests
in GUI Tests
@EvilTester 8
It is too easy to say 'flaky'
and then blame 'GUI execution'
and then blame 'the tool'
Living with flakiness is a choice.
Choose a different approach.
@EvilTester 9
I am not the only person saying this.
see references at the end and name drops throughout
try to cover something different in this talk
@EvilTester 10
"We designed that flakiness. We are allowing that
to happen. We engineered it to be that way. And
its our fault that that exists."
Richard Bradshaw, "Your Tests aren't Flaky, You Are!" Selenium
Conference 2017
https://www.youtube.com/watch?v=XnkWkrbzMh0
@EvilTester 11
Take it more seriously. Describe it
differently.
Intermittent
Occurring at irregular intervals; not continuous or steady.
https://en.oxforddictionaries.com/definition/intermittent
@EvilTester 12
Take it more seriously. Describe it
differently.
Nondeterministic Algorithm
"a nondeterministic algorithm is an algorithm that, even for the
same input, can exhibit different behaviors on different runs"
https://en.wikipedia.org/wiki/Nondeterministic_algorithm
@EvilTester 13
Flaky is not serious enough.
We do not want to use nondeterministic
algorithms for continuous assertions that we are
relying on
@EvilTester 14
Your Test Automation is not Flaky
Your automated execution fails intermittently
@EvilTester 15
Don't Blame Tests. Look For Root Causes.
watch Alister Scott's GTAC 2015 talk
@EvilTester 16
I have removed 'flakiness'
from Unit Tests
from API Tests
from Integration Tests
from GUI Tests
Automated execution does not have to fail intermittently.
@EvilTester 17
How to remove Intermittent Failure from
your Automated Execution
1. Care
2. Investigate
3. Do something about it
@EvilTester 18
How to remove Intermittent Failure from
your Automated Execution
1. Decide Intermittent Failure is unacceptable
2. Investigate the cause of Intermittent Failure
3. Mitigate
Remove the cause
actually fix it
Implement a retry strategy
might obscure bugs
Accept Intermittent Results
might provide hints at solutions
@EvilTester 19
Take it seriously
We write Automate Assertion checking because we care that those
assertions are true for each build of the system.
Determinism is important.
@EvilTester 20
High Level Grouping of Common Causes
of Intermittency
Synchronisation ‐ lack of or poor
Parallel Execution ‐ interference
Long Running Tests ‐ too long, too risky
Automatability ‐ hard to automate system
Tools ‐ inappropriate or out of date
State Preconditions ‐ not controlled
Assertions ‐ wrong or incorrect assumptions
Data ‐ not controlled
see also Richard Bradshaw and Mark Winteringham "SACRED"
Mnemonic.
@EvilTester 21
Will cover Top 3 for each Grouping
@EvilTester 22
Top 3 Common Causes ‐ Synchronisation
None
Time Based Synchronisation
Incorrect App State Synchronisation
@EvilTester 23
Common Solutions ‐ Synchronisation
Synchronise on States
do not rely on framework Synchronisation
Multiple Intermediate States
Consider Latency
Synchronise in Abstractions not the  @Test methods
unless  @Test specific
@EvilTester 24
Top 3 Common Causes ‐ Parallel
Execution
Framework not thread safe
Tests Interfere
Shared Test Environment
@EvilTester 25
Common Solutions ‐ Parallel Execution
Independent environments
Independent Data
Separate Suites rather than threaded execution
Create Threadsafe, reusable code
Create reusable library abstractions rather than
Frameworks
Avoid 'static' singleton objects
@EvilTester 26
Top 3 Common Causes ‐ Long Running
Tests
Sequential rather than Model Based
not delineating between: preconditions, process, assertion
components tests in flow rather than isolation
@EvilTester 27
Common Solutions ‐ Long Running Tests
Understand that more actions == more risk
Synchronise prior to each step
Consider Model Based Testing
Create component test and automated execution playgrounds
Minimum assertions
@EvilTester 28
Top 3 Common Causes ‐ Automatability,
Automatizability
Not Testability:
Application has non‐deterministic behaviour
Hard to Synchronise
Application fails non‐deterministically in live
@EvilTester 29
Common Solutions ‐ Automatability,
Automatizability
Build apps that can be automated
Non‐Deterministic apps need step retry strategies rather than
test retry strategies
@EvilTester 30
Top 3 Common Causes ‐ Tools
Out of Date
Inappropriate
Local Tool Infrastructure
@EvilTester 31
Common Solutions ‐ Tools
Use the right tool for the job
Keep your tooling environment controlled and up to date
Change your approach to take latency into account
process on server return results
return source, process on execution client
@EvilTester 32
Top 3 Common Causes ‐ State
Preconditions
Not Checking State Preconditions at start of test
Not controlling state preconditions prior to test
Precondition setup using same tool
@EvilTester 33
Common Solutions ‐ State Preconditions
control data
precondition state setup ‐ whatever works
http, db, api ‐ 'hack it in'
avoid dependencies between execution unless a long running
test
@EvilTester 34
Top 3 Common Causes ‐ Assumptions
Encoded in Assertions
Assert on an Ordered Set
Assert on Uncontrolled Data
Assertion Tolerences
@EvilTester 35
Common Solutions ‐ Assumptions
Encoded in Assertions
Logging so you can interrogate failure afterwards
Ability to re‐run tests with same data and setup
@EvilTester 36
Top 3 Common Causes ‐ Data
Missing Data
Externally controlled data
Uncontrolled Data
@EvilTester 37
Common Solutions ‐ Data
Create data for each test
Avoid test dependencies
Avoid re‐using data between tests
Check data as a precondition
Data synchronisation on all precondition data
@EvilTester 38
Summary
Your Test Execution is not 'flaky', it is failing intermittently
It is possible to remove intermittent failures, even when
automating through a GUI
Commons solutions: synchronisation, data control,
environmental isolation
@EvilTester 39
Other talks to watch
Alister Scott, GTAC 2015: Your Tests Aren't Flaky
https://www.youtube.com/watch?v=hmk1h40shaE
Richard Bradshaw, "Your Tests aren't Flaky, You Are!" Selenium
Conference 2017
https://www.youtube.com/watch?v=XnkWkrbzMh0
@EvilTester 40
Other talks to watch
Craig Schwarzwald, SAY GOODBYE TO THE “F” WORD … FLAKY
NO MORE!
https://www.youtube.com/watch?v=2K2M7s_Ups0
Mark Winteringham ‐ REST APIs and WebDriver: In Perfect
Harmony
https://www.youtube.com/watch?v=ugAlCZBMOvM
Search also for: Flaky Selenium, Flaky Automation, Flaky Test
Automation
@EvilTester 41
End
Alan Richardson www.compendiumdev.co.uk
Linkedin ‐ @eviltester
Twitter ‐ @eviltester
Instagram ‐ @eviltester
Facebook ‐ @eviltester
Youtube ‐ EvilTesterVideos
Pinterest ‐ @eviltester
Github ‐ @eviltester
Slideshare ‐ @eviltester
@EvilTester 42
BIO
Alan is a Software Development and Testing Coach/Consultant who
enjoys testing at a technical level using techniques from
psychotherapy and computer science. In his spare time Alan is
currently programming a Twitter client called ChatterScan, and
multi‐user text adventure game. Alan is the author of the books
"Dear Evil Tester", "Java For Testers" and "Automating and Testing a
REST API". Alan's main website is compendiumdev.co.uk and he
blogs at blog.eviltester.com
@EvilTester 43
1 of 43

Recommended

Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing... by
Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...
Test Bash Netherlands Alan Richardson "How to misuse 'Automation' for testing...Alan Richardson
1.3K views54 slides
How To Test With Agility by
How To Test With AgilityHow To Test With Agility
How To Test With AgilityAlan Richardson
1.8K views65 slides
The Future of Testing Webinar by
The Future of Testing WebinarThe Future of Testing Webinar
The Future of Testing WebinarAlan Richardson
1.1K views31 slides
Odinstar 2017 - Real World Automating to Support Testing by
Odinstar 2017 - Real World Automating to Support TestingOdinstar 2017 - Real World Automating to Support Testing
Odinstar 2017 - Real World Automating to Support TestingAlan Richardson
756 views48 slides
Secrets and Mysteries of Automated Execution Keynote slides by
Secrets and Mysteries of Automated Execution Keynote slidesSecrets and Mysteries of Automated Execution Keynote slides
Secrets and Mysteries of Automated Execution Keynote slidesAlan Richardson
1K views82 slides
Devfest 2019-slides by
Devfest 2019-slidesDevfest 2019-slides
Devfest 2019-slidesAlan Richardson
1.7K views96 slides

More Related Content

What's hot

Effective Software Testing for Modern Software Development by
Effective Software Testing for Modern Software DevelopmentEffective Software Testing for Modern Software Development
Effective Software Testing for Modern Software DevelopmentAlan Richardson
2.1K views58 slides
Joy of Coding Conference 2019 slides - Alan Richardson by
Joy of Coding Conference 2019 slides - Alan RichardsonJoy of Coding Conference 2019 slides - Alan Richardson
Joy of Coding Conference 2019 slides - Alan RichardsonAlan Richardson
2.3K views61 slides
Add More Security To Your Testing and Automating - Saucecon 2021 by
Add More Security To Your Testing and Automating - Saucecon 2021Add More Security To Your Testing and Automating - Saucecon 2021
Add More Security To Your Testing and Automating - Saucecon 2021Alan Richardson
1K views48 slides
Automating Strategically or Tactically when Testing by
Automating Strategically or Tactically when TestingAutomating Strategically or Tactically when Testing
Automating Strategically or Tactically when TestingAlan Richardson
1.5K views62 slides
What is Regression Testing? by
What is Regression Testing?What is Regression Testing?
What is Regression Testing?Alan Richardson
3.3K views22 slides
Automating Pragmatically - Testival 20190604 by
Automating Pragmatically - Testival 20190604Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604Alan Richardson
2.2K views21 slides

What's hot(20)

Effective Software Testing for Modern Software Development by Alan Richardson
Effective Software Testing for Modern Software DevelopmentEffective Software Testing for Modern Software Development
Effective Software Testing for Modern Software Development
Alan Richardson2.1K views
Joy of Coding Conference 2019 slides - Alan Richardson by Alan Richardson
Joy of Coding Conference 2019 slides - Alan RichardsonJoy of Coding Conference 2019 slides - Alan Richardson
Joy of Coding Conference 2019 slides - Alan Richardson
Alan Richardson2.3K views
Add More Security To Your Testing and Automating - Saucecon 2021 by Alan Richardson
Add More Security To Your Testing and Automating - Saucecon 2021Add More Security To Your Testing and Automating - Saucecon 2021
Add More Security To Your Testing and Automating - Saucecon 2021
Alan Richardson1K views
Automating Strategically or Tactically when Testing by Alan Richardson
Automating Strategically or Tactically when TestingAutomating Strategically or Tactically when Testing
Automating Strategically or Tactically when Testing
Alan Richardson1.5K views
Automating Pragmatically - Testival 20190604 by Alan Richardson
Automating Pragmatically - Testival 20190604Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604
Alan Richardson2.2K views
Risk Mitigation Using Exploratory and Technical Testing - QASymphony Webinar ... by Alan Richardson
Risk Mitigation Using Exploratory and Technical Testing - QASymphony Webinar ...Risk Mitigation Using Exploratory and Technical Testing - QASymphony Webinar ...
Risk Mitigation Using Exploratory and Technical Testing - QASymphony Webinar ...
Alan Richardson1.5K views
Automating to Augment Testing by Alan Richardson
Automating to Augment TestingAutomating to Augment Testing
Automating to Augment Testing
Alan Richardson1.1K views
Technical and Testing Challenges: Using the "Protect The Square" Game by Alan Richardson
Technical and Testing Challenges: Using the "Protect The Square" GameTechnical and Testing Challenges: Using the "Protect The Square" Game
Technical and Testing Challenges: Using the "Protect The Square" Game
Alan Richardson1.2K views
Practical Test Automation Deep Dive by Alan Richardson
Practical Test Automation Deep DivePractical Test Automation Deep Dive
Practical Test Automation Deep Dive
Alan Richardson1.7K views
How to Improve Your Technical Test Ability - AADays 2015 Keynote by Alan Richardson
How to Improve Your Technical Test Ability - AADays 2015 KeynoteHow to Improve Your Technical Test Ability - AADays 2015 Keynote
How to Improve Your Technical Test Ability - AADays 2015 Keynote
Alan Richardson2.1K views
If you want to automate, you learn to code by Alan Richardson
If you want to automate, you learn to codeIf you want to automate, you learn to code
If you want to automate, you learn to code
Alan Richardson1.2K views
Confessions of an Accidental Security Tester by Alan Richardson
Confessions of an Accidental Security TesterConfessions of an Accidental Security Tester
Confessions of an Accidental Security Tester
Alan Richardson7.6K views
Re-thinking Test Automation and Test Process Modelling (in pictures) by Alan Richardson
Re-thinking Test Automation and Test Process Modelling (in pictures)Re-thinking Test Automation and Test Process Modelling (in pictures)
Re-thinking Test Automation and Test Process Modelling (in pictures)
Alan Richardson5.4K views
TestIstanbul May 2013 Keynote Experiences With Exploratory Testing by Alan Richardson
TestIstanbul May 2013 Keynote Experiences With Exploratory TestingTestIstanbul May 2013 Keynote Experiences With Exploratory Testing
TestIstanbul May 2013 Keynote Experiences With Exploratory Testing
Alan Richardson1.8K views
Black Ops Testing Workshop from Agile Testing Days 2014 by Alan Richardson
Black Ops Testing Workshop from Agile Testing Days 2014Black Ops Testing Workshop from Agile Testing Days 2014
Black Ops Testing Workshop from Agile Testing Days 2014
Alan Richardson9K views
Automation vs. intelligence - "follow me if you want to live" by Viktor Slavchev
Automation vs. intelligence - "follow me if you want to live"Automation vs. intelligence - "follow me if you want to live"
Automation vs. intelligence - "follow me if you want to live"
Viktor Slavchev1K views

Similar to Your Automated Execution Does Not Have to be Flaky

Exploratory Testing in an Agile Context by
Exploratory Testing in an Agile ContextExploratory Testing in an Agile Context
Exploratory Testing in an Agile ContextElisabeth Hendrickson
4.4K views48 slides
Testing by
TestingTesting
TestingBas Bossink
186 views17 slides
Three Heuristics Of Regression To The Mean by
Three Heuristics Of Regression To The MeanThree Heuristics Of Regression To The Mean
Three Heuristics Of Regression To The MeanTina Williams
4 views41 slides
Influx/Days 2017 San Francisco | Baron Schwartz by
Influx/Days 2017 San Francisco | Baron SchwartzInflux/Days 2017 San Francisco | Baron Schwartz
Influx/Days 2017 San Francisco | Baron SchwartzInfluxData
245 views36 slides
Chaos Engineering, When should you release the monkeys? by
Chaos Engineering, When should you release the monkeys?Chaos Engineering, When should you release the monkeys?
Chaos Engineering, When should you release the monkeys?Thoughtworks
772 views77 slides
Google, quality and you by
Google, quality and youGoogle, quality and you
Google, quality and younelinger
313 views37 slides

Similar to Your Automated Execution Does Not Have to be Flaky(20)

Three Heuristics Of Regression To The Mean by Tina Williams
Three Heuristics Of Regression To The MeanThree Heuristics Of Regression To The Mean
Three Heuristics Of Regression To The Mean
Tina Williams4 views
Influx/Days 2017 San Francisco | Baron Schwartz by InfluxData
Influx/Days 2017 San Francisco | Baron SchwartzInflux/Days 2017 San Francisco | Baron Schwartz
Influx/Days 2017 San Francisco | Baron Schwartz
InfluxData245 views
Chaos Engineering, When should you release the monkeys? by Thoughtworks
Chaos Engineering, When should you release the monkeys?Chaos Engineering, When should you release the monkeys?
Chaos Engineering, When should you release the monkeys?
Thoughtworks772 views
Google, quality and you by nelinger
Google, quality and youGoogle, quality and you
Google, quality and you
nelinger313 views
JUG CH September 2021 - Debugging distributed systems by Bert Jan Schrijver
JUG CH September 2021 - Debugging distributed systemsJUG CH September 2021 - Debugging distributed systems
JUG CH September 2021 - Debugging distributed systems
Bert Jan Schrijver164 views
LISA18 - How to be your Security Team's Best Friend by EmilyGladstoneCole
LISA18 - How to be your Security Team's Best FriendLISA18 - How to be your Security Team's Best Friend
LISA18 - How to be your Security Team's Best Friend
EmilyGladstoneCole250 views
Put Some SRE in Your Shipped Software by Theo Schlossnagle
Put Some SRE in Your Shipped SoftwarePut Some SRE in Your Shipped Software
Put Some SRE in Your Shipped Software
Theo Schlossnagle2.1K views
ChaoSlingr: Introducing Security based Chaos Testing by Aaron Rinehart
ChaoSlingr: Introducing Security based Chaos TestingChaoSlingr: Introducing Security based Chaos Testing
ChaoSlingr: Introducing Security based Chaos Testing
Aaron Rinehart1.2K views
Craft 2019 - Security Chaos Engineering - Security Precognition by Aaron Rinehart
Craft 2019 - Security Chaos Engineering - Security PrecognitionCraft 2019 - Security Chaos Engineering - Security Precognition
Craft 2019 - Security Chaos Engineering - Security Precognition
Aaron Rinehart171 views
Metric Abuse: Frequently Misused Metrics in Oracle by Steve Karam
Metric Abuse: Frequently Misused Metrics in OracleMetric Abuse: Frequently Misused Metrics in Oracle
Metric Abuse: Frequently Misused Metrics in Oracle
Steve Karam1.9K views
Design patterns - Common Solutions to Common Problems - Brad Wood by Ortus Solutions, Corp
Design patterns -  Common Solutions to Common Problems - Brad WoodDesign patterns -  Common Solutions to Common Problems - Brad Wood
Design patterns - Common Solutions to Common Problems - Brad Wood
Machine Learning Interpretability - Mateusz Dymczyk - H2O AI World London 2018 by Sri Ambati
Machine Learning Interpretability - Mateusz Dymczyk - H2O AI World London 2018Machine Learning Interpretability - Mateusz Dymczyk - H2O AI World London 2018
Machine Learning Interpretability - Mateusz Dymczyk - H2O AI World London 2018
Sri Ambati460 views
Notes on Simulation and GHDL by DIlawar Singh
Notes on Simulation and GHDLNotes on Simulation and GHDL
Notes on Simulation and GHDL
DIlawar Singh522 views
MaLeNe2021-Evolving_Autonomous_Networks-L_Ciavaglia.pdf by Ahmed Mohamed
MaLeNe2021-Evolving_Autonomous_Networks-L_Ciavaglia.pdfMaLeNe2021-Evolving_Autonomous_Networks-L_Ciavaglia.pdf
MaLeNe2021-Evolving_Autonomous_Networks-L_Ciavaglia.pdf
Ahmed Mohamed3 views

More from Alan Richardson

Open source tools - Test Management Summit - 2009 by
Open source tools - Test Management Summit - 2009Open source tools - Test Management Summit - 2009
Open source tools - Test Management Summit - 2009Alan Richardson
599 views13 slides
Automating Tactically vs Strategically SauceCon 2020 by
Automating Tactically vs Strategically SauceCon 2020Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020Alan Richardson
1.9K views49 slides
Programming katas for Software Testers - CounterStrings by
Programming katas for Software Testers - CounterStringsProgramming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStringsAlan Richardson
2K views15 slides
About Consultant Alan Richardson Compendium Developments Evil Tester by
About Consultant Alan Richardson Compendium Developments Evil TesterAbout Consultant Alan Richardson Compendium Developments Evil Tester
About Consultant Alan Richardson Compendium Developments Evil TesterAlan Richardson
97 views6 slides
Automating and Testing a REST API by
Automating and Testing a REST APIAutomating and Testing a REST API
Automating and Testing a REST APIAlan Richardson
355 views11 slides
TDD - Test Driven Development - Java JUnit FizzBuzz by
TDD - Test Driven Development - Java JUnit FizzBuzzTDD - Test Driven Development - Java JUnit FizzBuzz
TDD - Test Driven Development - Java JUnit FizzBuzzAlan Richardson
4.4K views19 slides

More from Alan Richardson(14)

Open source tools - Test Management Summit - 2009 by Alan Richardson
Open source tools - Test Management Summit - 2009Open source tools - Test Management Summit - 2009
Open source tools - Test Management Summit - 2009
Alan Richardson599 views
Automating Tactically vs Strategically SauceCon 2020 by Alan Richardson
Automating Tactically vs Strategically SauceCon 2020Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020
Alan Richardson1.9K views
Programming katas for Software Testers - CounterStrings by Alan Richardson
Programming katas for Software Testers - CounterStringsProgramming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStrings
Alan Richardson2K views
About Consultant Alan Richardson Compendium Developments Evil Tester by Alan Richardson
About Consultant Alan Richardson Compendium Developments Evil TesterAbout Consultant Alan Richardson Compendium Developments Evil Tester
About Consultant Alan Richardson Compendium Developments Evil Tester
Alan Richardson97 views
Automating and Testing a REST API by Alan Richardson
Automating and Testing a REST APIAutomating and Testing a REST API
Automating and Testing a REST API
Alan Richardson355 views
TDD - Test Driven Development - Java JUnit FizzBuzz by Alan Richardson
TDD - Test Driven Development - Java JUnit FizzBuzzTDD - Test Driven Development - Java JUnit FizzBuzz
TDD - Test Driven Development - Java JUnit FizzBuzz
Alan Richardson4.4K views
What is Testability vs Automatability? How to improve your Software Testing. by Alan Richardson
What is Testability vs Automatability? How to improve your Software Testing.What is Testability vs Automatability? How to improve your Software Testing.
What is Testability vs Automatability? How to improve your Software Testing.
Alan Richardson830 views
What is Agile Testing? A MindMap by Alan Richardson
What is Agile Testing? A MindMapWhat is Agile Testing? A MindMap
What is Agile Testing? A MindMap
Alan Richardson3.4K views
Evil Tester's Guide to Agile Testing by Alan Richardson
Evil Tester's Guide to Agile TestingEvil Tester's Guide to Agile Testing
Evil Tester's Guide to Agile Testing
Alan Richardson2.2K views
The Evil Tester Show - Episode 001 Halloween 2017 by Alan Richardson
The Evil Tester Show - Episode 001 Halloween 2017The Evil Tester Show - Episode 001 Halloween 2017
The Evil Tester Show - Episode 001 Halloween 2017
Alan Richardson120 views
Simple ways to add and work with a `.jar` file in your local maven setup by Alan Richardson
Simple ways to add and work with a `.jar` file in your local maven setupSimple ways to add and work with a `.jar` file in your local maven setup
Simple ways to add and work with a `.jar` file in your local maven setup
Alan Richardson173 views
Learning in Public - A How to Speak in Public Workshop by Alan Richardson
Learning in Public - A How to Speak in Public WorkshopLearning in Public - A How to Speak in Public Workshop
Learning in Public - A How to Speak in Public Workshop
Alan Richardson3.5K views
How to Practise to Remove Fear of Public Speaking by Alan Richardson
How to Practise to Remove Fear of Public SpeakingHow to Practise to Remove Fear of Public Speaking
How to Practise to Remove Fear of Public Speaking
Alan Richardson150 views
FAQ - why does my code throw a null pointer exception - common reason #1 Rede... by Alan Richardson
FAQ - why does my code throw a null pointer exception - common reason #1 Rede...FAQ - why does my code throw a null pointer exception - common reason #1 Rede...
FAQ - why does my code throw a null pointer exception - common reason #1 Rede...
Alan Richardson22.9K views

Recently uploaded

Education and Diversity.pptx by
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptxDrHafizKosar
177 views16 slides
UNIDAD 3 6º C.MEDIO.pptx by
UNIDAD 3 6º C.MEDIO.pptxUNIDAD 3 6º C.MEDIO.pptx
UNIDAD 3 6º C.MEDIO.pptxMarcosRodriguezUcedo
124 views32 slides
Gopal Chakraborty Memorial Quiz 2.0 Prelims.pptx by
Gopal Chakraborty Memorial Quiz 2.0 Prelims.pptxGopal Chakraborty Memorial Quiz 2.0 Prelims.pptx
Gopal Chakraborty Memorial Quiz 2.0 Prelims.pptxDebapriya Chakraborty
684 views81 slides
AUDIENCE - BANDURA.pptx by
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptxiammrhaywood
89 views44 slides
Java Simplified: Understanding Programming Basics by
Java Simplified: Understanding Programming BasicsJava Simplified: Understanding Programming Basics
Java Simplified: Understanding Programming BasicsAkshaj Vadakkath Joshy
316 views155 slides
Structure and Functions of Cell.pdf by
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdfNithya Murugan
701 views10 slides

Recently uploaded(20)

Education and Diversity.pptx by DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar177 views
AUDIENCE - BANDURA.pptx by iammrhaywood
AUDIENCE - BANDURA.pptxAUDIENCE - BANDURA.pptx
AUDIENCE - BANDURA.pptx
iammrhaywood89 views
Structure and Functions of Cell.pdf by Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan701 views
Monthly Information Session for MV Asterix (November) by Esquimalt MFRC
Monthly Information Session for MV Asterix (November)Monthly Information Session for MV Asterix (November)
Monthly Information Session for MV Asterix (November)
Esquimalt MFRC58 views
Psychology KS4 by WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch90 views
When Sex Gets Complicated: Porn, Affairs, & Cybersex by Marlene Maheu
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & Cybersex
Marlene Maheu73 views
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB... by Nguyen Thanh Tu Collection
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
Create a Structure in VBNet.pptx by Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P75 views
AI Tools for Business and Startups by Svetlin Nakov
AI Tools for Business and StartupsAI Tools for Business and Startups
AI Tools for Business and Startups
Svetlin Nakov111 views
Drama KS5 Breakdown by WestHatch
Drama KS5 BreakdownDrama KS5 Breakdown
Drama KS5 Breakdown
WestHatch87 views
Solar System and Galaxies.pptx by DrHafizKosar
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptx
DrHafizKosar94 views
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx by Ms. Pooja Bhandare
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptxPharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
Pharmaceutical Inorganic chemistry UNIT-V Radiopharmaceutical.pptx
REPRESENTATION - GAUNTLET.pptx by iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood107 views

Your Automated Execution Does Not Have to be Flaky

  • 1. Your Automated Execution Does Not Have to be Flaky Eurostar Webinars Feb 2018 Alan Richardson www.eviltester.com/flaky www.compendiumdev.co.uk @eviltester @EvilTester 1
  • 2. Have you experienced flaky test automation? In this webinar, Alan Richardson plans to convince you that you haven't. Instead you have experienced the result of not resolving the causes of Intermittent execution. Alan will explore some common causes and solutions of intermittent behaviour. Why? So you never say the phrase, "flaky tests", ever again. @EvilTester 2
  • 3. Flaky Test Automation is Normal @EvilTester 3
  • 4. Flaky Test Automation is Normal Because we have normalized Flaky Test Automation "Our Tests are Flaky" "Some tests fail Randomly" @EvilTester 4
  • 5. "There is nothing so absurd that it has not been said by some philosopher." Cicero, On Divination, Book II chapter LVIII, section 119 ﴾44 BC﴿ "Truth happens to an idea. It becomes true, is made true by events." William James, Lecture VI, Pragmatism's Conception of Truth, Pragmatism: A New Name for Some Old Ways of Thinking ﴾1907﴿ @EvilTester 5
  • 6. How to Normalize Flaky Test Automation We all know these Test Automation Truths "GUI Automation is Flaky" "We have to live with 'flakiness'" "We shouldn't automate at the GUI" "We can only remove flakiness under the GUI" "Flaky Tests" blames the tests. Not good enough. @EvilTester 6
  • 7. It isn't even the "Tests" We don't automate Tests We automate the execution of steps in a workflow or process We automate the execution of a System We add condition assertions during that execution We don't have flaky Tests ‐ we have automated execution that fails. Sometimes on the steps, sometimes on the assertions. @EvilTester 7
  • 8. 'Flakiness' does not reside at a 'level' I have seen 'flakiness' in Unit Tests in API Tests in Integration Tests in GUI Tests @EvilTester 8
  • 9. It is too easy to say 'flaky' and then blame 'GUI execution' and then blame 'the tool' Living with flakiness is a choice. Choose a different approach. @EvilTester 9
  • 10. I am not the only person saying this. see references at the end and name drops throughout try to cover something different in this talk @EvilTester 10
  • 11. "We designed that flakiness. We are allowing that to happen. We engineered it to be that way. And its our fault that that exists." Richard Bradshaw, "Your Tests aren't Flaky, You Are!" Selenium Conference 2017 https://www.youtube.com/watch?v=XnkWkrbzMh0 @EvilTester 11
  • 12. Take it more seriously. Describe it differently. Intermittent Occurring at irregular intervals; not continuous or steady. https://en.oxforddictionaries.com/definition/intermittent @EvilTester 12
  • 13. Take it more seriously. Describe it differently. Nondeterministic Algorithm "a nondeterministic algorithm is an algorithm that, even for the same input, can exhibit different behaviors on different runs" https://en.wikipedia.org/wiki/Nondeterministic_algorithm @EvilTester 13
  • 14. Flaky is not serious enough. We do not want to use nondeterministic algorithms for continuous assertions that we are relying on @EvilTester 14
  • 15. Your Test Automation is not Flaky Your automated execution fails intermittently @EvilTester 15
  • 16. Don't Blame Tests. Look For Root Causes. watch Alister Scott's GTAC 2015 talk @EvilTester 16
  • 17. I have removed 'flakiness' from Unit Tests from API Tests from Integration Tests from GUI Tests Automated execution does not have to fail intermittently. @EvilTester 17
  • 18. How to remove Intermittent Failure from your Automated Execution 1. Care 2. Investigate 3. Do something about it @EvilTester 18
  • 19. How to remove Intermittent Failure from your Automated Execution 1. Decide Intermittent Failure is unacceptable 2. Investigate the cause of Intermittent Failure 3. Mitigate Remove the cause actually fix it Implement a retry strategy might obscure bugs Accept Intermittent Results might provide hints at solutions @EvilTester 19
  • 20. Take it seriously We write Automate Assertion checking because we care that those assertions are true for each build of the system. Determinism is important. @EvilTester 20
  • 21. High Level Grouping of Common Causes of Intermittency Synchronisation ‐ lack of or poor Parallel Execution ‐ interference Long Running Tests ‐ too long, too risky Automatability ‐ hard to automate system Tools ‐ inappropriate or out of date State Preconditions ‐ not controlled Assertions ‐ wrong or incorrect assumptions Data ‐ not controlled see also Richard Bradshaw and Mark Winteringham "SACRED" Mnemonic. @EvilTester 21
  • 22. Will cover Top 3 for each Grouping @EvilTester 22
  • 23. Top 3 Common Causes ‐ Synchronisation None Time Based Synchronisation Incorrect App State Synchronisation @EvilTester 23
  • 24. Common Solutions ‐ Synchronisation Synchronise on States do not rely on framework Synchronisation Multiple Intermediate States Consider Latency Synchronise in Abstractions not the  @Test methods unless  @Test specific @EvilTester 24
  • 25. Top 3 Common Causes ‐ Parallel Execution Framework not thread safe Tests Interfere Shared Test Environment @EvilTester 25
  • 26. Common Solutions ‐ Parallel Execution Independent environments Independent Data Separate Suites rather than threaded execution Create Threadsafe, reusable code Create reusable library abstractions rather than Frameworks Avoid 'static' singleton objects @EvilTester 26
  • 27. Top 3 Common Causes ‐ Long Running Tests Sequential rather than Model Based not delineating between: preconditions, process, assertion components tests in flow rather than isolation @EvilTester 27
  • 28. Common Solutions ‐ Long Running Tests Understand that more actions == more risk Synchronise prior to each step Consider Model Based Testing Create component test and automated execution playgrounds Minimum assertions @EvilTester 28
  • 29. Top 3 Common Causes ‐ Automatability, Automatizability Not Testability: Application has non‐deterministic behaviour Hard to Synchronise Application fails non‐deterministically in live @EvilTester 29
  • 30. Common Solutions ‐ Automatability, Automatizability Build apps that can be automated Non‐Deterministic apps need step retry strategies rather than test retry strategies @EvilTester 30
  • 31. Top 3 Common Causes ‐ Tools Out of Date Inappropriate Local Tool Infrastructure @EvilTester 31
  • 32. Common Solutions ‐ Tools Use the right tool for the job Keep your tooling environment controlled and up to date Change your approach to take latency into account process on server return results return source, process on execution client @EvilTester 32
  • 33. Top 3 Common Causes ‐ State Preconditions Not Checking State Preconditions at start of test Not controlling state preconditions prior to test Precondition setup using same tool @EvilTester 33
  • 34. Common Solutions ‐ State Preconditions control data precondition state setup ‐ whatever works http, db, api ‐ 'hack it in' avoid dependencies between execution unless a long running test @EvilTester 34
  • 35. Top 3 Common Causes ‐ Assumptions Encoded in Assertions Assert on an Ordered Set Assert on Uncontrolled Data Assertion Tolerences @EvilTester 35
  • 36. Common Solutions ‐ Assumptions Encoded in Assertions Logging so you can interrogate failure afterwards Ability to re‐run tests with same data and setup @EvilTester 36
  • 37. Top 3 Common Causes ‐ Data Missing Data Externally controlled data Uncontrolled Data @EvilTester 37
  • 38. Common Solutions ‐ Data Create data for each test Avoid test dependencies Avoid re‐using data between tests Check data as a precondition Data synchronisation on all precondition data @EvilTester 38
  • 39. Summary Your Test Execution is not 'flaky', it is failing intermittently It is possible to remove intermittent failures, even when automating through a GUI Commons solutions: synchronisation, data control, environmental isolation @EvilTester 39
  • 40. Other talks to watch Alister Scott, GTAC 2015: Your Tests Aren't Flaky https://www.youtube.com/watch?v=hmk1h40shaE Richard Bradshaw, "Your Tests aren't Flaky, You Are!" Selenium Conference 2017 https://www.youtube.com/watch?v=XnkWkrbzMh0 @EvilTester 40
  • 41. Other talks to watch Craig Schwarzwald, SAY GOODBYE TO THE “F” WORD … FLAKY NO MORE! https://www.youtube.com/watch?v=2K2M7s_Ups0 Mark Winteringham ‐ REST APIs and WebDriver: In Perfect Harmony https://www.youtube.com/watch?v=ugAlCZBMOvM Search also for: Flaky Selenium, Flaky Automation, Flaky Test Automation @EvilTester 41
  • 42. End Alan Richardson www.compendiumdev.co.uk Linkedin ‐ @eviltester Twitter ‐ @eviltester Instagram ‐ @eviltester Facebook ‐ @eviltester Youtube ‐ EvilTesterVideos Pinterest ‐ @eviltester Github ‐ @eviltester Slideshare ‐ @eviltester @EvilTester 42
  • 43. BIO Alan is a Software Development and Testing Coach/Consultant who enjoys testing at a technical level using techniques from psychotherapy and computer science. In his spare time Alan is currently programming a Twitter client called ChatterScan, and multi‐user text adventure game. Alan is the author of the books "Dear Evil Tester", "Java For Testers" and "Automating and Testing a REST API". Alan's main website is compendiumdev.co.uk and he blogs at blog.eviltester.com @EvilTester 43