SlideShare a Scribd company logo
1 of 20
Download to read offline
Retro Testing

Allon Mureinik
Team Lead, Cloud Storage, Red Hat
amureini@redhat.com / @mureinik
January 2014

Allon Mureinik - Retro Testing

1
TDD Is Easy...

Allon Mureinik - Retro Testing

2
... or is it?
●

The first two part should be
●

Write a test

●

Make sure it fails

●

The question is why it fails.

●

In a legacy system, it will often fail for “bad” reasons:
●

Unable to access the database

●

Some static resource not set up

●

Need to spin up an application server

●

Etc., etc., etc...
Allon Mureinik - Retro Testing

3
Will the mistakes of the past haunt me
forever?

Allon Mureinik - Retro Testing

4
It’s not an all-or-nothing situation

Allon Mureinik - Retro Testing

5
One baby step at a time

Allon Mureinik - Retro Testing

6
Refactor, refactor, refactor
●

●

Your first task would probably be to do some
refactoring
Resist the urge to improve the code
●

●

Frankly, this step may make the code look worse

Your only goal here is to create an opportunity to write
tests

Allon Mureinik - Retro Testing

7
Refacroting with no tests is like...

Allon Mureinik - Retro Testing

8
Example : Bad Code

Allon Mureinik - Retro Testing

9
Some minimal refactoring

Allon Mureinik - Retro Testing

10
Now we can start writing tests...
●

●

Now we have the tools to separate external resources
from logic
There are a couple of ways to do so:
●

Override the relevant methods in your test

●

Use Mockito/EasyMock to spy the tested object

●

Use @Rules to set up common mocking once

Allon Mureinik - Retro Testing

11
I @Spy With My Little Eye

Allon Mureinik - Retro Testing

12
Some more refactoring

Allon Mureinik - Retro Testing

13
Let’s modernize our code

Allon Mureinik - Retro Testing

14
But how can I write asserts?
●

Overriding, mocking and all that jazz are fine and well

●

But any test boils down to writing an assert...

●

... and I have no idea what this function is supposed to
do

●

Remember this is a legacy system

●

You may not need to test it for correctness ...

●

Just for backwards compatibility

Allon Mureinik - Retro Testing

15
Allon Mureinik - Retro Testing

16
The real challenge is changing mindset
●

We can discusses refactoring till we’re blue in the face

●

But the real challenge isn’t changing the way we code

●

It’s changing the way we approach the problem

Allon Mureinik - Retro Testing

17
It’s all too easy to slip back to bad habits
●

This bug is blocking the release...

●

It’s a ton of work to refactor this logic out...

●

The rest of the code is bad anyway...

Allon Mureinik - Retro Testing

18
Have the courage to stand up to excuses

Allon Mureinik - Retro Testing

19
Questions?

Allon Mureinik - Retro Testing

20

More Related Content

What's hot

Hands off Exploratory Testing - Managing Testing at Scale
Hands off Exploratory Testing - Managing Testing at ScaleHands off Exploratory Testing - Managing Testing at Scale
Hands off Exploratory Testing - Managing Testing at ScaleMaaret Pyhäjärvi
 
EuroSTAR '21 Keynote: Automationist's Gambit
EuroSTAR '21 Keynote: Automationist's GambitEuroSTAR '21 Keynote: Automationist's Gambit
EuroSTAR '21 Keynote: Automationist's GambitMaaret Pyhäjärvi
 
AADays Poland: Perfecting the Craft of Test Automation
AADays Poland: Perfecting the Craft of Test AutomationAADays Poland: Perfecting the Craft of Test Automation
AADays Poland: Perfecting the Craft of Test AutomationMaaret Pyhäjärvi
 
Selenium Summit 21: Contemporary Exploratory Testing
Selenium Summit 21: Contemporary Exploratory TestingSelenium Summit 21: Contemporary Exploratory Testing
Selenium Summit 21: Contemporary Exploratory TestingMaaret Pyhäjärvi
 
HUSTEF '21 Keynote: Hands Off Exploratory Testing - Managing at Scale
HUSTEF '21 Keynote: Hands Off Exploratory Testing - Managing at ScaleHUSTEF '21 Keynote: Hands Off Exploratory Testing - Managing at Scale
HUSTEF '21 Keynote: Hands Off Exploratory Testing - Managing at ScaleMaaret Pyhäjärvi
 
Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit TestingEyal Kenig
 
