0% found this document useful (0 votes)
51 views46 pages

UNIT 3 Software Testing

Testing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views46 pages

UNIT 3 Software Testing

Testing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

SEMESTER - V

Course Code:DSE-503: Computer Science Paper - XI

Course Title: Software Engineering

Unit – III : Software Testing


Let’s Start
Software Testing
֍ Software Testing Fundamentals
White Box Testing, Black Box Testing
֍ Software testing strategies
❑ Verification
❑ Validation
֍ System Testing, Unit testing, Integration Testing and Debugging

֍ Implementation types

֍ Software Maintenance, Maintenance Task


What is testing?
According to ANSI/IEEE 1059 standard, Testing can be defined as “A process of analysing a software item to detect
the differences between existing and required conditions (that is defects/errors/bugs) and to evaluate the
features of the software item”.
Software testing can be stated as the process of verifying and validating whether a software or application is bug-free,
meets the technical requirements as guided by its design and development, and meets the user requirements
effectively and efficiently by handling all the exceptional and boundary cases.
The process of software testing aims not only at finding faults in the existing software but also at finding measures
to improve the software in terms of efficiency, accuracy, and usability. It mainly aims at measuring the specification,
functionality, and performance of a software program or application.

Software testing is basically the sum total of the two activities – Verification and Validation.
Verification is the process of evaluating the artifacts of software development in order to ensure that the product being
developed will comply with the standards. It is the static process of analysing the documents and not the actual end
product.

Validation is the process of validating that the developed software product conforms to the specified business
requirements. It involves dynamic testing of a software product by running it.
Verification Validation
Verification involves the evaluation of artifacts of Validation involves validation of developed software product
software development to ensure that the product to check if it conforms to the specified business
being developed will comply with its requirements requirements.

It is a static process of analysing the documents and It involves dynamic testing of a software product by
not the actual end product. running it.

Verification is a process-oriented approach. Validation is a product-oriented approach.

Answers the question – “Are we building the product Answers the question – “Are we building the right product?”
right?”

Errors found during verification require lesser Errors found during validation require more cost /
cost/resources to get fixed as compared to be found resources. Later the error is discovered higher is the cost to
during the validation phase. fix it.

It involves activities like document review, test cases It involves activities like functional testing, automation
review, walk-throughs, inspection etc. testing etc.
Software Testing Life Cycle or STLC
Software Testing Life Cycle or STLC refers to a series of systematic and well-defined steps performed during the
testing of a software application.
Phases of STLC
Now, let’s see the different well-defined phases of the software testing life cycle along with their goals and
deliverables.
1. Requirement Analysis
Requirement Analysis
In this phase, the testing team understands the requirement and analyse all the
requirements documents. Along with that, the scope of testing is defined as to what all
Test Planning and Control
features can and will be tested and what all features will be out of the scope of the
testing activities.
Test Case Development
2. Test Planning and Control
Test planning is one of the most important activities in the test process. It involves
Test Environment Setup
defining the test specifications in order to achieve the project requirements.
Whereas, test Control includes continuous monitoring of test progress with the set plan
Test Execution
and escalating any deviation to the concerned stakeholders.

Test Closure Test control includes continuous monitoring of the test progress with a set plan and
along with the escalation of any deviation to the concerned stakeholders.
3. Test Case Development 4. Test Environment Setup
This phase involves the actual test case creation. It also This phase involves the creation of a test environment
involves the specification of test data and automated closely simulating the real-world environment. The
test script creation using different automation tools like testing team uses this environment to test the whole
Selenium WebDriver, Katalon Studio, etc. application. The different types of testing manual,
automated, performance, etc are carried out here.

5. Test Execution 6. Test Closure


This phase involves manual and automated test case
This phase marks the formal closure of testing. It
execution. During test case execution any deviation from
involves checking if all the project deliverables are
the expected result leads to the creation of defects in a
delivered, archiving the test-ware (everything involved
defect management tool or manual logging of bugs in an
in testing like test plan, test case, automation scripts),
excel sheet. Once, the development team fixes the bugs,
test environment, and documenting the learning.
the QA team retests the bugs for validation.
Software Testing Strategy :
Software Testing is a type of investigation to find out if there is any default or error present in the software so that the
errors can be reduced or removed to increase the quality of the software and to check whether it fulfils the specifies
requirements or not.

