It is one of the best practices in software industry to adopt standard methodologies and approaches in every phase of SDLC. Development, being the most critical phase, should also be accompanied by standard and approved methodology. A standard methodology is based on some theme factor which drives the process for e.g. Document Driven Approach (where various documents are the driving factor for development process), Model Driven Approach a.k.a. MDA (where models typically UML models are the driving factor), Test Driven Approach (where test cases are the driving factor), Functional Points Driven Approach a.k.a. FPDA (where functional points are the driving factor) etc.
In this article I presented a new driving approach and called it Unit Test Driven Approach (UTDA). Although this may not be a known or standard term in software industry right now, I evolved and adopted the same in one of the projects recently and found extremely helpful in specific situations. In this article I tried to cover introduction and advantages of this approach along with specific scenarios where it could be proved exceedingly helpful.
- Suitable Scenarios
Unlike other articles, where the approach is defined and explained before depicting the amiable situations where it is suitable to use, I feel that it would be helpful to take the reverse route. Listing scenarios where UTDA is most suitable; will not only help in understanding the uniqueness of this approach but also avoid ambiguity involved in the some of the assumptions in the definition of this approach.
The UTDA suits best in the scenarios where part or whole UI/Code is ready. Although the section below explains elaborately the reason for this requirement, it is helpful to note here that in UTDA, the test plan is built by developers looking at the actual UI and code. In the view of this requirement few of the scenarios where UTDA suits best are listed below.
- Technology Migration Projects: UTDA may suits best in projects involving migration from one technology (typically legacy) to another technology where existing product is used as benchmark for requirements and functionalities of the new product.
- Language Migration Project: This involves projects where the exiting product supporting a specific human language needs to port to support another specific language.
- Localization Projects: Projects where a product is enhanced to support I18N also best suits for UTDA.
- Unit Test Driven Approach
In Unit Test Driven Approach (UTDA), the unit test plan composed by developer team (with optional help from testing/QA and business team) is the driving factor for development process. It is important to note that the term UTDA includes the word ‘Unit’ which indicates that the development process is and should be divided into logical units. Although the definition of a ‘Unit’ is not arduous and each environment may define it in its own way, it may range from a simple actionable item on UI to a complete module. Thus the 1st task in UTDA is to define the unit and then prepare test plan for it.
The UTDA can further divide into 2 sub parts:
- Unit Test Driven Approach – UI based
In this approach the unit test plan is prepared using the UI. The test planner should use the UI to find out all possible test cases. Incases where UI is not ready, the HTML wire frame, UI documents etc can also be used to accomplish this task.
- Unit Test Driven Approach – Code based
In this approach, the test planner explores the code and then prepares test plan accordingly. This includes understanding the code and captures all scenarios and exceptional conditions.
Combining the above 2 approaches results in a comprehensive Unit Test Plan, which then used as the driving factors for development activities.
Once the unit test plan is ready, development team starts implementing the same followed by execution of the test plan as the ceasing step. In UTDA it is also recommend having peer or expert review and execution of unit test plan.
To sum up the above paragraphs, the important steps involved in UTDA are listed below:
- Preparation of unit test cases based on UI
- Preparation of unit test cases based on code
- Merging of unit test cases to prepare unit test plan with optional verification of the same
- Implementation/development process
- Execution of unit test plan
- Optional expert (or peer) unit test execution
- Code release to Testing/QA team
- Unit Test Driven Approach – UI based
How UTDA Different From Test Driven Approach ?
It is important to note that UTDA is not same as Test Driven Approach (TDA) except the fact that both use test cases as driving factor. Incase of TDA the test cases are typically written by Testing/QA team and delivered to development team. Also in most of the cases these test cases are written based on SRS or other documents rather than actual UI or code.
- Advantages of UTDA
UTDA is especially suitable where part/whole code base or UI is ready for reference and the further development is based on the same. Let’s cover some of the advantages of UTDA:
- Scenarios where part or whole of the code/UI is available UTDA can be proved extremely helpful as it involve exploring UI and code while preparing Unit Test Plan.
- UTDA is by definition completely compatible with Agile Methodology.
- Unit Test Plan composed by development team can be proved very helpful and useful for Testing/QA team and results in saving lot of time especially incase of black box testing.
Unit Test Driven Approach (UTDA) is a very simple but efficient approach specially incases where some code/UI is ready for reference to development process.