SlideShare una empresa de Scribd logo
1 de 26
WHY
FAKE IT
WHEN YOU CAN
FAKE IT EASY
Dan
Stroh

• Husband
• Father
• Software developer for
Meta Payment
Systems

• Home brewer
• Stat guy
AGENDA
• Goals
• Anatomy of a Unit Test
• Pillars of Unit Testing
• Unit testing
Development Practices

• Inversion of control

• Fakes, Mocks,
Stubs

• Mocking
Frameworks

• FakeItEasy
• Recap
• Questions
GOALS
• Write good unit tests
• Know what a good unit test looks like
• Use a mocking framework
ANATOMY OF A UNIT TEST
A
A
A
ARRANGE
ACT
ASSERT
PILLARS OF UNIT TESTING
UNIT TESTING DEVELOPMENT PRACTICES
TAD
TEST AFTER DEVELOPMENT
TDD
TEST DRIVEN DEVELOPMENT
BDD
BEHAVIOR DRIVEN DEVELOPMENT
FAKES, MOCKS, AND STUBS
INVERSION OF CONTROL
CONSTRUCTOR INJECTION
PROPERTY INJECTION
ARGUMENT INJECTION
MOCKING FRAMEWORKS
FakeItEasy
(nuget) github.com/fakeiteasy
Rhino Mocks
(nuget) hibernatingrhinos.com/oss/rhino-mocks
Moq
(nuget) github.com/Moq
Microsoft Fakes
msdn.microsoft.com/en-us/library/hh549175%28v=vs.110%29.aspx
TypeMocks
typemock.com
JustMock
(nuget) telerik.com/products/mocking.aspx
Nmock
(nuget) nmock3.codeplex.com
Nsubstitute (nuget) nsubstitute.github.io/
EasyMock .Net
sourceforge.net/projects/easymocknet/
FAKEITEASY
RECAP
WRITE GOOD UNIT TESTS
KNOW WHAT A GOOD UNIT TEST LOOKS
LIKE
USE A MOCKING FRAMEWORK
QUESTIONS
STROH.SD@GMAIL.COM
THANK YOU

Más contenido relacionado

Destacado

Destacado (10)

SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC
SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC
SELP TRUST PRESENTS PRIZE TO WINNERS IN SSLC
 
Marx, karl el capital i (parte 1)
Marx, karl   el capital i (parte 1)Marx, karl   el capital i (parte 1)
Marx, karl el capital i (parte 1)
 
Metodologias investigacion
Metodologias investigacionMetodologias investigacion
Metodologias investigacion
 
Metodología de la investigación módulo i- niveles de investigación
Metodología de la investigación módulo i- niveles de investigaciónMetodología de la investigación módulo i- niveles de investigación
Metodología de la investigación módulo i- niveles de investigación
 
Francis bacon - novum organum
Francis bacon - novum organumFrancis bacon - novum organum
Francis bacon - novum organum
 
Metodología de la investigación h- sampieri (5ta edición)
Metodología de la investigación   h- sampieri (5ta edición)Metodología de la investigación   h- sampieri (5ta edición)
Metodología de la investigación h- sampieri (5ta edición)
 
Proceso logistico de coca cola
Proceso logistico de coca colaProceso logistico de coca cola
Proceso logistico de coca cola
 
Modelo de espectaticas de victor vroom
Modelo de espectaticas de victor  vroomModelo de espectaticas de victor  vroom
Modelo de espectaticas de victor vroom
 
1 читательский дневник
1 читательский  дневник1 читательский  дневник
1 читательский дневник
 
Fotográfica Bogotá - Tríptico final a color
Fotográfica Bogotá - Tríptico final a colorFotográfica Bogotá - Tríptico final a color
Fotográfica Bogotá - Tríptico final a color
 

Similar a Why just fake it

Software Architecture: Test Case Writing
Software Architecture: Test Case WritingSoftware Architecture: Test Case Writing
Software Architecture: Test Case Writing
Sitdhibong Laokok
 
