Functional Test Refactoring: Extract Function
Extract a set of test steps performing a common user operation to a reusable function
This is the 1st of 6 Functional Test Refactorings: Extract Function. I will show each refactoring in the following sections:
- Motivation, Why?
- Mechanics, How?
- Refactoring Steps, step by step in TestWise IDE
- Sample test scripts (before and after)
- Demonstration (animated GIF, easier to follow the core steps)
- Demonstration (video, easier to get a flow of actions)
- Benefits
- Exercises
You may start with any section.
I strongly recommend you doing this refactoring exercise (the one demonstrated and extras). Once you have mastered the concept, performing refactorings is quick, usually in seconds. To help you get into action quickly, I prepared the test project on Github (available for free).
> cd my-working-dir
> git clone https://github.com/testwisely/agiletravel-ui-tests
The test project is at my-working-dir/agiletravel-ui-tests/pre-refactoring
.