Mock Objects, Test Suites, TDD Flashcards

1
Q

What is a mock object?

A

Cheap placeholder objects sued to set up certain test conditions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In brief, when do we use a mock object?

A

When the object being tested has dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In detail, what are the 6 characteristics that prompt the use of Mock Objects?

A

Object is slow; Non-deterministic; Complex to set up; Doesn’t exist yet; Is a GUI, Has hard to trigger behaviour.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

From which interface should mock objects be implemented?

A

The same interface as from which the production code was.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a test suite?

A

A construct that allows us to run multiple, independent tests as a single batch of tests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the purpose of categories in test suites?

A

Categories are the concept that enables the grouping of unit tests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

From which perspective is TDD implemented?

A

The users perspective.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the 2 main benefits of TDD?

A

Users perspective; Write better code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What do we do is a unit test is overly complex to test?

A

Re-design the code being tested.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Define invariants…

A

An assertion on an object that doesn’t change. Object state should always be consistent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly