How to refactor legacy test automation project, save code and your time

Photo by lan deng on Unsplash

1. Define a baseline

This step applies in a situation when the old test and page objects are still relevant in some ways and the application under tests is not changed so much. In this case, we need to retrieve as many tests as we can in a short time.

2. Fix Structure of the tests

Go throw all test methods and underhand their purpose. Compare with the actual status of a product.

3. Add narrative to the tests

Tests methods should tell a story. Story understandable by anyone.

4. Optimize Page Objects

After refactoring on a test classes level, page objects already contain all necessary methods. It remains to fill a new one with code and refactor the old one.

5. Clean up supported classes

Now you have comprehensive and functioning tests and succinct page objects. Remain classes are usually some sort of utilities, clients, and configurations.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store