We’ve got a little bit of duplication between these tests and in a more complex middleware we’ll have a lot of duplication. The duplication itself isn’t necessarily problematic. The problem comes in the form of readability of our tests. When there’s a great amount of duplication, it makes it harder to identify the parts of the test that distinguishes it from other tests. In this lesson we’ll apply the object factory pattern to reduce duplication and make it easier to maintain our tests.


Improve Test Maintainability using the Test Object Factory Pattern