Professional Documents
Culture Documents
- Testing fundamentals
- White-box testing
- Black-box testing
Testing
Software testing is a process of executing a program or application with the
intent of finding the software bugs.
Activity to check whether the actual results match the expected results and to
ensure that the software system is Defect free.
Software testing also helps to identify errors, gaps or missing requirements in
contrary to the actual requirements.
done manually or using automated tools
Static testing- during verification process
2
Test Characteristics
The tester must understand the software and how it might fail
Testing time is limited; one test should not serve the same purpose as
another test
A good test should be neither too simple nor too complex
3
Testing Techniques
Black-box testing
software
4
Testing Techniques contd..
White-box testing
Knowing the internal workings of a product, test that all
internal operations are performed according to
specifications and all internal components have been
exercised
5
White-box Testing
White-box Testing
Uses the control structure part of component-level design to derive
the test cases
These test cases
8
Flow Graph Notation
When counting regions, include the area outside the graph as a region,
too
9
Flow Graph Example
FLOW CHART FLOW GRAPH
0 0
R4
1 1
2 2
3 R3
3
6 4 6 4
R2
7 8 5
7 R1 8 5
9
9
11 10 11 10 10
Independent Program Paths
Defined as a path through the program from the start node until the end node that
introduces at least one new set of processing statements or a new condition (i.e., new
nodes)
Must move along at least one edge that has not been traversed before by a previous
path
Basis set for flow graph on previous slide
Path 1: 0-1-11
Path 2: 0-1-2-3-4-5-10-1-11
Path 3: 0-1-2-3-6-8-9-10-1-11
Path 4: 0-1-2-3-6-7-9-10-1-11
The number of paths in the basis set is determined by the cyclomatic complexity
11
Cyclomatic Complexity
Provides a quantitative measure of the logical complexity of a program
Provides an upper bound for the number of tests that must be conducted to ensure all
statements have been executed at least once
Can be computed three ways
V(G) = E – N + 2, where E is the number of edges and N is the number of nodes in graph
G
V(G) = P + 1, where P is the number of predicate nodes in the flow graph G
Number of regions = 4
4) Prepare test cases that will force execution of each path in the
basis set
13
A Second Flow Graph Example
3
1 int functionY(void)
2 {
3 int x = 0; 4
4 int y = 19;
5 A: x++; 5
6 if (x > 999)
7 goto D;
8 if (x % 11 == 0)
6
9 goto B; 8 7
10 else goto A;
11 B: if (x % y == 0) 10 9 16
12 goto C;
13 else goto A; 11 17
14 C: printf("%d\n", x);
15 goto A; 13 12
16 D: printf("End of list\n");
17 return 0; 14
18 }
15 14
A Sample Function to Diagram and Analyze
1 int functionZ(int y)
2 {
3 int x = 0;
0 printf("End of list\n");
1 return 0;
2 } // End functionZ 15
A Sample Function to Diagram and Analyze
1 int functionZ(int y) 3
2 {
3 int x = 0;
4
4 while (x <= (y * y))
5 { 6 7
6 if ((x % 11 == 0) &&
7 (x % y == 0))
8 { 9
9 printf(“%d”, x);
12 13
0 x++;
1 } // End if 10
2 else if ((x % 7 == 0) || 15
3 (x % y == 1))
4 { 16
5 printf(“%d”, y);
6 x = x + 2; 18
7 } // End else
8 printf(“\n”);
9 } // End while 20
0 printf("End of list\n"); 21
1 return 0;
2 } // End functionZ 16
Graph Matrices
To develop s/w tool that assist in basis path testing, a DS called graph
matrix is quite useful.
Is a square matrix whose size is equal to no of nodes on the flow
graph
Each node is identified by nos. & each edge is identified by letters
18
Software Testing
Strategies
A Strategic Approach to
Testing
General Characteristics of Strategic Testing
System Testing
r s to
pe
Validation Testing
de w
co
o a ro
Br Nar
Integration Testing
Unit Testing
Code
Design
re to
nc c t
te
co tra
Requirements
s
Ab
System Engineering
24
Levels of Testing for
Conventional Software
Unit testing
Concentrates on each component/function of the software as
implemented in the source code
Integration testing
Focuses on the design and construction of the software
architecture
Validation testing
Requirements are validated against the constructed software
System testing
The software and other system elements are tested as a whole
25
Unit Testing
26
Targets for Unit Test Cases
Module interface
Ensure that information flows properly into and out of the module
Local data structures
Ensure that data stored temporarily maintains its integrity during all steps in an
algorithm execution
Boundary conditions
Ensure that the module operates properly at boundary values established to limit or
restrict processing
Independent paths (basis paths)
Paths are exercised to ensure that all statements in a module have been executed at
least once
Error handling paths
Ensure that the algorithms respond correctly to specific error conditions
27
Integration Testing
28
Sample Integration Test Cases for the
following scenario:
Application has 3 modules say 'Login Page', 'Mail box' and 'Delete mails' and
each of them are integrated logically.
Here do not concentrate much on the Login Page testing as it's already been
done in Unit Testing. But check how it's linked to the Mail Box Page.
Similarly Mail Box: Check its integration to the Delete Mails Module.
Test Case
Test Case ID Test Case Objective Expected Result
Description
Check the interface link Enter login
To be directed to
1 between the Login and credentials and click
the Mail Box
Mailbox module on the Login button
Selected email
Check the interface link From Mail box select
should appear in
2 between the Mailbox and the an email and
the Deleted/Trash
Delete Mails Module click delete button
folder
29
Non-incremental
Integration Testing
Chaos results
Once a set of errors are corrected, more errors occur, and testing
appears to enter an endless loop
30
Incremental Integration Testing
Three kinds
Top-down integration
Bottom-up integration
Sandwich integration
31
Top-down Integration
32
Top-down Integration contd..
Advantages
This approach verifies major control or decision points early in the test
process
Disadvantages
Stubs need to be created to substitute for modules that have not been
built or tested yet; this code is later discarded
Because stubs are used to replace lower level modules, no significant
data flow can occur until much later in the integration/testing process
33
Bottom-up Integration
34
Bottom-up Integration
Advantages:
Fault localization is easier.
Disadvantages:
Occurs both at the highest level modules and also at the lowest level
modules
Proceeds using functional groups of modules, with each group completed
before the next
High and low-level modules are grouped based on the control and data
processing they provide for a specific program feature
Reaps the advantages of both types of integration while minimizing the
need for drivers and stubs
37
Regression Testing
Each new addition or change to baselined software may cause problems with functions
that previously worked flawlessly
Regression testing re-executes a small subset of tests that have already been conducted
Additional tests that focus on software functions that are likely to be affected by
the change
Tests that focus on the actual software components that have been changed 38
Validation Testing
Background
Alpha testing
Conducted at the developer’s site by end users
Software is used in a natural setting with developers watching intently
Testing is conducted in a controlled environment
Beta testing
Conducted at end-user sites
Developer is generally not present
It serves as a live application of the software in an environment that
cannot be controlled by the developer
The end-user records all problems that are encountered and reports these
to the developers at regular intervals
After beta testing is complete, software engineers make software
modifications and prepare for release of the software product to the
entire customer base
42
System Testing
Different Types
Recovery testing
Tests for recovery from system faults
Forces the software to fail in a variety of ways and verifies that recovery is
properly performed
Tests reinitialization, checkpointing mechanisms, data recovery, and restart for
correctness
Security testing
Verifies that protection mechanisms built into a system will, in fact, protect it
from improper access
Stress testing
Executes a system in a manner that demands resources in abnormal quantity,
frequency, or volume
Performance testing
Tests the run-time performance of software within the context of an integrated
system
Often coupled with stress testing and usually requires both hardware and
software instrumentation 44