Talentum: Testiautomaation tekemisen taito
Talentum: Testiautomaation tekemisen taitoTalentum: Testiautomaation tekemisen taito
Talentum: Testiautomaation tekemisen taitoMaaret Pyhäjärvi
 
Selenium Conference India: Intersection of Automation and Exploratory Testing
Selenium Conference India: Intersection of Automation and Exploratory TestingSelenium Conference India: Intersection of Automation and Exploratory Testing
Selenium Conference India: Intersection of Automation and Exploratory TestingMaaret Pyhäjärvi
 
Geekle QA: Automationist's Gambit
Geekle QA: Automationist's GambitGeekle QA: Automationist's Gambit
Geekle QA: Automationist's GambitMaaret Pyhäjärvi
 
AppiumLite Keynote: Many Hats to Make a Tester
AppiumLite Keynote: Many Hats to Make a TesterAppiumLite Keynote: Many Hats to Make a Tester
AppiumLite Keynote: Many Hats to Make a TesterMaaret Pyhäjärvi
 
Test Driven Development in Python
Test Driven Development in PythonTest Driven Development in Python
Test Driven Development in PythonAnoop Thomas Mathew
 
Agile Serbia: Exploratory Testing Explained and Experienced
Agile Serbia: Exploratory Testing Explained and ExperiencedAgile Serbia: Exploratory Testing Explained and Experienced
Agile Serbia: Exploratory Testing Explained and ExperiencedMaaret Pyhäjärvi
 
Testing United - Social Software Testing Approaches
Testing United - Social Software Testing ApproachesTesting United - Social Software Testing Approaches
Testing United - Social Software Testing ApproachesMaaret Pyhäjärvi
 
MoT Sarajevo: How to get better at Exploratory testing
MoT Sarajevo: How to get better at Exploratory testingMoT Sarajevo: How to get better at Exploratory testing
MoT Sarajevo: How to get better at Exploratory testingMaaret Pyhäjärvi
 
Web Pet Peeves Lecture from 2008
Web Pet Peeves Lecture from 2008Web Pet Peeves Lecture from 2008
Web Pet Peeves Lecture from 2008Mark Busse
 
Tampere Testing Days: Exploratory Testing an API
Tampere Testing Days: Exploratory Testing an APITampere Testing Days: Exploratory Testing an API
Tampere Testing Days: Exploratory Testing an APIMaaret Pyhäjärvi
 
MoT Sfax: Good Exploratory Testing Tactics for Taking Over Testing
MoT Sfax: Good Exploratory Testing Tactics for Taking Over TestingMoT Sfax: Good Exploratory Testing Tactics for Taking Over Testing
MoT Sfax: Good Exploratory Testing Tactics for Taking Over TestingMaaret Pyhäjärvi
 
Functional test best practice
Functional test best practiceFunctional test best practice
Functional test best practiceTest Armada
 
Code Smells - Refactoring
Code Smells - RefactoringCode Smells - Refactoring
Code Smells - RefactoringShobi P P
 
Easy to use correctly, hard to use incorrectly
Easy to use correctly, hard to use incorrectlyEasy to use correctly, hard to use incorrectly
Easy to use correctly, hard to use incorrectlyChristophe Addinquy
 

What's hot (20)

Hands off Exploratory Testing - Managing Testing at Scale
Hands off Exploratory Testing - Managing Testing at ScaleHands off Exploratory Testing - Managing Testing at Scale
Hands off Exploratory Testing - Managing Testing at Scale
 
EuroSTAR '21 Keynote: Automationist's Gambit
EuroSTAR '21 Keynote: Automationist's GambitEuroSTAR '21 Keynote: Automationist's Gambit
EuroSTAR '21 Keynote: Automationist's Gambit
 
AADays Poland: Perfecting the Craft of Test Automation
AADays Poland: Perfecting the Craft of Test AutomationAADays Poland: Perfecting the Craft of Test Automation
AADays Poland: Perfecting the Craft of Test Automation
 
Selenium Summit 21: Contemporary Exploratory Testing
Selenium Summit 21: Contemporary Exploratory TestingSelenium Summit 21: Contemporary Exploratory Testing
Selenium Summit 21: Contemporary Exploratory Testing
 
HUSTEF '21 Keynote: Hands Off Exploratory Testing - Managing at Scale
HUSTEF '21 Keynote: Hands Off Exploratory Testing - Managing at ScaleHUSTEF '21 Keynote: Hands Off Exploratory Testing - Managing at Scale
HUSTEF '21 Keynote: Hands Off Exploratory Testing - Managing at Scale
 
