Exercise 009: Remove Dead Steps
Related Smell: 009 - Dead Steps
Purpose
- Learn to identify the
Dead Steps
smell. - Learn how to search for dead steps and why it's important to remove them asap instead.
Your Task
Within the step implementation there are 3 steps that are not used by the Customer.feature
file.
Find and delete them.
Solution
Hint A
- After solving some exercises and understanding the business, you have maybe an idea which steps are unused.
- Review the
Customer.feature
file and then scroll through the step implementation, do you find it?
Hint B
- Two steps are empty at all, that means they provide no functionality.
- The third step implements the negation of finding a customer.
Hint C
- The relevant steps are
Given no customers exist
When the customer Rose Smith is searched
Then the customer can not be found
- Brainstorm why this steps are not used anymore
Step by Step Walkthrough
- The relevant steps are
Given no customers exist
When the customer Rose Smith is searched
Then the customer can not be found
- Possible explainations:
- The step was copied and renamed
- Somebody didn't find a step and created a similar one
- It was replaced with parameters or the input data in the scenario was changed
- Gold plating: implement a step for the future even if currently not used
- Remove the implementation from the step definition file.
The reqnroll extensions of MS Visual Studio provides a popup menue Find unused Step Definitions
. That's the easiest way to solve this smell.