The main objective of software testing is to design the tests in such a way that it systematically finds different types of
errors without taking much time and effort so that less time is required for the development of the software.

The overall strategy for testing software includes

1. Before testing starts, it’s necessary to identify and specify the requirements of the product in a quantifiable
manner.
Different characteristics quality of the software is there such as maintainability that means the ability to update and
modify, the probability that means to find and estimate any risk, and usability that means how it can easily be used by
the customers or end-users. All these characteristic qualities should be specified in a particular order to obtain clear
test results without any error.
2. Specifying the objectives of testing in a clear and detailed manner.
Several objectives of testing are there such as effectiveness that means how effectively the software can achieve the
target, any failure that means inability to fulfil the requirements and perform functions, and the cost of defects or errors
that mean the cost required to fix the error. All these objectives should be clearly mentioned in the test plan.
3. For the testing process, developing a approach for the continuous development.
As a part of a statistical process control approach, a test strategy that is already measured should be used for software
testing to measure and control the quality during the development of software.

4. For the software, identifying the user’s category and developing a profile for each user.
Use cases describe the interactions and communication among different classes of users and the system to achieve the
target. So as to identify the actual requirement of the users and then testing the actual use of the product.

5. Developing a test plan to give value and focus on rapid-cycle testing.


Rapid Cycle Testing is a type of test that improves quality by identifying and measuring the any changes that need to be
required for improving the process of software. Therefore, a test plan is an important and effective document that helps
the tester to perform rapid cycle testing.
6. Robust software is developed that is designed to test itself.
The software should be capable of detecting or identifying different classes of errors. Moreover, software design should
allow automated and regression testing which tests the software to find out if there is any adverse or side effect on the
features of software due to any change in code or program.
7. Before testing, using effective formal reviews as a filter.
Formal technical reviews is technique to identify the errors that are not discovered yet. The effective technical reviews
conducted before testing reduces a significant amount of testing efforts and time duration required for testing software
so that the overall development time of software is reduced.
8. Conduct formal technical reviews to evaluate the nature, quality or ability of the test strategy and test cases.
The formal technical review helps in detecting any unfilled gap in the testing approach. Hence, it is necessary to
evaluate the ability and quality of the test strategy and test cases by technical reviewers to improve the quality of
software.
Levels of Testing
Software testing can be performed at different levels of the software development process. Performing testing
activities at multiple levels help in early identification of bugs and better quality of software product.

In software testing, we have four different levels of testing, which are as discussed below:
Level 1: Unit Testing
Unit testing is the first level of software testing, which is used to test if software modules are satisfying the given
requirement or not.
The first level of testing involves analysing each unit or an individual component of the software application.
Unit testing is also the first level of functional testing. The primary purpose of executing unit testing is to validate
unit components with their performance.
A unit component is an individual function or regulation of the application, or we can say that it is the smallest
testable part of the software. The reason of performing the unit testing is to test the correctness of inaccessible code.
Unit testing will help the test engineer and developers in order to understand the base of code that makes them able
to change defect causing code quickly. The developers implement the unit.
Unit Testing
Advantages:
• Unit testing uses module approach due to that any part can be tested without waiting for completion of another
parts testing.
• 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.
• Unit testing allows the developer to refactor code after a number of days and ensure the module still working
without any defect.
Disadvantages
• It cannot identify integration or broad level error as it works on units of the code.
• 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.
• It is best suitable for conjunction with other testing activities.
Level2: Integration Testing
The second level of software testing is the integration testing. The integration testing process comes after unit
testing. It is mainly used to test the data flow from one module or component to other modules.
In integration testing, the test engineer tests the units or separate components or modules of the software in a
group. The primary purpose of executing the integration testing is to identify the defects at the interaction between
integrated components or units.
When each component or module works separately, we need to check the data flow between the dependent modules,
and this process is known as integration testing.
We only go for the integration testing when the functional testing has been completed successfully on each
application module.

