SlideShare une entreprise Scribd logo
1  sur  16
#DevoxxUS @spoole167 @stuartmarks
TEN SIMPLE RULES FOR WRITING
GREAT TESTCASES
#DevoxxUS @spoole167 @stuartmarks
Steve Poole : IBM
JVM Developer
DevOps practitioner
Developer Advocate
Stuart Marks : Oracle
Principal MTS
Java / OpenJDK Core Libraries
#DevoxxUS @spoole167 @stuartmarks
“I get paid for code that works, not for tests”
How to maximize your effort
and protect your investment
in tests and testing now with
added
Cloud
#DevoxxUS @spoole167 @stuartmarks
1. Think before you act
2. Make your tests understandable
3. Keep your tests “small and simple”
4. Test one thing only
5. Fast tests only
6. Absolute repeatability
7. Independent tests only
8. Provide diagnostic data on failure
9. No hard-coding of your environment
10.No extraneous output
#DevoxxUS @spoole167 @stuartmarks
1. Think before you act
What are
you testing?
Why are you
testing?
Planhttps://www.flickr.com/photos/ayurvedicmedicines/
#DevoxxUS @spoole167 @stuartmarks
2. Make your tests
understandable
Comments
Expected behaviour
Aid debug
Diagnostics
https://www.flickr.com/photos/83633410@N07/
#DevoxxUS @spoole167 @stuartmarks
3. Keep your tests
“small and simple”
Separate test logic / setup
Much easier to debug
Use setup / teardown
https://www.flickr.com/photos/9266144@N02/
#DevoxxUS @spoole167 @stuartmarks
4. Test one thing only
One scenario per test
Enables fast debug
Obvious why test failed
https://www.flickr.com/photos/ryantron/
#DevoxxUS @spoole167 @stuartmarks
5. Fast tests only
Run unit tests often as possible
Maintain quality bar
Quick results
https://www.flickr.com/photos/mcleod/
#DevoxxUS @spoole167 @stuartmarks
6. Absolute repeatability
Non-deterministic
tests are a headache
Fix intermittent tests
immediately
No value, waste of resource
Must trust all tests
https://www.flickr.com/photos/fdecomite/
#DevoxxUS @spoole167 @stuartmarks
7. Independent tests only
Must run in any order
Run subset, faster results
No dependencies
https://www.flickr.com/photos/sheila_sund/
#DevoxxUS @spoole167 @stuartmarks
8. Provide diagnostic
data on failure
Use message in asserts
Make it simple to debug
Reference input data
Record test environment info
https://www.flickr.com/photos/davidbaker/
#DevoxxUS @spoole167 @stuartmarks
9. No hard-coding of
your environment
No ports, IP addresses,
data files, databases
Use config files, system
properties or mock objects
Portable tests
https://www.flickr.com/photos/pug50/
#DevoxxUS @spoole167 @stuartmarks
10. No extraneous output
A passing test is a silent test
Too much output = confusion
Use option, config file to
turn on debug, save output
https://www.flickr.com/photos/3-bs/
#DevoxxUS @spoole167 @stuartmarks
Pirate rules
Guidelines only
Some may seen obvious.
Some may seem pedantic
Until you inherit a testsuite…
Thank you.
https://www.flickr.com/photos/gapic/
© 2017 IBM Corporation
Mission Badge #6:
SMS Text
Your mission should you
choose to accept it….
Join us at the IBM Booth for
hands-on labs, demos, games
and talk to our developers.
Text Mission2017 to 41411
to get the booth giveaway
and learn more about all the
IBM sessions & speakers.
Enter the raffle by
completing missions
for a chance to win
• a Drone
• TJBot Kit
• VR glasses

Contenu connexe

En vedette

Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)a16z
 
Mobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigitalMobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigitalAleyda Solís
 
What is A Cloud Stack in 2017
What is A Cloud Stack in 2017What is A Cloud Stack in 2017
What is A Cloud Stack in 2017Gaurav Roy
 
