SlideShare a Scribd company logo
Better Tests
Automagically
@leifwickland
@leifwickland
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Unit tests:
1. Happy path
2. Failing path (maybe?)
3. Ship it!
Better tests automagically (big sky dev con 2015)
Good arguments for that
● Finite time for writing tests
● Maintaining test code is expensive
● I’m just not that creative
How hard do you test edge cases?
● Test with Unicode most days?
● Insert control characters into strings?
● Throw negative values at your numbers?
● Toss empty containers at utility functions?
● Combine multiple edge cases in one test?
Better tests automagically (big sky dev con 2015)
Typical Unit Testing Flow
1. You provide code of questionable quality
2. You provide input values to your functions
3. You hope not comically misrepresentative
4. You use the values to do something useful
5. You verify useful thing has expected result
Examples are expedient, not good
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better Tests Automagically
● Property Testing
● Generative Testing
● Randomized Testing
Typical Unit Testing Flow
1. You provide code of questionable quality
2. You provide input values to your functions
3. You hope not comically misrepresentative
4. You use the values to do something useful
5. You verify useful thing has expected result
Enter Property Testing
1. You provide code of questionable quality
2. You provide specification of kinds of inputs
3. It provides values to kick your butt
4. You use the values to do something useful
5. You verify useful thing has expected result
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
Better tests automagically (big sky dev con 2015)
When to Use Property Tests
● Not always
● Natural round-tripping, symmetric functions
o Serialization/Deserialization
o Protocols
● Two equivalent algorithms
● Natural invariants
● General utility functions
o May need to resort to heuristic
What’s not to Like?
● Relatively slow to execute
● More to to get a basic level of coverage
● Documentation tends to be thin
Can I Use Property Testing?
● Scala
● Haskell
● JavaScript
● Ruby
● Python
● C# and .NET
● Java
● Closure
Others too!
From this old list
Questions?

More Related Content

What's hot

Bahaviour Driven Development
Bahaviour Driven DevelopmentBahaviour Driven Development
Bahaviour Driven Development
buildmaster
 
Being Lean Agile
Being Lean AgileBeing Lean Agile
Being Lean Agile
prakashmpujar
 
Agile Testing!
Agile Testing!Agile Testing!
Agile Testing!
Aman King
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
dcsunu
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
Dr. Syed Hassan Amin
 
Developer + tester = quality++
Developer + tester = quality++Developer + tester = quality++
Developer + tester = quality++
Mikalai Alimenkou
 
Insprint automation, build the culture
Insprint automation, build the cultureInsprint automation, build the culture
Insprint automation, build the culture
ShekharRamphal
 
Please review and merge
Please review and mergePlease review and merge
Please review and merge
Squash Apps Pvt Ltd
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Samnang Chhun
 
Concurrent Applications with F# Agents
Concurrent Applications with F# AgentsConcurrent Applications with F# Agents
Concurrent Applications with F# Agents
Rachel Reese
 
5 levels of api test automation
5 levels of api test automation5 levels of api test automation
5 levels of api test automation
ShekharRamphal
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Ciklum Ukraine
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
Paul Gower
 
Improve your development skills with Test Driven Development
Improve your development skills with Test Driven DevelopmentImprove your development skills with Test Driven Development
Improve your development skills with Test Driven Development
John Stevenson
 
Finding a good development partner
Finding a good development partnerFinding a good development partner
Finding a good development partner
Kevin Poorman
 
NTHU Natural Language Processing Term Project Intro
NTHU Natural Language Processing Term Project IntroNTHU Natural Language Processing Term Project Intro
NTHU Natural Language Processing Term Project Intro
Howard Lo
 
Basics of writing clean code
Basics of writing clean codeBasics of writing clean code
Basics of writing clean code
Knoldus Inc.
 
Everyone loves release notes!
Everyone loves release notes!Everyone loves release notes!
Everyone loves release notes!
Neal Kaplan
 
Beyond Unit Testing
Beyond Unit TestingBeyond Unit Testing
Beyond Unit Testing
Søren Lund
 
Five steps towards your testing dream
Five steps towards your testing dreamFive steps towards your testing dream
Five steps towards your testing dream
Lisa Gagarina
 

What's hot (20)

