Software Engineering Unit 4
Software Engineering Unit 4
Software Testing
Software Testing is a method to check whether the actual software product matches expected
requirements and to ensure that software product is Defect free. It involves execution of
software/system components using manual or automated tools to evaluate one or more properties
of interest. The purpose of software testing is to identify errors, gaps or missing requirements in
contrast to actual requirements.
Some prefer saying Software testing definition as a White Box and Black Box Testing. In simple
terms, Software Testing means the Verification of Application Under Test (AUT). This Software
Testing course introduces testing software to the audience and justifies the importance of
software testing.
Software Testing is Important because if there are any bugs or errors in the software, it can be
identified early and can be solved before delivery of the software product. Properly tested
software product ensures reliability, security and high performance which further results in time
saving, cost effectiveness and customer satisfaction.
1
Difference between Verification and Validation
Verification Validation
Verification is the process to find whether the The validation process is checked whether the
software meets the specified requirements for software meets requirements and expectation of
particular phase. the customer.
It estimates an intermediate product. It estimates the final product.
The objectives of verification is to check whether The objectives of the validation is to check
software is constructed according to requirement and whether the specifications are correct and satisfy
design specification. the business need.
It describes whether the outputs are as per the inputs It explains whether they are accepted by the user
or not. or not.
Verification is done before the validation. It is done after the verification.
Plans, requirement, specification, code are evaluated Actual product or software is tested under
during the verifications. validation.
It manually checks the files and document. It is a computer software or developed program
based checking of files and document.
Strategy of testing
A strategy of software testing is shown in the context of spiral.
Following figure shows the testing strategy:
Unit testing
Unit testing starts at the centre and each unit is implemented in source code.
2
Integration testing
An integration testing focuses on the construction and design of the software.
Validation testing
Check all the requirements like functional, behavioral and performance requirement are validate
against the construction software.
System testing
System testing confirms all system elements and performance are tested entirely.
Testing strategy for procedural point of view
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
Unit Testing
Unit testing is a type of software testing where individual units or components of a software are
tested. The purpose is to validate that each unit of the software code performs as expected. Unit
Testing is done during the development (coding phase) of an application by the developers. Unit
Tests isolate a section of code and verify its correctness. A unit may be an individual function,
method, procedure, module, or object.
In SDLC, STLC, V Model, Unit testing is first level of testing done before integration testing.
Unit testing is a WhiteBox testing technique that is usually performed by the developer. Though,
in a practical world due to time crunch or reluctance of developers to tests, QA engineers also do
unit testing.
Unit Testing is important because software developers sometimes try saving time doing minimal
unit testing and this is myth because inappropriate unit testing leads to high cost Defect fixing
during System Testing, Integration Testing and even Beta Testing after application is built. If
proper unit testing is done in early development, then it saves time and money in the end.
3
Unit Testing LifeCyle:
Integration testing
Integration testing is the second level of the software testing process comes after unit testing. In
this testing, units or individual components of the software are tested in a group. The focus of the
integration testing level is to expose defects at the time of interaction between integrated
components or units.
Unit testing uses modules for testing purpose, and these modules are combined and tested in
integration testing. The Software is developed with a number of software modules that are coded
by different coders or programmers. The goal of integration testing is to check the correctness of
communication among all the modules.
4
Once all the components or modules are working independently, then we need to check the data
flow between the dependent modules is known as integration testing.
Let us see one sample example of a banking application, as we can see in the below image of
amount transfer.
o First, we will login as a user P to amount transfer and send Rs200 amount, the
confirmation message should be displayed on the screen as amount transfer
successfully. Now logout as P and login as user Q and go to amount balance page and
check for a balance in that account = Present balance + Received Balance. Therefore, the
integration test is successful.
o Also, we check if the amount of balance has reduced by Rs200 in P user account.
o Click on the transaction, in P and Q, the message should be displayed regarding the data
and time of the amount transfer.
5
o We always do integration testing by picking module by module so that a proper sequence
is followed, and also we don't miss out on any integration scenarios.
o First, determine the test case strategy through which executable test cases can be prepared
according to test data.
o Examine the structure and architecture of the application and identify the crucial modules
to test them first and also identify all possible scenarios.
o Design test cases to verify each interface in detail.
o Choose input data for test case execution. Input data plays a significant role in testing.
o If we find any bugs then communicate the bug reports to developers and fix defects and
retest.
o Perform positive and negative integration testing.
6
White Box Testing
o Data flow testing
o Control Flow Testing
o Branch Coverage Testing
o Decision Coverage Testing
Incremental Approach
In the Incremental Approach, modules are added in ascending order one by one or according to
need. The selected modules must be logically related. Generally, two or more than two modules
are added and tested to determine the correctness of functions. The process continues until the
successful testing of all the modules.
OR
In this type of testing, there is a strong relationship between the dependent modules. Suppose we
take two or more modules and verify that the data flow between them is working fine. If it is,
then add more modules and test again.
7
For example: Suppose we have a Flipkart application, we will perform incremental integration
testing, and the flow of the application would like this:
Flipkart→ Login→ Home → Search→ Add cart→Payment → Logout
Top-Down Approach
The top-down testing strategy deals with the process in which higher level modules are tested
with lower level modules until the successful completion of testing of all the modules. Major
design flaws can be detected and fixed early because critical modules tested first. In this type of
method, we will add the modules incrementally or one by one and check the data flow in the
same order.
8
In the top-down approach, we will be ensuring that the module we are adding is the child of the
previous one like Child C is a child of Child B and so on as we can see in the below image:
Advantages:
o Identification of defect is difficult.
o An early prototype is possible.
Disadvantages:
o Due to the high number of stubs, it gets quite complicated.
o Lower level modules are tested inadequately.
o Critical Modules are tested first so that fewer chances of defects.
Bottom-Up Method
The bottom to up testing strategy deals with the process in which lower level modules are tested
with higher level modules until the successful completion of testing of all the modules. Top level
critical modules are tested at last, so it may cause a defect. Or we can say that we will be adding
the modules from bottom to the top and check the data flow in the same order.
In the bottom-up method, we will ensure that the modules we are adding are the parent of the
previous one as we can see in the below image:
9
Advantages
o Identification of defect is easy.
o Do not need to wait for the development of all the modules as it saves time.
Disadvantages
o Critical modules are tested last due to which the defects can occur.
o There is no possibility of an early prototype.
Advantages
o The hybrid method provides features of both Bottom Up and Top Down methods.
o It is most time reducing method.
o It provides complete testing of all modules.
Disadvantages
o This method needs a higher level of concentration as the process carried out in both
directions simultaneously.
o Complicated method.
10
Non- incremental integration testing
We will go for this method, when the data flow is very complex and when it is difficult to find
who is a parent and who is a child. And in such case, we will create the data in any module bang
on all other existing modules and check if the data is present. Hence, it is also known as the Big
bang method.
Advantages:
o It is convenient for small size software systems.
Disadvantages:
o Identification of defects is difficult because finding the error where it came from is a
problem, and we don't know the source of the bug.
o Small modules missed easily.
o Time provided for testing is very less.
o We may miss to test some of the interfaces.
11
System Testing
System Testing includes testing of a fully integrated software system. Generally, a computer
system is made with the integration of software (any software is only a single element of a
computer system). The software is developed in units and then interfaced with other software
and hardware to create a complete computer system. In other words, a computer system consists
of a group of software to perform the various tasks, but only software cannot perform the task;
for that software must be interfaced with compatible hardware. System testing is a series of
different type of tests with the purpose to exercise and examine the full working of an integrated
software computer system against requirements.
To check the end-to-end flow of an application or the software as a user is known as System
testing. In this, we navigate (go through) all the necessary modules of an application and check
if the end features or the end business works fine, and test the product as a whole system.
It is end-to-end testing where the testing environment is similar to the production environment.
There are four levels of software testing: unit testing, integration testing, system testing
and acceptance testing, all are used for the testing purpose. Unit Testing used to test a single
software; Integration Testing used to test a group of units of software, System Testing used to
test a whole system and Acceptance Testing used to test the acceptability of business
requirements. Here we are discussing system testing which is the third level of testing levels.
There are mainly two widely used methods for software testing, one is White box testing which
uses internal coding to design test cases and another is black box testing which uses GUI or user
perspective to develop test cases.
12
o White box testing
o Black box testing
System testing falls under Black box testing as it includes testing of the external working of
the software. Testing follows user's perspective to identify minor defects.
System Testing includes the following steps.
o Verification of input functions of the application to test whether it is producing the
expected output or not.
o Testing of integrated software by including external peripherals to check the interaction
of various components with each other.
o Testing of the whole system for End to End testing.
o Behavior testing of the application via auser's experience
13
Types of System Testing
System testing is divided into more than 50 types, but software testing companies typically uses
some of them. These are listed below:
Implementation of code is not needed for Code implementation is necessary for white
black box testing. box testing.
14
Black Box Testing White Box Testing
This testing can be initiated on the basis of This type of testing of software is started after
requirement specifications document. detail design document.
It is the behavior testing of the software. It is the logic testing of the software.
It is applicable to the higher levels of testing It is generally applicable to the lower levels of
of software. software testing.
Can be done by trial and error ways and Data domains along with inner or internal
methods. boundaries can be better tested.
15
As information systems are becoming more complex, the object-oriented paradigm is gaining
popularity because of its benefits in analysis, design, and coding. Conventional testing methods
cannot be applied for testing classes because of problems involved in testing classes, abstract
classes, inheritance, dynamic binding, message, passing, polymorphism, concurrency, etc.
Testing classes is a fundamentally different problem than testing functions. A function (or a
procedure) has a clearly defined input-output behavior, while a class does not have an input-
output behavior specification. We can test a method of a class using approaches for testing
functions, but we cannot test the class using these approaches.
16
This method of testing does not find all types of errors. However, incorrect specification
and interface errors can be missed. These types of errors can be uncovered by function
testing in the traditional testing model. In the object-oriented model, interaction errors can
be uncovered by scenario-based testing. This form of Object oriented-testing can only test
against the client’s specifications, so interface errors are still missed.
3. Random Testing:
It is supported by developing a random test sequence that tries the minimum variety of
operations typical to the behavior of the categories
4. Partition Testing:
This methodology categorizes the inputs and outputs of a category so as to check them
severely. This minimizes the number of cases that have to be designed.
5. Scenario-based Testing:
It primarily involves capturing the user actions then stimulating them to similar actions
throughout the test.
These tests tend to search out interaction form of error.
Alpha Testing
Alpha Testing is a type of acceptance testing; performed to identify all possible issues and bugs
before releasing the final product to the end users. Alpha testing is carried out by the testers who
are internal employees of the organization. The main goal is to identify the tasks that a typical
user might perform and test them.
To put it as simple as possible, this kind of testing is called alpha only because it is done early on,
near the end of the development of the software, and before beta testing. The main focus of alpha
testing is to simulate real users by using a black box and white box techniques.
Beta Testing
Beta Testing is performed by “real users” of the software application in “real environment” and
it can be considered as a form of external User Acceptance Testing. It is the final test before
shipping a product to the customers. Direct feedback from customers is a major advantage of
Beta Testing. This testing helps to test products in customer’s environment.
Beta version of the software is released to a limited number of end-users of the product to obtain
feedback on the product quality. Beta testing reduces product failure risks and provides increased
quality of the product through customer validation.
17
Sr. Alpha Testing Beta Testing
No.
2. Alpha testing performed at the Beta testing doesn't need any lab environment
developer's site; it always needs a or the testing environment; it is performed at
testing environment or lab a client's location or end-user of the product.
environment.
4. Alpha testing involves both white box Beta testing uses only black-box testing.
and black-box techniques.
5. Long execution cycles maybe require Only a few weeks are required for the
for alpha testing. execution of beta testing.
7. Alpha testing performed before the At the time of software product marketing.
launch of the product into the market.
8. Alpha testing focuses on the product's Beta testing concentrates on the quality of the
quality before going to beta testing. product, but gathers users input on the
product and ensures that the product is ready
for real-time users.
9. Alpha testing performed nearly the Beta testing is a final test before shipping a
end of the software development. product to the customers.
10. Alpha testing is conducting in the Beta testing reversed of alpha testing.
presence of developers and the
absence of end-users.
Phases of Testing
Alpha and Beta tests are typically carried for “off-the-shelf” software or product-oriented
companies. The Phases of Testing for a product company typically varies from a service-oriented
organization. Following is the testing phase adopted by product firms
Pre-Alpha:- Software is a prototype. UI is complete. But not all features are completed. At this
stage, software is not published.
Alpha: Software is near its development and is internally tested for bugs/issues
Beta: Software is stable and is released to a limited user base. The goal is to get customer
feedback on the product and make changes in software accordingly
Release Candidate (RC): Based on the feedback of Beta Test, you make changes to the
software and want to test out the bug fixes. At this stage, you do not want to make radical
changes in functionality but just check for bugs. RC is also put out to the public
Release: All works, software is released to the public.
Note: Above is a standard definition of the Testing stages but in order to garner marketing buzz,
companies combine stages like “pre-alpha beta”, “pre-beta” etc.
19
Exit Criteria for Beta Testing:
All major and minor issues are closed
Feedback report should be prepared from public
Delivery of Beta test summary report
20