Integration testing techniques

There are various techniques for doing Integration testing. Each integrates the individual components in a different
fashion. In general, the testing technique selected depends on projects size, complexity, and timeline.
Types of Integration Testing
Software Engineering defines variety of strategies to execute Integration testing, viz.
• Big Bang Approach :
• Incremental Approach: which is further divided into the Top Down Approach & Bottom Up Approach

Big Bang Testing


Big Bang Testing is an Integration testing approach in which all the components or modules are integrated together
at once and then tested as a unit. This combined set of components is considered as an entity while testing. If all of the
components in the unit are not completed, the integration process will not execute.
Advantages: Disadvantages:
• Convenient for small systems. • Fault Localization is difficult.
• Given the transparent number of interfaces that need to be tested in this
approach, some interfaces link to be tested could be missed easily.
• Since the Integration testing can commence only after “all” the modules are
designed, the testing team will have less time for execution in the testing phase.
• Since all modules are tested at once, high-risk critical modules are not isolated
and tested on priority. Peripheral modules which deal with user interfaces are also
not isolated and tested on priority.
Incremental Testing
In the Incremental Testing approach, testing is done by integrating two or more modules that are logically related to
each other and then tested for proper functioning of the application. Then the other related modules are integrated
incrementally and the process continues until all the logically related modules are integrated and tested successfully.
Incremental Approach, in turn, is carried out by two different Methods namely : Bottom Up & Top Down

Stubs and Drivers: Stubs and Drivers are the dummy programs in Integration testing used to facilitate the software
testing activity. These programs act as a substitutes for the missing models in the testing. They do not implement the
entire programming logic of the software module but they simulate data communication with the calling module while
testing.

• Stub: Is called by the Module under Test.


• Driver: Calls the Module to be tested.
Bottom-up Integration Testing
Bottom-up Integration Testing is a strategy in which the lower level modules are tested first. These tested modules are
then further used to facilitate the testing of higher level modules. The process continues until all modules at top level are
tested. Once the lower level modules are tested and integrated, then the next level of modules are formed.
Diagrammatic Representation:

Module 1

Module 2 Module 3
Bottom Up

Module 4 Module 5 Module 6

Advantages: Disadvantages:
• Fault localization is easier. • Critical modules (at the top level of software
• No time is wasted waiting for all modules to be architecture) which control the flow of application are
tested last and may be prone to defects
developed unlike Big-bang approach
• An early prototype is not possible
Top-down Integration Testing
Top Down Integration Testing is a method in which integration testing takes place from top to bottom following the
control flow of software system. The higher level modules are tested first and then lower level modules are tested and
integrated in order to check the software functionality. Stubs are used for testing if some modules are not ready.
Diagrammatic Representation:

Module 1

Top Down
Module 2 Module 3

Module 4 Module 5 Module 6

Advantages: Disadvantages:
• Fault Localization is easier. • Needs many Stubs.
• Possibility to obtain an early prototype. • Modules at a lower level are tested inadequately.
• Critical Modules are tested on priority; major design
flaws could be found and fixed first.
Advantages of Integration testing
• It helps to find defects from links and interfaces between the modules.
• It boosts the confidence level of the team in the product as it validates the group of modules together.
• Integration tests run faster than the end to end test scenarios.
• It results in higher code coverage.
• It starts in the early stages when all the module may not be ready. Hence, it avoids the bugs getting into the system.

Disadvantages of Integration testing


• Integration test strategy is very crucial to testing.

• Most of the programs and data required are mocked. Hence the development of test harness requires time and
good programming knowledge.

• At times, when mocked data is replaced with real modules, new bugs can be discovered.
Level 3: 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 behaviour of a component or a system when it is tested. 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 behaviour of the system and also the expectations of the customer. It is performed
to test the system beyond the bounds mentioned in the software requirements specification (SRS). System Testing is
basically performed by a testing team that is independent of the development team that helps to test the quality of the
system impartial.

