Management
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.
2
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
8
Flow Graph Notation
A predicate node has two edges leading out from it (True and False)
9
Flow Graph Notation
An edge, or a link, is a an arrow representing flow of control in a
specific direction
When counting regions, include the area outside the graph as a region,
too
10
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 11
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
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
12
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
Number of regions = 4
4) Prepare test cases that will force execution of each path in the
basis set
14
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 15
A Sample Function to Diagram and Analyze
1 int functionZ(int y)
2 {
3 int x = 0;
20 printf("End of list\n");
21 return 0;
22 } // End functionZ 16
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
10 x++;
11 } // End if 10
12 else if ((x % 7 == 0) || 15
13 (x % y == 1))
14 { 16
15 printf(“%d”, y);
16 x = x + 2; 18
17 } // End else
18 printf(“\n”);
19 } // End while 20
20 printf("End of list\n"); 21
21 return 0;
22 } // End functionZ 17
Graph Matrices
To develop s/w tool that assist in basis path testing, a DS called graph
matrix is quite useful.
19
When is White Box Testing
appropriate
“The rigour that white box Testing employs is quite useful – yes,
but not all the time.”
By mission critical, we mean for instance the Core Banking system that
provides the IT backbone to operate a Bank.
The core banking system will house all transactions and corresponding
customer data, and helps run the bank day-to-day.
Another example could be IT systems that help governments-run defence
operations.
Any system that provides such critical utility to a company, organization or
government needs to be bug-free. Any level of bugs or downtime is unacceptable
for such systems, as they perform extremely vital functions for the stakeholders
involved. 20
Black-box Testing
Black Box Testing - Steps
Here are the generic steps followed to carry out any type of Black Box Testing.
Tester chooses valid inputs (positive test scenario) to check whether SUT processes
them correctly . Also some invalid inputs (negative test scenario) are chosen to verify
that the SUT is able to detect them.
Software tester compares the actual outputs with the expected outputs.
22
Black-box Testing Categories
Interface errors
23
Black-box Testing
Practically, due to time and budget considerations, it is not possible to
perform exhausting testing for each set of test data, especially when
there is a large pool of input combinations.
We need an easy way or special techniques that can select test cases
intelligently from the pool of test-case, such that all test scenarios are
covered.
24
What is Boundary Testing?
Boundary testing is the process of testing between extreme ends or boundaries
between partitions of the input values
So these extreme ends like Start- End, Lower- Upper, Maximum-Minimum, Just
Inside-Just Outside values are called boundary values and the testing is called
"boundary testing".
The basic idea in boundary value testing is to select input variable values at
their:
Minimum
Just above the minimum
A nominal value
Just below the maximum
Maximum
25
What is Equivalent Class
Partitioning?
Equivalent Class Partitioning is a black box technique (code is not visible
to tester) which can be applied to all levels of testing like unit,
integration, system, etc. In this technique, you divide the set of test
condition into a partition that can be considered the same.
You can apply this technique, where there is a range in input field.
26
Example 1: Equivalence and
Boundary Value
Let's consider the behavior of tickets in the Flight reservation application, while
booking a new flight.
27
Ticket values 1 to 10 are considered valid & ticket is booked. While value 11 to 99
are considered invalid for reservation and error message will appear, "Only ten
tickets may be ordered at one time."
28
Here is the test condition
Any Number greater than 10 entered in the reservation column (let say 11) is
considered invalid.
We cannot test all the possible values because if done, the number of test cases
will be more than 100. To address this problem, we use equivalence
partitioning hypothesis where we divide the possible values of tickets into
groups or sets as shown below where the system behavior can be considered
the same.
29
30
The divided sets are called Equivalence Partitions or Equivalence Classes.
Then we pick only one value from each partition for testing. The hypothesis
behind this technique is that if one condition/value in a partition passes all
others will also pass. Likewise, if one condition in a partition fails, all other
conditions in that partition will fail.
31
Boundary Value Analysis- in Boundary Value Analysis, you test boundaries
between equivalence partitions
32
Example 2
Equivalence and Boundary Value
Suppose a password field accepts minimum 6 characters and maximum
10 characters
That means results for values in partitions 0-5, 6-10, 11-14 should be
equivalent
33
Examples 3: Input Box should accept
the Number 1 to 10
34
Why Equivalence & Boundary
Analysis Testing
35
Equivalence Partitioning
36
Guidelines for Defining Equivalence Classes
If an input condition specifies a range, one valid and two invalid equivalence
classes are defined
If an input condition requires a specific value, one valid and two invalid
equivalence classes are defined
If an input condition specifies a member of a set, one valid and one invalid
equivalence class are defined
Input set: {-2.5, 7.3, 8.4} Eq classes: {-2.5, 7.3, 8.4}, {any other x}
If an input condition is a Boolean value, one valid and one invalid class are define
37
Boundary Value Analysis
It derives test cases from both the input domain and output
domain
38
Guidelines for
Boundary Value Analysis
Apply guidelines 1 and 2 to output conditions; produce output that reflects the
minimum and the maximum values expected; also test the values just below and just
above
39
Software Testing
Strategies
Introduction
41
A Strategic Approach to
Testing
General Characteristics of Strategic Testing
Testing begins at the component level and work outward toward the
integration of the entire computer-based system
The set of activities that ensure that the software that has been
built is traceable to customer requirements
44
A Strategy for Testing Conventional
Software
System Testing
Validation Testing
Integration Testing
Unit Testing
Code
Design
Requirements
System Engineering
45
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
46
Unit Testing
47
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
48
Integration Testing
Two Approaches
Non-incremental Integration Testing
49
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
From Mail box Selected email
Check the interface link
select the an email should appear in
2 between the Mailbox and
and click delete the Deleted/Trash
Delete Mails Module
button folder
50
Non-incremental
Integration Testing
Chaos results
Once a set of errors are corrected, more errors occur, and testing
appears to enter an endless loop
51
Incremental Integration Testing
Three kinds
Top-down integration
Bottom-up integration
Sandwich integration
52
Top-down Integration
53
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
54
Bottom-up Integration
55
Bottom-up Integration
Advantages:
Disadvantages:
Integration and testing starts with subsystems & then added to the modules above
them.
Advantages
This approach verifies low-level data processing early in the testing process
Disadvantages
Driver modules need to be built to test the lower-level modules; this code is later
discarded or expanded into a full-featured version
Drivers inherently do not contain the complete algorithms that will eventually use
the services of the lower-level modules; consequently, testing may be incomplete
or more testing may be needed later when the upper level modules are available
57
Sandwich Integration
Occurs both at the highest level modules and also at the lowest level
modules
High and low-level modules are grouped based on the control and data
processing they provide for a specific program feature
58
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 59
Smoke Testing
Smoke testing is likely to uncover both functional errors and architectural and
component-level design errors
Smoke testing will probably uncover errors in the newest components that were
integrated
As integration testing progresses, more software has been integrated and more has
been demonstrated to work ,Managers get a good indication that progress is being
61
made
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
65
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
67
What is Quality Assurance ?
Quality =
– ...meeting the customer’s requirements,
– ...at the agreed cost,
– ...within the agreed timescales.
Quality = “Fitness for purpose”
Quality = Customer satisfaction !
“Success” v “Failure”
Quality Assurance helps us avoid failure !
Failure Failure
Success
Content
Failure
Quality Concepts
Process Formal
Definition & Technical
Standards Reviews
Process Test
Formal
Definition & Planning
Technical
Standards & Review
Measurement
Analysis Reviews
& TestTest
Reporting Planning
Planning
Measurement & Review
& Review
Measure
ment
Software Quality Assurance
1. SQA is an umbrella activity that is applied throughout the
software process.
2. SQA encompasses :
producer
maintenance
recorder reviewer
user rep
Conductingbethe Review
prepared—evaluate
1.
product before the review
79
The SQA Attribute contd..
80
The SQA Attribute contd..
Reliability: The purpose of the attribute is to check the
capability of the system to perform without delay during any
conditions
◦ Maturity: Less possibility of failure of the software in any activities.
◦ Recoverability: The rate of recovery ability once a failure occurs.
A simple measure of reliability is mean time
between failure (MTBF), where
MTBF = MTTF + MTTR
81
Software Availability
changes in
business requirements
changes in
technical requirements
changes in
user requirements other
documents
software models
Project
Plan
data
Test
code
Software Configuration Items
check-out SCIs
• What happened?