Skip to content

Instantly share code, notes, and snippets.

@suchov
Created April 12, 2017 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suchov/f13b3caffe45b6353d01e4ff59a9f6d2 to your computer and use it in GitHub Desktop.
Save suchov/f13b3caffe45b6353d01e4ff59a9f6d2 to your computer and use it in GitHub Desktop.
Duplication
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