SlideShare a Scribd company logo
© Asprotunity Ltd
Giovanni Asproni
email: gasproni@asprotunity.com
twitter: @gasproni
linkedin: http://www.linkedin.com/in/gasproni
Faking Hell
Use, abuse and misuse of fakes, mocks and other test doubles
1
© Asprotunity Ltd
Test Doubles
• Sometimes we need to test classes that interact with other objects which are difficult to control
• The real object has nondeterministic behaviour (e.g., random number generator)
• The real object is difficult to set up (e.g., requiring a certain file system, database, or network
environment)
• The real object has behaviour that is hard to trigger (e.g., a network error)
• The real object is slow
• The real object has (or is) a user interface
• The test needs to ask the real object about how it was used (e.g., confirm that a callback
function was actually called)
• The real object does not yet exist (e.g., interfacing with other teams or new hardware
systems)
2
© Asprotunity Ltd
Test Doubles
• Dummies
• Stubs
• Spies
• Fakes
• Mocks
3
© Asprotunity Ltd
Dummies
• Dummy objects are passed around but never
actually used
• E.g., a mandatory argument in a constructor never
used during a specific test
4
© Asprotunity Ltd
Stubs
• Stubs provide canned answers to calls made during
the test
5
© Asprotunity Ltd
Spies
• Spies are stubs that also record some information
based on how they were called. (e.g., the number of
times a method has been called)
6
© Asprotunity Ltd 7
public class OrderStateTest {
private static String TALISKER = "Talisker";
private WarehouseStub warehouse = new WarehouseStub();
@Test
public void orderIsFilledIfEnoughInWarehouse() {
Order order = new Order(TALISKER, 50);
order.fill(warehouse);
assertTrue(order.isFilled())
assertTrue(warehouse.removeCalled);
}
@Test
public void orderDoesNotRemoveIfNotEnough() {
Order order = new Order(TALISKER, 51);
order.fill(warehouse);
assertFalse(order.isFilled());
assertFalse(warehouse.removeCalled);
}
}
Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
public class WarehouseStub implements Warehouse {
public boolean removeCalled = false;
public void hasInventory(String brand, int amount) {
return “Talisker”.equals(brand) && amount <= 50
}
public void remove(String brand, int amount) {
removeCalled = true;
}
…..
}
© Asprotunity Ltd
Fakes
• Fake objects actually have working
implementations, but take some shortcuts which
make them not suitable for production (e.g., an in
memory database)
8
© Asprotunity Ltd 9
public class OrderStateTest {
private static String TALISKER = "Talisker";
private Warehouse warehouse = new WarehouseFake();
@Test
public void orderIsFilledIfEnoughInWarehouse() {
Order order = new Order(TALISKER, 50);
order.fill(warehouse);
assertTrue(order.isFilled())
}
@Test
public void orderDoesNotRemoveIfNotEnough() {
Order order = new Order(TALISKER, 51);
order.fill(warehouse);
assertFalse(order.isFilled());
}
}
Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
public class WarehouseFake implements Warehouse {
private HashMap<String, Integer> inventoryByBrand;
public WarehouseFake() {
inventoryByBrand =
new HashMap<>(){{put(“Talisker”, 50);}}
}
public void hasInventory(String brand, int required) {
available = inventoryByBrand.get(brand)
return available != null && required <= available;
}
public void remove(String brand, int amount) {
available = inventoryByBrand.get(brand)
if (available == null || amount > available) {
// Manage the error…
}
else {
inventoryByBrand.put(brand, available - amount);
}
}
…..
}
© Asprotunity Ltd
Mocks
• Mocks are objects pre-programmed with
expectations which form a specification of the calls
they are expected to receive
10
© Asprotunity Ltd
History of MockObjects
• Invented at Connextra and XtC in 1999
• The initial purpose was to get rid of getters in testing
• Component composition
• Tell don’t ask
• Testing behaviours
• More at http://www.mockobjects.com/2009/09/brief-
history-of-mock-objects.html
11
© Asprotunity Ltd 12
Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
@Test
public void fillingDoesNotRemoveIfNotEnoughInStock() {
Order order = new Order(TALISKER, 51);
Mockery context = new JUnit4Mockery();
Warehouse mockWarehouse = context.mock(Warehouse.class);
//setup - expectations
context.checking(new Expectations() {{
oneOf(mockWarehouse).hasInventory(with(any(String.class)), with(any(int.class)));
will(returnValue(false));
never(mockWarehouse).remove(with(any(String.class)), with(any(int.class)));
}});
order.fill(mockWarehouse));
context.assertIsSatisfied();
assertFalse(order.isFilled());
}
© Asprotunity Ltd
Mocks Aren’t Stubs
• Mocks are meant for testing behaviour
• Stubs and all other doubles are generally used for
testing state
• Classic TDD vs Mockist TDD (Classic school vs
London School of TDD)
13
http://martinfowler.com/articles/mocksArentStubs.html
© Asprotunity Ltd 14
public class OrderStateTest {
private static String TALISKER = "Talisker";
private Warehouse warehouse = new WarehouseStub();
@Test
public void orderIsFilledIfEnoughInWarehouse() {
Order order = new Order(TALISKER, 50);
order.fill(warehouse);
assertTrue(order.isFilled())
}
@Test
public void orderDoesNotRemoveIfNotEnough() {
Order order = new Order(TALISKER, 51);
order.fill(warehouse);
assertFalse(order.isFilled());
}
}
Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
public class WarehouseStub implements Warehouse {
public void hasInventory(String brand, int amount) {
return “Talisker”.equals(brand) && amount <= 50
}
public void remove(String brand, int amount) {
// Intentionally blank
}
…..
}
© Asprotunity Ltd 15
public class OrderInteractionTest {
private static String TALISKER = "Talisker";
@Test
public void fillingRemovesInventoryIfInStock() {
//setup - data
Order order = new Order(TALISKER, 50);
Mockery context = new JUnit4Mockery();
Warehouse mockWarehouse = context.mock(Warehouse.class);
//setup - expectations
context.checking(new Expectations() {{
oneOf(mockWarehouse).hasInventory(TALISKER, 50);
will(returnValue(true));
oneOf(mockWarehouse).remove(TALISKER, 50);
}});
order.fill(mockWarehouse);
context.assertIsSatisfied();
assertTrue(order.isFilled());
}
Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
© Asprotunity Ltd 16
Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
@Test
public void fillingDoesNotRemoveIfNotEnoughInStock() {
Order order = new Order(TALISKER, 51);
Mockery context = new JUnit4Mockery();
Warehouse mockWarehouse = context.mock(Warehouse.class);
//setup - expectations
context.checking(new Expectations() {{
oneOf(mockWarehouse).hasInventory(with(any(String.class)), with(any(int.class)));
will(returnValue(false));
never(mockWarehouse).remove(with(any(String.class)), with(any(int.class)));
}});
order.fill(mockWarehouse));
context.assertIsSatisfied();
assertFalse(order.isFilled());
}
© Asprotunity Ltd 17
Outside-In And Middle-Out
Database
Client
GUI Domain layer Server
Walking skeleton
© Asprotunity Ltd
Sometimes we need to test
state, sometimes we need
to test behaviour, and
sometimes we need both
18
State Or Behaviour?
© Asprotunity Ltd
Problems Frequently Due To
• The design of the application is unfit for purpose
• The test has no clear purpose
• Plain old confusion
• …I just want to increase code coverage…
19
© Asprotunity Ltd
The Design Of The Application Is Unfit For
Purpose
• Too many dependencies to mock
• Too many interactions with a single mock object
• Mocks nested into each other
20
© Asprotunity Ltd
The Test Has No Clear Purpose
• Testing state or behaviour?
• Fakes or stubs used to test behaviour
• Use of mock objects used to test state
21
© Asprotunity Ltd 22
public class OrderStateTest {
private static String TALISKER = "Talisker";
private WarehouseStub warehouse = new WarehouseStub();
@Test
public void orderIsFilledIfEnoughInWarehouse() {
Order order = new Order(TALISKER, 50);
order.fill(warehouse);
assertTrue(order.isFilled())
assertTrue(warehouse.removeCalled);
}
@Test
public void orderDoesNotRemoveIfNotEnough() {
Order order = new Order(TALISKER, 51);
order.fill(warehouse);
assertFalse(order.isFilled());
assertFalse(warehouse.removeCalled);
}
}
Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
public class WarehouseStub implements Warehouse {
public boolean removeCalled = false;
public void hasInventory(String brand, int amount) {
return “Talisker”.equals(brand) && amount <= 50
}
public void remove(String brand, int amount) {
removeCalled = true;
}
…..
}
© Asprotunity Ltd 23
public class OrderInteractionTest {
private static String TALISKER = "Talisker";
@Test
public void fillingRemovesInventoryIfInStock() {
//setup - data
Order order = new Order(TALISKER, 50);
Mockery context = new JUnit4Mockery();
Warehouse mockWarehouse = context.mock(Warehouse.class);
//setup - expectations
context.checking(new Expectations() {{
oneOf(mockWarehouse).hasInventory(TALISKER, 50);
will(returnValue(true));
oneOf(mockWarehouse).remove(TALISKER, 50);
}});
order.fill(mockWarehouse);
// We don’t check that context.assertIsSatisfied();
assertTrue(order.isFilled());
}
Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
© Asprotunity Ltd
Plain Old Confusion
• Testing the mocks
• Too many dependencies or interactions
• Partial mocking
24
© Asprotunity Ltd 25
…I just want to increase code coverage…
© Asprotunity Ltd
The Solution To Those Problems?
• Learn to listen to what the tests are telling you
• Avoid dubious practices as much as possible
• Partial mocks
• Mocking concrete classes
• Monkey patching
26
© Asprotunity Ltd 27
To Mock Or Not To Mock?
© Asprotunity Ltd
Test Doubles: Some Advantages
• Clarify which interactions are actually important for
the test
• Help in design protocols
• Make testing of some behaviours possible
• Allows for creation of faster tests
• Can alleviate dependencies on other teams
28
© Asprotunity Ltd
Test Doubles: Some (Alleged) Disadvantages
• Duplication of effort
• Changes of behaviour of the real object need to
be reflected in the test doubles
• Tests coupled to implementation (in case of mocks)
29
© Asprotunity Ltd
I’m Biased
• I find test doubles useful
• The important thing is to know which ones to use when
• …and when it’s best to use the real object
• The real object is“simple”to build and to interact with
• Full system tests
• Etc.
30
© Asprotunity Ltd 31
Questions?
© Asprotunity Ltd 32
Ad

More Related Content

What's hot (20)

Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest Matchers
Shai Yallin
 
No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012
Alex Soto
 
Server1
Server1Server1
Server1
FahriIrawan3
 
Google guava overview
Google guava overviewGoogle guava overview
Google guava overview
Steve Min
 
Testing the waters of iOS
Testing the waters of iOSTesting the waters of iOS
Testing the waters of iOS
Kremizas Kostas
 
ActiveRecord Query Interface (1), Season 1
ActiveRecord Query Interface (1), Season 1ActiveRecord Query Interface (1), Season 1
ActiveRecord Query Interface (1), Season 1
RORLAB
 
Developer Test - Things to Know
Developer Test - Things to KnowDeveloper Test - Things to Know
Developer Test - Things to Know
vilniusjug
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap Dumps
Andrei Pangin
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
wahyuseptiansyah
 
Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113
SOAT
 
J unit스터디슬라이드
J unit스터디슬라이드J unit스터디슬라이드
J unit스터디슬라이드
ksain
 
Google Guava
Google GuavaGoogle Guava
Google Guava
Scott Leberknight
 
Software Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW SydneySoftware Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW Sydney
julien.ponge
 
The core libraries you always wanted - Google Guava
The core libraries you always wanted - Google GuavaThe core libraries you always wanted - Google Guava
The core libraries you always wanted - Google Guava
Mite Mitreski
 
Executable documentation
Executable documentationExecutable documentation
Executable documentation
Russell Gold
 
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
Danny Preussler
 
Lab4
Lab4Lab4
Lab4
siragezeynu
 
Recommending Method Invocation Context Changes
Recommending Method Invocation Context ChangesRecommending Method Invocation Context Changes
Recommending Method Invocation Context Changes
Beat Fluri
 
COScheduler In Depth
COScheduler In DepthCOScheduler In Depth
COScheduler In Depth
WO Community
 
Writing and using Hamcrest Matchers
Writing and using Hamcrest MatchersWriting and using Hamcrest Matchers
Writing and using Hamcrest Matchers
Shai Yallin
 
No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012
Alex Soto
 
Google guava overview
Google guava overviewGoogle guava overview
Google guava overview
Steve Min
 
Testing the waters of iOS
Testing the waters of iOSTesting the waters of iOS
Testing the waters of iOS
Kremizas Kostas
 
ActiveRecord Query Interface (1), Season 1
ActiveRecord Query Interface (1), Season 1ActiveRecord Query Interface (1), Season 1
ActiveRecord Query Interface (1), Season 1
RORLAB
 
Developer Test - Things to Know
Developer Test - Things to KnowDeveloper Test - Things to Know
Developer Test - Things to Know
vilniusjug
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap Dumps
Andrei Pangin
 
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coinsoft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch - Java SE 7: The Fork/Join Framework and Project Coin
soft-shake.ch
 
201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
wahyuseptiansyah
 
Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113
SOAT
 
J unit스터디슬라이드
J unit스터디슬라이드J unit스터디슬라이드
J unit스터디슬라이드
ksain
 
Software Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW SydneySoftware Testing - Invited Lecture at UNSW Sydney
Software Testing - Invited Lecture at UNSW Sydney
julien.ponge
 
The core libraries you always wanted - Google Guava
The core libraries you always wanted - Google GuavaThe core libraries you always wanted - Google Guava
The core libraries you always wanted - Google Guava
Mite Mitreski
 
Executable documentation
Executable documentationExecutable documentation
Executable documentation
Russell Gold
 
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
15 tips to improve your unit tests (Droidcon Berlin 2016 Barcamp)
Danny Preussler
 
Recommending Method Invocation Context Changes
Recommending Method Invocation Context ChangesRecommending Method Invocation Context Changes
Recommending Method Invocation Context Changes
Beat Fluri
 
COScheduler In Depth
COScheduler In DepthCOScheduler In Depth
COScheduler In Depth
WO Community
 

Viewers also liked (20)

Software Configuration Management Problemas e Soluções
Software Configuration Management Problemas e SoluçõesSoftware Configuration Management Problemas e Soluções
Software Configuration Management Problemas e Soluções
elliando dias
 
WANTED: Seeking Single Agile Knowledge Development Tool-set
WANTED: Seeking Single Agile Knowledge Development Tool-setWANTED: Seeking Single Agile Knowledge Development Tool-set
WANTED: Seeking Single Agile Knowledge Development Tool-set
Brad Appleton
 
P4 Branching Overview
P4 Branching OverviewP4 Branching Overview
P4 Branching Overview
Go2Group, Inc.
 
How do you deliver your applications to the cloud?
How do you deliver your applications to the cloud?How do you deliver your applications to the cloud?
How do you deliver your applications to the cloud?
Michael Elder
 
Go2Group_secrets of high-performing software teams_EAD event_san jose_Doug Bass
Go2Group_secrets of high-performing software teams_EAD event_san jose_Doug BassGo2Group_secrets of high-performing software teams_EAD event_san jose_Doug Bass
Go2Group_secrets of high-performing software teams_EAD event_san jose_Doug Bass
Go2Group, Inc.
 
Is agile adoption losing steam?
Is agile adoption losing steam?Is agile adoption losing steam?
Is agile adoption losing steam?
Go2Group, Inc.
 
Tui Travel - Overcoming the Challenges of Agile Methods
Tui Travel - Overcoming the Challenges of Agile MethodsTui Travel - Overcoming the Challenges of Agile Methods
Tui Travel - Overcoming the Challenges of Agile Methods
DBmaestro - Database DevOps
 
Trustworthy Transparency and Lean Traceability
Trustworthy Transparency and Lean TraceabilityTrustworthy Transparency and Lean Traceability
Trustworthy Transparency and Lean Traceability
Brad Appleton
 
Continuous delivery made possible
Continuous delivery made possibleContinuous delivery made possible
Continuous delivery made possible
mimmozzo_
 
DBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application DevelopmentDBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application Development
Kyle Hailey
 
Delphix modernization whitepaper
Delphix  modernization whitepaperDelphix  modernization whitepaper
Delphix modernization whitepaper
Franco_Dagosto
 
Delphix and DBmaestro
Delphix and DBmaestroDelphix and DBmaestro
Delphix and DBmaestro
Kyle Hailey
 
Kscope 2013 delphix
Kscope 2013 delphixKscope 2013 delphix
Kscope 2013 delphix
Kyle Hailey
 
In (database) automation we trust
In (database) automation we trustIn (database) automation we trust
In (database) automation we trust
DBmaestro - Database DevOps
 
Jenkins Plugin
Jenkins PluginJenkins Plugin
Jenkins Plugin
DelphixCorp
 
Agile Configuration Management Environments
Agile Configuration Management EnvironmentsAgile Configuration Management Environments
Agile Configuration Management Environments
Brad Appleton
 
Test case management and requirements traceability
Test case management and requirements traceabilityTest case management and requirements traceability
Test case management and requirements traceability
Go2Group, Inc.
 
Delphix Workflow for SQL Server
Delphix Workflow for SQL ServerDelphix Workflow for SQL Server
Delphix Workflow for SQL Server
rcaccia
 
Preventing the Next Deployment Issue with Continuous Performance Testing and ...
Preventing the Next Deployment Issue with Continuous Performance Testing and ...Preventing the Next Deployment Issue with Continuous Performance Testing and ...
Preventing the Next Deployment Issue with Continuous Performance Testing and ...
Correlsense
 
MuleSoft Connect 2015 - Go2Group presentation
MuleSoft Connect 2015 - Go2Group presentationMuleSoft Connect 2015 - Go2Group presentation
MuleSoft Connect 2015 - Go2Group presentation
Go2Group, Inc.
 
Software Configuration Management Problemas e Soluções
Software Configuration Management Problemas e SoluçõesSoftware Configuration Management Problemas e Soluções
Software Configuration Management Problemas e Soluções
elliando dias
 
WANTED: Seeking Single Agile Knowledge Development Tool-set
WANTED: Seeking Single Agile Knowledge Development Tool-setWANTED: Seeking Single Agile Knowledge Development Tool-set
WANTED: Seeking Single Agile Knowledge Development Tool-set
Brad Appleton
 
How do you deliver your applications to the cloud?
How do you deliver your applications to the cloud?How do you deliver your applications to the cloud?
How do you deliver your applications to the cloud?
Michael Elder
 
Go2Group_secrets of high-performing software teams_EAD event_san jose_Doug Bass
Go2Group_secrets of high-performing software teams_EAD event_san jose_Doug BassGo2Group_secrets of high-performing software teams_EAD event_san jose_Doug Bass
Go2Group_secrets of high-performing software teams_EAD event_san jose_Doug Bass
Go2Group, Inc.
 
Is agile adoption losing steam?
Is agile adoption losing steam?Is agile adoption losing steam?
Is agile adoption losing steam?
Go2Group, Inc.
 
Tui Travel - Overcoming the Challenges of Agile Methods
Tui Travel - Overcoming the Challenges of Agile MethodsTui Travel - Overcoming the Challenges of Agile Methods
Tui Travel - Overcoming the Challenges of Agile Methods
DBmaestro - Database DevOps
 
Trustworthy Transparency and Lean Traceability
Trustworthy Transparency and Lean TraceabilityTrustworthy Transparency and Lean Traceability
Trustworthy Transparency and Lean Traceability
Brad Appleton
 
Continuous delivery made possible
Continuous delivery made possibleContinuous delivery made possible
Continuous delivery made possible
mimmozzo_
 
DBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application DevelopmentDBTA Data Summit : Eliminating the data constraint in Application Development
DBTA Data Summit : Eliminating the data constraint in Application Development
Kyle Hailey
 
Delphix modernization whitepaper
Delphix  modernization whitepaperDelphix  modernization whitepaper
Delphix modernization whitepaper
Franco_Dagosto
 
Delphix and DBmaestro
Delphix and DBmaestroDelphix and DBmaestro
Delphix and DBmaestro
Kyle Hailey
 
Kscope 2013 delphix
Kscope 2013 delphixKscope 2013 delphix
Kscope 2013 delphix
Kyle Hailey
 
Agile Configuration Management Environments
Agile Configuration Management EnvironmentsAgile Configuration Management Environments
Agile Configuration Management Environments
Brad Appleton
 
Test case management and requirements traceability
Test case management and requirements traceabilityTest case management and requirements traceability
Test case management and requirements traceability
Go2Group, Inc.
 
Delphix Workflow for SQL Server
Delphix Workflow for SQL ServerDelphix Workflow for SQL Server
Delphix Workflow for SQL Server
rcaccia
 
Preventing the Next Deployment Issue with Continuous Performance Testing and ...
Preventing the Next Deployment Issue with Continuous Performance Testing and ...Preventing the Next Deployment Issue with Continuous Performance Testing and ...
Preventing the Next Deployment Issue with Continuous Performance Testing and ...
Correlsense
 
MuleSoft Connect 2015 - Go2Group presentation
MuleSoft Connect 2015 - Go2Group presentationMuleSoft Connect 2015 - Go2Group presentation
MuleSoft Connect 2015 - Go2Group presentation
Go2Group, Inc.
 
Ad

Similar to Faking Hell (20)

Resilience mit Hystrix
Resilience mit HystrixResilience mit Hystrix
Resilience mit Hystrix
Java Usergroup Berlin-Brandenburg
 
Resilience with Hystrix
Resilience with HystrixResilience with Hystrix
Resilience with Hystrix
Uwe Friedrichsen
 
03 - Testowanie GUI
03 - Testowanie GUI03 - Testowanie GUI
03 - Testowanie GUI
Krzysztof Jelski
 
Tdd & unit test
Tdd & unit testTdd & unit test
Tdd & unit test
GomathiNayagam S
 
Scrum Gathering 2012 Shanghai_工程实践与技术卓越分会场:how to write unit test for new cod...
Scrum Gathering 2012 Shanghai_工程实践与技术卓越分会场:how to write unit test for new cod...Scrum Gathering 2012 Shanghai_工程实践与技术卓越分会场:how to write unit test for new cod...
Scrum Gathering 2012 Shanghai_工程实践与技术卓越分会场:how to write unit test for new cod...
LetAgileFly
 
Breaking Dependencies To Allow Unit Testing - Steve Smith | FalafelCON 2014
Breaking Dependencies To Allow Unit Testing - Steve Smith | FalafelCON 2014Breaking Dependencies To Allow Unit Testing - Steve Smith | FalafelCON 2014
Breaking Dependencies To Allow Unit Testing - Steve Smith | FalafelCON 2014
FalafelSoftware
 
Breaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit TestingBreaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit Testing
Steven Smith
 
JDK Power Tools
JDK Power ToolsJDK Power Tools
JDK Power Tools
Tobias Lindaaker
 
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
solit
 
Easy Button
Easy ButtonEasy Button
Easy Button
Adam Dale
 
Use of Apache Commons and Utilities
Use of Apache Commons and UtilitiesUse of Apache Commons and Utilities
Use of Apache Commons and Utilities
Pramod Kumar
 
Pragmatic unittestingwithj unit
Pragmatic unittestingwithj unitPragmatic unittestingwithj unit
Pragmatic unittestingwithj unit
liminescence
 
Mockito intro
Mockito introMockito intro
Mockito intro
Cristian R. Silva
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
Jiayun Zhou
 
Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016
Danny Preussler
 
Mockito intro
Mockito introMockito intro
Mockito intro
Jonathan Holloway
 
Android testing
Android testingAndroid testing
Android testing
Sean Tsai
 
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
Tech in Asia ID
 
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile appsTech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
Fandy Gotama
 
Solid Software Design Principles
Solid Software Design PrinciplesSolid Software Design Principles
Solid Software Design Principles
Jon Kruger
 
Scrum Gathering 2012 Shanghai_工程实践与技术卓越分会场:how to write unit test for new cod...
Scrum Gathering 2012 Shanghai_工程实践与技术卓越分会场:how to write unit test for new cod...Scrum Gathering 2012 Shanghai_工程实践与技术卓越分会场:how to write unit test for new cod...
Scrum Gathering 2012 Shanghai_工程实践与技术卓越分会场:how to write unit test for new cod...
LetAgileFly
 
Breaking Dependencies To Allow Unit Testing - Steve Smith | FalafelCON 2014
Breaking Dependencies To Allow Unit Testing - Steve Smith | FalafelCON 2014Breaking Dependencies To Allow Unit Testing - Steve Smith | FalafelCON 2014
Breaking Dependencies To Allow Unit Testing - Steve Smith | FalafelCON 2014
FalafelSoftware
 
Breaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit TestingBreaking Dependencies to Allow Unit Testing
Breaking Dependencies to Allow Unit Testing
Steven Smith
 
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
solit
 
Use of Apache Commons and Utilities
Use of Apache Commons and UtilitiesUse of Apache Commons and Utilities
Use of Apache Commons and Utilities
Pramod Kumar
 
Pragmatic unittestingwithj unit
Pragmatic unittestingwithj unitPragmatic unittestingwithj unit
Pragmatic unittestingwithj unit
liminescence
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
Jiayun Zhou
 
Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016Unit testing without Robolectric, Droidcon Berlin 2016
Unit testing without Robolectric, Droidcon Berlin 2016
Danny Preussler
 
Android testing
Android testingAndroid testing
Android testing
Sean Tsai
 
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
Tech in Asia ID
 
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile appsTech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
Fandy Gotama
 
Solid Software Design Principles
Solid Software Design PrinciplesSolid Software Design Principles
Solid Software Design Principles
Jon Kruger
 
Ad

More from Giovanni Asproni (9)

Remote Mob Programming In A High Stakes Environment (Agile Manchester 2023)
Remote Mob Programming In A High Stakes Environment (Agile Manchester 2023)Remote Mob Programming In A High Stakes Environment (Agile Manchester 2023)
Remote Mob Programming In A High Stakes Environment (Agile Manchester 2023)
Giovanni Asproni
 
Remote mobprogrammingina highstakesenvironment
Remote mobprogrammingina highstakesenvironmentRemote mobprogrammingina highstakesenvironment
Remote mobprogrammingina highstakesenvironment
Giovanni Asproni
 
Creating An Incremental Architecture For Your System
Creating An Incremental Architecture For Your SystemCreating An Incremental Architecture For Your System
Creating An Incremental Architecture For Your System
Giovanni Asproni
 
Scaling Agile Done Right (XP 2017 version)
Scaling Agile Done Right (XP 2017 version)Scaling Agile Done Right (XP 2017 version)
Scaling Agile Done Right (XP 2017 version)
Giovanni Asproni
 
Scaling Agile Done Right (Agile Manchester 2017)
Scaling Agile Done Right (Agile Manchester 2017)Scaling Agile Done Right (Agile Manchester 2017)
Scaling Agile Done Right (Agile Manchester 2017)
Giovanni Asproni
 
Creating An Incremental Architecture For Your System
Creating An Incremental Architecture For Your SystemCreating An Incremental Architecture For Your System
Creating An Incremental Architecture For Your System
Giovanni Asproni
 
Design For Testability
Design For TestabilityDesign For Testability
Design For Testability
Giovanni Asproni
 
Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)
Giovanni Asproni
 
