SlideShare a Scribd company logo
1 of 14
Download to read offline
Dealing
with Team Dependencies in
Tests
Diego Pacheco
@diego_pacheco
❏ Cat's Father
❏ Head of Software Architecture
❏ Agile Coach
❏ SOA/Microservices Expert
❏ DevOps Practitioner
❏ Speaker
❏ Author
diegopacheco
http://diego-pacheco.blogspot.com.br/
About me...
https://diegopacheco.github.io/
Going Down == Going Faster? Dependencies?
Test Doubles
❏ Also known as “Impostors”. Much before AmongUs!
❏ There are multiple Flavors: Fakes, Mocks, Spys, Stubs
and Dummy.
❏ Motivations:
❏ Verify code when dependency is unusable
❏ Avoiding Slow Tests
❏ Wrongly: People often call all “Mocks”.
Ontology
Dealing with dependencies is not a free lunch
Fakes
❏ Objects with Working Implementations but not the same
as the REAL production ones.
❏ Usually Dynamic. You can add data.
❏ Usually using gortcuts and simplified versions.
❏ I.e: Faking Redis with a HashMap in memory.
❏ I.e: Postgres DAO in memory.
User Service
<REAL>
UserPostgresDAO
<Test>
UserFakePostgresDAO
Stub
❏ Holds predefined Data and use it to answer questions on tests.
❏ Use it when we don't want we cannot use real data because side effects.
❏ Often used when the target code does not allow you to control input objects.
❏ Similar to FAKE but static. Fake is Dynamic.
❏ I.e: You have PII Data and don't want return real user data.
❏ I.e: You have to test a GET record but the api takes 7 days to activate it.
Profile
Service
<PII DATA>
RedisProfileDao
<Test - PRE-defined fake
data>
StubProfileDao
Mocks
❏ Register Calls they received.
❏ You can verify is specific actions happened. More complex than Stubs.
❏ Solutions: Mockitto, EasyMocks, PowerMocks.
❏ I.e: Return void and send emails. Want to verify that email service was called.
Spys
❏ It might be better change the design - think twice before doing it.
❏ Special kind of Mocks.
❏ Register some information on how they were called.
❏ Capture the target method to know is was called or not.
❏ i.e : A Mail service, how many messages were sent?
❏ I.e: Legacy code that might be impossible to test with Stubs
And mocks.
Dummy
❏ No Implementation. Simple to do it.
❏ Often used to satisfy an method argument need.
❏ Could be either Dummy values or Dummy Objects.
❏ I.e: You need pass a parameter that you don't care or is not useful for you test. Like
a notification callback or customization /parametrization you don't care.
Isolation Matters!
❏ A good design - It should be easy to test right?
❏ Specially for shared libraries
❏ Hiding Implementation Details
❏ Less public classes
❏ Avoid Coupling with DI/IoC Libraries.
❏ Avoid coupling - Reduce surface, reduce customization.
❏ As Results - Harder to Test. Not necessary wrong.
Cross Cutting Concerns like i.e: AUTH.
❏ Functional and Nonfunctional requirements can be:
❏ Cutting and Cross-cutting concerns.
❏ Even business rules can be cross-cutting concerns.
❏ AUTH often is implemented in a centralized fashion.
❏ But imagine is was implemented Component by component basis
Would you easily disable it in order to speed up tests? For sure you
Should be able to mock project by project but would that be
The right call?
Dealing
with Team Dependencies in
Tests
Diego Pacheco

More Related Content

What's hot

Architecture 101: Vision, Properties and Skills
Architecture 101: Vision, Properties and SkillsArchitecture 101: Vision, Properties and Skills
Architecture 101: Vision, Properties and SkillsDiego Pacheco
 
Spring framework 4.0
Spring framework 4.0Spring framework 4.0
Spring framework 4.0Diego Pacheco
 
Design is not Subjective
Design is not SubjectiveDesign is not Subjective
Design is not SubjectiveDiego Pacheco
 
Dealing with dependencies
Dealing  with dependenciesDealing  with dependencies
Dealing with dependenciesDiego Pacheco
 
Revision techniques for students 2018 v3
Revision techniques for students 2018 v3Revision techniques for students 2018 v3
Revision techniques for students 2018 v3David Drake
 
I will NOT attend your meeting - I'm an Open Source person
I will NOT attend your meeting - I'm an Open Source personI will NOT attend your meeting - I'm an Open Source person
I will NOT attend your meeting - I'm an Open Source personBertrand Delacretaz
 
DevDay.lk - Bare Knuckle Web Development
DevDay.lk - Bare Knuckle Web DevelopmentDevDay.lk - Bare Knuckle Web Development
DevDay.lk - Bare Knuckle Web DevelopmentJohannes Brodwall
 
