Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Testing Unit 4

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

Topics Covered:

 Software Testing Activities: Levels of Testing

 Debugging

 Testing techniques

 Exploratory Testing

 Automated Test Data Generation

 Approaches to test data generation

 Test data generation using genetic algorithm

 Test Data Generation Tools

 Software Testing Tools

 Software test Plan.


Levels of Testing
Unit Testing

 We develop software in parts / units and every unit is expected to have a defined

functionality.
 We may call it a component, module, procedure, function, etc., which will have a purpose

and may be developed independently and simultaneously.


 A unit may not be completely independent.

 The additional source code to handle the activities of a calling unit is called ‘driver’ and the

additional source code to handle the activities of a called units is called ‘stub’.
 The complete additional source code which is written for the design of stub and driver is

called scaffolding.
Integration Testing
 We combine two or more units because they share some relationship.

 This relationship is represented by an interface and is known as coupling. The coupling is the measure

of the degree of interdependence between units.


 Two units with high coupling are strongly connected and thus, dependent on each other.

 Two units with low coupling are weakly connected and thus have low dependency on each other.

 A good design should have low coupling.

System Testing
 We test complete software along with its expected environment.

 This is the only phase of testing which tests both functional and non-functional

requirements of the system.


 A team of the testing persons does the system testing under the supervision of a test team

leader.
 We also review all associated documents and manuals of the software.
Acceptance Testing

 The testing done for the purpose of accepting a product is known as acceptance

testing.
 This may be carried out by the customer(s) or persons authorized by the

customer(s).
 The venue may be the developer’s site or the customer’s site depending on

mutual agreement.
 Acceptance testing is carried out only when the software is developed for a

particular customer(s). If we develop ‘standardised’ software for anonymous


users at large, then alpha / beta testing is done.
Debugging
 The process of identifying and correcting a software error is known as debugging.

 It starts after receiving a failure report and completes after ensuring that all corrections

have been rightly placed and the software does not fail with the same set of input(s).

Why Debugging is so difficult?

 Developers become uncomfortable after receiving any request of debugging.

 Symptom may appear in one part of program, while the cause may actually be located in

other part.
 Symptom may also disappear temporarily when another error is corrected.

 There may be many reasons which may make the debugging process difficult and time

consuming.
 However, psychological reasons are more prevalent over technical reasons.
Debugging Process

 Replication of the bug

 Understanding the bug

 Locate the bug

 Fix the bug and Retest the program


Debugging Approaches

 Trial and Error Method

 Backtracking

 Brute Force

 Cause Elimination
Debugging Tools
 We may need a tool that may execute every statement of a program at a time and defined

variables without having to put print statements in the source code.


 It should print values of any variable after executing very statement of the program. Thus,

runtime debuggers are designed.


 These tools are called automatic debuggers.

 Compilers are also used for finding bugs.

 We may apply a wide variety of tools like run time debugger, automatic debugger,

automatic test case generators, etc. during the debugging process.


 However, tools are not the substitute for careful examination of the source code after

thorough understanding.
Software Test Plan
 The test plan document may force us to maintain a certain level of standards.

 The most popular document is the IEEE standard for Software Test Documentation (Std

829 – 1998).
 This document addresses the scope, schedule, milestones and purpose of various testing

activities.
 It also specifies the items and features to be tested and features which are not to be

tested.
 Pass/fail criteria, roles and responsibilities of persons involved, associated risks and

constraints are also described in this document.


 We should also describe who will perform testing, at what level and when.

 Roles and responsibilities of testers must be clearly documented.


Software Testing Tools

I. Static Software Testing Tools


a) Complexity Analysis Tools

b) Syntax and semantic analysis tools

c) Flow graph generator tools

d) Code comprehension tools

e) Code inspectors

II. Dynamic Software Testing Tools

f) Coverage Analysis Tools


g) Performance Testing Tools
h) Functional / Regression Testing Tools
Process Management Tools
 These tools help us to manage and improve the software testing process.
 We may create a test plan, allocate resources and prepare a schedule for unattended
