May 2019
Intermediate to advanced
496 pages
10h 38m
English
We've written a set of tests that fully define the firstName text field. We now want to add two more fields, which are essentially the same as the firstName field but with different id and labels.
Before you reach for the copy and paste, stop and think about the duplication you could be about to add to both your tests and your production code. We have six tests that define the first name. We'll end up with 18 tests to define three fields. That's a lot of tests without any kind of grouping or abstraction.
So, let's do both. Let's group our tests and abstract out a function that generates our tests for us.
Read now
Unlock full access