It has both functional and non-functional testing. System Testing is a black-box testing. System Testing is performed
after the integration testing and before the acceptance testing.
System Testing Process: System Testing is performed in the following steps:

• Test Environment Setup: Create testing environment for the better quality testing.
• Create Test Case: Generate test case for the testing process.

• Create Test Data: Generate the data that is to be tested.


• Execute Test Case: After the generation of the test case and the test data, test cases are executed.
• Defect Reporting: Defects in the system are detected.
• Regression Testing: It is carried out to test the side effects of the testing process.

• Log Defects: Defects are fixed in this step.


• Retest: If the test is not successful then again test is performed.
Types of System 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.

• Load Testing: Load Testing is a type of software Testing which is carried out to determine the behaviour of a
system or software product under extreme load.

• 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.

Tools used for System Testing : Jmeter, Gallen Framework, Selenium


Advantages of System Testing :

• The testers do not require more knowledge of programming to carry out this testing.
• It will test the entire product or software so that we will easily detect the errors or defects which cannot be identified
during the unit testing and integration testing.

• The testing environment is similar to that of the real time production or business environment.
• It checks the entire functionality of the system with different test scripts and also it covers the technical and business
requirements of clients.
• After this testing, the product will almost cover all the possible bugs or errors and hence the development team will
confidently go ahead with acceptance testing.

Disadvantages of System Testing :

• This testing is time consuming process than another testing techniques since it checks the entire product or software.
• The cost for the testing will be high since it covers the testing of entire software.
• It needs good debugging tool otherwise the hidden errors will not be found.
Level 4: Acceptance Testing
Acceptance Testing is a method of software testing where a system is tested for acceptability. The major aim of this
test is to evaluate the compliance of the system with the business requirements and assess whether it is acceptable
for delivery or not.
Standard Definition of Acceptance Testing:
It is a formal testing according to user needs, requirements and business processes conducted to determine whether
a system satisfies the acceptance criteria or not and to enable the users, customers or other authorized entities to
determine whether to accept the system or not.

Acceptance Testing is the last phase of software testing performed after System Testing and before making the
system available for actual use.
Types of Acceptance Testing:
• User Acceptance Testing (UAT): User acceptance testing is used to determine whether the product is working for
the user correctly. Specific requirements which are quite often used by the customers are primarily picked for the
testing purpose. This is also termed as End-User Testing.

• Business Acceptance Testing (BAT): BAT is used to determine whether the product meets the business goals and
purposes or not. BAT mainly focuses on business profits which are quite challenging due to the changing market
conditions and new technologies so the current implementation may have to being changed which results in extra
budgets.

• Contract Acceptance Testing (CAT): CAT is a contract that specifies that once the product goes live, within a
predetermined period, the acceptance test must be performed and it should pass all the acceptance use cases. Here
is a contract termed a Service Level Agreement (SLA), which includes the terms where the payment will be made
only if the Product services are in-line with all the requirements, which means the contract is fulfilled. Sometimes,
this contract happens before the product goes live. There should be a well-defined contract in terms of the period of
testing, areas of testing, conditions on issues encountered at later stages, payments, etc.
• Regulations Acceptance Testing (RAT): RAT is used to determine whether the product violates the rules and
regulations that are defined by the government of the country where it is being released. This may be unintentional
but will impact negatively on the business. Generally, the product or application that is to be released in the market,
has to go under RAT, as different countries or regions have different rules and regulations defined by its governing
bodies. If any rules and regulations are violated for any country then that country or the specific region then the
product will not be released in that country or region. If the product is released even though there is a violation then
only the vendors of the product will be directly responsible.

• Operational Acceptance Testing (OAT): OAT is used to determine the operational readiness of the product and is
non-functional testing. It mainly includes testing of recovery, compatibility, maintainability, reliability, etc. OAT
assures the stability of the product before it is released to production.

• Alpha Testing: Alpha testing is used to determine the product in the development testing environment by a
specialized testers team usually called alpha testers.

• Beta Testing: Beta testing is used to assess the product by exposing it to the real end-users, usually called beta
testers in their environment. Feedback is collected from the users and the defects are fixed. Also, this helps in
enhancing the product to give a rich user experience.
Acceptance Testing
Advantages of Acceptance Testing
• This testing helps the project team to know the further requirements from the users directly as it involves the users
for testing.
• Automated test execution.

• It brings confidence and satisfaction to the clients as they are directly involved in the testing process.
• It is easier for the user to describe their requirement.
• It covers only the Black-Box testing process and hence the entire functionality of the product will be tested.

Disadvantages of Acceptance Testing

• Users should have basic knowledge about the product or application.


• Sometimes, users don’t want to participate in the testing process.
• The feedback for the testing takes long time as it involves many users and the opinions may differ from one user to
another user.
• Development team is not participated in this testing process.
Debugging
Debugging, in computer programming and engineering, is a multistep process that involves identifying a problem,
isolating the source of the problem and then either correcting the problem or determining a way to work
around it. The final step of debugging is to test the correction or workaround and make sure it works.
Debugging is a method used by developers to test the code to find out whether the problem is solved. Or it is used to
find out where the problem is to know exactly where the code has to be fixed if something in the program goes wrong.
Debugging helps to understand whether the code works fine. If it doesn’t work fine, debugging helps to figure out why.
When it comes to debugging definition, we can divide the term into two. First of all, it is fixing bugs in the system.
Secondly, it is a cyclic testing execution with code improvement aimed at locating errors. Debugging is a tedious, time-
consuming process, which requires hours of staring at the screen. Thus, it requires a certain strategy and approach to
make the process easier and get the results faster. The process should not be rushed. A developer takes time to think
and analyse the code.
It is a multi-step procedure in software testing by which a programmer is trying to figure out a source of a problem in
the code to eliminate it. Developers have to go through a lot of lines in the code to have a better understanding of the
problems and what has caused them. It involves both a large amount of time and resources.
Debugging: Debugging is the process of fixing a bug in the software. It can defined as the identifying, analyzing and
removing errors. This activity begins after the software fails to execute properly and concludes by solving the problem
and successfully testing the software. It is considered to be an extremely complex and tedious task because errors
need to be resolved at all stages of debugging.
The Importance of Debugging

Though debugging is a challenging process, it is critical, especially if the cause of the problem is not clear. So, what is the
purpose of debugging in software testing if it is such a sophisticated process?
Without debugging, the errors snowball. One coding error accidentally introduces another coding error. Debugging
helps to save time on more complicated bugs which might appear later.
The Process of Debugging
Debugging is a complex process that requires understanding and preparation to create functional programs. The
debugging process is not effective without understanding the fundamental principles and steps of it. There are
debugging tools/modes or debuggers that allow a programmer to identify with accuracy the area with the error by
analysing code execution line-by-line and making the necessary corrections.
Compilers (programs that transform coding into usable formats) and API (a tool for operating different languages in
one program) are also widely used.
Debugging is applied for syntax, logic, run-time, and interface problems in a program.
Principles and Phases of Debugging in Software Engineering
There are a couple of principles and phases of debugging for a programmer to follow to detect, remove, and minimize
errors effectively.

• Early reporting. It is important to report the error as early as possible. This allows figuring out the cause of the
problem with minimal effort by narrowing down the list of potential reasons for that bug.

• Easy interpretation. The information should be easy to understand and the structure should be displayed in a way
that can be easily checked for correctness. Not all information is relevant to the error.
• Less useless information. Concrete information is preferred. For example, the reports should appear only after the
error is detected.
• Avoiding too complicated one-use testing code. This prevents incorrect results and saves time in software
development.
No matter what technique is going to be applied to debug a program, there is always the same first step to start with.
The programmer analyses where the error may be and attempts to create the same situation to recreate the existing
bug.
The test cases must be simplified for easier debugging by removing certain parts. Now, a debugging tool can be used to
investigate the problem and find out its origin.
So, the key stages of debugging are:
• problem identifying;
• ensuring the problem is legit;
• defect reporting;
• analysing and taking actions;
• verifying the result by running the code successfully.
If there is an error found in one part of a system, the rest of the system should be thoroughly inspected as well. There is
a high possibility for other errors in the program.
Testing Debugging
Debugging is the process to correct the bugs found during
Testing is the process to find bugs and errors.
testing.
It is the process to identify the failure of implemented
It is the process to give the absolution to code failure.
code.
Testing is done by the tester. Debugging is done by either programmer or developer.