testing for tracking the status of a bug using such tools.
 They improve many aspects of testing and make it a disciplined process.
 Tools assist us to make testing effective, efficient and performance oriented.

Exploratory Testing
 It is a type of testing in which the tester is free to select any possible methodology to test the software.

 It checks the functionality and operations of the software as well as identify the functional and

technical faults in it.


 The aim of exploratory testing is to optimize and improve the software in every possible way.
Types of Exploratory Testing

Advantages
 Early detection of critical bug.
 Needs less preparation.
 We can also find those bugs which may have been missed in the test cases.
 Test the new features, whereas, for the existing functionality, we will use the regression
testing if we have less time to test the application.

Disadvantages
 For the test engineer, this testing requires a lot of concentration to explore the
application.
 Time taking process because we don't know the requirements.
 The test engineer will misunderstand the feature as a bug.
 Bugs can be misunderstood as a feature.
Automated Test Data Generation
 Automated test data generation is an activity that generates test data automatically for the

software under test.


 The quality and effectiveness of testing is heavily dependent on the generated test data.

 The simplest way is to generate test data randomly, meaning, without considering any

internal structure and / or functionality of the software.

Test Adequacy Criteria


1. Every statement of the source code should be executed at least once (statement coverage).
2. Every branch of the source code should be executed at least once (branch coverage).
3. Every condition should be tested at least once (condition coverage).
4. Every path of the source code should be executed at least once (path coverage).
5. Every independent path of source code should be executed at least once (independent path
coverage).
6. Every stated requirement should be tested at least once.
7. Every possible output of the program should be verified at least once.
8. Every definition use path and definition clear path should be executed at least once.
Static and Dynamic Test Data Generation
 The techniques which are based on static evaluation are called static test data generation
techniques. They do not require the execution of the program. The program is examined
thoroughly and its paths are traversed without executing the program.
 The techniques which are based on the actual execution of the program for the generation
of test data are called dynamic test data generation techniques. If during execution, a
desired path is not executed, the program is traced back to find the statement which has
diverted the desired flow of the program.
APPROACHES TO TEST DATA GENERATION
 Random Testing
 Symbolic Execution
 Dynamic test data generation Test Data Generation Tools
TEST DATA GENERATION USING GENETIC ALGORITHM
 With reference to software testing, GA is used to search the domain of input variables and to
find those input variables which satisfy the desired goal of testing.
 Inputs are combined to generate new inputs which are used for further searching of the desired
goal.
 The power of GA is the technique of applying GA operators (crossover and mutation) to a
population of individuals.
 It uses the old knowledge held in a parent population to generate new solutions with improved
performance.
 Good solutions are retained and relatively bad ones are discarded and are replaced by fitter new
members called offsprings.
 The significant parameters for a genetic algorithm are:

(i) Initial population


(ii) Operators such as mutation and crossover with their values.
(iii) Fitness function created to guide the search procedure.
(iv) Selection strategy for parents.
(v) Stopping criteria
ALGORITHM FOR TEST DATA GENERATION USING GENETIC ALGORITHM
1. Genetic algorithm begins with an initial population which is randomly generated where each
population is represented as a chromosome.
2. Fitness of each individual is calculated for comparing them and to differentiate their performance.
3. An individual who is near an optimum solution is assigned a higher fitness value.
4. A stopping criterion is decided for stopping the test data generation process. It may be based on
coverage criteria, number of iterations or the size of the final population. The following steps are
repeated until the criterion is satisfied. The genetic operators: crossover and mutation are
randomly selected.

(a) If the crossover operator is selected the following steps are followed:
(i) Parents are selected from the initial population on the basis of their fitness value.
(ii) Crossover is performed to generate offsprings with probably better genes / fitness
value.

(b) Otherwise
Each offspring is mutated by occasional random alteration of a bit value with changes
in some features with unpredictable consequences.

5. Data is prepared for the next generation. If after nth generation, the criteria are satisfied then
testing will be stopped at this point.
Thank You!

You might also like