Effective Unit Testing
Effective Unit TestingEffective Unit Testing
Effective Unit Testing
 
Talentum: Testiautomaation tekemisen taito
Talentum: Testiautomaation tekemisen taitoTalentum: Testiautomaation tekemisen taito
Talentum: Testiautomaation tekemisen taito
 
Selenium Conference India: Intersection of Automation and Exploratory Testing
Selenium Conference India: Intersection of Automation and Exploratory TestingSelenium Conference India: Intersection of Automation and Exploratory Testing
Selenium Conference India: Intersection of Automation and Exploratory Testing
 
Geekle QA: Automationist's Gambit
Geekle QA: Automationist's GambitGeekle QA: Automationist's Gambit
Geekle QA: Automationist's Gambit
 
AppiumLite Keynote: Many Hats to Make a Tester
AppiumLite Keynote: Many Hats to Make a TesterAppiumLite Keynote: Many Hats to Make a Tester
AppiumLite Keynote: Many Hats to Make a Tester
 
Test Driven Development in Python
Test Driven Development in PythonTest Driven Development in Python
Test Driven Development in Python
 
Agile Serbia: Exploratory Testing Explained and Experienced
Agile Serbia: Exploratory Testing Explained and ExperiencedAgile Serbia: Exploratory Testing Explained and Experienced
Agile Serbia: Exploratory Testing Explained and Experienced
 
Testing United - Social Software Testing Approaches
Testing United - Social Software Testing ApproachesTesting United - Social Software Testing Approaches
Testing United - Social Software Testing Approaches
 
MoT Sarajevo: How to get better at Exploratory testing
MoT Sarajevo: How to get better at Exploratory testingMoT Sarajevo: How to get better at Exploratory testing
MoT Sarajevo: How to get better at Exploratory testing
 
Web Pet Peeves Lecture from 2008
Web Pet Peeves Lecture from 2008Web Pet Peeves Lecture from 2008
Web Pet Peeves Lecture from 2008
 
Tampere Testing Days: Exploratory Testing an API
Tampere Testing Days: Exploratory Testing an APITampere Testing Days: Exploratory Testing an API
Tampere Testing Days: Exploratory Testing an API
 
MoT Sfax: Good Exploratory Testing Tactics for Taking Over Testing
MoT Sfax: Good Exploratory Testing Tactics for Taking Over TestingMoT Sfax: Good Exploratory Testing Tactics for Taking Over Testing
MoT Sfax: Good Exploratory Testing Tactics for Taking Over Testing
 
Functional test best practice
Functional test best practiceFunctional test best practice
Functional test best practice
 
Code Smells - Refactoring
Code Smells - RefactoringCode Smells - Refactoring
Code Smells - Refactoring
 
Easy to use correctly, hard to use incorrectly
Easy to use correctly, hard to use incorrectlyEasy to use correctly, hard to use incorrectly
Easy to use correctly, hard to use incorrectly
 

Similar to Retro Testing (DevConTLV Jan 2014)

Solving Flaky Automated Tests Using Machine Learning
Solving Flaky Automated Tests Using Machine LearningSolving Flaky Automated Tests Using Machine Learning
Solving Flaky Automated Tests Using Machine LearningJames Farrier
 
7 lessons learned building high availability / performance systems - CM2015
7 lessons learned building high availability / performance systems - CM20157 lessons learned building high availability / performance systems - CM2015
7 lessons learned building high availability / performance systems - CM2015Francesco Degrassi
 
Software Craftsmanship
Software CraftsmanshipSoftware Craftsmanship
Software CraftsmanshipAndreas Enbohm
 
Nick India Presentation
Nick India PresentationNick India Presentation
Nick India PresentationGHNick
 
Reversed Tests Pyramid - Agile Prague 2014
Reversed Tests Pyramid - Agile Prague 2014Reversed Tests Pyramid - Agile Prague 2014
Reversed Tests Pyramid - Agile Prague 2014Wiktor Żołnowski
 
Test-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftTest-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftAmey Tavkar
 
Dev presentation
Dev presentationDev presentation
Dev presentationDavid Ford
 
Extreme Programming practices for your team
Extreme Programming practices for your teamExtreme Programming practices for your team
Extreme Programming practices for your teamPawel Lipinski
 
Super fast end-to-end-tests
Super fast end-to-end-testsSuper fast end-to-end-tests
Super fast end-to-end-testsLars Thorup
 
