Arunkumar Khannur's Software Testing Knowledge Center
   
 

7.9. Activities in Unit Testing

Unit testing consists of a set of activities that allow us to test both code and unit.. The schematic diagram representing unit testing related activities is represented in Fig. 4.6 Unit Test Workflow.

Fig. 7.6 Unit Test Workflow
Following sections discuss on each of these steps.

7.9.1. Develop Unit Test Plan
Unit Test plan is created at the outset of the project, when requirements and high level designs are stable enough, and then it is maintained if necessary throughout the project. Steps involved in this activity are:

  • Unit Test Lead gathers the input documents for this activity, they may include: SRS (Optional), High Level Design Documents, Detailed Design Documents, Software Development Plan.
  • Unit Test Lead develops the Unit Test Plan document using the template Unit Test Plan
  • Unit Test Plan will define clearly the planning of:
  • What tool(s) to be used
  • What module/class and units to be tested
  • Who will do the tests (Test Resource Assignment)
At the end of this activity, we arrive at Unit Test Plan

7.9.2. Review Unit Test Plan
This activity is performed as planned in project schedule, after finishing the draft of Unit Test Plan, or anytime if necessary when there is a change in approved Unit Test Plan. Steps involved in this activity are:

  • Project manager schedules the reviews in project schedule,
  • Project manager decides the list of reviewers; the reviewers should include at least one QC team representative.
  • Project manager sends the Unit Test Plan together with associated documents to all reviewers at least 3 days before the review.
  • The review could be informal (for minor changes) or formal (for major changes or for approval)
  • The Unit Test Plan is reviewed to determine whether it is:
  • Feasible and appropriate to implement in software,
  • Clearly and properly stated, and
  • Reflect to design, or requirements (optional)
  • Consistent with each other
  • A Review Record should be created, for the minor changes; review record can be noted in email. Review record must be sent to all effected people after the review.
  • Unit Test Lead or assigned people analyzes and updates the Unit Test Plan upon the reviews

At the end of this activity, we arrive at review records and approved Unit Test Plan.

7.9.3. Perform Code Development
This activity is to develop the software modules; it is performed throughout project, and started when software requirements and designs are stable enough. Steps involved in this activity are:

  • Developers perform activities below to develop source codes, compiles the units, modules or components:
  • Develop source code in accordance with the design model, or SRS.
  • Follow company’s coding standards
  • Follow other programming guidelines
  • Review the coded unit, module or component. Other relevant people may be requested to involve these reviews
  • Pre-compile source code and correct errors if any before requesting building service from RM
  • Provide feedbacks to designs if necessary

At the end of this activity, we arrive at Units, modules or components (Source codes)

7.9.4. Conduct Code Walkthrough and Code Review
This activity is optional to identify and remove defects from the units, modules or components during the code development. Steps involved in this activity are:
  • Developers perform steps below to do code inspection:
  • Compile source code; set compiler's warning to the highest level.
  • Get inspection through the source code, try to inspect all the paths, and identify all exception conditions.
  • Use tools to check the errors of code. For example, a static code rule checker.
At the end of this activity, we arrive at Bug Report

7.9.5. Create Unit Test Cases
This activity commences after Unit Test Plan was developed and reviewed, corresponding units already coded, and software designs (or requirements if necessary) are stable enough.

  • For each units identified in the Unit Test Plan, the Development Team (Unit Tester) will:
  • Create and document (using tool if applicable) Unit Test Cases for the units or modules, components or subsystems.
  • Follow company’s coding standard (if Unit Test Cases are under source code form).

At the end of this activity, we arrive at Unit Test Cases and Test harness for Unit test cases.
 

 
Khannur's Book
Arunkumar Khannur, Software Testing - Techniques and Applications, Published by Pearson Publications, 2011 (ISBN:978-81-317-5836-6; Pages:341 + xxii)
Follow Khannur
         
Khannur's Company
ISQT Process & Consulting Services Pvt. Ltd., Bangalore, INDIA
Khannur's Software Testing Forum
STEP-AUTO Forum
 Contact Khannur
ISQT Process & Consulting Services Pvt. Ltd.
#732, 1st Floor, 12th Main,
3rd Block, Rajajinagar,
Bangalore - 560010, INDIA
Phone: +91 80 23012511
URL: www.isqtinternational.com
Email: khannur@isqtinternational.com
Skype: arun.isqt