John Stuart-Clarke - beginning the data governance journey - 8th june 2016
John Stuart-Clarke - beginning the data governance journey - 8th june 2016John Stuart-Clarke - beginning the data governance journey - 8th june 2016
John Stuart-Clarke - beginning the data governance journey - 8th june 2016BCS Data Management Specialist Group
 
2013-11-07 standups, stories, planning & estimates
2013-11-07 standups, stories, planning & estimates2013-11-07 standups, stories, planning & estimates
2013-11-07 standups, stories, planning & estimatesmezis
 
The Joy of JavaScript: it's magical!
The Joy of JavaScript: it's magical!The Joy of JavaScript: it's magical!
The Joy of JavaScript: it's magical!Manning Publications
 

What's hot (20)

Reflections on SCM
Reflections on SCMReflections on SCM
Reflections on SCM
 
Lean 2020
Lean 2020Lean 2020
Lean 2020
 
Design 101
Design 101Design 101
Design 101
 
Code Forensics
Code ForensicsCode Forensics
Code Forensics
 
Architecture 101: Vision, Properties and Skills
Architecture 101: Vision, Properties and SkillsArchitecture 101: Vision, Properties and Skills
Architecture 101: Vision, Properties and Skills
 
Spring framework 4.0
Spring framework 4.0Spring framework 4.0
Spring framework 4.0
 
CDKs
CDKsCDKs
CDKs
 
Design is not Subjective
Design is not SubjectiveDesign is not Subjective
Design is not Subjective
 
RxNetty
RxNettyRxNetty
RxNetty
 
Dealing with dependencies
Dealing  with dependenciesDealing  with dependencies
Dealing with dependencies
 
Revision techniques for students 2018 v3
Revision techniques for students 2018 v3Revision techniques for students 2018 v3
Revision techniques for students 2018 v3
 
I will NOT attend your meeting - I'm an Open Source person
I will NOT attend your meeting - I'm an Open Source personI will NOT attend your meeting - I'm an Open Source person
I will NOT attend your meeting - I'm an Open Source person
 
DevDay.lk - Bare Knuckle Web Development
DevDay.lk - Bare Knuckle Web DevelopmentDevDay.lk - Bare Knuckle Web Development
DevDay.lk - Bare Knuckle Web Development
 
John Stuart-Clarke - beginning the data governance journey - 8th june 2016
John Stuart-Clarke - beginning the data governance journey - 8th june 2016John Stuart-Clarke - beginning the data governance journey - 8th june 2016
John Stuart-Clarke - beginning the data governance journey - 8th june 2016
 
2013-11-07 standups, stories, planning & estimates
2013-11-07 standups, stories, planning & estimates2013-11-07 standups, stories, planning & estimates
2013-11-07 standups, stories, planning & estimates
 
Slow innovation
Slow innovationSlow innovation
Slow innovation
 
The Joy of JavaScript: it's magical!
The Joy of JavaScript: it's magical!The Joy of JavaScript: it's magical!
The Joy of JavaScript: it's magical!
 
Spaghetti gate
Spaghetti gateSpaghetti gate
Spaghetti gate
 
Lit Day 2
Lit Day 2Lit Day 2
Lit Day 2
 
9 22 Ss
9 22 Ss9 22 Ss
9 22 Ss
 

Similar to Dealing with dependencies in tests

Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Acquia
 
Keeping lab notes as a software developer
Keeping lab notes as a software developerKeeping lab notes as a software developer
Keeping lab notes as a software developerJames McKay
 
Software Design Notes
Software Design NotesSoftware Design Notes
Software Design NotesDiego Pacheco
 
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!Lorenzo Barbieri
 
Commit Hooks: the Subtle Hammer
Commit Hooks: the Subtle HammerCommit Hooks: the Subtle Hammer
Commit Hooks: the Subtle HammerBen McGraw
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedJoão Pedro Martins
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDavide Mauri
 
Sync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpnSync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpnLorenzo Barbieri
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
 
From dev to ops and beyond - getting it done
From dev to ops and beyond - getting it doneFrom dev to ops and beyond - getting it done
From dev to ops and beyond - getting it doneEdorian
 
Performant Django - Ara Anjargolian
Performant Django - Ara AnjargolianPerformant Django - Ara Anjargolian
Performant Django - Ara AnjargolianHakka Labs
 
DevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesDevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesFab L
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...DevSecCon
 
Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!mold
 
XPDays Ukraine: Legacy
XPDays Ukraine: LegacyXPDays Ukraine: Legacy
XPDays Ukraine: LegacyVictor_Cr
 
10 Things Designers Do That Piss Developers Off (And Vice Versa)
10 Things Designers Do That Piss Developers Off (And Vice Versa)10 Things Designers Do That Piss Developers Off (And Vice Versa)
10 Things Designers Do That Piss Developers Off (And Vice Versa)Mindy Wagner
 
Architecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons LearnedArchitecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons LearnedJoão Pedro Martins
 
UVA MDST 3703 JavaScript (ii) 2012-10-04
UVA MDST 3703 JavaScript (ii) 2012-10-04UVA MDST 3703 JavaScript (ii) 2012-10-04
UVA MDST 3703 JavaScript (ii) 2012-10-04Rafael Alvarado
 

Similar to Dealing with dependencies in tests (20)

Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)Become a Better Developer with Debugging Techniques for Drupal (and more!)
Become a Better Developer with Debugging Techniques for Drupal (and more!)
 
Keeping lab notes as a software developer
Keeping lab notes as a software developerKeeping lab notes as a software developer
Keeping lab notes as a software developer
 
Software Design Notes
Software Design NotesSoftware Design Notes
Software Design Notes
 
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
 
Reusable Apps
Reusable AppsReusable Apps
Reusable Apps
 
Commit Hooks: the Subtle Hammer
Commit Hooks: the Subtle HammerCommit Hooks: the Subtle Hammer
Commit Hooks: the Subtle Hammer
 
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons LearnedITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
ITARC15 Workshop - Architecting a Large Software Project - Lessons Learned
 
Usable Software Design
Usable Software DesignUsable Software Design
Usable Software Design
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your life
 
Sync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpnSync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpn
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....
 
From dev to ops and beyond - getting it done
From dev to ops and beyond - getting it doneFrom dev to ops and beyond - getting it done
From dev to ops and beyond - getting it done
 
Performant Django - Ara Anjargolian
Performant Django - Ara AnjargolianPerformant Django - Ara Anjargolian
Performant Django - Ara Anjargolian
 
DevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation SlidesDevSecCon SG 2018 Fabian Presentation Slides
DevSecCon SG 2018 Fabian Presentation Slides
 
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...DevSecCon Singapore 2018 -  Remove developers’ shameful secrets or simply rem...
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
 
Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!Catalyst - refactor large apps with it and have fun!
Catalyst - refactor large apps with it and have fun!
 
XPDays Ukraine: Legacy
XPDays Ukraine: LegacyXPDays Ukraine: Legacy
XPDays Ukraine: Legacy
 
10 Things Designers Do That Piss Developers Off (And Vice Versa)
10 Things Designers Do That Piss Developers Off (And Vice Versa)10 Things Designers Do That Piss Developers Off (And Vice Versa)
10 Things Designers Do That Piss Developers Off (And Vice Versa)
 
Architecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons LearnedArchitecting a Large Software Project - Lessons Learned
Architecting a Large Software Project - Lessons Learned
 
UVA MDST 3703 JavaScript (ii) 2012-10-04
UVA MDST 3703 JavaScript (ii) 2012-10-04UVA MDST 3703 JavaScript (ii) 2012-10-04
UVA MDST 3703 JavaScript (ii) 2012-10-04
 

More from Diego Pacheco

Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!Diego Pacheco
 
Continuous Discovery Habits Book Review.pdf
Continuous Discovery Habits  Book Review.pdfContinuous Discovery Habits  Book Review.pdf
Continuous Discovery Habits Book Review.pdfDiego Pacheco
 
Encryption Deep Dive
Encryption Deep DiveEncryption Deep Dive
Encryption Deep DiveDiego Pacheco
 
Management: Doing the non-obvious! III
Management: Doing the non-obvious! IIIManagement: Doing the non-obvious! III
Management: Doing the non-obvious! IIIDiego Pacheco
 
Management doing the non-obvious II
Management doing the non-obvious II Management doing the non-obvious II
Management doing the non-obvious II Diego Pacheco
 
Testing in production
Testing in productionTesting in production
Testing in productionDiego Pacheco
 
Nine lies about work
Nine lies about workNine lies about work
Nine lies about workDiego Pacheco
 
Management: doing the nonobvious!
Management: doing the nonobvious!Management: doing the nonobvious!
Management: doing the nonobvious!Diego Pacheco
 
The Death of Microservices
The Death of MicroservicesThe Death of Microservices
The Death of MicroservicesDiego Pacheco
 
Making sense of streaming
Making sense of streamingMaking sense of streaming
Making sense of streamingDiego Pacheco
 
Understand the system
Understand the systemUnderstand the system
Understand the systemDiego Pacheco
 

More from Diego Pacheco (19)

Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!
 
Continuous Discovery Habits Book Review.pdf
Continuous Discovery Habits  Book Review.pdfContinuous Discovery Habits  Book Review.pdf
Continuous Discovery Habits Book Review.pdf
 
Holacracy
HolacracyHolacracy
Holacracy
 
AWS IAM
AWS IAMAWS IAM
AWS IAM
 