Reversed Test Pyramid - Testing and dealing with Legacy Code
Reversed Test Pyramid - Testing and dealing with Legacy CodeReversed Test Pyramid - Testing and dealing with Legacy Code
Reversed Test Pyramid - Testing and dealing with Legacy CodeSQALab
 
Selenium Users Anonymous
Selenium Users AnonymousSelenium Users Anonymous
Selenium Users AnonymousDave Haeffner
 
Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!Puppet
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdodaniil3
 

Similar to Retro Testing (DevConTLV Jan 2014) (20)

Solving Flaky Automated Tests Using Machine Learning
Solving Flaky Automated Tests Using Machine LearningSolving Flaky Automated Tests Using Machine Learning
Solving Flaky Automated Tests Using Machine Learning
 
7 lessons learned building high availability / performance systems - CM2015
7 lessons learned building high availability / performance systems - CM20157 lessons learned building high availability / performance systems - CM2015
7 lessons learned building high availability / performance systems - CM2015
 
Agileee 2012
Agileee 2012Agileee 2012
Agileee 2012
 
Software Craftsmanship
Software CraftsmanshipSoftware Craftsmanship
Software Craftsmanship
 
Nick India Presentation
Nick India PresentationNick India Presentation
Nick India Presentation
 
Reversed Tests Pyramid - Agile Prague 2014
Reversed Tests Pyramid - Agile Prague 2014Reversed Tests Pyramid - Agile Prague 2014
Reversed Tests Pyramid - Agile Prague 2014
 
Xp days ukraine 2012
Xp days ukraine 2012Xp days ukraine 2012
Xp days ukraine 2012
 
Test-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftTest-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in Swift
 
Tdd in swift
Tdd in swiftTdd in swift
Tdd in swift
 
Dev presentation
Dev presentationDev presentation
Dev presentation
 
Clean code
Clean codeClean code
Clean code
 
Extreme Programming practices for your team
Extreme Programming practices for your teamExtreme Programming practices for your team
Extreme Programming practices for your team
 
Fast end-to-end-tests
Fast end-to-end-testsFast end-to-end-tests
Fast end-to-end-tests
 
Super fast end-to-end-tests
Super fast end-to-end-testsSuper fast end-to-end-tests
Super fast end-to-end-tests
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
Reversed Test Pyramid - Testing and dealing with Legacy Code
Reversed Test Pyramid - Testing and dealing with Legacy CodeReversed Test Pyramid - Testing and dealing with Legacy Code
Reversed Test Pyramid - Testing and dealing with Legacy Code
 
Sqa days2013
Sqa days2013Sqa days2013
Sqa days2013
 
Selenium Users Anonymous
Selenium Users AnonymousSelenium Users Anonymous
Selenium Users Anonymous
 
Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!Stop Sucking at Building Stuff!
Stop Sucking at Building Stuff!
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdo
 

More from Allon Mureinik

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Default to Async - Prevent DoS attacks on your app and your day
Default to Async - Prevent DoS attacks on your app and your dayDefault to Async - Prevent DoS attacks on your app and your day
Default to Async - Prevent DoS attacks on your app and your dayAllon Mureinik
 
What an episode of Rick and Morty taught me about (accidental) toxicity
What an episode of Rick and Morty taught me about (accidental) toxicityWhat an episode of Rick and Morty taught me about (accidental) toxicity
What an episode of Rick and Morty taught me about (accidental) toxicityAllon Mureinik
 
We are the Borg, you will be interviewed
We are the Borg, you will be interviewedWe are the Borg, you will be interviewed
We are the Borg, you will be interviewedAllon Mureinik
 
What I wish I knew about security - Allon Mureinik DevConf.CZ 2022
What I wish I knew about security  - Allon Mureinik DevConf.CZ 2022What I wish I knew about security  - Allon Mureinik DevConf.CZ 2022
What I wish I knew about security - Allon Mureinik DevConf.CZ 2022Allon Mureinik
 
Somebody set up us the bomb DevConf.CZ 2022 Lightning Talk
Somebody set up us the bomb  DevConf.CZ 2022 Lightning TalkSomebody set up us the bomb  DevConf.CZ 2022 Lightning Talk
Somebody set up us the bomb DevConf.CZ 2022 Lightning TalkAllon Mureinik
 
Cognitive biases, blind spots and inclusion
Cognitive biases, blind spots and inclusionCognitive biases, blind spots and inclusion
Cognitive biases, blind spots and inclusionAllon Mureinik
 
