0% found this document useful (0 votes)
1 views

SQT_Unit-1

For mca students

Uploaded by

Kaviya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

SQT_Unit-1

For mca students

Uploaded by

Kaviya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

UNIT-I

Unit Testing:-
Unit Testing is a software testing technique using which individual units of
software i.e. group of computer program modules, usage procedures, and operating
procedures are tested to determine whether they are suitable for use or not. It is a testing
method using which every independent module is tested to determine if there is an issue by
the developer himself. It is correlated with the functional correctness of the independent
modules. Unit Testing is defined as a type of software testing where individual components
of a software are tested. Unit Testing of the software product is carried out during the
development of an application. An individual component may be either an individual
function or a procedure. Unit Testing is typically performed by the developer. In SDLC or
V Model, Unit testing is the first level of testing done before integration testing. Unit
testing is a type of testing technique that is usually performed by developers. Although due
to the reluctance of developers to test, quality assurance engineers also do unit testing.
Objective of Unit Testing:
The objective of Unit Testing is:
1. To isolate a section of code.
2. To verify the correctness of the code.
3. To test every function and procedure.
4. To fix bugs early in the development cycle and to save costs.
5. To help the developers understand the code base and enable them to make
changes quickly.
6. To help with code reuse.

Types of Unit Testing:


There are 2 types of Unit Testing: Manual, and Automated.
Workflow of Unit Testing:

Unit Testing Techniques:


There are 3 types of Unit Testing Techniques. They are
1. Black Box Testing: This testing technique is used in covering the unit tests for
input, user interface, and output parts.
2. White Box Testing: This technique is used in testing the functional behavior of
the system by giving the input and checking the functionality output including
the internal design structure and code of the modules.
3. Gray Box Testing: This technique is used in executing the relevant test cases,
test methods, and test functions, and analyzing the code performance for the
modules.
Unit Testing Tools:
Here are some commonly used Unit Testing tools:
1. Jtest
2. Junit
3. NUnit
4. EMMA
5. PHPUnit
Advantages of Unit Testing:
➢ Unit Testing allows developers to learn what functionality is provided by a unit and
how to use it to gain a basic understanding of the unit API.
➢ Unit testing allows the programmer to refine code and make sure the module works
properly.
➢ Unit testing enables testing parts of the project without waiting for others to be
completed.
➢ Early Detection of Issues: Unit testing allows developers to detect and fix issues
early in the development process before they become larger and more difficult to
fix.
➢ Improved Code Quality: Unit testing helps to ensure that each unit of code works as
intended and meets the requirements, improving the overall quality of the software.
➢ Increased Confidence: Unit testing provides developers with confidence in their
code, as they can validate that each unit of the software is functioning as expected.
➢ Faster Development: Unit testing enables developers to work faster and more
efficiently, as they can validate changes to the code without having to wait for the
full system to be tested.
➢ Better Documentation: Unit testing provides clear and concise documentation of the
code and its behavior, making it easier for other developers to understand and
maintain the software.
➢ Facilitation of Refactoring: Unit testing enables developers to safely make changes
to the code, as they can validate that their changes do not break existing
functionality.
➢ Reduced Time and Cost: Unit testing can reduce the time and cost required for later
testing, as it helps to identify and fix issues early in the development process.
Disadvantages of Unit Testing:
➢ The process is time-consuming for writing the unit test cases.
➢ Unit Testing will not cover all the errors in the module because there is a chance of
having errors in the modules while doing integration testing.
➢ Unit Testing is not efficient for checking the errors in the UI(User Interface) part of
the module.
➢ It requires more time for maintenance when the source code is changed frequently.
➢ It cannot cover the non-functional testing parameters such as scalability, the
performance of the system, etc.
➢ Time and Effort: Unit testing requires a significant investment of time and effort to
create and maintain the test cases, especially for complex systems.
➢ Dependence on Developers: The success of unit testing depends on the developers,
who must write clear, concise, and comprehensive test cases to validate the code.
➢ Difficulty in Testing Complex Units: Unit testing can be challenging when dealing
with complex units, as it can be difficult to isolate and test individual units in
isolation from the rest of the system.
➢ Difficulty in Testing Interactions: Unit testing may not be sufficient for testing
interactions between units, as it only focuses on individual units.
➢ Difficulty in Testing User Interfaces: Unit testing may not be suitable for testing
user interfaces, as it typically focuses on the functionality of individual units.
➢ Over-reliance on Automation: Over-reliance on automated unit tests can lead to a
false sense of security, as automated tests may not uncover all possible issues or
bugs.
➢ Maintenance Overhead: Unit testing requires ongoing maintenance and updates, as
the code and test cases must be kept up-to-date with changes to the software.

