İstanbul evden eve nakliyat Beylikd¨¹z¨¹ evden eve nakliyat Tuzla evden eve nakliyat
Effective Strategies of Unit Testing
Delicious Bookmark this on Delicious
software testing genius

Effective Strategies of Unit Testing

Welcome to “Software Testing Genius”. Subscribe to my RSS feed for latest content on Software Testing.

Effective Strategies of Unit Testing

Place of Unit Testing in Software Development Life Cycle:
This is the first and the most important level of testing. Its need begins from the moment a programmer develops a unit of code. Every unit is tested for various scenarios. Detecting and fixing bugs during early stages of the Software Lifecycle helps reduce costly fixes later on. It is much more economical to find and eliminate the bugs during early stages of application building process. Hence Unit Testing is the most important of all the testing levels. As the software project progresses ahead it becomes more and more costly to find and fix the bugs.

By and large developers carry the prime responsibility to deliver Unit Tested Code.

Steps for Unit Testing are:

Step 1: Creation of a Test Plan

Step 2: Creation of Test Cases and the Test Data

face="Verdana, Arial, Helvetica, sans-serif">Step 3: Creation of scripts to run the test cases wherever applicable

Step 4: Execution of the test cases, once the code is ready

Step 5: Fixing of the bugs if present and re testing of the code

Step 6: Repetition of the test cycle until the Unit is free from all types of bugs

Unit Test Plan:
Unit Test Plan Is a document, which describes the Test Plan. It describes various steps as to how the tests will be carried out. This typically includes the list of things to be Tested, Roles and Responsibilities, prerequisites to begin the Testing, Test Environment, Assumptions, what to do after a test is successfully carried out, what to do if test fails, Glossary and so on

What is a Test Case:
Test Case is a document which describes exactly how the test should be carried out.

For example the test case may describe a test as follows:

Step 1: Type 10 characters in the Name Field

Step 2: Click on Submit etc. etc. & so on

When many Test Cases are clubbed together they form a Test Suite

Broad Format of a Test Case is as under

Test Case ID

Test Case Desc.

Input Data


Actual Result

Pass  Fail



In addition to the above, following information may also be captured & included in the Test Case format:

  1. Name of the Unit
  2. Version Number
  3. Tested By
  4. Date
  5. Test Iteration (More than one iterations of unit testing may be performed as per the need)

Steps to Effective Unit Testing:

1) Proper Documentation: Right from the beginning, do proper documentation of all the Test Cases as planned to unit test the code. Many a times documentation is not given due importance. It is very important to do documentation of the Test Cases, actual Results when executing the Test Cases, Response Time of the code for each test case. If all the test cases and the actual execution of test cases are well documented, we derive several significant advantages like.

  1. Proper documentation of the Test Cases prevent oversight.

  2. Proper documentation of the Test Cases reflects towards the quality of test cases.

  3. If the code needs to be re-tested we can be sure that we did not miss anything.

  4. Proper documentation provides a good level of transparency regarding the real contents during the unit testing. This is one of the most important aspects.

  5. Proper documentation helps in knowledge transfer in case of programmer attrition.

  6. Sometimes Unit Test Cases can be used to develop test cases for other levels of testing. In that case, if proper documentation is available, it is extremely helpful.

An Effective Unit Testing Process should always be developed to increase the Software Reliability and credibility of the developer. Many new developers consider unit testing tasks lightly but sooner or the later realize its importance down the road across SDLC.

2) Areas to be covered during Unit Testing: There is no specific hard & fast rule for the areas of Unit testing. A lot depends on the type of program or unit which is being created. It could be a screen or a component or a web service. Broadly speaking following aspects can be considered:

  1. In case of a UI screen, have test cases to verify all the screen elements which are expected to appear on the screens.

  2. In case of a UI screen, have test cases to verify the spellings / font / size of all the Labels or text which appears on the screen.
  3. Create Test Cases in such a way that every line of code in the unit gets tested at least once in a test cycle

  4. Create Test Cases in such a way that every condition in case of - Conditional Statements gets tested at least once.

  5. Create Test Cases to test the minimum / maximum range of data which can be entered. For instance what shall be the maximum - Amount which can be entered or the max length of string which can be entered or passed in as a parameter.

  6. Create Test Cases to verify how various errors are handled.

  7. Create Test Cases to verify if all the validations are being performed.

3) Do Necessary Automation if need be:
Developers are usually seen cutting corners in unit testing due to time pressures to complete the task. Sometimes it helps to write scripts, which automate a part of unit testing. This may help ensure that the necessary tests were done and may result in saving time required to perform the tests.  

Many More Articles on Best Practices in Manual Testing 

Largest Database of Sample Papers - 1000+ Unique Questions for ISTQB Foundation Exam

ISTQB Foundation Exam - Full Crash Course for Download

ISTQB Advanced CTAL Test Analysts Exam - Full Crash Course for Download

ISTQB Advanced CTAL Test Manager Exam - Full Crash Course for Download

Consolidated Study Material - All ISTQB Certification Exams

What Successful Testers say about the Quality of this website

If you want to keep track of further articles on Software Testing,
I suggest you to subscribe my
RSS feed

You can also Subscribe by E-mail
and get All New articles delivered directly to your Inbox.

Quick Navigation of Software Testing Genius

Get your Absolutely Free Copy of Several MS PowerPoint Presentations & E-Books related to ISTQB, HP Load Runner, IBM RFT, HP QTP & QC Certification Exams, prepared by Popular Writers & Trainers, by writing to:

Study Material for Certification Exams on Other Automation Tools:

Download Full Study Material - HP QTP & QC Certification Exams

Practical Roadmap to QTP Certification

Rehearsal of QTP in 1 Hr. -  Interview Questions

Study Material - HP LoadRunner Certification Exams for All Modules

Rehearsal of LoadRunner in 1 Hr. -  Interview Questions

Study Material - IBM RFT Certification Exam

Study Material to prepare for Manual Testing & QA:

Practical Roadmap to CSTE Certification

Consolidated Study Material - Testing & QA


Comments :

comments ↓

Leave Your Comments: (*) Marked Fields are Mandatory

You can apply basic formatting to the text

Name *
Email Address *
Speak your mind
sex hikayeleri