SQT_Unit-1
SQT_Unit-1
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.
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
➢ 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.