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

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
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
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
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

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!
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
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
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

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