SE Unit IV
SE Unit IV
Unit – IV
Dr. S. Manikandan
HOD-IT
1
1. Introduction to Software Testing
2
2. Software Testing Life Cycle (STLC)
3
• Requirement Analysis:
In this phase, tester analyses requirement document of
SDLC (Software Development Life Cycle) to examine
requirements stated by the client. After examining the
requirements, the tester makes a test plan to check whether
the software is meeting the requirements or not.
• Test Plan Creation:
Here all the testing strategies are defined. Tester determines
the estimated effort and cost of the entire project. Testing
strategy and effort estimation documents provided by this
phase. Test case execution can be started after the
successful completion of Test Plan Creation.
4
• Environment setup:
Setup of the test environment is an independent activity and
can be started along with Test Case Development.
Environment setup requires a group of essential software
and hardware to create a test environment. The testing team
is not involved in setting up the testing environment, its
senior developers who create it.
• Test case Execution:
Test case Execution takes place after the successful
completion of test planning. In this phase, the testing team
starts case development and execution activity. The testing
team writes down the detailed test cases, also prepares the
test data if required. The prepared test cases are reviewed
by peer members of the team or Quality Assurance leader.
5
• Defect Logging:
Testers and developers evaluate the completion criteria of
the software based on test coverage, quality, time
consumption, cost, and critical business objectives. This
phase determines the characteristics and drawbacks of the
software. Test cases and bug reports are analyzed in depth
to detect the type of defect and its severity.
• Test Cycle Closure:
The test cycle closure report includes all the documentation
related to software design, development, testing results, and
defect reports.
6
3. Strategic Approach to Software Testing
8
9
• As per the procedural point of view the testing includes
following steps.
1) Unit testing
2) Integration testing
3) High-order tests
4) Validation testing
10
4. Strategic Issues
Following are the issues considered to implement
software testing strategies.
• Specify the requirement before testing starts in a
quantifiable manner.
• According to the categories of the user generate profiles
for each category of user.
• Produce a robust software and it's designed to test itself.
• Should use the Formal Technical Reviews (FTR) for the
effective testing.
• To access the test strategy and test cases FTR should be
conducted.
• To improve the quality level of testing generate test plans
from the users feedback.
11
5. Test Strategies for Conventional Software
12
6. Unit Testing
13
7. Integration Testing
14
Regression and Smoke Testing
15
8. System Testing
16
Following are the system tests for software-
based system
17
4. Performance testing
• Performance testing is designed to test run-time
performance of the system in the context of an
integrated system.
• It always combines with the stress testing and needs
both hardware and software requirements.
5. Deployment testing
• It is also known as configuration testing.
• The software works in each environment in which it is
to be operated.
18
9. The Art of Debugging
Debugging process
• Debugging process is not a testing process, but it is the
result of testing.
• This process starts with the test cases.
• The debugging process gives two results, i.e the cause
is found and corrected second is the cause is not
found.
19
20
The debugging strategies
1. Brute force
• Brute force is commonly used and least efficient
method for separating the cause of software error.
• This method is applied when all else fails.
2. Backtracking
• Backtracking is successfully used in small programs.
• The source code is traced manually till the cause is
found.
3. Cause elimination
• Cause elimination establishes the concept of binary
partitioning.
• It indicates the use of induction or deduction.
• The data related to the error occurrence is arranged in
separate potential cause. 21
10. Conventional Applications
Testability
• Software testability is simply how easily [a computer
program] can be tested.
The following characteristics lead to testable software.
• Operability—it operates cleanly
• Observability—the results of each test case are readily
observed
• Controllability—the degree to which testing can be
automated and optimized
• Decomposability—testing can be targeted
• Simplicity—reduce complex architecture and logic to
simplify tests
• Stability—few changes are requested during testing
• Understandability—of the design 22
What is a “Good” Test?
The following are the attributes of a “good” test:
• A good test has a high probability of finding an
error
• A good test is not redundant
• .A good test should be “best of breed”
• A good test should be neither too simple nor too
complex
23
Internal and External Views of Testing
25
To design test cases using this technique,
four steps are followed :
• Construct the Control Flow Graph
• Compute the Cyclomatic Complexity of
the Graph
• Identify the Independent Paths
• Design Test cases from Independent
Paths
26
1. Control Flow Graph –
A control flow graph (or simply, flow graph) is a
directed graph which represents the control structure of
a program or module. A control flow graph (V, E) has V
number of nodes/vertices and E number of edges in it.
A control graph can also have :
• Junction Node – a node with more than one arrow
entering it.
• Decision Node – a node with more then one arrow
leaving it.
• Region – area bounded by edges and nodes (area
outside the graph is also counted as a region.).
• 27
28
Flow Graph Notation
29
2. Cyclomatic Complexity
30
3. Independent Paths
An independent path in the control flow graph is the one which
introduces at least one new edge that has not been
traversed before the path is defined.
The cyclomatic complexity gives the number of independent
paths present in a flow graph. This is because the
cyclomatic complexity is used as an upper-bound for the
number of tests that should be executed in order to make
sure that all the statements in the program have been
executed at least once.
• Consider first graph given above here the independent
paths would be 2 because number of independent paths is
equal to the cyclomatic complexity.
So, the independent paths in above first given graph :
• Path 1:A -> B
• Path 2:C -> D 31
4. Design Test Cases :
Finally, after obtaining the independent paths, test
cases can be designed where each test case
represents one or more independent paths.
32
12. Control Structure Testing
33
1. Condition Testing :
• Condition testing is a test cased design method,
which ensures that the logical condition and
decision statements are free from errors.
• The errors present in logical conditions can be
incorrect boolean operators, missing parenthesis in
a booleans expression, error in relational operators,
arithmetic expressions, and so on.
2. Data Flow Testing :
The data flow test method chooses the test path of
a program based on the locations of the definitions
and uses all the variables in the program.
34
3. Loop Testing
35
36
• Concatenated Loops – If loops are not dependent on
each other, contact loops can be tested using the
approach used in simple loops. if the loops are
interdependent, the steps are followed in nested loops.
37
• Nested Loops – Loops within loops are called as
nested loops. when testing nested loops, the number of
tested increases as level nesting increases.
The following steps for testing nested loops are as
follows-
– Start with inner loop. set all other loops to minimum
values.
– Conduct simple loop testing on inner loop.
– Work outwards.
– Continue until all loops tested.
38
• Unstructured loops – This type of loops should be
redesigned, whenever possible, to reflect the use of
unstructured the structured programming constructs.
39
13. Black Box Testing
43
14. White Box Testing
44
The white box testing contains various tests, which are
as follows:
• Path testing
• Loop testing
• Condition testing
• Testing based on the memory perspective
• Test performance of the program
45
Path testing
• In the path testing, we will write the flow graphs and
test all independent paths. Here writing the flow graph
implies that flow graphs are representing the flow of
the program and also show how every program is
added with one another
Loop testing
• In the loop testing, we will test the loops such as while,
for, and do-while, etc. and also check for ending
condition if working correctly and if the size of the
conditions is enough.
46
Condition testing
• In this, we will test all logical conditions for
both true and false values; that is, we will verify for
both if and else condition.
Testing based on the memory (size) perspective
• The size of the code is increasing for the following reasons:
• The reuse of code is not there:
• The developers use the logic that might be modified. If
one programmer writes code and the file size is up to 250kb,
then another programmer could write a similar code using
the different logic, and the file size is up to 100kb.
• The developer declares so many functions and
variables that might never be used in any portion of the
code. Therefore, the size of the program will increase.
47
Test the performance (Speed, response time) of the
program
• The application could be slow for the following reasons:
• When logic is used.
• For the conditional cases, we will
use or & and adequately.
• Switch case, which means we cannot use nested if,
instead of using a switch case.
48
15. Model Based Testing
49
16. Testing Object Oriented Applications
50
51
Object- Oriented Testing Strategy
• Unit Testing in the OO Context Each class and each
instance of a class packages attributes and operations that
manipulate these data. Because a class can contain a
number of different operations, and a particular operation
may exist as a part of a number of different classes, the
operation is not tested in isolation but rather as a part of a
number of different classes.
52
• Integration Testing in the OO Context There are two different
strategies for integration testing of OO systems :
• 1)Thread-based testing : integrates the set of classes
required to respond to one input or event for the system.
Each thread is integrated and tested individually. Regression
testing is applied to ensure that no side effects occur.
• 2)Use-based testing : begins the construction of the system
by testing those classes that use very few server classes.
After independent classes are tested, dependent classes are
tested.
• 3)Cluster Testing : A cluster of collaborating classes is
exercised by designing test cases that attempt to uncover
errors in the collaboration.
53
• Validation Testing in the OO Context The validation of
OO software focuses on user- visible actions and user-
recognizable outputs from the system. To assist in the
derivation of validation tests, the tester should draw
upon use cases that are part of the requirement model.
Conventional black box testing methods can be used to
derive validation tests.
54