Encryption Deep Dive
Encryption Deep DiveEncryption Deep Dive
Encryption Deep Dive
 
Sec 101
Sec 101Sec 101
Sec 101
 
Management: Doing the non-obvious! III
Management: Doing the non-obvious! IIIManagement: Doing the non-obvious! III
Management: Doing the non-obvious! III
 
Management doing the non-obvious II
Management doing the non-obvious II Management doing the non-obvious II
Management doing the non-obvious II
 
Testing in production
Testing in productionTesting in production
Testing in production
 
Nine lies about work
Nine lies about workNine lies about work
Nine lies about work
 
Management: doing the nonobvious!
Management: doing the nonobvious!Management: doing the nonobvious!
Management: doing the nonobvious!
 
AI and the Future
AI and the FutureAI and the Future
AI and the Future
 
Hardening
HardeningHardening
Hardening
 
Sidecars
SidecarsSidecars
Sidecars
 
The Death of Microservices
The Death of MicroservicesThe Death of Microservices
The Death of Microservices
 
SRE 101
SRE 101SRE 101
SRE 101
 
Making sense of streaming
Making sense of streamingMaking sense of streaming
Making sense of streaming
 
SOA.2020
SOA.2020SOA.2020
SOA.2020
 
Understand the system
Understand the systemUnderstand the system
Understand the system
 

Recently uploaded

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

Dealing with dependencies in tests

  • 1. Dealing with Team Dependencies in Tests Diego Pacheco
  • 2. @diego_pacheco ❏ Cat's Father ❏ Head of Software Architecture ❏ Agile Coach ❏ SOA/Microservices Expert ❏ DevOps Practitioner ❏ Speaker ❏ Author diegopacheco http://diego-pacheco.blogspot.com.br/ About me... https://diegopacheco.github.io/
  • 3. Going Down == Going Faster? Dependencies?
  • 4. Test Doubles ❏ Also known as “Impostors”. Much before AmongUs! ❏ There are multiple Flavors: Fakes, Mocks, Spys, Stubs and Dummy. ❏ Motivations: ❏ Verify code when dependency is unusable ❏ Avoiding Slow Tests ❏ Wrongly: People often call all “Mocks”.
  • 6. Dealing with dependencies is not a free lunch
  • 7. Fakes ❏ Objects with Working Implementations but not the same as the REAL production ones. ❏ Usually Dynamic. You can add data. ❏ Usually using gortcuts and simplified versions. ❏ I.e: Faking Redis with a HashMap in memory. ❏ I.e: Postgres DAO in memory. User Service <REAL> UserPostgresDAO <Test> UserFakePostgresDAO
  • 8. Stub ❏ Holds predefined Data and use it to answer questions on tests. ❏ Use it when we don't want we cannot use real data because side effects. ❏ Often used when the target code does not allow you to control input objects. ❏ Similar to FAKE but static. Fake is Dynamic. ❏ I.e: You have PII Data and don't want return real user data. ❏ I.e: You have to test a GET record but the api takes 7 days to activate it. Profile Service <PII DATA> RedisProfileDao <Test - PRE-defined fake data> StubProfileDao
  • 9. Mocks ❏ Register Calls they received. ❏ You can verify is specific actions happened. More complex than Stubs. ❏ Solutions: Mockitto, EasyMocks, PowerMocks. ❏ I.e: Return void and send emails. Want to verify that email service was called.
  • 10. Spys ❏ It might be better change the design - think twice before doing it. ❏ Special kind of Mocks. ❏ Register some information on how they were called. ❏ Capture the target method to know is was called or not. ❏ i.e : A Mail service, how many messages were sent? ❏ I.e: Legacy code that might be impossible to test with Stubs And mocks.
  • 11. Dummy ❏ No Implementation. Simple to do it. ❏ Often used to satisfy an method argument need. ❏ Could be either Dummy values or Dummy Objects. ❏ I.e: You need pass a parameter that you don't care or is not useful for you test. Like a notification callback or customization /parametrization you don't care.
  • 12. Isolation Matters! ❏ A good design - It should be easy to test right? ❏ Specially for shared libraries ❏ Hiding Implementation Details ❏ Less public classes ❏ Avoid Coupling with DI/IoC Libraries. ❏ Avoid coupling - Reduce surface, reduce customization. ❏ As Results - Harder to Test. Not necessary wrong.
  • 13. Cross Cutting Concerns like i.e: AUTH. ❏ Functional and Nonfunctional requirements can be: ❏ Cutting and Cross-cutting concerns. ❏ Even business rules can be cross-cutting concerns. ❏ AUTH often is implemented in a centralized fashion. ❏ But imagine is was implemented Component by component basis Would you easily disable it in order to speed up tests? For sure you Should be able to mock project by project but would that be The right call?
  • 14. Dealing with Team Dependencies in Tests Diego Pacheco