Writing usableap isinpractice
Writing usableap isinpracticeWriting usableap isinpractice
Writing usableap isinpractice
Giovanni Asproni
 
Remote Mob Programming In A High Stakes Environment (Agile Manchester 2023)
Remote Mob Programming In A High Stakes Environment (Agile Manchester 2023)Remote Mob Programming In A High Stakes Environment (Agile Manchester 2023)
Remote Mob Programming In A High Stakes Environment (Agile Manchester 2023)
Giovanni Asproni
 
Remote mobprogrammingina highstakesenvironment
Remote mobprogrammingina highstakesenvironmentRemote mobprogrammingina highstakesenvironment
Remote mobprogrammingina highstakesenvironment
Giovanni Asproni
 
Creating An Incremental Architecture For Your System
Creating An Incremental Architecture For Your SystemCreating An Incremental Architecture For Your System
Creating An Incremental Architecture For Your System
Giovanni Asproni
 
Scaling Agile Done Right (XP 2017 version)
Scaling Agile Done Right (XP 2017 version)Scaling Agile Done Right (XP 2017 version)
Scaling Agile Done Right (XP 2017 version)
Giovanni Asproni
 
Scaling Agile Done Right (Agile Manchester 2017)
Scaling Agile Done Right (Agile Manchester 2017)Scaling Agile Done Right (Agile Manchester 2017)
Scaling Agile Done Right (Agile Manchester 2017)
Giovanni Asproni
 
