SE Module 5
SE Module 5
MODULE 5
Software Testing
What is testing?
“Testing is the process of executing a program with the intent of finding errors.”
Although software testing is itself an expensive activity, yet launching of software without testing may
lead to cost potentially much higher than that of testing, specially in systems where human safety is
involved.In the software life cycle the earlier the errors are discovered and removed, the lower is the
cost of their removal.
1
KE College Dept of Computer Application SE Module 5
The set of test cases is called a test suite. Hence any combination of test cases may generate a
test suite.Test suite is a container that has a set of tests which helps testers in executing and
reporting the test execution status. It can take any of the three states namely Active, Inprogress
and completed.Test suites are created based on the cycle or based on the scope. It can contain
any type of tests, viz - functional or Non-Functional.
Verification is the process of confirming if the software is meeting the business requirements,
and is developed adhering to the proper specifications and methodologies.
● Errors - These are actual coding mistakes made by developers. In addition, there is a
difference in output of software and desired output, is considered as an error.
● Fault - When error exists fault occurs. A fault, also known as a bug, is a result of an
error which can cause system to fail.
● Failure - failure is said to be the inability of the system to perform the desired task.
Failure occurs when fault exists in the system.
Validation is the process of evaluating a system or component during or at the end of the
development process to determine whether it satisfies the specified requirements .It examines
whether or not the software satisfies the user requirements. It is carried out at the end of the
SDLC. If the software matches requirements for which it was made, it is validated.
● Validation ensures the product under development is as per the user requirements.
● Validation answers the question – "Are we developing the product which attempts all that
user needs from this software ?".
● Validation emphasizes on user requirements.
2
KE College Dept of Computer Application SE Module 5
Testing= Verification+Validation
Alpha Tests are conducted at the developer’s site by some potential customers. These tests are
conducted in a controlled environment. Alpha testing may be started when the formal testing process is
near completion.
Beta Tests are conducted by the customers / end users at their sites. Unlike alpha testing, developers
are not present here. Beta testing is conducted in a real environment that cannot be controlled by the
developer.
3
KE College Dept of Computer Application SE Module 5
● Alpha testing may require ● Beta testing requires only a few weeks
long execution cycle. of execution.
It is basically defined as a type of testing which verifies that each function of the software
application works in conformance with the requirement and specification. This testing is not
concerned about the source code of the application.
4
KE College Dept of Computer Application SE Module 5
1.Syntax Driven Testing – This type of testing is applied to systems that can be syntactically
represented by some language. For example- compilers,language that can be represented by
context free grammar. In this, the test cases are generated so that each grammar rule is used at
least once.
2. Equivalence partitioning – It is often seen that many type of inputs work similarly so instead
of giving all of them separately we can group them together and test only one input of each
group. The idea is to partition the input domain of the system into a number of equivalence
classes such that each member of class works in a similar way, i.e., if a test case in one class
results in some error, other members of class would also result into same error.
3.Boundary values - The input is divided into higher and lower end values. If these values pass
the test, it is assumed that all values in between may pass too.
4.Cause-effect graphing - In both previous methods, only one input value at a time is tested.
Cause (input) – Effect (output) is a testing technique where combinations of input values are
tested in a systematic way.
5
KE College Dept of Computer Application SE Module 5
6. State-based testing - The system changes state on provision of input. These systems are
tested based on their states and input.
There are many types of Black Box Testing but the following are the prominent ones –
● Functional testing – This black box testing type is related to the functional
requirements of a system; it is done by software testers.
● Non-functional testing – This type of black box testing is not related to testing of
specific functionality, but non-functional requirements such as performance, scalability,
usability.
● Regression testing –Regression testing is done after code fixes, upgrades or any other
system maintenance to check the new code has not affected the existing code.
● The black box test is based on the specification of requirements, so it is examined in the
beginning.
● In the second step, the tester creates a positive test scenario and an adverse test
scenario by selecting valid and invalid input values to check that the software is
processing them correctly or incorrectly.
● In the third step, the tester develops various test cases such as decision table, all pairs
test, equivalent division, error estimation, cause-effect graph, etc.
● The fourth phase includes the execution of all test cases.
● In the fifth step, the tester compares the expected output against the actual output.
● In the sixth and final step, if there is any flaw in the software, then it is cured and tested
again.
6
KE College Dept of Computer Application SE Module 5
● SInce the tester and developer are independent of each other, testing is balanced and
unprejudiced.
● Tester can be non-technical.
● There is no need for the tester to have detailed functional knowledge of system.
● Tests will be done from an end user's point of view, because the end user should accept
the system. (This testing technique is sometimes also called Acceptance testing.)
● Testing helps to identify vagueness and contradictions in functional specifications.
● Test cases can be designed as soon as the functional specifications are complete.
● Test cases are challenging to design without having clear functional specifications.
● It is difficult to identify tricky inputs if the test cases are not developed based on
specifications.
● It is difficult to identify all possible inputs in limited testing time. As a result, writing test
cases may be slow and difficult.
● There are chances of having unidentified paths during the testing process.
● There is a high probability of repeating tests already performed by the programmer.
The term 'white box' is used because of the internal perspective of the system. The clear box or
white box or transparent box name denote the ability to see through the software's outer shell
into its inner workings.
The white box testing contains various tests, which are as follows:
● Path testing
● Loop testing
● Condition testing
7
KE College Dept of Computer Application SE Module 5
We have divided the process into two basic parts so that you can understand the process
briefly. So let’s discuss the process of testing an application through the technique of White Box
Testing:
Firstly, a tester/developer requires understanding and learning the source code of any
application.
As we know that White Box Testing includes internal workings of an application, so the tester
must be proficient in the programming languages. These languages are used in the testing of
various applications. Apart from it, the tester must be highly aware of secure coding methods,
and security is a primary objective of testing software. Hence, it is also essential that a tester
must be capable of finding security issues and preventing attacks from hackers and who may
insert malicious code in the application both knowingly or unknowingly.
The second essential step to White Box Testing includes testing the source code application for
appropriate structure and flow. Testers need to create more and more sources for testing the
application and develop little tests for every process in an application. This process demands
specialized knowledge of the code. Other processes involve Manual Testing, error testing and
the usage of testing tools, so we will discuss these aspects in further information.
Advantage
8
KE College Dept of Computer Application SE Module 5
● This testing helps to optimize the codes by finding hidden bugs and errors from the
software.
Disadvantage
9
KE College Dept of Computer Application SE Module 5
It is generally seen that a large number of errors occur at the boundaries of the defined input
values rather than the center. It is also known as BVA and gives a selection of test cases which
exercise bounding values.
This black box testing technique complements equivalence partitioning. This software testing
technique base on the principle that, if a system works well for these particular values then it will
work perfectly well for all values which comes between the two boundary values.
For example, programmers may improperly use < instead of <=, or conversely <= for <.
Boundary value analysis leads to selection of test cases at the boundaries of the different
equivalence classes.
Example: For a function that computes the square root of integer values in the range of 0 and
5000, the test cases must include the following values: {0, -1,5000,5001}.
The concept behind this technique is that test case of a representative value of each class is
equal to a test of any other value of the same class. It allows you to Identify valid as well as
invalid equivalence classes
In equivalence partitioning, equivalence classes are evaluated for given input conditions.
Whenever any input is given, then type of input condition is checked, then for this input
conditions, Equivalence class represents or describes set of valid or invalid states.
1. The equivalence classes are identified by taking each input condition and partitioning it into
valid and invalid classes. For example, if an input condition specifies a range of values from 1 to
10
KE College Dept of Computer Application SE Module 5
999, we identify one valid equivalence class [1<item<999]; and two invalid equivalence classes
[item<1] and [item>999].
2. Generate the test cases using the equivalence classes identified in the previous step. This is
performed by writing test cases covering all the valid equivalence classes. Then a test case is
written for each invalid equivalence class so that no test contains more than one invalid class.
This is to ensure that no two invalid classes mask each other.
Steps
11
KE College Dept of Computer Application SE Module 5
2. The semantic content of the specification is analysed and transformed into a boolean graph
linking the causes & effects.
5. The columns in the decision table are converted into test cases.
Structural Testing
Structural testing is a type of software testing which uses the internal design of the software
for testing or in other words the software testing which is performed by the team which knows
the development phase of the software, is known as structural testing.A complementary
approach to functional testing is called structural / white box testing. It permits us to examine the
internal structure of the program.
Mutation Testing:
Mutation Testing is a type of Software Testing that is performed to design new software tests
and also evaluate the quality of already existing software tests. Mutation testing is related to
12
KE College Dept of Computer Application SE Module 5
modification a program in small ways. It focuses to help the tester develop effective tests or
locate weaknesses in the test data used for the program.
Path Testing
Path Testing is a method that is used to design the test cases. In path testing method, the
control flow graph of a program is designed to find a set of linearly independent paths of
execution. In this method Cyclomatic Complexity is used to determine the number of linearly
independent paths and then test cases are generated for each path.Path testing is the name
given to a group of test techniques based on judiciously selecting a set of test paths through the
program. If the set of paths is properly chosen, then it means that we have achieved some
measure of test thoroughness.
1. generating a set of paths that will cover every branch in the program.
2. finding a set of test cases that will execute every path in the set of program paths.
13
KE College Dept of Computer Application SE Module 5
● Cyclomatic Complexity:
After the generation of the control flow graph, calculate the cyclomatic complexity of
the program using the following formula.
● Make Set:
Make a set of all the path according to the control floe graph and calculated cyclomatic
complexity. The cardinality of set is equal to the calculated cyclomatic complexity.
● Create Test Cases:
Create test case for each path of the set obtained in above step.
Flow Graph
The control flow of a program can be analysed using a graphical representation known as flow
graph. The flow graph is a directed graph in which nodes are either entire statements or
fragments of a statement, and edges represents flow of control.
14
KE College Dept of Computer Application SE Module 5
Cyclomatic Complexity
McCabe’s cyclomatic metric V(G) = e – n + 2P. For example, a flow graph shown in in Fig. 21
with entry node ‘a’ and exit node ‘f’.
15
KE College Dept of Computer Application SE Module 5
1. V(G) ≥1
2. V (G) is the maximum number of independent paths in graph G.
3. Inserting & deleting functional statements to G does not affect V(G).
4. G has only one path if and only if V(G)=1.
5. Inserting a new row in G increases V(G) by unity.
6. V(G) depends only on the decision structure of G.
Graph Matrix
A graph matrix is a data structure that can assist in developing a tool for automation of path
testing. Properties of graph matrices are fundamental for developing a test tool and hence graph
matrices are very useful in understanding software testing concepts and theory. It is a square
matrix whose size represents the number of nodes in the control flow graph.Each row and
column in the matrix identifies a node and the entries in the matrix represent the edges or links
between these nodes. Conventionally, nodes are denoted by digits and edges are denoted by
letters.
16
KE College Dept of Computer Application SE Module 5
Let’s convert this control flow graph into a graph matrix. Since the graph has 4 nodes, so the
graph matrix would have a dimension of 4 X 4. Matrix entries will be filled as follows :
● (1, 1) will be filled with ‘a’ as an edge exists from node 1 to node 1
● (1, 2) will be filled with ‘b’ as an edge exists from node 1 to node 2. It is important to note
that (2, 1) will not be filled as the edge is unidirectional and not bidirectional
● (1, 3) will be filled with ‘c’ as edge c exists from node 1 to node 3
● (2, 4) will be filled with ‘d’ as edge exists from node 2 to node 4
● (3, 4) will be filled with ‘e’ as an edge exists from node 3 to node 4
The graph matrix formed is shown below :
Data flow testing is another from of structural testing. It has nothing to do with data flow
diagrams.
17
KE College Dept of Computer Application SE Module 5
Levels of Testing
There are 3 levels of testing:
i. Unit Testing
ii.Integration Testing
❖ Unit Testing
Unit testing is undertaken after a module has been coded and successfully reviewed. Unit
testing (or module testing) is the testing of different units (or modules) of a system in isolation. In
order to test a single module, a complete environment is needed to provide all that is necessary
for execution of the module. That is, besides the module under test itself, the following steps are
needed in order to be able to test the module:
• The procedures belonging to other modules that the module under test calls.
18
KE College Dept of Computer Application SE Module 5
• A procedure to call the functions of the module under test with appropriate parameters
.There are number of reasons in support of unit testing than testing the entire product.
1. The size of a single module is small enough that we can locate an error fairly easily.
2. The module is small enough that we can attempt to test it in some demonstrably exhaustive
fashion.
3. Confusing interactions of multiple errors in widely different parts of the software are
eliminated.
Advantages
❖ Integration Testing
19
KE College Dept of Computer Application SE Module 5
The purpose of unit testing is to determine that each independent module is correctly
implemented. This gives little chance to determine that the interface between modules is also
correct, and for this reason integration testing must be performed.
Integration testing is the process of testing the interface between two software units or module.
It’s focus on determining the correctness of the interface.
The purpose of the integration testing is to expose faults in the interaction between integrated
units. Once all the modules have been unit tested, integration testing is performed.One specific
target of integration testing is the interface: whether parameters match on both sides as to type,
permissible ranges, meaning and utilization.
Advantage
Disadvantages:
● There will be quite a lot of delay because you would have to wait for all the modules to
be integrated.
● High risk critical modules are not isolated and tested on priority since all modules are
tested at once.
In bottom-up testing, each module at lower levels is tested with higher modules
until all modules are tested. The primary purpose of this integration testing is,
each subsystem is to test the interfaces among various modules making up the subsystem. This
20
KE College Dept of Computer Application SE Module 5
integration testing uses test drivers to drive and pass appropriate data to the lower level
modules.
Advantages:
Disadvantages:
Top-down integration testing technique used in order to simulate the behaviour of the lower-
level modules that are not yet integrated.In this integration testing, testing takes place from top
to bottom. First high-level modules are tested and then low-level modules and finally integrating
the low-level modules to a high level to ensure the system is working as intended.
Advantages:
Disadvantages:
21
KE College Dept of Computer Application SE Module 5
A mixed integration testing is also called sandwiched integration testing. A mixed integration
testing follows a combination of top down and bottom-up testing approaches. In top-down
approach, testing can start only after the top-level module have been coded and unit tested. In
bottom-up approach, testing can start only after the bottom level modules are ready. This
sandwich or mixed approach overcomes this shortcoming of the top-down and bottom-up
approaches. A mixed integration testing is also called sandwiched integration testing.
Advantages:
● Mixed approach is useful for very large projects having several sub projects.
● This Sandwich approach overcomes this shortcoming of the top-down and bottom-up
approaches.
Disadvantages:
● For mixed integration testing, require very high cost because one part has Top-down
approach while another part has bottom-up approach.
● This integration testing cannot be used for smaller system with huge
interdependence between different modules
❖ System Testing
System Testing is a type of software testing that is performed on a complete integrated system
to evaluate the compliance of the system with the corresponding requirements.In system
testing, integration testing passed components are taken as input. The goal of integration
testing is to detect any irregularity between the units that are integrated together. System testing
detects defects within both the integrated units and the whole system. The result of system
testing is the observed behavior of a component or a system when it is tested.
22
KE College Dept of Computer Application SE Module 5
System Testing is carried out on the whole system in the context of either system requirement
specifications or functional requirement specifications or in the context of both. System testing
tests the design and behavior of the system and also the expectations of the customer. System
Testing is performed after the integration testing and before the acceptance testing.
● Performance Testing:
Performance Testing is a type of software testing that is carried out to test the speed,
scalability, stability and reliability of the software product or application.
23
KE College Dept of Computer Application SE Module 5
● Load Testing:
Load Testing is a type of software Testing which is carried out to determine the
● Stress Testing:
Stress Testing is a type of software testing performed to check the robustness of the
system under the varying loads.
● Scalability Testing:
Scalability Testing is a type of software testing which is carried out to check the
performance of a software application or system in terms of its capability to scale up
or scale down the number of user request load.
Validation Testing
The process of evaluating software during the development process or at the end of the
development process to determine whether it satisfies specified business requirements.
Validation Testing ensures that the product actually meets the client's needs. It can also be
defined as to demonstrate that the product fulfills its intended use when deployed on
appropriate environment.
It answers to the question, Are we building the right product?
24
KE College Dept of Computer Application SE Module 5
The goal of testing is to identify errors (bugs) in the program. The process of testing generates
symptoms, and a program’s failure is a clear symptom of the presence of an error. After getting
a symptom, we begin to investigate the cause and place of that error. After identification of
place, we examine that portion to identify the cause of the problem. This process is called
debugging.
Testing Tools
One way to improve the quality & quantity of testing is to make the process as pleasant as
possible for the tester. This means that tools should be as concise, powerful & natural as
possible.
➔ Static
➔ Dynamic
There are different types of tools available and some are listed below:
2. Code inspectors, who inspect programs automatically to make sure they adhere to minimum
quality standards.
5. Output comparators, used to determine whether the output in a program is appropriate or not.
25