Bahaviour Driven Development
Bahaviour Driven DevelopmentBahaviour Driven Development
Bahaviour Driven Development
 
Being Lean Agile
Being Lean AgileBeing Lean Agile
Being Lean Agile
 
Agile Testing!
Agile Testing!Agile Testing!
Agile Testing!
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Developer + tester = quality++
Developer + tester = quality++Developer + tester = quality++
Developer + tester = quality++
 
Insprint automation, build the culture
Insprint automation, build the cultureInsprint automation, build the culture
Insprint automation, build the culture
 
Please review and merge
Please review and mergePlease review and merge
Please review and merge
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Concurrent Applications with F# Agents
Concurrent Applications with F# AgentsConcurrent Applications with F# Agents
Concurrent Applications with F# Agents
 
5 levels of api test automation
5 levels of api test automation5 levels of api test automation
5 levels of api test automation
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Improve your development skills with Test Driven Development
Improve your development skills with Test Driven DevelopmentImprove your development skills with Test Driven Development
Improve your development skills with Test Driven Development
 
Finding a good development partner
Finding a good development partnerFinding a good development partner
Finding a good development partner
 
NTHU Natural Language Processing Term Project Intro
NTHU Natural Language Processing Term Project IntroNTHU Natural Language Processing Term Project Intro
NTHU Natural Language Processing Term Project Intro
 
Basics of writing clean code
Basics of writing clean codeBasics of writing clean code
Basics of writing clean code
 
Everyone loves release notes!
Everyone loves release notes!Everyone loves release notes!
Everyone loves release notes!
 
Beyond Unit Testing
Beyond Unit TestingBeyond Unit Testing
Beyond Unit Testing
 
Five steps towards your testing dream
Five steps towards your testing dreamFive steps towards your testing dream
Five steps towards your testing dream
 

Viewers also liked

Chris Omland - AWS Code Deploy - BSDC 2016
Chris Omland - AWS Code Deploy - BSDC 2016Chris Omland - AWS Code Deploy - BSDC 2016
Chris Omland - AWS Code Deploy - BSDC 2016
roblund
 
Will Price - Venture Capital in Montana - BSDC 2016
Will Price - Venture Capital in Montana - BSDC 2016Will Price - Venture Capital in Montana - BSDC 2016
Will Price - Venture Capital in Montana - BSDC 2016
roblund
 
Property.CoZa Introduction - Roadshow - September 2015
Property.CoZa Introduction - Roadshow - September 2015Property.CoZa Introduction - Roadshow - September 2015
Property.CoZa Introduction - Roadshow - September 2015
Gustav Kruger
 
Ben Werner - Mountains and startups
Ben Werner - Mountains and startupsBen Werner - Mountains and startups
Ben Werner - Mountains and startups
roblund
 
Josef Verbanac - Voice is (a) Best Practice
Josef Verbanac - Voice is (a) Best PracticeJosef Verbanac - Voice is (a) Best Practice
Josef Verbanac - Voice is (a) Best Practice
roblund
 
Jason Moore - Why releasing 50 features are less than 1 solution - BSDC 2016
Jason Moore - Why releasing 50 features are less than 1 solution - BSDC 2016Jason Moore - Why releasing 50 features are less than 1 solution - BSDC 2016
Jason Moore - Why releasing 50 features are less than 1 solution - BSDC 2016
roblund
 
Hotel site information copy 2
Hotel site information copy 2Hotel site information copy 2
Hotel site information copy 2
Sandra Lawn
 
HKR 3220: Routes
HKR 3220: RoutesHKR 3220: Routes
HKR 3220: Routes
bfp877
 
Emergence Of Code Schools
Emergence Of Code SchoolsEmergence Of Code Schools
Emergence Of Code Schools
roblund
 
Nora McDougall-Collins - I Can Do That
Nora McDougall-Collins - I Can Do ThatNora McDougall-Collins - I Can Do That
Nora McDougall-Collins - I Can Do That
roblund
 
Best Logo Design Deal Ever
Best Logo Design Deal EverBest Logo Design Deal Ever
Best Logo Design Deal Ever
Minhajul Hoque
 
McKinney_Greg_ES_342_Final_Project
McKinney_Greg_ES_342_Final_ProjectMcKinney_Greg_ES_342_Final_Project
McKinney_Greg_ES_342_Final_Project
Gregory McKinney
 
Jason Moore - Interaction design in enterprise teams
Jason Moore - Interaction design in enterprise teamsJason Moore - Interaction design in enterprise teams
Jason Moore - Interaction design in enterprise teams
roblund
 
Pete Sveen - How to Build, Grow, and Monetize Your Online Platform - BSDC 2016
Pete Sveen - How to Build, Grow, and Monetize Your Online Platform - BSDC 2016Pete Sveen - How to Build, Grow, and Monetize Your Online Platform - BSDC 2016
Pete Sveen - How to Build, Grow, and Monetize Your Online Platform - BSDC 2016
roblund
 

Viewers also liked (14)

Chris Omland - AWS Code Deploy - BSDC 2016
Chris Omland - AWS Code Deploy - BSDC 2016Chris Omland - AWS Code Deploy - BSDC 2016
Chris Omland - AWS Code Deploy - BSDC 2016
 
Will Price - Venture Capital in Montana - BSDC 2016
Will Price - Venture Capital in Montana - BSDC 2016Will Price - Venture Capital in Montana - BSDC 2016
Will Price - Venture Capital in Montana - BSDC 2016
 
Property.CoZa Introduction - Roadshow - September 2015
Property.CoZa Introduction - Roadshow - September 2015Property.CoZa Introduction - Roadshow - September 2015
Property.CoZa Introduction - Roadshow - September 2015
 
Ben Werner - Mountains and startups
Ben Werner - Mountains and startupsBen Werner - Mountains and startups
Ben Werner - Mountains and startups
 
Josef Verbanac - Voice is (a) Best Practice
Josef Verbanac - Voice is (a) Best PracticeJosef Verbanac - Voice is (a) Best Practice
Josef Verbanac - Voice is (a) Best Practice
 
Jason Moore - Why releasing 50 features are less than 1 solution - BSDC 2016
Jason Moore - Why releasing 50 features are less than 1 solution - BSDC 2016Jason Moore - Why releasing 50 features are less than 1 solution - BSDC 2016
Jason Moore - Why releasing 50 features are less than 1 solution - BSDC 2016
 
Hotel site information copy 2
Hotel site information copy 2Hotel site information copy 2
Hotel site information copy 2
 
HKR 3220: Routes
HKR 3220: RoutesHKR 3220: Routes
HKR 3220: Routes
 
Emergence Of Code Schools
Emergence Of Code SchoolsEmergence Of Code Schools
Emergence Of Code Schools
 
Nora McDougall-Collins - I Can Do That
Nora McDougall-Collins - I Can Do ThatNora McDougall-Collins - I Can Do That
Nora McDougall-Collins - I Can Do That
 
Best Logo Design Deal Ever
Best Logo Design Deal EverBest Logo Design Deal Ever
Best Logo Design Deal Ever
 
McKinney_Greg_ES_342_Final_Project
McKinney_Greg_ES_342_Final_ProjectMcKinney_Greg_ES_342_Final_Project
McKinney_Greg_ES_342_Final_Project
 
Jason Moore - Interaction design in enterprise teams
Jason Moore - Interaction design in enterprise teamsJason Moore - Interaction design in enterprise teams
Jason Moore - Interaction design in enterprise teams
 
Pete Sveen - How to Build, Grow, and Monetize Your Online Platform - BSDC 2016
Pete Sveen - How to Build, Grow, and Monetize Your Online Platform - BSDC 2016Pete Sveen - How to Build, Grow, and Monetize Your Online Platform - BSDC 2016
Pete Sveen - How to Build, Grow, and Monetize Your Online Platform - BSDC 2016
 

Similar to Better tests automagically (big sky dev con 2015)

Developer Testing
Developer TestingDeveloper Testing
Developer Testing
Chris Wallace
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assurance
Benjamin Baumann
 
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Igalia
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Concepts
wesovi
 
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Peter Kofler
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
ikram_ahamed
 
Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit Testing
Eyal Kenig
 
Super fast end-to-end-tests
Super fast end-to-end-testsSuper fast end-to-end-tests
Super fast end-to-end-tests
Lars Thorup
 
