SlideShare uma empresa Scribd logo
1 de 20
Baixar para ler 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a 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
 

Semelhante a 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
 
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
 
Lecture 11
Lecture 11Lecture 11
Lecture 11
 
Sqa days2013
Sqa days2013Sqa days2013
Sqa days2013
 
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
 
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
 

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

Mais de Allon Mureinik (19)

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)
 

Último

Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sectoritnewsafrica
 

Último (20)

Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
4. Cobus Valentine- Cybersecurity Threats and Solutions for the Public Sector
 

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