R, Spark, Tensorflow, H20.ai Applied to Streaming Analytics
R, Spark, Tensorflow, H20.ai Applied to Streaming AnalyticsR, Spark, Tensorflow, H20.ai Applied to Streaming Analytics
R, Spark, Tensorflow, H20.ai Applied to Streaming AnalyticsKai Wähner
 
Mobile Finance: 2017 Trends and Innovations
Mobile Finance: 2017 Trends and InnovationsMobile Finance: 2017 Trends and Innovations
Mobile Finance: 2017 Trends and InnovationsCorporate Insight
 
Just Jobs, helping blue collared jobs to carve a place in India
Just Jobs, helping blue collared jobs to carve a place in IndiaJust Jobs, helping blue collared jobs to carve a place in India
Just Jobs, helping blue collared jobs to carve a place in IndiaJust.Jobs
 
Webデザイナーのためのタイポグラフィ入門1
Webデザイナーのためのタイポグラフィ入門1Webデザイナーのためのタイポグラフィ入門1
Webデザイナーのためのタイポグラフィ入門1Akio Yonekura
 
Ansibleはじめよぉ -Infrastructure as Codeを理解-
Ansibleはじめよぉ -Infrastructure as Codeを理解-Ansibleはじめよぉ -Infrastructure as Codeを理解-
Ansibleはじめよぉ -Infrastructure as Codeを理解-Shingo Kitayama
 
Wielding the Hard and Soft Science of Service Design
Wielding the Hard and Soft Science of Service DesignWielding the Hard and Soft Science of Service Design
Wielding the Hard and Soft Science of Service Designbrandonschauer
 
La elasticidad-y-su-aplicación
La elasticidad-y-su-aplicaciónLa elasticidad-y-su-aplicación
La elasticidad-y-su-aplicaciónEmily-19
 
Build business applications with HoloLens and Cloud
Build business applications with HoloLens and CloudBuild business applications with HoloLens and Cloud
Build business applications with HoloLens and CloudAlexander Meijers
 
Deep Learning による視覚×言語融合の最前線
Deep Learning による視覚×言語融合の最前線Deep Learning による視覚×言語融合の最前線
Deep Learning による視覚×言語融合の最前線Yoshitaka Ushiku
 
Leadership Makes a Difference
Leadership Makes a DifferenceLeadership Makes a Difference
Leadership Makes a DifferenceWiley
 
Portrait of a lady
Portrait of a ladyPortrait of a lady
Portrait of a ladyMakala (D)
 
Next Generation Digital Enterprise (Workplace) Technology | Enterprise Digita...
Next Generation Digital Enterprise (Workplace) Technology | Enterprise Digita...Next Generation Digital Enterprise (Workplace) Technology | Enterprise Digita...
Next Generation Digital Enterprise (Workplace) Technology | Enterprise Digita...Dion Hinchcliffe
 

En vedette (17)

Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)
 
Mobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigitalMobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigital
 
What is A Cloud Stack in 2017
What is A Cloud Stack in 2017What is A Cloud Stack in 2017
What is A Cloud Stack in 2017
 
R, Spark, Tensorflow, H20.ai Applied to Streaming Analytics
R, Spark, Tensorflow, H20.ai Applied to Streaming AnalyticsR, Spark, Tensorflow, H20.ai Applied to Streaming Analytics
R, Spark, Tensorflow, H20.ai Applied to Streaming Analytics
 
Mobile Finance: 2017 Trends and Innovations
Mobile Finance: 2017 Trends and InnovationsMobile Finance: 2017 Trends and Innovations
Mobile Finance: 2017 Trends and Innovations
 
Just Jobs, helping blue collared jobs to carve a place in India
Just Jobs, helping blue collared jobs to carve a place in IndiaJust Jobs, helping blue collared jobs to carve a place in India
Just Jobs, helping blue collared jobs to carve a place in India
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 
Webデザイナーのためのタイポグラフィ入門1
Webデザイナーのためのタイポグラフィ入門1Webデザイナーのためのタイポグラフィ入門1
Webデザイナーのためのタイポグラフィ入門1
 
