Subscribe by Email

Monday, July 9, 2012

What is the role of testing frameworks and automated scripts in refactoring?

Re-factoring is one of the most disciplined techniques which very well save use from the drudgery of rewriting the program code for software systems and applications. 

About Re-factoring

- Re-factoring is a technique that facilitates the restructuring of the existing body of the program code by carrying out alteration in the internal structure of the software system or application.
The best thing about re-factoring is that even if it does make changes to the internal structure of the software system or application, the external behavior of the system under question is not at all affected.
- Re-factoring is quite in demand during the testing phases since it helps a lot in improving the non functional attributes of the software system or application. 
- Typically, a part of the software system or application is changed by the application of a number of re-factorings which constitute a little change in the program’s source code which does not needs any modification in its functional requirements. 

There are so many advantages of refactoring like some of them mentioned below:
  1. It improves code readability
  2. It reduces complexity
  3. It improves maintainability
  4. It improves extensibility.
When the design of a program’s code is continuously improved, it gradually becomes easy to work with. Usually what we do is pay a lot of attention to the addition of the new features and functionalities and we do only a little refactoring. As a consequence of the software system or applications becomes quite clumsy in its working. 

"The good habit is to refactor a lot in ratio with the expedient addition of new features and functionalities. Refactoring your system now will help you maintain and extend it in the later stages of the software development whenever you want. If the testers fail to refactor the program code they will have increased technical debts."

Role of Testing Frameworks and Automated test scripts in Re-factoring

- Test frame works and automated test scripts have got a lot to do with the refactoring process. 
- Some solid sets of automatic unit tests are a priority before you start refactoring the program code. 
- These tests are in turn are generated using a test automation frame work and testing scripts. - These automated tests are so quick that it only takes a few seconds for them to execute and tell whether or not the respective program module is working properly. 
- This process is like going through the following steps:
  1. Make a small program transformation.
  2. Test it to ensure its correctness.
  3. Make another small transformation.
- It seems like an iterative cycle, isn’t it? 
- Suppose at some point the test fails, then the last change that was made is undone and redone in some different ways and again subjected to testing. 
- It is like moving the program from where it is to where you want to be in small small steps. 
- This process forms an integral part of the software development life cycle. 
- A number of general frameworks have been designed to make the process of refactoring effective and efficient. 
- A refactoring tool must be able to refactor the code that is written under a particular testing frame work. 
However there are certain aspects without addressing which refactoring cannot be achieved:
  1. Naming conventions
  2. Meta programming aspects
  3. Call back functions and so on.

No comments:

Facebook activity