Title: More refactoring!
Time: 15-45 minutes
Purpose: To further practice refactoring C# and automation code
Introduction: At the end of Lesson 11 (part 2) I challenged you to refactor, either code we didn’t get to or some of the code you have written with some of these “applying what we’ve learned” opportunities.
Activity:
- Determine what you would like to refactor:
- Review the extra code you’ve written for opportunities like we tackled in the lesson. Look for:
- Duplication (any code you’ve copied/pasted)
- Magic strings/numbers (like the URLs or IDs)
- Long methods/classes (look out for separation of concerns)
- Test data mismanagement
- Some ideas if you haven’t tackled the opportunities all as yet:
- Move the PUT check to its own class (like we did with POST and DELETE)
- Add Setup and Teardown methods for the PUT checks
- Add Setup and Teardown methods for the GET checks, to control the test data used in the checks
- Review the extra code you’ve written for opportunities like we tackled in the lesson. Look for:
- Modify your code, and verify all checks still pass
- Share on this thread:
- What opportunities for refactoring did you find that weren’t covered in the lesson?
- Are you stuck anywhere?