Test Fixture Introduction
Reduce duplication by using a test fixture. Let’s look at the basic syntax.
- 5 min connect: Duplication and Readability
- 10 min concept: Test Fixture
- 30 min concrete: convert code to use fixture
- 5 min conclusions: What is a custom assert, what is a test fixture
Connect: Duplication and Readability
- Give me three reasons why code duplication can be a problem.
- Is duplication in test code an exception? Is it a problem?
Concept: Test Fixture
Explain what it is, show them the documentation for the language and framework you’re using.
Concrete: Convert duplication to fixture
In RecentlyUsedList, or RecentlyUsedList there are several tests which share common code. Explain the problem and give them some pointers about how to refactor the tests to use a test fixture.
Note down in your own words what you learnt about a custom assert and a test fixture.