There is no need of design knowledge in the testing Debugging can’t be done without proper design
process. knowledge.
Debugging is done only by insider. Outsider can’t do
Testing can be done by insider as well as outsider.
debugging.
Debugging is always manual. Debugging can’t be
Testing can be manual or automated.
automated.
It is based on different testing levels i.e. unit testing,
Debugging is based on different types of bugs.
integration testing, system testing etc.
Testing is a stage of software development life cycle Debugging is not an aspect of software development life
(SDLC). cycle, it occurs as a consequence of testing.

Testing is composed of validation and verification of While debugging process seeks to match symptom with
software. cause, by that it leads to the error correction.
Testing is initiated after the code is written. Debugging commences with the execution of a test case.
Software Maintenance
Software Maintenance is the process of modifying a software product after it has been delivered to the customer. The
main purpose of software maintenance is to modify and update software applications after delivery to correct faults and
to improve performance.
Software maintenance is also an important part of the Software Development Life Cycle(SDLC). To update the software
application and do all modifications in software application so as to improve performance is the main focus of software
maintenance.
Software is a model that run on the basis of real world. so, whenever any change requires in the software that means the
need of real world changes wherever possible. Software Maintenance is an inclusive activity that includes error
corrections, enhancement of capabilities, deletion of obsolete capabilities, and optimization.
Need for Maintenance
Software Maintenance is needed for:-
• Correct errors, Change in user requirement with time, Changing hardware/software requirements
• To improve system efficiency, To optimize the code to run faster
• To modify the components, To reduce any unwanted side effects.
Thus the maintenance is required to ensure that the system continues to satisfy user requirements.
Types of Software Maintenance
1. Corrective Maintenance
Corrective maintenance aims to correct any remaining errors regardless of where they may cause specifications,
design, coding, testing, and documentation, etc.
2. Adaptive Maintenance
It contains modifying the software to match changes in the ever-changing environment.

3. Preventive Maintenance
It is the process by which we prevent our system from being obsolete. It involves the concept of reengineering &
reverse engineering in which an old system with old technology is re-engineered using new technology. This
maintenance prevents the system from dying out.

4. Perfective Maintenance
It defines improving processing efficiency or performance or restricting the software to enhance changeability. This
may contain enhancement of existing system functionality, improvement in computational efficiency, etc.
Causes of Software Maintenance Problems
Lack of Traceability
• Codes are rarely traceable to the requirements and design specifications.
• It makes it very difficult for a programmer to detect and correct a critical defect affecting customer operations.
• Like a detective, the programmer pores over the program looking for clues.
• Life Cycle documents are not always produced even as part of a development project.
Lack of Code Comments
• Most of the software system codes lack adequate comments. Lesser comments may not be helpful in certain
situations.
Obsolete Legacy Systems
• In most of the countries worldwide, the legacy system that provides the backbone of the nation's critical
industries, e.g., telecommunications, medical, transportation utility services, were not designed with
maintenance in mind.
• They were not expected to last for a quarter of a century or more!
• As a consequence, the code supporting these systems is devoid of traceability to the requirements, compliance
to design and programming standards and often includes dead, extra and uncommented code, which all make
the maintenance task next to the impossible.
Software Maintenance Process
Program Understanding
The first step consists of analysing the program to understand.
Generating a Particular maintenance problem
The second phase consists of creating a particular maintenance
proposal to accomplish the implementation of the maintenance
goals.
Ripple Effect
The third step consists of accounting for all of the ripple effects as
a consequence of program modifications.
Modified Program Testing
The fourth step consists of testing the modified program to
ensure that the revised application has at least the same
reliability level as prior.