Control Flow Testing:-


Control flow testing is a type of software testing that uses a program’s control flow
as a model. Control flow testing is a structural testing strategy. This testing technique
comes under white box testing. For the type of control flow testing, all the structure, design,
code and implementation of the software should be known to the testing team. This type of
testing method is often used by developers to test their own code and own implementation
as the design, code and the implementation is better known to the developers. This testing
method is implemented with the intention to test the logic of the code so that the user
requirements can be fulfilled. Its main application is to relate the small programs and
segments of the larger programs.
Control Flow Testing Process:
Following are the steps involved into the process of control flow testing:
Control Flow Testing Process
➢ Control Flow Graph Creation: From the given source code a control flow graph is
created either manually or by using the software.
➢ Coverage Target: A coverage target is defined over the control flow graph that
includes nodes, edges, paths, branches etc.
➢ Test Case Creation: Test cases are created using control flow graphs to cover the
defined coverage target.
➢ Test Case Execution: After the creation of test cases over coverage target, further
test cases are executed.
➢ Analysis: Analyze the result and find out whether the program is error free or has
some defects.
Objectives of Control Flow Testing:
➢ Path Coverage: During testing, it makes sure that every path through the program
is run at least once.
➢ Branch Coverage: This guarantees that, during testing, every decision point
(branch) in the program is evaluated as true or false at least once.
➢ Decision Coverage: This guarantees that all potential outcomes are covered by
executing each decision point in the program at least once.
➢ Loop testing: It evaluates how the program performs in various loop scenarios,
such as numerous, zero and single iterations.
➢ Testing Error-Handling Paths: It tests the program’s error and exception handling
pathways.
➢ Multiple condition testing: It involves testing both simple and complicated
condition combinations inside decision points.
➢ Boundary Value Examination: It evaluates how the software behaves when input
ranges are pushed to their limits.
➢ Integration testing: It examines how various software modules or components
interact with one another.
➢ Cyclomatic Complexity Reduction: It determines and reduces the program’s
cyclomatic complexity.
Advantages of Control flow testing:
➢ It detects almost half of the defects that are determined during the unit testing.
➢ It also determines almost one-third of the defects of the whole program.
➢ It can be performed manually or automated as the control flow graph that is used
can be made by hand or by using software also.
Disadvantages of Control flow testing:
➢ It is difficult to find missing paths if program and the model are done by same
person.
➢ Unlikely to find spurious features.

Data Flow Testing:-


Is a type of structural testing. It is a method that is used to find the test paths of a program
according to the locations of definitions and uses of variables in the program. It has nothing
to do with data flow diagrams. Furthermore, it is concerned with:
➢ Statements where variables receive values,
➢ Statements where these values are used or referenced.
To illustrate the approach of data flow testing, assume that each statement in the program
assigned a unique statement number. For a statement number S-
DEF(S) = {X | statement S contains the definition of X}
USE(S) = {X | statement S contains the use of X}

If a statement is a loop or if condition then its DEF set is empty and USE set is based on the
condition of statement s. Data Flow Testing uses the control flow graph to find the
situations that can interrupt the flow of the program. Reference or define anomalies in the
flow of the data are detected at the time of associations between values and variables. These
anomalies are:
• A variable is defined but not used or referenced,
• A variable is used but never defined,
• A variable is defined twice before it is used
Types of Data Flow Testing:
1. Testing for All-Du-Paths: It Focuses on “All Definition-Use Paths. All-Du-
Paths is an acronym for “All Definition-Use Paths.” Using this technique, every
possible path from a variable’s definition to every usage point is tested.
2. All-Du-Path Predicate Node Testing: This technique focuses on predicate
nodes, or decision points, in the control flow graph.
3. All-Uses Testing: This type of testing checks every place a variable is used in
the application.
4. All-Defs Testing: This type of testing examines every place a variable is
specified within the application’s code.
5. Testing for All-P-Uses: All-P-Uses stands for “All Possible Uses.” Using this
method, every potential use of a variable is tested.
6. All-C-Uses Test: It stands for “All Computation Uses.” Testing every possible
path where a variable is used in calculations or computations is the main goal of
this technique.
7. Testing for All-I-Uses: All-I-Uses stands for “All Input Uses.” With this
method, every path that uses a variable obtained from outside inputs is tested.
8. Testing for All-O-Uses: It stands for “All Output Uses.” Using this method,
every path where a variable has been used to produce output must be tested.
9. Testing of Definition-Use Pairs: It concentrates on particular pairs of
definitions and uses for variables.
10. Testing of Use-Definition Paths: This type of testing examines the routes that
lead from a variable’s point of use to its definition.
Advantages of Data Flow Testing:
Data Flow Testing is used to find the following issues-
➢ To find a variable that is used but never defined,
➢ To find a variable that is defined but never used,
➢ To find a variable that is defined multiple times before it is use,
➢ Deallocating a variable before it is used.
Disadvantages of Data Flow Testing
➢ Time consuming and costly process
➢ Requires knowledge of programming languages

