0% found this document useful (0 votes)
50 views23 pages

Unit II

Uploaded by

Omkar Kamtekar
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)
50 views23 pages

Unit II

Uploaded by

Omkar Kamtekar
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/ 23

https://youtube.com/playlist?

list=PLQ-nEJNYlEV29CBLzIDxcogm6CEZjVad2&si=_y70QWFuBDw_dJ
c_

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
Behavioral 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 Techniques
Following are the prominent Test Strategy amongst the many used in Black
box Testing
● Equivalence Class Testing: It is used to minimize the number of
possible test cases to an optimum level while maintains reasonable test
coverage.
● Boundary Value Testing: Boundary value testing is focused on the
values at boundaries. This technique determines whether a certain
range of values are acceptable by the system or not. It is very useful in
reducing the number of test cases. It is most suitable for the systems
where an input is within certain ranges.
● Decision Table Testing: A decision table puts causes and their effects in
a matrix. There is a unique combination in each column.

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.
How to do BlackBox Testing in Software Engineering
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
SUT processes them correctly. Also, some invalid inputs (negative test
scenario) are chosen to verify that the SUT 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.
White Box Testing
White Box Testing is a testing technique in which software’s internal
structure, design, and coding are tested to verify input-output flow and
improve design, usability, and security. In white box testing, code is visible to
testers, so it is also called Clear box testing, Open box testing, Transparent
box testing, Code-based testing, and Glass box testing.
It is one of two parts of the Box Testing approach to software testing. Its
counterpart, Blackbox testing, involves testing from an external or end-user
perspective. On the other hand, White box testing in software engineering is
based on the inner workings of an application and revolves around internal
testing.
How do you perform White Box Testing?
We have divided it into two basic steps to give you a simplified explanation
of white box testing. This is what testers do when testing an application using
the white box testing technique:
STEP 1) UNDERSTAND THE SOURCE CODE
The first thing a tester will often do is learn and understand the source code
of the application. Since white box testing involves the testing of the inner
workings of an application, the tester must be very knowledgeable in the
programming languages used in the applications they are testing. Also, the
testing person must be highly aware of secure coding practices. Security is
often one of the primary objectives of testing software. The tester should be
able to find security issues and prevent attacks from hackers and naive users
who might inject malicious code into the application either knowingly or
unknowingly.
STEP 2) CREATE TEST CASES AND EXECUTE
The second basic step to white box testing involves testing the application’s
source code for proper flow and structure. One way is by writing more code
to test the application’s source code. The tester will develop little tests for
each process or series of processes in the application. This method requires
that the tester must have intimate knowledge of the code and is often done by
the developer.

UNIT II

Chapter I : Software Testing Strategies


Software testing is the process of exercising the program with the specific intent of
finding errors prior to the delivery to the end users.

Software testing strategies:


1) Unit Testing
2) Integration Testing
3) Validation Testing
4) System 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

Unit Testing
Unit testing involves the testing of each unit or an individual component of the
software application. It is the first level of functional testing. The aim behind unit
testing is to validate unit components with its performance.

A unit is a single testable part of a software system and tested during the
development phase of the application software.

The purpose of unit testing is to test the correctness of isolated code. A unit
component is an individual function or code of the application. White box testing
approach used for unit testing and usually done by the developers.

Whenever the application is ready and given to the Test engineer, he/she will start
checking every component of the module or module of the application
independently or one by one, and this process is known as Unit testing or
components testing.
Some important reasons of Unit testing are:

○ Unit testing helps tester and developers to understand the base of code that
makes them able to change defect causing code quickly.

○ Unit testing helps in the documentation.

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

○ It helps with code reusability by migrating code and test cases.

Example of Unit testing


Let us see one sample example for a better understanding of the concept of unit
testing:

For the amount transfer, requirements are as follows:

1. Amount transfer
1.1 From account number (FAN)→ Text Box

1.1.1 FAN→ accept only 4 digit

1.2 To account no (TAN)→ Text Box

1.2.1 TAN→ Accept only 4 digit

1.3 Amount→ Text Box

1.3.1 Amount → Accept maximum 4 digit

1.4 Transfer→ Button

1.4.1 Transfer → Enabled

1.5 Cancel→ Button

1.5.1 Cancel→ Enabled

○ From account number(FAN)

○ To account number(TAN)

○ Amount

○ Transfer

○ Cancel
For the FAN components

Values Description

1234 accept

4311 Error message→ account valid or not

blank Error message→ enter some values

5 digit/ 3 digit Error message→ accept only 4 digit

Alphanumeric Error message → accept only digit

Blocked account no Error message

Copy and paste the value Error message→ type the value

Same as FAN and TAN Error message


For the TAN component

○ Provide the values just like we did in From account number (FAN) components

For Amount component