Maintainability
Each of these four steps and their associated software quality attributes is critical to the maintenance process. All of
these methods must be combined to form maintainability.
White Box Testing
White Box Testing is a software examining technique that involves testing the product’s basic structure, design, and
coding in order to verify input-output flow and improve design, usability, and security.
White box testing is also known as Clear box testing, Open box testing, transparent box testing, Code-based testing,
and Glass box testing since the code is visible to the testers.

Test Case Input


Test Case Output

White box testing involves putting the software code to the test for the following −
• Internal mistakes in security
• Paths in the coding process that are broken or poorly structured
• The path is taken by specified inputs through the program.
• Expected results
• Conditional loops are useful in a variety of situations.
• Individualized testing of each statement, object, and function
Software development might include testing at the system, integration, and unit levels. One of the primary aims of
white-box testing is to ensure that an application's operating flow is correct. It needs to comparing a set of
predetermined inputs to expected or desired outputs, with the goal of identifying bugs when one of the inputs fails to
provide the expected outcome.

We have broken down white box testing into two simple phases to make it easier to understand. When utilizing the
white box testing technique to test an application, testers do the following −
Step 1: Understand the Source Code
The source code of the program is generally the first thing a tester learns and understands. Because white box
testing entails testing an application's inner workings, the tester must be well-versed in the programming languages
used in the applications under test. Furthermore, the tester must be well-versed in secure coding techniques.
One of the main goals of software testing is to ensure that it is secure. The tester should be able to detect security
flaws and prevent assaults from hackers and naive users who may purposefully or unknowingly inject dangerous
code into the program.
Step 2: Create and Execute Test Case
The application's source code is tested for correct flow and structure in the second fundamental step of white box
testing. One method is to write more code to test the source code of the application. For each step or sequence of
processes in the application, the tester will create little tests. This method necessitates the tester's extensive
understanding of the code and is frequently carried out by the developer.
Example of White Box Testing : Code
1. WhiteBox testing in software engineering aims to make sure that all decision branches, loops, and statements in the
code are correct.

printme (int a, int b) { ------------ it is a function


int result = a+ b;
if (result > 0)
Print ("Positive", result)
else
Print ("Negative", result)
} ----------- End of the code

2. WhiteBox test cases would be used to put the statements in the preceding white box testing example to the test.

A = 1; B = 1
A = -1, B = -3
Advantages of WhiteBox Testing

• Code optimization through the detection of hidden defects.

• Cases for white-box tests are simple to automate.

• Because all code paths are usually covered, testing is more thorough.

• Even if a GUI is not accessible, testing can begin early in the SDLC.

Disadvantages of WhiteBox Testing

• White box testing can be time-consuming and costly.


• It irritates developers who are used to running white box test scenarios. Developers' lack of detail in white box
testing can lead to production problems.
• Professional resources with a thorough understanding of programming and implementation are required for
white box testing.
• White-box testing takes time, and larger programming applications require more time to thoroughly test.
Techniques for White Box Testing
Code Coverage Analysis is a popular White box testing technique. A Test Case suite's holes are filled through Code
Coverage analysis. It identifies parts of a program that aren't put to the test in a collection of test cases. You write test
cases to check untested areas of the code once the holes have been detected, thereby improving the quality of the
software product.
Code coverage analysis can be performed using automated technologies. A box tester can employ the following coverage
analysis techniques −
• Statement Coverage − During the software engineering testing process, this technique mandates that every
possible statement in the code be tested at least once.
• Branch Coverage − This technique examines every conceivable path of a software application (if-else and other
conditional loops).
Aside from the aforementioned coverage kinds, there is a slew of others, including Condition Coverage, Multiple
Condition Coverage, Path Coverage, and Function Coverage. Each method has its own set of advantages and aims to test
(cover) all aspects of software code. You can typically achieve 80-90 percent code coverage using Statement and Branch
coverage, which is sufficient.
Following are some of the important WhiteBox Testing Techniques −
• Statement Coverage, Decision Coverage
• Branch Coverage, Condition Coverage
• Multiple Condition Coverage, Path Coverage
• Control flow testing, Data flow testing
Black Box Testing
Black Box Testing is a software testing method in which the functionalities of software applications are tested without
having knowledge of internal code structure, implementation details and internal paths. Black Box Testing mainly
focuses on input and output of software applications and it is entirely based on software requirements and
specifications. It is also known as Behavioural Testing.