Creating An Incremental Architecture For Your System
Creating An Incremental Architecture For Your SystemCreating An Incremental Architecture For Your System
Creating An Incremental Architecture For Your System
Giovanni Asproni
 
Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)Methodology Patterns (Agile Cambridge 2014)
Methodology Patterns (Agile Cambridge 2014)
Giovanni Asproni
 
Writing usableap isinpractice
Writing usableap isinpracticeWriting usableap isinpractice
Writing usableap isinpractice
Giovanni Asproni
 

Recently uploaded (20)

Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 

Faking Hell

  • 1. © Asprotunity Ltd Giovanni Asproni email: [email protected] twitter: @gasproni linkedin: http://www.linkedin.com/in/gasproni Faking Hell Use, abuse and misuse of fakes, mocks and other test doubles 1
  • 2. © Asprotunity Ltd Test Doubles • Sometimes we need to test classes that interact with other objects which are difficult to control • The real object has nondeterministic behaviour (e.g., random number generator) • The real object is difficult to set up (e.g., requiring a certain file system, database, or network environment) • The real object has behaviour that is hard to trigger (e.g., a network error) • The real object is slow • The real object has (or is) a user interface • The test needs to ask the real object about how it was used (e.g., confirm that a callback function was actually called) • The real object does not yet exist (e.g., interfacing with other teams or new hardware systems) 2
  • 3. © Asprotunity Ltd Test Doubles • Dummies • Stubs • Spies • Fakes • Mocks 3
  • 4. © Asprotunity Ltd Dummies • Dummy objects are passed around but never actually used • E.g., a mandatory argument in a constructor never used during a specific test 4
  • 5. © Asprotunity Ltd Stubs • Stubs provide canned answers to calls made during the test 5
  • 6. © Asprotunity Ltd Spies • Spies are stubs that also record some information based on how they were called. (e.g., the number of times a method has been called) 6
  • 7. © Asprotunity Ltd 7 public class OrderStateTest { private static String TALISKER = "Talisker"; private WarehouseStub warehouse = new WarehouseStub(); @Test public void orderIsFilledIfEnoughInWarehouse() { Order order = new Order(TALISKER, 50); order.fill(warehouse); assertTrue(order.isFilled()) assertTrue(warehouse.removeCalled); } @Test public void orderDoesNotRemoveIfNotEnough() { Order order = new Order(TALISKER, 51); order.fill(warehouse); assertFalse(order.isFilled()); assertFalse(warehouse.removeCalled); } } Adapted from: http://martinfowler.com/articles/mocksArentStubs.html public class WarehouseStub implements Warehouse { public boolean removeCalled = false; public void hasInventory(String brand, int amount) { return “Talisker”.equals(brand) && amount <= 50 } public void remove(String brand, int amount) { removeCalled = true; } ….. }
  • 8. © Asprotunity Ltd Fakes • Fake objects actually have working implementations, but take some shortcuts which make them not suitable for production (e.g., an in memory database) 8
  • 9. © Asprotunity Ltd 9 public class OrderStateTest { private static String TALISKER = "Talisker"; private Warehouse warehouse = new WarehouseFake(); @Test public void orderIsFilledIfEnoughInWarehouse() { Order order = new Order(TALISKER, 50); order.fill(warehouse); assertTrue(order.isFilled()) } @Test public void orderDoesNotRemoveIfNotEnough() { Order order = new Order(TALISKER, 51); order.fill(warehouse); assertFalse(order.isFilled()); } } Adapted from: http://martinfowler.com/articles/mocksArentStubs.html public class WarehouseFake implements Warehouse { private HashMap<String, Integer> inventoryByBrand; public WarehouseFake() { inventoryByBrand = new HashMap<>(){{put(“Talisker”, 50);}} } public void hasInventory(String brand, int required) { available = inventoryByBrand.get(brand) return available != null && required <= available; } public void remove(String brand, int amount) { available = inventoryByBrand.get(brand) if (available == null || amount > available) { // Manage the error… } else { inventoryByBrand.put(brand, available - amount); } } ….. }
  • 10. © Asprotunity Ltd Mocks • Mocks are objects pre-programmed with expectations which form a specification of the calls they are expected to receive 10
  • 11. © Asprotunity Ltd History of MockObjects • Invented at Connextra and XtC in 1999 • The initial purpose was to get rid of getters in testing • Component composition • Tell don’t ask • Testing behaviours • More at http://www.mockobjects.com/2009/09/brief- history-of-mock-objects.html 11
  • 12. © Asprotunity Ltd 12 Adapted from: http://martinfowler.com/articles/mocksArentStubs.html @Test public void fillingDoesNotRemoveIfNotEnoughInStock() { Order order = new Order(TALISKER, 51); Mockery context = new JUnit4Mockery(); Warehouse mockWarehouse = context.mock(Warehouse.class); //setup - expectations context.checking(new Expectations() {{ oneOf(mockWarehouse).hasInventory(with(any(String.class)), with(any(int.class))); will(returnValue(false)); never(mockWarehouse).remove(with(any(String.class)), with(any(int.class))); }}); order.fill(mockWarehouse)); context.assertIsSatisfied(); assertFalse(order.isFilled()); }
  • 13. © Asprotunity Ltd Mocks Aren’t Stubs • Mocks are meant for testing behaviour • Stubs and all other doubles are generally used for testing state • Classic TDD vs Mockist TDD (Classic school vs London School of TDD) 13 http://martinfowler.com/articles/mocksArentStubs.html
  • 14. © Asprotunity Ltd 14 public class OrderStateTest { private static String TALISKER = "Talisker"; private Warehouse warehouse = new WarehouseStub(); @Test public void orderIsFilledIfEnoughInWarehouse() { Order order = new Order(TALISKER, 50); order.fill(warehouse); assertTrue(order.isFilled()) } @Test public void orderDoesNotRemoveIfNotEnough() { Order order = new Order(TALISKER, 51); order.fill(warehouse); assertFalse(order.isFilled()); } } Adapted from: http://martinfowler.com/articles/mocksArentStubs.html public class WarehouseStub implements Warehouse { public void hasInventory(String brand, int amount) { return “Talisker”.equals(brand) && amount <= 50 } public void remove(String brand, int amount) { // Intentionally blank } ….. }
  • 15. © Asprotunity Ltd 15 public class OrderInteractionTest { private static String TALISKER = "Talisker"; @Test public void fillingRemovesInventoryIfInStock() { //setup - data Order order = new Order(TALISKER, 50); Mockery context = new JUnit4Mockery(); Warehouse mockWarehouse = context.mock(Warehouse.class); //setup - expectations context.checking(new Expectations() {{ oneOf(mockWarehouse).hasInventory(TALISKER, 50); will(returnValue(true)); oneOf(mockWarehouse).remove(TALISKER, 50); }}); order.fill(mockWarehouse); context.assertIsSatisfied(); assertTrue(order.isFilled()); } Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
  • 16. © Asprotunity Ltd 16 Adapted from: http://martinfowler.com/articles/mocksArentStubs.html @Test public void fillingDoesNotRemoveIfNotEnoughInStock() { Order order = new Order(TALISKER, 51); Mockery context = new JUnit4Mockery(); Warehouse mockWarehouse = context.mock(Warehouse.class); //setup - expectations context.checking(new Expectations() {{ oneOf(mockWarehouse).hasInventory(with(any(String.class)), with(any(int.class))); will(returnValue(false)); never(mockWarehouse).remove(with(any(String.class)), with(any(int.class))); }}); order.fill(mockWarehouse)); context.assertIsSatisfied(); assertFalse(order.isFilled()); }
  • 17. © Asprotunity Ltd 17 Outside-In And Middle-Out Database Client GUI Domain layer Server Walking skeleton
  • 18. © Asprotunity Ltd Sometimes we need to test state, sometimes we need to test behaviour, and sometimes we need both 18 State Or Behaviour?
  • 19. © Asprotunity Ltd Problems Frequently Due To • The design of the application is unfit for purpose • The test has no clear purpose • Plain old confusion • …I just want to increase code coverage… 19
  • 20. © Asprotunity Ltd The Design Of The Application Is Unfit For Purpose • Too many dependencies to mock • Too many interactions with a single mock object • Mocks nested into each other 20
  • 21. © Asprotunity Ltd The Test Has No Clear Purpose • Testing state or behaviour? • Fakes or stubs used to test behaviour • Use of mock objects used to test state 21
  • 22. © Asprotunity Ltd 22 public class OrderStateTest { private static String TALISKER = "Talisker"; private WarehouseStub warehouse = new WarehouseStub(); @Test public void orderIsFilledIfEnoughInWarehouse() { Order order = new Order(TALISKER, 50); order.fill(warehouse); assertTrue(order.isFilled()) assertTrue(warehouse.removeCalled); } @Test public void orderDoesNotRemoveIfNotEnough() { Order order = new Order(TALISKER, 51); order.fill(warehouse); assertFalse(order.isFilled()); assertFalse(warehouse.removeCalled); } } Adapted from: http://martinfowler.com/articles/mocksArentStubs.html public class WarehouseStub implements Warehouse { public boolean removeCalled = false; public void hasInventory(String brand, int amount) { return “Talisker”.equals(brand) && amount <= 50 } public void remove(String brand, int amount) { removeCalled = true; } ….. }
  • 23. © Asprotunity Ltd 23 public class OrderInteractionTest { private static String TALISKER = "Talisker"; @Test public void fillingRemovesInventoryIfInStock() { //setup - data Order order = new Order(TALISKER, 50); Mockery context = new JUnit4Mockery(); Warehouse mockWarehouse = context.mock(Warehouse.class); //setup - expectations context.checking(new Expectations() {{ oneOf(mockWarehouse).hasInventory(TALISKER, 50); will(returnValue(true)); oneOf(mockWarehouse).remove(TALISKER, 50); }}); order.fill(mockWarehouse); // We don’t check that context.assertIsSatisfied(); assertTrue(order.isFilled()); } Adapted from: http://martinfowler.com/articles/mocksArentStubs.html
  • 24. © Asprotunity Ltd Plain Old Confusion • Testing the mocks • Too many dependencies or interactions • Partial mocking 24
  • 25. © Asprotunity Ltd 25 …I just want to increase code coverage…
  • 26. © Asprotunity Ltd The Solution To Those Problems? • Learn to listen to what the tests are telling you • Avoid dubious practices as much as possible • Partial mocks • Mocking concrete classes • Monkey patching 26
  • 27. © Asprotunity Ltd 27 To Mock Or Not To Mock?
  • 28. © Asprotunity Ltd Test Doubles: Some Advantages • Clarify which interactions are actually important for the test • Help in design protocols • Make testing of some behaviours possible • Allows for creation of faster tests • Can alleviate dependencies on other teams 28
  • 29. © Asprotunity Ltd Test Doubles: Some (Alleged) Disadvantages • Duplication of effort • Changes of behaviour of the real object need to be reflected in the test doubles • Tests coupled to implementation (in case of mocks) 29
  • 30. © Asprotunity Ltd I’m Biased • I find test doubles useful • The important thing is to know which ones to use when • …and when it’s best to use the real object • The real object is“simple”to build and to interact with • Full system tests • Etc. 30
  • 31. © Asprotunity Ltd 31 Questions?