SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
Test-driven development in
with BabyMock 2

Attila Magyar
FOSDEM 01/02/2014
Brussels
Who am I?

Attila Magyar
●

Java for living

●

Smalltalk for joy, since 2012
●

●

Python, Groovy, Lisp, etc..

TDD for about 4 years
Contact:
http://twitter.com/zeroflag
Agenda

●

●

●

About TDD and Mock objects in general
About BabyMock 2
● Differences between the new and the old version
● How does it work?
● Few words about the internals
DEMO
Outside-in TDD with Mocks

B
3
age
ss
Me

Message 2

A
Me
ssa
ge
4

R
es
po
ns
e

Test

Message 1

C
Expect Message 3
●
Exactly once
●
With x argument
●

Outside-in TDD with Mocks

MOCK B
3
age
ss
Me

Message 2

Allow Message 4
● Any number of times
● With y argument
● Answer „Response”

A

●

Me
ssa
ge
4

R
es
po
ns
e

Test

Message 1

Inter-object protocol

MOCK C
BabyMock is a visual mock object library
http://smalltalkhub.com/#!/~zeroflag/BabyMock2/

Get a good mental picture of the objects relationships, and
the inter-object protocol
●

●

Identifying test failures is easier
The old syntax (BabyMock 1)
The new syntax (BabyMock 2)
Expectations
Under the hood
How does it work?
●

●

●

Mock object is a Proxy that intercepts all messages
Using the doesNotUnderstand is easiest way to implement it
(but limited).
Nil methodDictionary + cannotInterpret
More information:
Efficient Proxies in Smalltalk by Mariano Martinez Peck et al.
BabyMock visualized with BabyMock
BabyMock visualized with BabyMock
BabyMock visualized with BabyMock
DEMO

ShoppingCart
●

Adding new item ids

●

CreditCard

●

Paying for its content

●

PriceCatalog
Food for thought

●

http://jmock.org/
(https://github.com/jmock-developers/jmock-library)

●

Evolving an Embedded Domain-Specific Language in Java, Freeman, S. and Pryce, N.

●

Mock Roles, Not Objects. OOPSLA 2004, Freeman, S., Mackinnon, T., Pryce, N., Walnes, J.,

●

Growing Object-Oriented Software, Guided by Tests, Freeman, S. and Pryce, N.

●

Efficient Proxies in Smalltalk, Mariano Martinez Peck et al.

Más contenido relacionado

Similar a TDD with BabyMock 2

How to deliver the right software (Specification by example)
How to deliver the right software (Specification by example)How to deliver the right software (Specification by example)
How to deliver the right software (Specification by example)Asier Barrenetxea
 
Standing out as a new grad candidate
Standing out as a new grad candidateStanding out as a new grad candidate
Standing out as a new grad candidateSashko Stubailo
 
Haik Mherian: ChatGPT: Master Effective Dialogue
Haik Mherian: ChatGPT: Master Effective DialogueHaik Mherian: ChatGPT: Master Effective Dialogue
Haik Mherian: ChatGPT: Master Effective DialogueLviv Startup Club
 
Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Peter Kofler
 
Technical interview experience sharing
Technical interview experience sharingTechnical interview experience sharing
Technical interview experience sharingKaty Lee
 
Pair Programming (2014)
Pair Programming (2014)Pair Programming (2014)
Pair Programming (2014)Peter Kofler
 
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...Prasid Pathak
 
Informal talk at pict
Informal talk at pictInformal talk at pict
Informal talk at pictMayank Jain
 
Itgopro programmingforkids
Itgopro programmingforkidsItgopro programmingforkids
Itgopro programmingforkidsRichGuerra
 
Teach yourself Ruby on Rails
Teach yourself Ruby on RailsTeach yourself Ruby on Rails
Teach yourself Ruby on Railspatrikbona
 
Kickstarting career as an Android developer.pdf
Kickstarting career as an Android developer.pdfKickstarting career as an Android developer.pdf
Kickstarting career as an Android developer.pdfShreyaDhurde
 
How not to fail at programming education
How not to fail at programming educationHow not to fail at programming education
How not to fail at programming educationEsther Seyffarth
 
Tips sukses berkarir sebagai developer dan programmer 2021
Tips sukses berkarir sebagai developer dan programmer 2021Tips sukses berkarir sebagai developer dan programmer 2021
Tips sukses berkarir sebagai developer dan programmer 2021DicodingEvent
 
Intro to Technical Writing: Creating Content that Google and Readers will Love
Intro to Technical Writing: Creating Content that Google and Readers will LoveIntro to Technical Writing: Creating Content that Google and Readers will Love
Intro to Technical Writing: Creating Content that Google and Readers will LoveLauren Hayward Schaefer
 
Gsoc2012 checklist
Gsoc2012 checklistGsoc2012 checklist
Gsoc2012 checklistDavid Bain
 
Code Retreat Venice (2016)
Code Retreat Venice (2016)Code Retreat Venice (2016)
Code Retreat Venice (2016)Peter Kofler
 
Writing clean scientific software Murphy cleancoding
Writing clean scientific software Murphy cleancodingWriting clean scientific software Murphy cleancoding
Writing clean scientific software Murphy cleancodingsaber tabatabaee
 

Similar a TDD with BabyMock 2 (20)

How to deliver the right software (Specification by example)
How to deliver the right software (Specification by example)How to deliver the right software (Specification by example)
How to deliver the right software (Specification by example)
 
Standing out as a new grad candidate
Standing out as a new grad candidateStanding out as a new grad candidate
Standing out as a new grad candidate
 
Introduce Python
Introduce PythonIntroduce Python
Introduce Python
 
LET'S TALK ANDROID Dev
LET'S TALK ANDROID DevLET'S TALK ANDROID Dev
LET'S TALK ANDROID Dev
 
Haik Mherian: ChatGPT: Master Effective Dialogue
Haik Mherian: ChatGPT: Master Effective DialogueHaik Mherian: ChatGPT: Master Effective Dialogue
Haik Mherian: ChatGPT: Master Effective Dialogue
 
Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)Coding Dojo: Fun with Tic-Tac-Toe (2014)
Coding Dojo: Fun with Tic-Tac-Toe (2014)
 