Ansibleはじめよぉ -Infrastructure as Codeを理解-
Ansibleはじめよぉ -Infrastructure as Codeを理解-Ansibleはじめよぉ -Infrastructure as Codeを理解-
Ansibleはじめよぉ -Infrastructure as Codeを理解-
 
Sistema educativo indígena propio seip La Guajira
Sistema educativo indígena propio seip La GuajiraSistema educativo indígena propio seip La Guajira
Sistema educativo indígena propio seip La Guajira
 
Wielding the Hard and Soft Science of Service Design
Wielding the Hard and Soft Science of Service DesignWielding the Hard and Soft Science of Service Design
Wielding the Hard and Soft Science of Service Design
 
La elasticidad-y-su-aplicación
La elasticidad-y-su-aplicaciónLa elasticidad-y-su-aplicación
La elasticidad-y-su-aplicación
 
Build business applications with HoloLens and Cloud
Build business applications with HoloLens and CloudBuild business applications with HoloLens and Cloud
Build business applications with HoloLens and Cloud
 
Deep Learning による視覚×言語融合の最前線
Deep Learning による視覚×言語融合の最前線Deep Learning による視覚×言語融合の最前線
Deep Learning による視覚×言語融合の最前線
 
Leadership Makes a Difference
Leadership Makes a DifferenceLeadership Makes a Difference
Leadership Makes a Difference
 
Portrait of a lady
Portrait of a ladyPortrait of a lady
Portrait of a lady
 
Next Generation Digital Enterprise (Workplace) Technology | Enterprise Digita...
Next Generation Digital Enterprise (Workplace) Technology | Enterprise Digita...Next Generation Digital Enterprise (Workplace) Technology | Enterprise Digita...
Next Generation Digital Enterprise (Workplace) Technology | Enterprise Digita...
 

Plus de Steve Poole

Key Takeaways for Java Developers from the State of the Software Supply Chain...
Key Takeaways for Java Developers from the State of the Software Supply Chain...Key Takeaways for Java Developers from the State of the Software Supply Chain...
Key Takeaways for Java Developers from the State of the Software Supply Chain...Steve Poole
 
THRIVING IN THE GEN AI ERA: NAVIGATING CHANGE IN TECH
THRIVING IN THE GEN AI ERA: NAVIGATING CHANGE IN TECHTHRIVING IN THE GEN AI ERA: NAVIGATING CHANGE IN TECH
THRIVING IN THE GEN AI ERA: NAVIGATING CHANGE IN TECHSteve Poole
 
Maven Central++ What's happening at the core of the Java supply chain
Maven Central++ What's happening at the core of the Java supply chainMaven Central++ What's happening at the core of the Java supply chain
Maven Central++ What's happening at the core of the Java supply chainSteve Poole
 
GIDS-2023 A New Hope for 2023? What Developers Must Learn Next
GIDS-2023 A New Hope for 2023? What Developers Must Learn NextGIDS-2023 A New Hope for 2023? What Developers Must Learn Next
GIDS-2023 A New Hope for 2023? What Developers Must Learn NextSteve Poole
 
A new hope for 2023? What developers must learn next
A new hope for 2023? What developers must learn nextA new hope for 2023? What developers must learn next
A new hope for 2023? What developers must learn nextSteve Poole
 
Stop Security by Sleight Of Hand.pptx
Stop Security by Sleight Of Hand.pptxStop Security by Sleight Of Hand.pptx
Stop Security by Sleight Of Hand.pptxSteve Poole
 
Superman or Ironman - can everyone be a 10x developer?
Superman or Ironman - can everyone be a 10x developer?Superman or Ironman - can everyone be a 10x developer?
Superman or Ironman - can everyone be a 10x developer?Steve Poole
 
The Secret Life of Maven Central
The Secret Life of Maven CentralThe Secret Life of Maven Central
The Secret Life of Maven CentralSteve Poole
 
The Secret Life of Maven Central.pptx
The Secret Life of Maven Central.pptxThe Secret Life of Maven Central.pptx
The Secret Life of Maven Central.pptxSteve Poole
 
