Refactoring refer to the process of changing the structure of the code without changing the basic behavior (i.e. The code should solve the purpose even after Refactoring it. ).
Example
Suppose you have written some Selenium Automation code to open the www.google.com, enter 'Selenium-By-Arun' text into the Search Text Box and click on 'Search' Button.
So you have written Selenium Automation Code to perform the above, but the code you have written is not structured but will work.
So you Refactored the code(i.e. changed the structured of the code) to make it more Readable, Simple, Maintainable etc.
Even after changing the structure of the code our Selenium Automation code should open the www.google.com, enter 'Selenium-By-Arun' text into the Search Text Box and click on 'Search' Button.
This is called as Refactoring (i.e. The process of changing the structure of the code without changing the basic behavior ).
Now Lets Understand the objectives of Refactoring:
As I have already mentioned above that the objectives of Refactoring the code is to:
- Make the code Readable
- Make the code Simple
- Make the code Maintainable
I will explain all these objects practically in the next upcoming posts.
Please comment below to feedback or ask questions.
Identifying few sample real time tests for implementing the Refactoring concept will be explained in the next post.