Testing Flashcards

1
Q

What are some of the benefits of unit testing?

A

Reduces defects in newly developed features and reduces defects when changing existing functionality.
Reduces cost of testing and fixing as defects are captured early.
Allows better refactoring of code.
Unit tests can be integrated with builds, improving the quality of the build as well.

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

What problem does a test double solve when writing unit tests?

A

One problem that can arise when testing service-layer components is that these components make calls to repository components. If we get an error testing a service-layer component, we’d like to be sure that it is actually a service-layer error and not a repository error leaking through into the service layer. In this case, we can use a test double for the repository to ensure that the repository will not return errors.

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