Fast end-to-end-tests
Fast end-to-end-testsFast end-to-end-tests
Fast end-to-end-tests
Rikke Veng Petersen
 
JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)
Peter Kofler
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
Danny Preussler
 
TDD and Getting Paid
TDD and Getting PaidTDD and Getting Paid
TDD and Getting Paid
Rowan Merewood
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
Mehdi Khalili
 
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Kaunas Java User Group
 
Tdd
TddTdd
Test automation expert days
Test automation   expert daysTest automation   expert days
Test automation expert days
Oren Rubin
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
Andrea Polci
 
Let's test!
Let's test!Let's test!
Let's test!
Andrea Giuliano
 
Getting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud ShaonGetting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud Shaon
Cefalo
 
Getting started with Test Driven Development
Getting started with Test Driven DevelopmentGetting started with Test Driven Development
Getting started with Test Driven Development
Ferdous Mahmud Shaon
 

Similar to Better tests automagically (big sky dev con 2015) (20)

Developer Testing
Developer TestingDeveloper Testing
Developer Testing
 
Software testing and quality assurance
Software testing and quality assuranceSoftware testing and quality assurance
Software testing and quality assurance
 
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Concepts
 
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)Pragmatic Introduction to Python Unit Testing (PyDays 2018)
Pragmatic Introduction to Python Unit Testing (PyDays 2018)
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
 
Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit Testing
 
Super fast end-to-end-tests
Super fast end-to-end-testsSuper fast end-to-end-tests
Super fast end-to-end-tests
 
Fast end-to-end-tests
Fast end-to-end-testsFast end-to-end-tests
Fast end-to-end-tests
 
JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)JUnit Boot Camp (GeeCON 2016)
JUnit Boot Camp (GeeCON 2016)
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 
TDD and Getting Paid
TDD and Getting PaidTDD and Getting Paid
TDD and Getting Paid
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
 
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
Bye Bye Cowboy Coder Days! (Legacy Code & TDD)
 
Tdd
TddTdd
Tdd
 
Test automation expert days
Test automation   expert daysTest automation   expert days
Test automation expert days
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
 
Let's test!
Let's test!Let's test!
Let's test!
 
Getting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud ShaonGetting started with Test Driven Development - Ferdous Mahmud Shaon
Getting started with Test Driven Development - Ferdous Mahmud Shaon
 
Getting started with Test Driven Development
Getting started with Test Driven DevelopmentGetting started with Test Driven Development
Getting started with Test Driven Development
 

Better tests automagically (big sky dev con 2015)

  • 10. Unit tests: 1. Happy path 2. Failing path (maybe?) 3. Ship it!
  • 12. Good arguments for that ● Finite time for writing tests ● Maintaining test code is expensive ● I’m just not that creative
  • 13. How hard do you test edge cases? ● Test with Unicode most days? ● Insert control characters into strings? ● Throw negative values at your numbers? ● Toss empty containers at utility functions? ● Combine multiple edge cases in one test?
  • 15. Typical Unit Testing Flow 1. You provide code of questionable quality 2. You provide input values to your functions 3. You hope not comically misrepresentative 4. You use the values to do something useful 5. You verify useful thing has expected result
  • 22. Better Tests Automagically ● Property Testing ● Generative Testing ● Randomized Testing
  • 23. Typical Unit Testing Flow 1. You provide code of questionable quality 2. You provide input values to your functions 3. You hope not comically misrepresentative 4. You use the values to do something useful 5. You verify useful thing has expected result
  • 24. Enter Property Testing 1. You provide code of questionable quality 2. You provide specification of kinds of inputs 3. It provides values to kick your butt 4. You use the values to do something useful 5. You verify useful thing has expected result
  • 53. When to Use Property Tests ● Not always ● Natural round-tripping, symmetric functions o Serialization/Deserialization o Protocols ● Two equivalent algorithms ● Natural invariants ● General utility functions o May need to resort to heuristic
  • 54. What’s not to Like? ● Relatively slow to execute ● More to to get a basic level of coverage ● Documentation tends to be thin
  • 55. Can I Use Property Testing? ● Scala ● Haskell ● JavaScript ● Ruby ● Python ● C# and .NET ● Java ● Closure Others too! From this old list