Created
April 12, 2017 09:25
-
-
Save suchov/f13b3caffe45b6353d01e4ff59a9f6d2 to your computer and use it in GitHub Desktop.
Duplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test code can fall victim to many of the same traps as production code. One of the | |
worst offenders is duplication. Those who don’t recognize this slowly see productivity | |
drop as it becomes necessary to modify multiple tests with small changes to the production codebase. | |
Just like you refactor your production code, you should refactor test code, lest it | |
become a burden. In fact, refactoring tests should be handled at the same time as | |
refactoring production code — during the refactoring step in Red, Green, Refactor. | |
You can use all the tools you use in object oriented programming to DRY up duplicate | |
test code, such as extracting to methods and classes. For feature specs, you may consider using | |
Page Objects to clean up repetitive interactions. https://gist.github.com/suchov/f8c6570d8891f31cec647faab8688863 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment