Tuesday, April 5, 2011

Unit Testing

Unit Testing: Unit is testable piece of s/w that can be build and executed under the control a test driver or Testing individual s/w component.

Unit Testing focuses on the smallest unit of software design or module.

# Unit Test Environment:-

1. Driver: It is just like main program that accepts case, data and prints the relevant results
A test driver simulates a calling component or external environment.

2. Stubs: - It is just like a dummy subprogram that returns control to the module undergoing testing.
A test stub simulates a called component.

The unit test heavily uses white box testing and the testing can be conducted in parallel for multiple components.

3. It is usually done by the developer.

# Activities in Unit Testing:-

1. Develop unit test plan
2. Design unit test case
3. Develop unit test case
4. Execute unit test case

# Unit test conditions:
-Local data structure
-Boundary conditions
-Basis path
-Error handling paths.

# Unit Test Techniques: -

# White box Testing:-

-Basis path testing
-Loop Testing
-Condition Testing
-Data definition and use testing
-Internal boundary value testing

# Black box Testing:-

-Specification derived tests
-Equivalence portioning
-State transition testing

# Common errors uncovered during unit testing.

-Incorrect arithmetic precedence
-Incorrect precision
-Incorrect symbolic representation etc.

# Major benefits of unit testing:

-Be able to detect and remove defects at a much less cost compared to other later stages of testing.
-Simplifies debugging.
-Able to achieve a high level of structural coverage of code.

# Why unit Test:-

-Nobody is perfect.
-Bug in development tools.
-Certain bugs easier to find in unit testing.
-To localize defects

What is a unit?

In conventional structured programming language like C, Pascal
Unit:- Function, Procedure or subroutine.

In Object oriented language like JAVA and C++
Unit: Class

In ADA Unit could be Package or Procedures.

In 4GLS, Unit could be a display window, menu etc.

# Misconceptions of Unit Testing:-

-It is waste of time.
-Only proves that code does what the code does
-I am too good a programmer to need unit tests.
-Integration tests will catch all bugs any way.
-It is not cost effective.

# Develop unit Test Plan:-

-Entry criteria:-
An approved detailed design (Program specs) is available

Unit test Plan (UTP) is reviewed

-Exit Criteria:-
UTP is reviewed and approved.

# Design Unit Test Cases:-

-Entry Criteria: -
-UTP is available
-An approved detailed design is available

-Design of unit test cases is reviewed.

Exit Criteria
-Unit Test cases design is reviewed and approved.

# Develop unit test cases

-Entry Criteria: Design of unit test cases is available
-Validation: - unit test cases are reviewed
-Exit Criteria:- Unit test cases are reviewed and approved.

# Execute unit test cases:-

Entry criteria :- Approved unit test cases are available and Inspected code is available
Validation: Defect report reviewed.
Exit Criteria: - Test items passed the unit testing as per pass/fail criteria in the UTP
Unit testing summary details are available in the defect report

# Test Design
-Test strategy
-Test Planning
-Test Specification
-Test Procedure
# Test Specification:

-Test objective
-Initial stage of the unit
-Expected output

# UNIT Test Steps:-

-Make it run
-Positive Testing
-Negative Testing
-Special consideration
-Coverage Tests.

Unit Test Plan Template
Unit id: Prepared by
Unit Name Prepared on
Testing By Testing on



Software Testing is a critical element of software quality assurance and represents the ultimate process to ensure the correctness of the product.

Software Testing: Testing is the process of executing a program with intent of finding errors.

# What is the purpose of testing:-

-To show the software works: - it is known as demonstrated oriented.
-To show the software doesn’t work: - it is known as destruction oriented.
- To minimize the risk of not working up to acceptable level. It is known as evaluation oriented.
-To show the product is free from defect.

Why do we need test:-

Defect can exist in the software, as it is developed by human who can make mistakes during the development of software. It is the primary duty of a software vendor to ensure that software doesn’t have defect, error free application or product.

# The most common origin of software bug is due to

-Poor understanding and incomplete requirement
-Unrealistic schedule
-Fast changes in requirement
-Too many assumptions and compliancy

# Approaches to testing:

1. Debug oriented.
2. Demonstration oriented.
3. Evaluation oriented.
4. Prevention oriented.

# Purpose of debugging: Find the error/misconception that led to failure and implement progress changes that correct the error.

# Test Case: - Test case is an identify associated with program behavior it has set of input and list of expected output.

# What is bug: - Software did not operate as intended.

# Importance of Testing:-

-Testing is a critical element of s/w QA.
-Post release removal of defects in the s/w most expensive.
-Significant portion of life cycle effort expanded on testing.

# Mainly Testing Involves:

-Plan for Testing
-Design test conditions, cases.
-Develop test data.
-Create required test environment
-Execute tests
-Analyze actual result with expected results.
-Results: Test Passed or Failed.

# Level of Testing:

1. Unit Testing
2. Integration Testing
3. System Testing
4. User Acceptance Testing.

India Glorious win on the World Cup 2011 !!!!!

India won the world cup in 1983.It was indeed the most prestigious and memorable day for the entire country.

We achieved this under the the captaincy of Mr. Kapil Dev.

The wait is finally over. After 28 long years, India finally laid their hand on the ICC Cricket World Cup. During the miracle run in 1983 it was Kapil Dev who led the troops to glory and this time it was Mahendra Singh Dhoni who led from the front and helped India achieve their dream. The Indian team had a billion hopes resting on their shoulders, and they made each and every Indian proud on Saturday night as they became the first lost nation to lift the world cup.

The best part of this victory was that it was not just cricket fans that were ecstatic, but it was every Indian who basked in the moment of glory.