○ Provide the values just like we did in FAN and TAN components.

For Transfer component

○ Enter valid FAN value

○ Enter valid TAN value

○ Enter the correct value of Amount

○ Click on the Transfer button→ amount transfer successfully( confirmation


message)

For Cancel Component

○ Enter the values of FAN, TAN, and amount.

○ Click on the Cancel button → all data should be cleared.

Unit Testing Tools


We have various types of unit testing tools available in the market, which are as follows:

○ NUnit

○ JUnit

○ PHPunit

○ Parasoft Jtest

○ EMMA
Advantages and disadvantages of unit testing
The pros and cons of unit testing are as follows:

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.

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

Any testing technique (Blackbox, Whitebox, and Greybox) can be used for Integration
Testing

Reason Behind Integration Testing


Although all modules of software application already tested in unit testing, errors still
exist due to the following reasons:

1. Each module is designed by individual software developer whose programming


logic may differ from developers of other modules so; integration testing
becomes essential to determine the working of software modules.

2. To check the interaction of software modules with the database whether it is an


erroneous or not.

3. Requirements can be changed or enhanced at the time of module development.


These new requirements may not be tested at the level of unit testing hence
integration testing becomes mandatory.

4. Incompatibility between modules of software could create errors.

5. To test hardware's compatibility with software.

6. If exception handling is inadequate between modules, it can create bugs.


Why is Integration Testing Important?
Integration testing is important because it verifies that individual software
modules or components work together correctly as a whole system. This
ensures that the integrated software functions as intended and helps identify
any compatibility or communication issues between different parts of the
system. By detecting and resolving integration problems early, integration
testing contributes to the overall reliability, performance, and quality of the
software product.

Example of integration testing


Let us assume that we have a Gmail application where we perform the integration
testing.

First, we will do functional testing on the login page, which includes the various
components such as username, password, submit, and cancel button. Then only we
can perform integration testing.

The different integration scenarios are as follows:


Scenarios1:

○ First, we login as P users and click on the Compose mail and performing the
functional testing for the specific components.

○ Now we click on the Send and also check for Save Drafts.

○ After that, we send a mail to Q and verify in the Send Items folder of P to check if
the send mail is there.

○ Now, we will log out as P and login as Q and move to the Inbox and verify that if
the mail has reached.

Secanrios2: We also perform the integration testing on Spam folders. If the particular
contact has been marked as spam, then any mail sent by that user should go to the
spam folder and not in the inbox.
Note: We will perform functional testing for all features, such as to send items, inbox, and so
on.

As we can see in the below image, we will perform the functional testing for all the text
fields and every feature. Then we will perform integration testing for the related
functions. We first test the add user, list of users, delete user, edit user, and then search
user.
Types of Integration testing
Basically there are two types of integration testing
a) Incremental Integration Testing:
Here modules are added in ascending order one by one or according to need.The
modules are logically connected.They test data flow between modules and correctness
of each module
i) Top Down Integration Testing
ii)Bottom Up Integration Testing
b) Non Incremental Integration Testing:
In this testing all the modules are developed and tested individually,they are integrated
once and tested together at once.
i)Big Bang Integration Testing
Big-Bang Integration Testing

● It is the simplest integration testing approach, where all the

modules are combined and the functionality is verified after the

completion of individual module testing.

● In simple words, all the modules of the system are simply put

together and tested.

● This approach is practicable only for very small systems. If an error

is found during the integration testing, it is very difficult to localize

the error as the error may potentially belong to any of the modules

being integrated.

● So, debugging errors reported during Big Bang integration testing is

very expensive to fix.


● Big-bang integration testing is a software testing approach in which

all components or modules of a software application are combined

and tested at once.

● This approach is typically used when the software components have

a low degree of interdependence or when there are constraints in

the development environment that prevent testing individual

components.

● The goal of big-bang integration testing is to verify the overall

functionality of the system and to identify any integration problems

that arise when the components are combined.

● While big-bang integration testing can be useful in some situations,

it can also be a high-risk approach, as the complexity of the system

and the number of interactions between components can make it

difficult to identify and diagnose problems.

Advantages of Big-Bang Integration Testing

● It is convenient for small systems.

● Simple and straightforward approach.

● Can be completed quickly.

● Does not require a lot of planning or coordination.

● May be suitable for small systems or projects with a low degree of

interdependence between components.


Disadvantages of Big-Bang Integration Testing

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

● Not Good for long projects.

● High risk of integration problems that are difficult to identify and

diagnose.

● This can result in long and complex debugging and troubleshooting

efforts.

● This can lead to system downtime and increased development

costs.

● May not provide enough visibility into the interactions and data

exchange between components.

● This can result in a lack of confidence in the system’s stability and

reliability.

● This can lead to decreased efficiency and productivity.

● This may result in a lack of confidence in the development team.

