This is my personal blog for my software testing study purposes. The topics posted in this blog are mine and from some other sources (credits are given). I always add those topics which helps me. Hope these topics will help you guys also.
- Happy testing

Recent Posts

QTP & Keyword Driven Testing

Tricky Questions in QTP

Asset Upgrade tool in QTP

New Features in QTP 10

Jun 25, 2009

Unit Testing Best Practices

Subscribe the QA and Software Testing Newsletter
Post Your Queries | QA and Testing - Table of Contents

SPONSORED LINKS Reading: Unit Testing Best PracticesTweet this Post

 

In software development projects, unit testing is a software validation type where the coder verifies each units of source code versus its specification. A unit is nothing but a most atomic testable part of a developed application program. In procedural computer programming single program, function, procedure, etc. can be considered as unit. In object-oriented computer programming, the smallest unit is a method, that may lie in to a base/super class, abstract class or derived/child class.

 

As per Microsoft:

 

The primary goal of unit testing is to take the smallest piece of testable software in the application, isolate it from the remainder of the code, and determine whether it behaves exactly as you expect. Each unit is tested separately before integrating them into modules to test the interfaces between modules. Unit testing has proven its value in that a large percentage of defects are identified during its use.

The most common approach to unit testing requires drivers and stubs to be written. The driver simulates a calling unit and the stub simulates a called unit. The investment of developer time in this activity sometimes results in demoting unit testing to a lower level of priority and that is almost always a mistake. Even though the drivers and stubs cost time and money, unit testing provides some undeniable advantages. It allows for automation of the testing process, reduces difficulties of discovering errors contained in more complex pieces of the application, and test coverage is often enhanced because attention is given to each unit.


Here are a few Best Practices:
1. The print out of a unit should reside on a single sheet of paper.
2. If there are more than 4 levels of nested unit, then maybe it should be split in two.
3. Whenever the cyclomatic complexness of a unit is greater than 10 then it's getting excessively complex.
4. Whenever it is content-coupled with another unit then it Is not a good unit.


The process is:
1. Prepare a test Plan of the unit tests.
2. Design the tests, the test environment, and operator instructions.
3. Identify and get the test data.
4. Code and run the tests.
5. Analyse the results.

 

Related Posts:

1. Unit Testing vs System Testing

2. Test Levels

SPONSORED LINKS

Software testing Metrices-Test Case Review

Metrics are the means by which the software quality can be measured; they give you confidence in the product.

 

Energize your test team

You're waist deep in your third month of late nights, weekends, and shipping stress; you can see and feel your team's energy waning.

 

The Value of Positive Testing

There is a school of thought in software testing that debunks the value of positive testing. This school basically states that any test that does not produce a defect is not a good test.

Impact Analysis Checklist for Req. Changes
___    Implications of the Proposed Change* Identify any existing requirements in the baseline that

The Process of Test Process Improvement

Software testing is still a pain-in-the-neck for many organizations. Because it is only marginally addressed in software process improvement models like CMMi

 

Software Defect-bug Management Philosphy

Imperfect processes cause most of the software defects. Thus to prevent defects, the development process needs to be overhauled.

 

Software testing Metrices-Test Case Review

Metrics are the means by which the software quality can be measured; they give you confidence in the product.

 

Energize your test team

You're waist deep in your third month of late nights, weekends, and shipping stress; you can see and feel your team's energy waning.

 

The Value of Positive Testing

There is a school of thought in software testing that debunks the value of positive testing. This school basically states that any test that does not produce a defect is not a good test.

Blog Archive