This DoS goes loop-di-loop
This DoS goes loop-di-loopThis DoS goes loop-di-loop
This DoS goes loop-di-loopAllon Mureinik
 
How open source made me a better manager
How open source made me a better managerHow open source made me a better manager
How open source made me a better managerAllon Mureinik
 
Automatic for the People
Automatic for the PeopleAutomatic for the People
Automatic for the PeopleAllon Mureinik
 
Automatic for the people
Automatic for the peopleAutomatic for the people
Automatic for the peopleAllon Mureinik
 
Mockito - How a mocking library built a real community
Mockito - How a mocking library built a real communityMockito - How a mocking library built a real community
Mockito - How a mocking library built a real communityAllon Mureinik
 
Mockito - how a mocking library built a real community (August Penguin 2017)
Mockito - how a mocking library built a real community (August Penguin 2017)Mockito - how a mocking library built a real community (August Penguin 2017)
Mockito - how a mocking library built a real community (August Penguin 2017)Allon Mureinik
 
Reversim Summit 2016 - Ja-WAT
Reversim Summit 2016 - Ja-WATReversim Summit 2016 - Ja-WAT
Reversim Summit 2016 - Ja-WATAllon Mureinik
 
Virtualization Management The oVirt Way (August Penguin 2015)
Virtualization Management The oVirt Way (August Penguin 2015)Virtualization Management The oVirt Way (August Penguin 2015)
Virtualization Management The oVirt Way (August Penguin 2015)Allon Mureinik
 
Step by Step - Reusing old features to build new ones
Step by Step - Reusing old features to build new onesStep by Step - Reusing old features to build new ones
Step by Step - Reusing old features to build new onesAllon Mureinik
 
oVirt 3.5 Storage Features Overview
oVirt 3.5 Storage Features OverviewoVirt 3.5 Storage Features Overview
oVirt 3.5 Storage Features OverviewAllon Mureinik
 
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...Allon Mureinik
 
Live Storage Migration in oVirt (Open Storage Meetup May 2013)
Live Storage Migration in oVirt (Open Storage Meetup May 2013)Live Storage Migration in oVirt (Open Storage Meetup May 2013)
Live Storage Migration in oVirt (Open Storage Meetup May 2013)Allon Mureinik
 