System Integration Testing:-


System Integration Testing (SIT) is the type of software testing that is carried out
to perform the overall testing of a complete system that consists of many integrated
components. The system on which SIT is performed may have different hardware parts,
different software parts or both hardware and software. SIT is the process of fabricating the
constituent integral parts of a system in a reasonable and logical way. SIT performs the
testing in a less cost. It checks the full functionality of the system. System test is involved
in SIT which is a process of verification of the system fulfilling the requirements and it test
whether the system performs in according to the user’s requirements. During the
development phase, system integration testing is the first testing process performed after
the system is assembled. SIT can also be defined as a testing process that exercises the
coexistence of a software system with other system. Multiple integrated systems are
involved in it and it is assumed that each have already passed system integration testing.
SIT is performed to test the interactions among several integrated components.
SIT is a black-box testing technique.
Objective of System Integration Testing: The objective of SIT is to:
➢ To meet software with user requirements.
➢ To maximize the memory usage.
➢ To control data flow in within the system.
➢ To test the control flow of the system.
➢ To find the errors and bugs in the system.
➢ To minimize time consumption for testing process.
Major States of SIT:
There are three major states of system integration testing:
1. Data state within the integration layer: Integration layer is the medium used
for data transformation. Different web services are involved in this layer which
is used as medium for data sending and receiving. There are several check-
points where the validation of data is checked and there are several protocols
used in it. Middleware is also used as medium for transformation which allows
the data mapping against the cross-checking.
2. Data state within the database layer: Database layer consists of several steps
involved in it. It checks whether the data is transformed from integration layer to
database layer. Data properties are checked and data validation process is
performed. Mainly SQL is used for data storing and data manipulation process.
3. Data state within the application layer: Application layer is used to create a
data map for databases and check its interaction with user interface. Data
properties are also checked in it.
System Integration Testing (SIT) is a type of testing that focuses on verifying the
interactions and interfaces between different systems or components of a software
application. The purpose of SIT is to ensure that the different components are integrated
and work together correctly as a system.
SIT is typically performed after unit testing and integration testing, and before user
acceptance testing (UAT). SIT tests the end-to-end flow of data and transactions through
the system, including the interfaces between the components, the communication protocols,
the data transfer mechanisms, and the shared resources.
During SIT, various test scenarios are executed to ensure that the components of the system
interact with each other seamlessly and correctly, and that they conform to the functional
and non-functional requirements of the system. The testing team may use automated testing
tools and techniques to simulate various real-world scenarios and edge cases.
The test environment for SIT should closely resemble the production environment,
including all the hardware, software, and networking components, to ensure that the system
behaves as expected in the production environment. Any defects or issues that are
discovered during SIT are logged and tracked, and are usually fixed before the system is
deployed for user acceptance testing or production.
In summary, SIT is an important testing phase in the software development lifecycle that
ensures that the different components of a system are integrated and work together
correctly. SIT helps to identify and resolve any issues or defects before the system is
deployed for user acceptance testing or production, thereby reducing the risk of costly and
time-consuming rework.

There are several advantages of System Integration Testing (SIT) in software


development. Here are some of them:

➢ Ensures system functionality: SIT verifies that the different components of the
system are integrated and work together correctly, ensuring that the overall system
meets the functional and non-functional requirements.
➢ Reduces risk: SIT helps to identify and resolve any issues or defects before the
system is deployed for user acceptance testing or production, reducing the risk of
costly and time-consuming rework.
➢ Improves system quality: By verifying the interactions and interfaces between
different systems or components, SIT helps to improve the quality of the system and
ensures that it performs as expected.
➢ Enhances system performance: SIT helps to identify and address any performance
issues that may arise due to the interactions and interfaces between different
components of the system.
➢ Increases team collaboration: SIT requires close collaboration between the different
teams responsible for developing and testing the system, enhancing team
collaboration and communication.
➢ Supports agile development: SIT is an essential testing phase in agile development
methodologies, helping to ensure that the system is tested comprehensively and
meets the specified requirements.

You might also like