Devoxx France 2022: Game Over or Game Changing? Why Software Development May ...
Devoxx France 2022: Game Over or Game Changing? Why Software Development May ...Devoxx France 2022: Game Over or Game Changing? Why Software Development May ...
Devoxx France 2022: Game Over or Game Changing? Why Software Development May ...Steve Poole
 
Log4Shell - Armageddon or Opportunity.pptx
Log4Shell - Armageddon or Opportunity.pptxLog4Shell - Armageddon or Opportunity.pptx
Log4Shell - Armageddon or Opportunity.pptxSteve Poole
 
DevnexusRansomeware.pptx
DevnexusRansomeware.pptxDevnexusRansomeware.pptx
DevnexusRansomeware.pptxSteve Poole
 
Game Over or Game Changing? Why Software Development May Never be the same again
Game Over or Game Changing? Why Software Development May Never be the same againGame Over or Game Changing? Why Software Development May Never be the same again
Game Over or Game Changing? Why Software Development May Never be the same againSteve Poole
 
Cybercrime and the developer 2021 style
Cybercrime and the developer 2021 styleCybercrime and the developer 2021 style
Cybercrime and the developer 2021 styleSteve Poole
 
Agile Islands 2020 - Dashboards and Culture
Agile Islands 2020 - Dashboards and CultureAgile Islands 2020 - Dashboards and Culture
Agile Islands 2020 - Dashboards and CultureSteve Poole
 
LJC Speaker Clnic June 2020
LJC Speaker Clnic June 2020LJC Speaker Clnic June 2020
LJC Speaker Clnic June 2020Steve Poole
 
Agile Tour London 2018: DASHBOARDS AND CULTURE – HOW OPENNESS CHANGES YOUR BE...
Agile Tour London 2018: DASHBOARDS AND CULTURE – HOW OPENNESS CHANGES YOUR BE...Agile Tour London 2018: DASHBOARDS AND CULTURE – HOW OPENNESS CHANGES YOUR BE...
Agile Tour London 2018: DASHBOARDS AND CULTURE – HOW OPENNESS CHANGES YOUR BE...Steve Poole
 
Beyond the Pi: What’s Next for the Hacker in All of Us?
Beyond the Pi: What’s Next for the Hacker in All of Us?Beyond the Pi: What’s Next for the Hacker in All of Us?
Beyond the Pi: What’s Next for the Hacker in All of Us?Steve Poole
 
A Modern Fairy Tale: Java Serialization
A Modern Fairy Tale: Java Serialization A Modern Fairy Tale: Java Serialization
A Modern Fairy Tale: Java Serialization Steve Poole
 
Eclipse OpenJ9 - SpringOne 2018 Lightning talk
Eclipse OpenJ9 - SpringOne 2018 Lightning talkEclipse OpenJ9 - SpringOne 2018 Lightning talk
Eclipse OpenJ9 - SpringOne 2018 Lightning talkSteve Poole
 

Plus de Steve Poole (20)

Key Takeaways for Java Developers from the State of the Software Supply Chain...
Key Takeaways for Java Developers from the State of the Software Supply Chain...Key Takeaways for Java Developers from the State of the Software Supply Chain...
Key Takeaways for Java Developers from the State of the Software Supply Chain...
 
THRIVING IN THE GEN AI ERA: NAVIGATING CHANGE IN TECH
THRIVING IN THE GEN AI ERA: NAVIGATING CHANGE IN TECHTHRIVING IN THE GEN AI ERA: NAVIGATING CHANGE IN TECH
THRIVING IN THE GEN AI ERA: NAVIGATING CHANGE IN TECH
 
Maven Central++ What's happening at the core of the Java supply chain
Maven Central++ What's happening at the core of the Java supply chainMaven Central++ What's happening at the core of the Java supply chain
Maven Central++ What's happening at the core of the Java supply chain
 
GIDS-2023 A New Hope for 2023? What Developers Must Learn Next
GIDS-2023 A New Hope for 2023? What Developers Must Learn NextGIDS-2023 A New Hope for 2023? What Developers Must Learn Next
GIDS-2023 A New Hope for 2023? What Developers Must Learn Next
 
