Testing Doubles Flashcards
Testing doubles
Objects in unit testing for verifying data or interactions without dependencies
Spies
Records/monitors values and functionality. Spies don’t change the behaviour but verified wether the method has been called/interactions been called
Similar to mock
Mocks
Records/monitors values and functionality. Mocks has expectations on the outcome and fails if the methods outcome don’t match the test pre programmer results
Similar to spies
Dummy
Placeholder object being passed through. The value doesn’t matter, it’s if the function is being run that’s important
Fake
Less complex objects used instead of labor intensive objects such as databases or external API:s
Stub
Hard coded values and responses to remove complex logic such as dependencies so that the test solely focused on the logic being tested