Week 10 Flashcards
What are test doubles?
Units that are used to replace parts of the real system for test purposes.
What are some examples of test doubles?
- Databases
- Code that is not ready
- External Hardware
- Components that do not return values
What are some motivations for using test doubles?
- Check that the SUT correctly interacts with the double
- If we want to recreate specific issues raised by returning specific values
- If we want to record values recieved by DOC
What does SUT stand for?
System Under Test (The part of the system we are testing)
What does DOC stand for?
Depended-On Component
What is a Test Stub?
A unit that allows us to insert some logic to respond to calls from SUT.
What are the types of test stub?
- Responder (returns correct values)
- Saboteur (returns incorrect values)
What is a Mock Object?
An object that is set up with information about what calls it should expect.
It might also be setup with details of the data it should expect
What can mock objects be used to test?
The behaviour of the interaction between the SUT and DOC
What is Mockito?
A mocking framework that can help with testing
What does Mockito do?
It takes an interface, and can create a replacement version of it
What is a test spy?
A way that we can implement an observation point that exposes the indirect outputs of the SUT so they can be verified
Why would a test spy be used?
If a developer needed more complex ways to verify the success of the info passed from SUT to DOC.
e.g checking email contents from a SUT
What is a fake object?
An object that replaces the functionality of the DOC
What is a dummy object?
An object that is not actually used in the code being tested, but is needed for the successful completion of it.