● This can lead to system failure and decreased user satisfaction.


Bottom-Up Integration Testing

In bottom-up testing, each module at lower levels are tested with higher
modules until all modules are tested. It starts the testing with the lowest
units of the application and moving up one by one. Again in this case it might
be possible that higher models may not developed by the time lower
modules are being tested.The primary purpose of this integration testing is
that each subsystem tests the interfaces among various modules making up
the subsystem. This integration testing uses test drivers to drive and pass
appropriate data to the lower-level modules.Drivers are used as a dummy
program as a substitute for the missing modules..

Advantages of Bottom-Up Integration Testing

● In bottom-up testing, no stubs are required.

● A principal advantage of this integration testing is that several

disjoint subsystems can be tested simultaneously.

● It is easy to create the test conditions.

● Best for applications that uses bottom up design approach.

● It is Easy to observe the test results.

Disadvantages of Bottom-Up Integration Testing

● Driver modules must be produced.

● In this testing, the complexity that occurs when the system is made

up of a large number of small subsystems.

● As Far modules have been created, there is no working model can

be represented.
3. Top-Down Integration Testing

Top-down integration testing technique is used in order to simulate the


behavior of the lower-level modules that are not yet integrated. It starts
testing topmost modules and moving down to the lowest set of modules one
by one and check control flow of the system .While top modules are tested
lower level modules might not be developed yet.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.It uses Stubs as a
dummy programs which acts as a substitutes for the missing models in the
testing.

Advantages of Top-Down Integration Testing

● Separately debugged module.

● Few or no drivers needed.

● It is more stable and accurate at the aggregate level.

● Easier isolation of interface errors.

● In this, design defects can be found in the early stages.

Disadvantages of Top-Down Integration Testing

● Needs many Stubs.

● Modules at lower level are tested inadequately.

● It is difficult to observe the test output.

● It is difficult to stub design.


Applications of Integration Testing
1. Identify the components: Identify the individual components of your

application that need to be integrated. This could include the

frontend, backend, database, and any third-party services.

2. Create a test plan: Develop a test plan that outlines the scenarios

and test cases that need to be executed to validate the integration

points between the different components. This could include testing

data flow, communication protocols, and error handling.

3. Set up test environment: Set up a test environment that mirrors the

production environment as closely as possible. This will help ensure

that the results of your integration tests are accurate and reliable.

4. Execute the tests: Execute the tests outlined in your test plan,

starting with the most critical and complex scenarios. Be sure to log

any defects or issues that you encounter during testing.

5. Analyze the results: Analyze the results of your integration tests to

identify any defects or issues that need to be addressed. This may

involve working with developers to fix bugs or make changes to the

application architecture.

6. Repeat testing: Once defects have been fixed, repeat the integration

testing process to ensure that the changes have been successful

and that the application still works as expected.


Unit Testing vs Integration Testing

S.
Unit Testing Integration Testing
No.

In unit testing, each module In integration testing, all modules


1. of the software is tested of the software are tested
separately. combined.

In unit testing tester knows Integration testing doesn’t know


2. the internal design of the the internal design of the
software. software.

Unit testing is performed Integration testing is performed


3. first of all testing after unit testing and before
processes. system testing.

Unit testing is white box Integration testing is black box


4.
testing. testing.
Unit testing is performed Integration testing is performed
5.
by the developer. by the tester.

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

Example of validation testing


Let’s consider a real-time example of validation testing for an e-commerce website
checkout process:
Scenario: Validating the checkout process of an e-commerce website like Amazon or
eBay
Browsing and adding items to the cart:
● Ensure that users can browse products, select the desired items, and add them
to the cart.
● Validate that the selected items are accurately displayed in the cart with the
correct quantities and prices.
Cart functionality:
● Confirm that users can edit the cart, adjust quantities, and remove items.
● Ensure the cart accurately displays the total price, including taxes and applied
discounts.
Shipping and payment details:
● Validate that users can enter shipping information accurately, including address
and preferred shipping method.
● Confirm that the system accurately calculates shipping costs based on the
selected shipping method.
● Ensure that users can choose different payment options (e.g., credit card,
PayPal) and enter payment details securely.
● Validate that the payment processing is smooth, secure, and successful, without
errors or double charges.
Order Confirmation:
● Confirm that users receive the right order confirmation page after checkout.
● Validate that the order details, including items, prices, shipping information, and
estimated delivery date, are accurate.
Email confirmation:
● Check that users receive an email confirmation with order details after
purchasing.
● Ensure that the email contains all necessary information and is sent promptly.
Validation testing ensures all these steps function seamlessly, providing a positive user
experience and accurate order processing in an e-commerce environment.
Any issues found during this testing are documented and addressed to improve the
overall functionality and reliability of the checkout process.

You might also like