Technical interview experience sharing
Technical interview experience sharingTechnical interview experience sharing
Technical interview experience sharing
 
Pair Programming (2014)
Pair Programming (2014)Pair Programming (2014)
Pair Programming (2014)
 
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
Beginner's Guide to Frontend Development: Comparing Angular, React, Ember, an...
 
Informal talk at pict
Informal talk at pictInformal talk at pict
Informal talk at pict
 
Itgopro programmingforkids
Itgopro programmingforkidsItgopro programmingforkids
Itgopro programmingforkids
 
Teach yourself Ruby on Rails
Teach yourself Ruby on RailsTeach yourself Ruby on Rails
Teach yourself Ruby on Rails
 
Kickstarting career as an Android developer.pdf
Kickstarting career as an Android developer.pdfKickstarting career as an Android developer.pdf
Kickstarting career as an Android developer.pdf
 
How not to fail at programming education
How not to fail at programming educationHow not to fail at programming education
How not to fail at programming education
 
Coding Dojo Applied
Coding Dojo AppliedCoding Dojo Applied
Coding Dojo Applied
 
Tips sukses berkarir sebagai developer dan programmer 2021
Tips sukses berkarir sebagai developer dan programmer 2021Tips sukses berkarir sebagai developer dan programmer 2021
Tips sukses berkarir sebagai developer dan programmer 2021
 
Intro to Technical Writing: Creating Content that Google and Readers will Love
Intro to Technical Writing: Creating Content that Google and Readers will LoveIntro to Technical Writing: Creating Content that Google and Readers will Love
Intro to Technical Writing: Creating Content that Google and Readers will Love
 
Gsoc2012 checklist
Gsoc2012 checklistGsoc2012 checklist
Gsoc2012 checklist
 
Code Retreat Venice (2016)
Code Retreat Venice (2016)Code Retreat Venice (2016)
Code Retreat Venice (2016)
 
Writing clean scientific software Murphy cleancoding
Writing clean scientific software Murphy cleancodingWriting clean scientific software Murphy cleancoding
Writing clean scientific software Murphy cleancoding
 

Último

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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 Processorsdebabhi2
 
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)wesley chun
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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 educationjfdjdjcjdnsjd
 
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?Antenna Manufacturer Coco
 
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 DiscoveryTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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 slidevu2urc
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Último (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
[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
 
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
 
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)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
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?
 
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
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

TDD with BabyMock 2