Ch 6 Software Testing
Ch 6 Software Testing
6 Software Testing
Content:
6.1Definition
6.2 Software testing Process
6.3 Unit Testing
6.4 Integration Testing
6.5 System Testing
6.1 Definition:
Software testing is a process of identifying the correctness of software by considering
its all attributes (Reliability, Scalability, Portability, Re-usability, Usability) and
evaluating the execution of software components to find the software bugs or errors or
defects.
Software Testing is a method to assess the functionality of the software program. The
process checks whether the actual software matches the expected requirements and
ensures the software is bug-free. The purpose of software testing is to identify the
errors, faults, or missing requirements in contrast to actual requirements. It mainly
aims at measuring the specification, functionality, and performance of a software
program or application.
1985: Canada’s Therac-25 radiation therapy malfunctioned due to a software bug and
resulted in lethal radiation doses to patients leaving 3 injured and 3 people dead.
1994: China Airlines Airbus A300 crashed due to a software bug killing 264 people.
1996: A software bug caused U.S. bank accounts of 823 customers to be credited with
920 million US dollars.
1999: A software bug caused the failure of a $1.2 billion military satellite launch.
2015: A software bug in fighter plan F-35 resulted in making it unable to detect targets
correctly.
2015: Bloomberg terminal in London crashed due to a software bug affecting 300,000
traders on the financial market and forcing the government to postpone the 3bn pound
debt sale.
Starbucks was forced to close more than 60% of its outlet in the U.S. and Canada due to
a software failure in its POS system.
Nissan cars were forced to recall 1 million cars from the market due to a software
failure in the car’s airbag sensory detectors.
Different Types of Software Testing:
In a testing level hierarchy, unit testing is the first level of testing done before
integration and other remaining levels of the testing. It uses modules for the testing
process which reduces the dependency of waiting for Unit testing frameworks, stubs,
drivers and mock objects are used for assistance in unit testing.
Generally, the software goes under four level of testing: Unit Testing, Integration
Testing, System Testing, and Acceptance Testing but sometimes due to time
consumption software testers does minimal unit testing but skipping of unit testing may
lead to higher defects during Integration Testing, System Testing, and Acceptance
Testing or even during Beta Testing which takes place after the completion of software
application.
o Unit testing helps tester and developers to understand the base of code that
makes them able to change defect causing code quickly.
o Unit testing fixes defects very early in the development phase that's why there is
a possibility to occur a smaller number of defects in upcoming testing levels.
We have various types of unit testing tools available in the market, which are as follows:
o NUnit
o JUnit
o PHPunit
o Parasoft Jtest
o EMMA
Unit testing uses all white box testing techniques as it uses the code of software
application:
Unit testing can give best results without getting confused and increase complexity by
following the steps listed below:
Advantages
o Unit testing uses module approach due to that any part can be tested without waiting for
completion of another parts testing.
o The developing team focuses on the provided functionality of the unit and how
functionality should look in unit test suits to understand the unit API.
o Unit testing allows the developer to refactor code after a number of days and ensure the
module still working without any defect.
Disadvantages
o It cannot identify integration or broad level error as it works on units of the code.
o In the unit testing, evaluation of all execution paths is not possible, so unit testing is not
able to catch each and every error in a program.
o It is best suitable for conjunction with other testing activities.
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.
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 We go for the integration testing only after the functional testing is completed on each
module of the application.
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.
Here positive testing implies that if the total balance is Rs15, 000 and we are
transferring Rs1500 and checking if the amount transfer works fine. If it does, then the
test would be a pass.
And negative testing means, if the total balance is Rs15, 000 and we are transferring
Rs20, 000 and check if amount transfer occurs or not, if it does not occur, the test is a
pass. If it happens, then there is a bug in the code, and we will send it to the
development team for fixing that bug.
Although all modules of software application already tested in unit testing, errors still
exist due to the following reasons:
Any testing technique (Black box, White box, and Grey box) can be used for Integration
Testing; some are listed below:
o Top-Down approach
o Bottom-Up approach
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.
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:
Disadvantages:
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:
Advantages
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.
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.
OR
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.
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.
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.
Regression testing is performed under system testing to confirm and identify that if
there's any defect in the system due to modification in any other part of the system. It
makes sure, any changes done during the development process have not introduced a
new defect and also gives assurance; old defects will not exist on the addition of new
software over the time.
Load Testing
Load testing is performed under system testing to clarify whether the system can work
under real-time loads or not.
Functional Testing
Functional testing of a system is performed to find if there's any missing function in the
system. Tester makes a list of vital functions that should be in the system and can be
added during functional testing and should improve quality of the system.
Recovery Testing
In this testing, we will test the application to check how well it recovers from the
crashes or disasters.
o Whenever the software crashes, it should not vanish but should write the crash log
message or the error log message where the reason for crash should be
mentioned. For example: C://Program Files/QTP/Cresh.log
o It should kill its own procedure before it vanishes. Like, in Windows, we have the Task
Manager to show which process is running.
o We will introduce the bug and crash the application, which means that someone will
lead us to how and when will the application crash. Or By experiences, after few
months of involvement on working the product, we can get to know how and when the
application will crash.
o Re-open the application; the application must be reopened with earlier settings.
For example: Suppose, we are using the Google Chrome browser, if the power goes off,
then we switch on the system and re-open the Google chrome, we get a message asking
whether we want to start a new session or restore the previous session. For any
developed product, the developer writes a recovery program that describes, why the
software or the application is crashing, whether the crash log messages are written or
not, etc.
Migration Testing
Migration testing is performed to ensure that if the system needs to be modified in new
infrastructure so it should be modified without any issue.
Usability Testing
The purpose of this testing to make sure that the system is well familiar with the user
and it meets its objective for what it supposed to do.
Software and Hardware Testing
This testing of the system intends to check hardware and software compatibility. The
hardware configuration must be compatible with the software to run it without any
issue. Compatibility provides flexibility by providing interactions between hardware
and software.
System testing uses both existing system and a new system to feed same data in both and then
compare the differences in functionalities of added and existing functions so, the user can
understand benefits of new added functions of the system.