Acceptance testfurureinmind
Acceptance testfurureinmindAcceptance testfurureinmind
Acceptance testfurureinmind
LeanDog
 
prdc10-tdd-patterns
prdc10-tdd-patternsprdc10-tdd-patterns
prdc10-tdd-patterns
Amir Barylko
 
Introduction to unit testing
Introduction to unit testingIntroduction to unit testing
Introduction to unit testing
Gil Zilberfeld
 
Practical (J)Unit Testing (2009)
Practical (J)Unit Testing (2009)Practical (J)Unit Testing (2009)
Practical (J)Unit Testing (2009)
Peter Kofler
 
Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014
Pedro Santos
 
'An Evolution Into Specification By Example' by Adam Knight
'An Evolution Into Specification By Example' by Adam Knight'An Evolution Into Specification By Example' by Adam Knight
'An Evolution Into Specification By Example' by Adam Knight
TEST Huddle
 

Similar a Why just fake it (20)

[DevSecOps Live] DevSecOps: Challenges and Opportunities
[DevSecOps Live] DevSecOps: Challenges and Opportunities[DevSecOps Live] DevSecOps: Challenges and Opportunities
[DevSecOps Live] DevSecOps: Challenges and Opportunities
 
Unit testing for Cocoa developers
Unit testing for Cocoa developersUnit testing for Cocoa developers
Unit testing for Cocoa developers
 
Software Architecture: Test Case Writing
Software Architecture: Test Case WritingSoftware Architecture: Test Case Writing
Software Architecture: Test Case Writing
 
Acceptance testfurureinmind
Acceptance testfurureinmindAcceptance testfurureinmind
Acceptance testfurureinmind
 
Introduction To Web Application Testing
Introduction To Web Application TestingIntroduction To Web Application Testing
Introduction To Web Application Testing
 
Devday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvuDevday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvu
 
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
OSSF 2018 - Jamie Jones of GitHub - Pull what where? Contributing to Open Sou...
 
What CS Class Didn't Teach About Testing
What CS Class Didn't Teach About TestingWhat CS Class Didn't Teach About Testing
What CS Class Didn't Teach About Testing
 
Design For Testability
Design For TestabilityDesign For Testability
Design For Testability
 
Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)Test Driven Development on Android (Kotlin Kenya)
Test Driven Development on Android (Kotlin Kenya)
 
Create an architecture for web test automation
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automation
 
Anatomy of Test Driven Development
Anatomy of Test Driven DevelopmentAnatomy of Test Driven Development
Anatomy of Test Driven Development
 
prdc10-tdd-patterns
prdc10-tdd-patternsprdc10-tdd-patterns
prdc10-tdd-patterns
 
Completely Test-Driven
Completely Test-DrivenCompletely Test-Driven
Completely Test-Driven
 
Introduction to unit testing
Introduction to unit testingIntroduction to unit testing
Introduction to unit testing
 
Unit Testing in JavaScript
Unit Testing in JavaScriptUnit Testing in JavaScript
Unit Testing in JavaScript
 
Practical (J)Unit Testing (2009)
Practical (J)Unit Testing (2009)Practical (J)Unit Testing (2009)
Practical (J)Unit Testing (2009)
 
Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014Intro TDD Portuguese developers meetup London 16/04/2014
Intro TDD Portuguese developers meetup London 16/04/2014
 
'An Evolution Into Specification By Example' by Adam Knight
'An Evolution Into Specification By Example' by Adam Knight'An Evolution Into Specification By Example' by Adam Knight
'An Evolution Into Specification By Example' by Adam Knight
 
Taking a Test Drive: iOS Dev UK guide to TDD
Taking a Test Drive: iOS Dev UK guide to TDDTaking a Test Drive: iOS Dev UK guide to TDD
Taking a Test Drive: iOS Dev UK guide to TDD
 

Último

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

Why just fake it