Test Case Input Black Box Test Case Input


Testing

The above Black-Box can be any software system you want to test. For Example, an operating system like Windows, a
website like Google, a database like Oracle or even your own custom application. Under Black Box Testing, you can test
these applications by just focusing on the inputs and outputs without knowing their internal code implementation.
Black box testing involves testing a system with no prior knowledge of its internal workings. A tester provides an input,
and observes the output generated by the system under test. This makes it possible to identify how the system
responds to expected and unexpected user actions, its response time, usability issues and reliability issues.
Black box testing is a powerful testing technique because it exercises a system end-to-end. Along the way, a black box
test evaluates all relevant subsystems, including UI/UX, web server or application server, database, dependencies, and
integrated systems.
How to do BlackBox Testing
Here are the generic steps followed to carry out any type of Black Box Testing.
• Initially, the requirements and specifications of the system are examined.
• Tester chooses valid inputs (positive test scenario) to check whether system under test processes them
correctly. Also, some invalid inputs (negative test scenario) are chosen to verify that the system under test is
able to detect them.
• Tester determines expected outputs for all those inputs.
• Software tester constructs test cases with the selected inputs.
• The test cases are executed, Software tester compares the actual outputs with the expected outputs.
• Defects if any are fixed and re-tested.
Types of Black Box Testing
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.
Advantages of Black Box Testing

• A technical background is not required of the tester. It's critical to test by putting yourself in the user's shoes
and thinking from their perspective.
• Once the project/application has been completed, testing may begin. Both testers and developers operate in
their own area, without intruding on each other.
• For big and sophisticated applications, it is more effective.
• Defects and inconsistencies may be detected early in the testing process.

Disadvantages of Black Box Testing

• There is a risk of neglecting the probable circumstances of the scenario to be examined if you don't have any
technical or programming experience.
• It is feasible to test fewer inputs and outputs in a given amount of time by bypassing all available inputs and
output testing.
• For big and complicated projects, complete test coverage is impossible.
Black Box testing White Box testing

It is a testing approach which is used to test the


It is a testing approach in which internal structure is
software without the knowledge of the internal
known to the tester.
structure of program or application.
It also knowns as data-driven, box testing, data and It is also called structural testing, clear box testing, code-
functional testing. based testing, or glass box testing.
Testing is based on external expectations; internal Internal working is known, and the tester can test
behaviour of the application is unknown. accordingly.
This type of testing is ideal for higher levels of testing Testing is best suited for a lower level of testing like Unit
like System Testing, Acceptance testing. Testing, Integration testing.
Programming knowledge is not needed to perform Programming knowledge is required to perform White
Black Box testing. Box testing.
Implementation knowledge is not requiring doing Complete understanding needs to implement WhiteBox
Black Box testing. testing.
Test and programmer are dependent on each other, so
White Box testing is easy to automate.
it is tough to automate.
It is based on trial and error method. Data domain and internal boundaries can be tested.
It is less exhaustive and time-consuming. Exhaustive and time-consuming method.
Black Box testing White Box testing

Testing can start after preparing requirement Testing can start after preparing for Detail design
specification document. document.
White box testing requires code access. Thereby, the code
Code access is not required for Black Box Testing.
could be stolen if testing is outsourced.
It allows removing the extra lines of code, which can bring
Well suited and efficient for large code segments.
in hidden defects.

Low skilled testers can test the application with no


Need an expert tester with vast experience to perform
knowledge of the implementation of programming
white box testing.
language or operating system.
The main objective of this testing is to check what The main objective of White Box testing is done to check
functionality of the system under test. the quality of the code.
Performed by the end user, developer, and tester. Usually done by tester and developers.

Not the best method for algorithm testing. Best suited for algorithm testing.
Thank You

You might also like