More from Allon Mureinik (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Default to Async - Prevent DoS attacks on your app and your day
Default to Async - Prevent DoS attacks on your app and your dayDefault to Async - Prevent DoS attacks on your app and your day
Default to Async - Prevent DoS attacks on your app and your day
 
What an episode of Rick and Morty taught me about (accidental) toxicity
What an episode of Rick and Morty taught me about (accidental) toxicityWhat an episode of Rick and Morty taught me about (accidental) toxicity
What an episode of Rick and Morty taught me about (accidental) toxicity
 
We are the Borg, you will be interviewed
We are the Borg, you will be interviewedWe are the Borg, you will be interviewed
We are the Borg, you will be interviewed
 
What I wish I knew about security - Allon Mureinik DevConf.CZ 2022
What I wish I knew about security  - Allon Mureinik DevConf.CZ 2022What I wish I knew about security  - Allon Mureinik DevConf.CZ 2022
What I wish I knew about security - Allon Mureinik DevConf.CZ 2022
 
Somebody set up us the bomb DevConf.CZ 2022 Lightning Talk
Somebody set up us the bomb  DevConf.CZ 2022 Lightning TalkSomebody set up us the bomb  DevConf.CZ 2022 Lightning Talk
Somebody set up us the bomb DevConf.CZ 2022 Lightning Talk
 
Zoom out
Zoom outZoom out
Zoom out
 
Cognitive biases, blind spots and inclusion
Cognitive biases, blind spots and inclusionCognitive biases, blind spots and inclusion
Cognitive biases, blind spots and inclusion
 
This DoS goes loop-di-loop
This DoS goes loop-di-loopThis DoS goes loop-di-loop
This DoS goes loop-di-loop
 
How open source made me a better manager
How open source made me a better managerHow open source made me a better manager
How open source made me a better manager
 
Automatic for the People
Automatic for the PeopleAutomatic for the People
Automatic for the People
 
Automatic for the people
Automatic for the peopleAutomatic for the people
Automatic for the people
 
Mockito - How a mocking library built a real community
Mockito - How a mocking library built a real communityMockito - How a mocking library built a real community
Mockito - How a mocking library built a real community
 
Mockito - how a mocking library built a real community (August Penguin 2017)
Mockito - how a mocking library built a real community (August Penguin 2017)Mockito - how a mocking library built a real community (August Penguin 2017)
Mockito - how a mocking library built a real community (August Penguin 2017)
 
Reversim Summit 2016 - Ja-WAT
Reversim Summit 2016 - Ja-WATReversim Summit 2016 - Ja-WAT
Reversim Summit 2016 - Ja-WAT
 
Virtualization Management The oVirt Way (August Penguin 2015)
Virtualization Management The oVirt Way (August Penguin 2015)Virtualization Management The oVirt Way (August Penguin 2015)
Virtualization Management The oVirt Way (August Penguin 2015)
 
Step by Step - Reusing old features to build new ones
Step by Step - Reusing old features to build new onesStep by Step - Reusing old features to build new ones
Step by Step - Reusing old features to build new ones
 
oVirt 3.5 Storage Features Overview
oVirt 3.5 Storage Features OverviewoVirt 3.5 Storage Features Overview
oVirt 3.5 Storage Features Overview
 
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
Disaster Recovery Strategies Using oVirt's new Storage Connection Management ...
 
Live Storage Migration in oVirt (Open Storage Meetup May 2013)
Live Storage Migration in oVirt (Open Storage Meetup May 2013)Live Storage Migration in oVirt (Open Storage Meetup May 2013)
Live Storage Migration in oVirt (Open Storage Meetup May 2013)
 

Recently uploaded

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Retro Testing (DevConTLV Jan 2014)

  • 1. Retro Testing Allon Mureinik Team Lead, Cloud Storage, Red Hat amureini@redhat.com / @mureinik January 2014 Allon Mureinik - Retro Testing 1
  • 2. TDD Is Easy... Allon Mureinik - Retro Testing 2
  • 3. ... or is it? ● The first two part should be ● Write a test ● Make sure it fails ● The question is why it fails. ● In a legacy system, it will often fail for “bad” reasons: ● Unable to access the database ● Some static resource not set up ● Need to spin up an application server ● Etc., etc., etc... Allon Mureinik - Retro Testing 3
  • 4. Will the mistakes of the past haunt me forever? Allon Mureinik - Retro Testing 4
  • 5. It’s not an all-or-nothing situation Allon Mureinik - Retro Testing 5
  • 6. One baby step at a time Allon Mureinik - Retro Testing 6
  • 7. Refactor, refactor, refactor ● ● Your first task would probably be to do some refactoring Resist the urge to improve the code ● ● Frankly, this step may make the code look worse Your only goal here is to create an opportunity to write tests Allon Mureinik - Retro Testing 7
  • 8. Refacroting with no tests is like... Allon Mureinik - Retro Testing 8
  • 9. Example : Bad Code Allon Mureinik - Retro Testing 9
  • 10. Some minimal refactoring Allon Mureinik - Retro Testing 10
  • 11. Now we can start writing tests... ● ● Now we have the tools to separate external resources from logic There are a couple of ways to do so: ● Override the relevant methods in your test ● Use Mockito/EasyMock to spy the tested object ● Use @Rules to set up common mocking once Allon Mureinik - Retro Testing 11
  • 12. I @Spy With My Little Eye Allon Mureinik - Retro Testing 12
  • 13. Some more refactoring Allon Mureinik - Retro Testing 13
  • 14. Let’s modernize our code Allon Mureinik - Retro Testing 14
  • 15. But how can I write asserts? ● Overriding, mocking and all that jazz are fine and well ● But any test boils down to writing an assert... ● ... and I have no idea what this function is supposed to do ● Remember this is a legacy system ● You may not need to test it for correctness ... ● Just for backwards compatibility Allon Mureinik - Retro Testing 15
  • 16. Allon Mureinik - Retro Testing 16
  • 17. The real challenge is changing mindset ● We can discusses refactoring till we’re blue in the face ● But the real challenge isn’t changing the way we code ● It’s changing the way we approach the problem Allon Mureinik - Retro Testing 17
  • 18. It’s all too easy to slip back to bad habits ● This bug is blocking the release... ● It’s a ton of work to refactor this logic out... ● The rest of the code is bad anyway... Allon Mureinik - Retro Testing 18
  • 19. Have the courage to stand up to excuses Allon Mureinik - Retro Testing 19
  • 20. Questions? Allon Mureinik - Retro Testing 20