A new hope for 2023? What developers must learn next
A new hope for 2023? What developers must learn nextA new hope for 2023? What developers must learn next
A new hope for 2023? What developers must learn next
 
Stop Security by Sleight Of Hand.pptx
Stop Security by Sleight Of Hand.pptxStop Security by Sleight Of Hand.pptx
Stop Security by Sleight Of Hand.pptx
 
Superman or Ironman - can everyone be a 10x developer?
Superman or Ironman - can everyone be a 10x developer?Superman or Ironman - can everyone be a 10x developer?
Superman or Ironman - can everyone be a 10x developer?
 
The Secret Life of Maven Central
The Secret Life of Maven CentralThe Secret Life of Maven Central
The Secret Life of Maven Central
 
The Secret Life of Maven Central.pptx
The Secret Life of Maven Central.pptxThe Secret Life of Maven Central.pptx
The Secret Life of Maven Central.pptx
 
Devoxx France 2022: Game Over or Game Changing? Why Software Development May ...
Devoxx France 2022: Game Over or Game Changing? Why Software Development May ...Devoxx France 2022: Game Over or Game Changing? Why Software Development May ...
Devoxx France 2022: Game Over or Game Changing? Why Software Development May ...
 
Log4Shell - Armageddon or Opportunity.pptx
Log4Shell - Armageddon or Opportunity.pptxLog4Shell - Armageddon or Opportunity.pptx
Log4Shell - Armageddon or Opportunity.pptx
 
DevnexusRansomeware.pptx
DevnexusRansomeware.pptxDevnexusRansomeware.pptx
DevnexusRansomeware.pptx
 
Game Over or Game Changing? Why Software Development May Never be the same again
Game Over or Game Changing? Why Software Development May Never be the same againGame Over or Game Changing? Why Software Development May Never be the same again
Game Over or Game Changing? Why Software Development May Never be the same again
 
Cybercrime and the developer 2021 style
Cybercrime and the developer 2021 styleCybercrime and the developer 2021 style
Cybercrime and the developer 2021 style
 
Agile Islands 2020 - Dashboards and Culture
Agile Islands 2020 - Dashboards and CultureAgile Islands 2020 - Dashboards and Culture
Agile Islands 2020 - Dashboards and Culture
 
LJC Speaker Clnic June 2020
LJC Speaker Clnic June 2020LJC Speaker Clnic June 2020
LJC Speaker Clnic June 2020
 
Agile Tour London 2018: DASHBOARDS AND CULTURE – HOW OPENNESS CHANGES YOUR BE...
Agile Tour London 2018: DASHBOARDS AND CULTURE – HOW OPENNESS CHANGES YOUR BE...Agile Tour London 2018: DASHBOARDS AND CULTURE – HOW OPENNESS CHANGES YOUR BE...
Agile Tour London 2018: DASHBOARDS AND CULTURE – HOW OPENNESS CHANGES YOUR BE...
 
Beyond the Pi: What’s Next for the Hacker in All of Us?
Beyond the Pi: What’s Next for the Hacker in All of Us?Beyond the Pi: What’s Next for the Hacker in All of Us?
Beyond the Pi: What’s Next for the Hacker in All of Us?
 
A Modern Fairy Tale: Java Serialization
A Modern Fairy Tale: Java Serialization A Modern Fairy Tale: Java Serialization
A Modern Fairy Tale: Java Serialization
 
Eclipse OpenJ9 - SpringOne 2018 Lightning talk
Eclipse OpenJ9 - SpringOne 2018 Lightning talkEclipse OpenJ9 - SpringOne 2018 Lightning talk
Eclipse OpenJ9 - SpringOne 2018 Lightning talk
 

Dernier

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 

Dernier (20)

Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 

