Sei sulla pagina 1di 32

TESTING

NEED OF TESTING
The aim of program testing is to identify all defects in a program. Software testing is needed to verify and validate that the software that has been built to meet the specifications. Testing ensures that what you get in the end is what you wanted to build. Testing enhances the integrity of a system by detecting deviations in design and errors in the system.

Basic concepts
Testing a program involves providing the program with set of test inputs and observing the program behaves as expected. An error is a mistake commited by the development team during development phase.(a fault, a bug, a defect) A test case is a triplet[I,S,O] A test suite is the set of all test cases with which a given software tested. While verification is concerned with phase containment of errors, the aim of validation is to make final product error free.

Levels of testing

1)Unit testing: It is referred as testing in the small. Unit testing is undertaken after a module has been coded and reviewed. During unit testing, all the individual components of a program are tested . Requires knowledge of the internal program design and code. Done by Programmers (not by testers). Methods for testing are White Box testing techniques,Test Coverage techniques .

2)Integration testing:
After testing individually, the units are slowly integrated and tested after each step of integration Developers does this type of testing. Methods of testing are: White and Black Box techniques

3)System testing:
Finally, the fully integrated system is tested. Integration testing and system testing are known as testing in the large. Objective is To perform inter-system test and to check the transaction flow To demonstrate that the system performs both functionally and operationally as specified System testers do this kind of test.

4) Systems Integration Testing


To test the co-existence of products and applications that are required to perform together in the production-like operational environment The system connected with the network in organisation and make an environment where the project can be run and test it System Testers do this kind of test.

5) Acceptance Testing
The objective is To verify that the system meets the user requirements It is done in the users environment User does this kind of testing

Testing methods/techniques

1)Black box testing: This testing methodology looks at what are the available inputs for an application and what the expected outputs are that should result from each input. It is solely based on an analysis of the input/output behaviour(functional behaviour) This testing is also known as functional testing

2)White box testing: white-box testing enables you to see what is happening inside the application. It means while designing test cases for white box testing ,one needs to have a thorough knowledge of the internal structure of a program. It is also known as structural testing. It is based on analysis of the code.

Testing activities

code Design document SRS document Design test suite Run test and check result

Test suite

Failure list

Corrected programs

Corrected errors

Error list

Debug program

Design test cases

Design test cases In Black box testing


There are two approaches to design black box test cases 1)Equivalence class partitioning Here the domain of input values to the program under test is partitioned into a set of equivalence classes and take one input from each class to form test case General guidelines for designing the equivalence classes: -if the range of values specified in the program, then one valid and two invalid classes need to be identified.-if the input data assumes values from set of discrete members of some domain, then one valid class and one invalid class should be defined.(eg, ABCD)

2)Boundary value analysis: Boundary value analysis-based test suite design involves designing test cases using the values at the boundaries of different equivalnce classes. It is done to find out the error related to the <;>;>=;<= etc. Here first the equivalence classes is identified only if it contains range of values. And boundary values are included in the test case. If there are not a range of values ,then boundary value test case cant be defined.

problem
1)For software that computes the square root of an integer that can assume values in the range of 0 to 5000. determine the equivance and boundary value analysis 2)Design equivalence class for a function that reads a character string of size less than five characters and displays whether it is palindrome.

Design test cases In White box testing


Large no. of white box testing strategies exists to design test cases. Each strategies design test cases based on the analysis of source code. Ex: 1)statement coverage strategy 2)branch coverage strategy 3)path coverage

Statement coverage strategy


It aims to design test cases so as to execute every statement in a program at least once. Here for upper control loop, it needs to be false. And for inner control loop, it needs to be made true and false.

Branch coverage strategies


It aims at designing test cases so as to make each branch condition in a program to assume true and false values in turn. It is stronger testing than statement coverage testing

Path coverage strategy


It aims at designing test cases such that all linearly independent paths(basis path) In the program are executed at least once. Before identifying the basis path, tester need to have the knowledge of CFG CFG is a control flow graph. It describes how the control flows trough the program. CFG for sequence, selection and iteration. Specify the nodes and edge in the CFG.

Find the no of linear independent graph in the program using Mccabes Cyclomatic complexity metric V(G)=E-N+2 Then find out the path from source to destination. each path should be different from others.means same nodes should not be in other path.in addition new node should be there. And specific value is given according to path Example: path1= (1,6) value=(3,3)

Debugging approches
After a failure has been detected, it is necessary to first identify the program statements that are in error and are responsible for the failure, the error can then be fixed. Approaches: 1)backtracking: fairly common approach in this approach, beginning from the statement at which an error symptom has been observed, the source code is traced backwards until the error is discovered.

2)Cause elimination method: In this approach, once a failure is observed, the symptoms of the failure(that is certain variable is having a ve value though it should be +ve, etc) are noted. After it, the cause of error is found and it is corrected.

Code reviews
Code review is undertaken after the module successfully compiles. Reviews directly detect errors while testing is done stepwise. Failure finding is the result of testing. hence it is effective. There are two types of reviews are carried out on the code of the module. 1)Code walkthrough 2)Code inspection

Code walkthrough: The main aim of this is to discover the algorithmic and logical errors in the code. Code inspection: The main aim of this is to check for the presense of some common type errors that usually due to programmer oversights and to check whether coding standards have been adhered to.

Stress test
the goals of such tests may be to ensure the software does not crash in conditions of insufficient computational resources (such as memory or disk space) Stress testing tries to break the system under test Stress testing evaluates system performance when it is stressed for short periods times. For eg. Imposing a range of illegal input condition so as to stress the capabilities of the software. Input data volume,input data rate,processing time ,utiliation of memory etc are tested beyond the designed capacity.

Load test
"load testing" is usually defined as the process of exercising the system under test by feeding it the largest tasks it can operate with. load testing operates at a predefined load level, usually the highest load that the system can accept while still functioning properly.

Use case based testing


For each use case typically consists of a mainline scenario and severalalternate scenarios. The mainline and alternate sequences are covered to check if any errors show up.

automation testing
.Test automation is the process of writing a computer program to do testing This is often the most cost effective method for software products There are two general approaches to test automation: 1)Code-driven testing. The public (usually) interfaces to classes, modules, or libraries are tested with a variety of input arguments to validate that the results that are returned are correct. 2)Graphical user interface testing. A testing framework generates user interface events such as keystrokes and mouse clicks, and observes the changes that result in the user interface, to validate that the observable behavior of the program is correct.

Integration testing
The primary objective of this testing is to test the module interfaces, i.e. there are no errors in parameter passing, when one module invokes the functionality of another module. Four approaches: 1)big-bang integration testing 2)Bottom up 3)Top down 4)Mixed

Potrebbero piacerti anche