Week 6 - Testing and Build Management Flashcards

1
Q

What is a unit?

A

Typically a single function or method

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

What is a good unit testing plan?

A

To have one test module/class per production module/class, which tests the public interface of the production class

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

What does the Arrange-Act-Assert Pattern divide tests into?

A

The arrange section

The act section

The assert section

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

What happens in the arrange section of the Arrange-Act-Assert Pattern?

A

You bring the system under test and its dependencies to a desired state

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

What happens in the act section of the Arrange-Act-Assert Pattern?

A

You can call functions/methods on the system under test, passing the prepared dependencies, and capturing the output value (if any)

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

What happens in the assert section of the Arrange-Act-Assert Pattern?

A

You verify the outcome. The outcome may be represented by the return value, the final state of the SUT and its collaborators, or the methods the SUT called on those collaborators

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

What does SUT stand for?

A

System Under Test

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

What are the phases of Test-Driven Development (TDD)?

A

Red, Green and Refactor

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

What does TDD stand for?

A

Test-Driven Development

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

Describe the red phase of TDD.

A

Write an automated test for some behaviour

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

Describe the green phase of TDD.

A

Write just enough code to pass the test

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

Describe the refactor phase of TDD.

A

Change the code so it becomes better

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

What is build management driven by?

A

Version control

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

What are the three benefits version control provides?

A

Change histories

Branching and merging

Traceability

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

What do change histories do?

A

Change histories make it possible to quickly and reliably get any version of a file

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

What does branching and merging do?

A

Makes it possible for developers to work independently, and to combine their work together, warning of any conflicts

17
Q

How does version control make traceability possible?

A

By annotating each change with a short message describing the purpose of the change

18
Q

What are the seven essential practices of continuous integration?

A

Do not check in on a broken build

Always run commit tests locally

Wait for commit tests to pass

Never go home on a broken build

Always be prepared to revert

Do not comment out failing tests

Take responsibility for breakages

19
Q

Why should you not check in on a broken build?

A

There is no point checking in further changes, triggering new builds, and compounding the failure

20
Q

Why should you always run commit tests locally and wait for them to pass?

A

So failures can be fixed right away before causing a broken build - only commit once a local build is successful

21
Q

Why should you never go home on a broken build?

A

Because it means nobody else can work so you should check in at least an hour before the end of the working day, or first thing next morning

22
Q

What should you do if a problem with a commit cannot be fixed quickly?

A

Revert it

23
Q

What are the two common branching models?

A

Feature-based development and trunk-based development

24
Q

Describe feature-based development.

A

A branch is created for each feature being developed. Merging branches is delayed until the feature is finished, possibly weeks later

25
Q

Describe trunk-based development

A

A branch is created for each feature being developed. Merging branches is done daily, with feature flags used to hide incomplete work

26
Q

What are the two common repo organisations?

A

Monorepo and multirepo

27
Q

What is a monorepo?

A

One giant repo for all microservices - any check-in triggers the production of multiple microservices. Should be avoided

28
Q

What is a multirepo?

A

One repo per microservice - any check-in triggers the production of a single microservice