Ten Simple Rules for Writing Great Testcases @ Devoxx US

  • 1. #DevoxxUS @spoole167 @stuartmarks TEN SIMPLE RULES FOR WRITING GREAT TESTCASES
  • 2. #DevoxxUS @spoole167 @stuartmarks Steve Poole : IBM JVM Developer DevOps practitioner Developer Advocate Stuart Marks : Oracle Principal MTS Java / OpenJDK Core Libraries
  • 3. #DevoxxUS @spoole167 @stuartmarks “I get paid for code that works, not for tests” How to maximize your effort and protect your investment in tests and testing now with added Cloud
  • 4. #DevoxxUS @spoole167 @stuartmarks 1. Think before you act 2. Make your tests understandable 3. Keep your tests “small and simple” 4. Test one thing only 5. Fast tests only 6. Absolute repeatability 7. Independent tests only 8. Provide diagnostic data on failure 9. No hard-coding of your environment 10.No extraneous output
  • 5. #DevoxxUS @spoole167 @stuartmarks 1. Think before you act What are you testing? Why are you testing? Planhttps://www.flickr.com/photos/ayurvedicmedicines/
  • 6. #DevoxxUS @spoole167 @stuartmarks 2. Make your tests understandable Comments Expected behaviour Aid debug Diagnostics https://www.flickr.com/photos/83633410@N07/
  • 7. #DevoxxUS @spoole167 @stuartmarks 3. Keep your tests “small and simple” Separate test logic / setup Much easier to debug Use setup / teardown https://www.flickr.com/photos/9266144@N02/
  • 8. #DevoxxUS @spoole167 @stuartmarks 4. Test one thing only One scenario per test Enables fast debug Obvious why test failed https://www.flickr.com/photos/ryantron/
  • 9. #DevoxxUS @spoole167 @stuartmarks 5. Fast tests only Run unit tests often as possible Maintain quality bar Quick results https://www.flickr.com/photos/mcleod/
  • 10. #DevoxxUS @spoole167 @stuartmarks 6. Absolute repeatability Non-deterministic tests are a headache Fix intermittent tests immediately No value, waste of resource Must trust all tests https://www.flickr.com/photos/fdecomite/
  • 11. #DevoxxUS @spoole167 @stuartmarks 7. Independent tests only Must run in any order Run subset, faster results No dependencies https://www.flickr.com/photos/sheila_sund/
  • 12. #DevoxxUS @spoole167 @stuartmarks 8. Provide diagnostic data on failure Use message in asserts Make it simple to debug Reference input data Record test environment info https://www.flickr.com/photos/davidbaker/
  • 13. #DevoxxUS @spoole167 @stuartmarks 9. No hard-coding of your environment No ports, IP addresses, data files, databases Use config files, system properties or mock objects Portable tests https://www.flickr.com/photos/pug50/
  • 14. #DevoxxUS @spoole167 @stuartmarks 10. No extraneous output A passing test is a silent test Too much output = confusion Use option, config file to turn on debug, save output https://www.flickr.com/photos/3-bs/
  • 15. #DevoxxUS @spoole167 @stuartmarks Pirate rules Guidelines only Some may seen obvious. Some may seem pedantic Until you inherit a testsuite… Thank you. https://www.flickr.com/photos/gapic/
  • 16. © 2017 IBM Corporation Mission Badge #6: SMS Text Your mission should you choose to accept it…. Join us at the IBM Booth for hands-on labs, demos, games and talk to our developers. Text Mission2017 to 41411 to get the booth giveaway and learn more about all the IBM sessions & speakers. Enter the raffle by completing missions for a chance to win • a Drone • TJBot Kit • VR glasses

Notes de l'éditeur

  1. Questions for the end or on twitter..
  2. Steve: To say why we are doing. Intro Why do we write tests. I don’t need to my code is good enough. I only get paid for code. Stuart: Platitudes -> things are ‘better’ if we write tests. With not much complexity there was more knowledge in the code and tests than in my head. 200 lines of code Your brain is not big enough to keep even a simple code in your head.
  3. Pirate Rules (guidelines only) Can we agree on rules vs guidelines ? This list is the top ish(10) from professional testers and developers. Most of our pain has come from from personal experience in breaking these rules.. Our experiences only. Valueable. Its not exclusive, just our opnion. And we don’t have time for more.. Non of these are unimportant
  4. Steve – intro and substance --- Your first job is to capture the expected behaviour of your system so you can continue to show you have not broken bevaiour.. You cannot test quality in But without tests you cannot assert ‘quality’ you only have some much time to capture your systems behavior in tests - don’t waste it -- Stuart – your opinion “on testing in relation to quality” How do you measure this? Test coverage -> Don’t just test getters and setters Its not valueless but unless you’re looking at conformance don’t get too bent out of shape about coverage. Improving Test coveage without bugs is not necessary a good thing. JDK has jtreg. SQE has separate test suite (closed for no good reason) too much effort to open source the framework and tests. Is adding more tests to extend coverage a good idea? Not necessary - time spend on arguing how the code is supposed to work Do new tests have bugs as often as code has bugs?
  5. Stuart: tests are an equally important part of a code base as the production code. Tests need to be maintained and enhanced alongside the production code, not left as an afterthought. Q: What happens if your tests are not understandable? Should tests be easier to understand than the code their testing? Tests should be coded and commented well. A test suite is the inverse of the code. Its codifing expected behaviour so write it down what your think the behavior is. When and a test fails you don’t want to be spending time figuring out if it’s the test. How would you report a bug if you can’t work out what the test.
  6. Steve: tests should have a well defined setup Can you find the actual line of testing in a large test suite Why are we saying this - how often have you had to step a 1000times Or debug a nested loop inside a nested loop? Or inserted code to allow you to set a break point. If you have to hack the test its too big clean separate between getting to to the actual cost. Q: “you are in full agreement?”
  7. Stuart: setup – operation – verification – teardown Don’t do multiple operations; they can spoil the fixture for subsequent op/verify steps. Separate into multiple tests. Q: “do you agree?”
  8. Steve: Testing is domain / time context We’d all like all our tests to run all the time. We can’t do that so when backing off chose wisely. Running the whole testsuite is useful. Long tests encourage you to not run tests. You let more bugs through Even if part of a CI run.. Long running test suites are evil. They encourage corner cutting. The make you think about not running tests… Q: “Stuart – what happens if your tests are not fast?” War story about test suite run monthly
  9. Stuart: An ideal to strive for but possibly impossible to achieve in practice. Nonetheless v important! (ask for show of hands) Noise level of intermittent test failures makes result analysis harder, masks real failures. Q: “Steve how does this work in a cloud environment?” Cloud: reliable system built from unreliable components. This manifests itself in intermittent test failures. How to distinguish "valid" failure (failure that can be handled by the larger system) vs an "invalid" failure? Do we care? "Offensive programming" – deliberate injection of failures. Useful for system tests. Random without a seed. Sleeping to wait for stuff to happen. Repeatability with timeouts is difficult. “Chaos Monkeys”
  10. Steve: War story - junit test ordering. Exposed unexpected test interdependences… I want to one day run one of these tests singualry for debug purposes. I don’t want to run 50 others first! Run your tests in random order? Q: “ has this ever happened to you? Stuart: Yes. Don't write tests that have persistent side effects. CORBA test war story.
  11. Stuart: Reduce debugging time. Exception stack traces usually help here, but not always. Consider: asserting that right exception was thrown at the right time. Timeout war story. Q: what’s your experience with this? Steve : War story FFDC works for me syndrome + Cloud: Remote tests are difficult remove env is always different and un reproducable locally..
  12. Steve: War story “the App server test env and 1yr” + Cloud needs you not to do this.. Every instance could be on a different box, somewhere else in the world Reduce opportunities to be effected by using mock objects. Q: “can you think of any reasons why you would want to hard code your environment?” Stuart: Barely. Hard to avoid hard-coding 100%. Example: test that the default port is 80.
  13. Stuart: Essential if you have 10,000 unit tests. Even saying ”passed” can generate too much output. But for complex system tests, esp with timeouts, sometimes verbose logging is necessary. Q: You like verbose output don’t you Steve? Steve: if you have too much output - > you invest in systems to analyse the log and look for the real ‘truth’
  14. Steve: Just like the movie says – these are all guidelines. We think you should think before you ignore the rules. Wait until you inherit your first test suite.. Q: Stuart –any closing thoughts?