Introduction to software Testing : Week 4

Test Doubles: Introduction Quiz


1) If a system under test needs to interact with other systems in order to complete a unit test, just skip the testing.
a) True b) False
ANS - b) False


2) What do you call lightweight versions of components that a system under test interacts with that are necessary to do unit testing?
a) Dummy Objects
b) Test doubles
c) Test Stubs
d) Mock objects
ANS - b) Test doubles


3) What do you call the dummy values that are filled into objects that are required as parameters by the system under test, but are otherwise irrelevant?
a) Dummy values
b) Dummy Stubs
c) Dummy Mocks
d) Dummy Objects
ANS - d) Dummy Objects


4) What are the dummy input data sources used by a system under test?
a) Dummy Objects
b) Test Stubs
c) Fake Objects
d) Spy Objects
ANS - b) Test Stubs


5) What would you use in order to check the indirect results produced by a system under test?
a) Mock Objects
b) Sky Objects
c) Fake Objects
d) Dummy Objects
ANS - a) Mock Objects

6) There is essentially no difference between spy objects and mock objects.
a) True b) False
ANS - b) False

7) The goal of Mockito is to:
a) Automatically generate flakey tests
b) Create test doubles and inspect interactions
c) Assist in doing unit testing in a vacuum
ANS - b) Create test doubles and inspect interactions


Test Doubles: Input Quiz

1) When providing test inputs for test doubles, we want to use ____ and ____.
a) Mock objects; Spy objects
b) Dummy objects; Mock objects
c) Test stubs; Spy objects
d) Dummy objects; Test stubs
ANS - d) Dummy objects; Test stubs

2) During constructing test doubles, you wish to provide outputs for just a handful of values. What do you use?
a) Dummy Objects
b) Test Doubles
c) Test Stubs
d) Mock Objects
ANS - c) Test Stubs

3) During testing, you find that the unit tests require the use of a computationally expensive database. What could you use as a test double?
a) Test Stubs
b) Fake Objects
ANS - b) Fake Objects

4) In Mockito, there is a distiction between the roles that a class plays and how you construct it. The roles of a test double are stub, mock, and dummy (or all three). How you construct them in Mockito is the same.
a) True b) False
ANS - a) True

Test Doubles: Output Quiz

1) ______ provide the ecosystem.
a) Test doubles
b) Inputs and outputs
c) Side effects
d) Mock objects
ANS - a) Test doubles

2) Mocks and spies will allow fine grain monitoring of the system under test.
a) True b) False
ANS - a) True

3) Which of the following are not a part of testing interactions using mock objects and spy objects?
a) Methods are being called (or not)
b) Required fill-in values are being created for the system under test
c) Proper parameters are being used for method calls
d) Methods are being called in the proper order
ANS - b) Required fill-in values are being created for the system under test

4) ______ objects allow us to observe interactions of fake objects. _____ objects allow us to observe interactions of real objects.
a) Mock; Dummy
b) Spy; Mock
c) Dummy; Mock
d) Mock; Spy
ANS - d) Mock; Spy

5) In Mockito, there is no capability to override the behavior of methods with a spy object.
a) True b) False
ANS - b) False

6) In Mockito, there is no capability to override the behavior of methods with a spy object.
a) True b) False
ANS - a) True 

Comments

Popular Posts