SlideShare une entreprise Scribd logo
1  sur  20
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 

Tendances (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
 

Similaire à 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
 

Similaire à 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
 

Plus de 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
 

Plus de 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)
 

Dernier

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
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
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
[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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Dernier (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
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
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
[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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

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