SE Unit IV
SE Unit IV
SE Unit IV
1. Testing
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. The article focuses on discussing Software Testing in detail.
Software Testing is a method to assess the functionality of the software program. The process
checks whether the actual software matches the expected requirements and ensures the software
is bug-free. The purpose of software testing is to identify the errors, faults, or missing
requirements in contrast to actual requirements. It mainly aims at measuring the specification,
functionality, and performance of a software program or application.
1. Verification: It refers to the set of tasks that ensure that the software correctly implements a
specific function. It means “Are we building the product right?”.
2. Validation: It refers to a different set of tasks that ensure that the software that has been built
is traceable to customer requirements. It means “Are we building the right product?”.
Importance of Software Testing:
• Defects can be identified early: Software testing is important because if there are any bugs
they can be identified early and can be fixed before the delivery of the software.
• Improves quality of software: Software Testing uncovers the defects in the software, and
fixing them improves the quality of the software.
• Increased customer satisfaction: Software testing ensures reliability, security, and high
performance which results in saving time, costs, and customer satisfaction.
• Helps with scalability: Software testing type non-functional testing helps to identify the
scalability issues and the point where an application might stop working.
• Saves time and money: After the application is launched it will be very difficult to trace
and resolve the issues, as performing this activity will incur more costs and time. Thus, it
is better to conduct software testing at regular intervals during software development.
Different Types Of Software Testing
2. Unit Testing
Unit testing is a type of software testing that focuses on individual units or components of a
software system. The purpose of unit testing is to validate that each unit of the software works
as intended and meets the requirements. Unit testing is typically performed by developers, and
it is performed early in the development process before the code is integrated and tested as a
whole system.
Unit tests are automated and are run each time the code is changed to ensure that new code does
not break existing functionality. Unit tests are designed to validate the smallest possible unit of
code, such as a function or a method, and test it in isolation from the rest of the system. This
allows developers to quickly identify and fix any issues early in the development process,
improving the overall quality of the software and reducing the time required for later 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.
0 seconds of 0 secondsVolume 0%
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.
Unit
Testing Techniques:
Each column corresponds to a rule which will become a test case for testing. So there will be 4
test cases.
5. Requirement-based testing – It includes validating the requirements given in the SRS of a
software system.
6. Compatibility testing – The test case results not only depends on the product but is also on
the infrastructure for delivering functionality. When the infrastructure parameters are changed
it is still expected to work properly. Some parameters that generally affect the compatibility of
software are:
1. Processor (Pentium 3, Pentium 4) and several processors.
2. Architecture and characteristics of machine (32-bit or 64-bit).
3. Back-end components such as database servers.
4. Operating System (Windows, Linux, etc).
Black Box Testing Type
The following are the several categories of black box testing:
1. Functional Testing
2. Regression Testing
3. Nonfunctional Testing (NFT)
Functional Testing: It determines the system’s software functional requirements.
Regression Testing: It ensures that the newly added code is compatible with the existing code.
In other words, a new software update has no impact on the functionality of the software. This
is carried out after a system maintenance operation and upgrades.
Nonfunctional Testing: Nonfunctional testing is also known as NFT. This testing is not
functional testing of software. It focuses on the software’s performance, usability, and
scalability.
Tools Used for Black Box Testing:
1. Appium
2. Selenium
3. Microsoft Coded UI
4. Applitools
5. HP QTP.
What can be identified by Black Box Testing
1. Discovers missing functions, incorrect function & interface errors
2. Discover the errors faced in accessing the database
3. Discovers the errors that occur while initiating & terminating any functions.
4. Discovers the errors in performance or behaviour of software.
Features of black box testing:
1. Independent testing: Black box testing is performed by testers who are not involved in
the development of the application, which helps to ensure that testing is unbiased and
impartial.
2. Testing from a user’s perspective: Black box testing is conducted from the perspective of
an end user, which helps to ensure that the application meets user requirements and is easy
to use.
3. No knowledge of internal code: Testers performing black box testing do not have access
to the application’s internal code, which allows them to focus on testing the application’s
external behaviour and functionality.
4. Requirements-based testing: Black box testing is typically based on the application’s
requirements, which helps to ensure that the application meets the required specifications.
5. Different testing techniques: Black box testing can be performed using various testing
techniques, such as functional testing, usability testing, acceptance testing, and regression
testing.
6. Easy to automate: Black box testing is easy to automate using various automation tools,
which helps to reduce the overall testing time and effort.
7. Scalability: Black box testing can be scaled up or down depending on the size and
complexity of the application being tested.
8. Limited knowledge of application: Testers performing black box testing have limited
knowledge of the application being tested, which helps to ensure that testing is more
representative of how the end users will interact with the application.
Advantages of Black Box Testing:
• The tester does not need to have more functional knowledge or programming skills to
implement the Black Box Testing.
• It is efficient for implementing the tests in the larger system.
• Tests are executed from the user’s or client’s point of view.
• Test cases are easily reproducible.
• It is used in finding the ambiguity and contradictions in the functional specifications.
Disadvantages of Black Box Testing:
• There is a possibility of repeating the same tests while implementing the testing process.
• Without clear functional specifications, test cases are difficult to implement.
• It is difficult to execute the test cases because of complex inputs at different stages of testing.
• Sometimes, the reason for the test failure cannot be detected.
• Some programs in the application are not tested.
• It does not reveal the errors in the control structure.
• Working with a large sample space of inputs can be exhaustive and consumes a lot of time.
2. Branch Coverage:
In this technique, test cases are designed so that each branch from all decision points is traversed
at least once. In a flowchart, all edges must be traversed at least once.
4 test cases are required such that all branches of all decisions are covered, i.e, all edges of the flowchart are covered
3. Condition Coverage
4. Multiple Condition Coverage
In this technique, all the possible combinations of the possible outcomes of conditions are tested
at least once. Let’s consider the following example:
• READ X, Y
• IF(X == 0 || Y == 0)
• PRINT ‘0’
• #TC1: X = 0, Y = 0
• #TC2: X = 0, Y = 5
• #TC3: X = 55, Y = 0
• #TC4: X = 55, Y = 5
5. Basis Path Testing
In this technique, control flow graphs are made from code or flowchart and then Cyclomatic
complexity is calculated which defines the number of independent paths so that the minimal
number of test cases can be designed for each independent path. Steps:
• Make the corresponding control flow graph
• Calculate the cyclomatic complexity
• Find the independent paths
• Design test cases corresponding to each independent path
• V(G) = P + 1, where P is the number of predicate nodes in the flow graph
• V(G) = E – N + 2, where E is the number of edges and N is the total number of nodes
• V(G) = Number of non-overlapping regions in the graph
• #P1: 1 – 2 – 4 – 7 – 8
• #P2: 1 – 2 – 3 – 5 – 7 – 8
• #P3: 1 – 2 – 3 – 6 – 7 – 8
• #P4: 1 – 2 – 4 – 7 – 1 – . . . – 7 – 8
6. Loop Testing
Loops are widely used and these are fundamental to many algorithms hence, their testing is very
important. Errors often occur at the beginnings and ends of loops.
• Simple loops: For simple loops of size n, test cases are designed that:
1. Skip the loop entirely
2. Only one pass through the loop
3. 2 passes
4. m passes, where m < n
5. n-1 ans n+1 passes
• Nested loops: For nested loops, all the loops are set to their minimum count, and we
start from the innermost loop. Simple loop tests are conducted for the innermost loop
and this is worked outwards till all the loops have been tested.
• Concatenated loops: Independent loops, one after another. Simple loop tests are
applied for each. If they’re not independent, treat them like nesting.
White Testing is performed in 2 Steps
1. Tester should understand the code well
2. Tester should write some code for test cases and execute them
Tools required for White box testing:
• PyUnit
• Sqlmap
• Nmap
• Parasoft Jtest
• Nunit
• VeraUnit
• CppUnit
• Bugzilla
• Fiddler
• JSUnit.net
• OpenGrok
• Wireshark
• HP Fortify
• CSUnit
Features of White box Testing
1. Code coverage analysis: White box testing helps to analyze the code coverage of an
application, which helps to identify the areas of the code that are not being tested.
2. Access to the source code: White box testing requires access to the application’s source
code, which makes it possible to test individual functions, methods, and modules.
3. Knowledge of programming languages: Testers performing white box testing must have
knowledge of programming languages like Java, C++, Python, and PHP to understand the
code structure and write tests.
4. Identifying logical errors: White box testing helps to identify logical errors in the code,
such as infinite loops or incorrect conditional statements.
5. Integration testing: White box testing is useful for integration testing, as it allows testers
to verify that the different components of an application are working together as expected.
6. Unit testing: White box testing is also used for unit testing, which involves testing
individual units of code to ensure that they are working correctly.
7. Optimization of code: White box testing can help to optimize the code by identifying any
performance issues, redundant code, or other areas that can be improved.
8. Security testing: White box testing can also be used for security testing, as it allows
testers to identify any vulnerabilities in the application’s code.
9. Verification of Design: It verifies that the software’s internal design is implemented in
accordance with the designated design documents.
10. Check for Accurate Code: It verifies that the code operates in accordance with the
guidelines and specifications.
11. Identifying Coding Mistakes: It finds and fix programming flaws in your code, including
syntactic and logical errors.
12. Path Examination: It ensures that each possible path of code execution is explored and
test various iterations of the code.
13. Determining the Dead Code: It finds and remove any code that isn’t used when the
programme is running normally (dead code).
Advantages of Whitebox Testing
1. Thorough Testing: White box testing is thorough as the entire code and structures are tested.
2. Code Optimization: It results in the optimization of code removing errors and helps in
removing extra lines of code.
3. Early Detection of Defects: It can start at an earlier stage as it doesn’t require any
interface as in the case of black box testing.
4. Integration with SDLC: White box testing can be easily started in Software Development
Life Cycle.
5. Detection of Complex Defects: Testers can identify defects that cannot be detected
through other testing techniques.
6. Comprehensive Test Cases: Testers can create more comprehensive and effective test
cases that cover all code paths.
7. Testers can ensure that the code meets coding standards and is optimized for performance.
Disadvantages of White box Testing
1. Programming Knowledge and Source Code Access: Testers need to have programming
knowledge and access to the source code to perform tests.
2. Overemphasis on Internal Workings: Testers may focus too much on the internal
workings of the software and may miss external issues.
3. Bias in Testing: Testers may have a biased view of the software since they are familiar
with its internal workings.
4. Test Case Overhead: Redesigning code and rewriting code needs test cases to be written
again.
5. Dependency on Tester Expertise: Testers are required to have in-depth knowledge of the
code and programming language as opposed to black-box testing.
6. Inability to Detect Missing Functionalities: Missing functionalities cannot be detected as
the code that exists is tested.
7. Increased Production Errors: High chances of errors in production.
5. Integration and System testing
Integration testing is the process of testing the interface between two software units or modules.
It focuses on determining the correctness of the interface. The purpose of integration testing is to
expose faults in the interaction between integrated units. Once all the modules have been unit-
tested, integration testing is performed.
Integration testing is a software testing technique that focuses on verifying the interactions and
data exchange between different components or modules of a software application. The goal of
integration testing is to identify any problems or bugs that arise when different components are
combined and interact with each other. Integration testing is typically performed after unit testing
and before system testing. It helps to identify and resolve integration issues early in the
development cycle, reducing the risk of more severe and costly problems later on.
Integration testing can be done by picking module by module. This can be done so that there
should be a proper sequence to be followed. And also if you don’t want to miss out on any
integration scenarios then you have to follow the proper sequence. Exposing the defects is the
major focus of the integration testing and the time of interaction between the integrated units.
Integration test approaches – There are four types of integration testing approaches. Those
approaches are the following:
1. 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:
1. It is convenient for small systems.
2. Simple and straightforward approach.
3. Can be completed quickly.
4. Does not require a lot of planning or coordination.
5. May be suitable for small systems or projects with a low degree of interdependence
between components.
Disadvantages:
1. There will be quite a lot of delay because you would have to wait for all the modules
to be integrated.
2. High-risk critical modules are not isolated and tested on priority since all modules are
tested at once.
3. Not Good for long projects.
4. High risk of integration problems that are difficult to identify and diagnose.
5. This can result in long and complex debugging and troubleshooting efforts.
6. This can lead to system downtime and increased development costs.
7. May not provide enough visibility into the interactions and data exchange between
components.
8. This can result in a lack of confidence in the system’s stability and reliability.
9. This can lead to decreased efficiency and productivity.
10. This may result in a lack of confidence in the development team.
11. This can lead to system failure and decreased user satisfaction.
2. Bottom-Up Integration Testing – In bottom-up testing, each module at lower levels are tested
with higher modules until all modules are 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.
Advantages:
• 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:
• 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.
4. Mixed Integration Testing – A mixed integration testing is also called sandwiched integration
testing. A mixed integration testing follows a combination of top down and bottom-up testing
approaches. In top-down approach, testing can start only after the top-level module have been
coded and unit tested. In bottom-up approach, testing can start only after the bottom level modules
are ready. This sandwich or mixed approach overcomes this shortcoming of the top-down and
bottom-up approaches. It is also called the hybrid integration testing. also, stubs and drivers are
used in mixed integration testing.
Advantages:
• Mixed approach is useful for very large projects having several sub projects.
• This Sandwich approach overcomes this shortcoming of the top-down and bottom-up
approaches.
• Parallel test can be performed in top and bottom layer tests.
Disadvantages:
• For mixed integration testing, it requires very high cost because one part has a Top-
down approach while another part has a bottom-up approach.
• This integration testing cannot be used for smaller systems with huge interdependence
between different modules.
Applications:
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.
6. Regression Testing
Regression Testing
is the process of testing the modified parts of the code and the parts that might get affected due
to the modifications to ensure that no new errors have been introduced in the software after the
modifications have been made. Regression means the return of something and in the software
field, it refers to the return of a bug.
When to do regression testing?
• When a new functionality is added to the system and the code has been modified to
absorb and integrate that functionality with the existing code.
• When some defect has been identified in the software and the code is debugged to
fix it.
• When the code is modified to optimize its working.
Process of Regression testing:
Firstly, whenever we make some changes to the source code for any reason like adding new
functionality, optimization, etc. then our program when executed fails in the previously
designed test suite for obvious reasons. After the failure, the source code is debugged in order
to identify the bugs in the program. After identification of the bugs in the source code,
appropriate modifications are made. Then appropriate test cases are selected from the already
existing test suite which covers all the modified and affected parts of the source code. We can
add new test cases if required. In the end, regression testing is performed using the selected test
cases.
8. Program analysis
Program analysis in software engineering refers to the process of automatically examining and
understanding computer programs to gain insights into their behavior, structure, and properties. Program
analysis techniques and tools are used to identify bugs, improve code quality, optimize performance,
enforce security policies, and verify correctness. Program analysis encompasses a wide range of
techniques, including static analysis, dynamic analysis, and hybrid approaches.
In summary, program analysis plays a crucial role in software engineering by providing automated
techniques and tools for understanding, debugging, optimizing, and securing computer programs. It helps
improve software quality, reliability, and maintainability throughout the software development lifecycle.
9. Symbolic Execution
Symbolic execution is a powerful technique used in software engineering for analyzing and
reasoning about the behavior of computer programs. Unlike traditional testing methods that use
concrete inputs to execute programs, symbolic execution operates on symbolic inputs, allowing it
to explore all possible paths of execution and systematically generate test cases that exercise
different program behaviors. Here's a detailed explanation of symbolic execution:
In summary, symbolic execution is a powerful technique in software engineering for analyzing program
behavior, generating test cases, and identifying software defects and vulnerabilities. While it has its
challenges and limitations, it remains an essential tool for improving software quality, reliability, and
security throughout the software development lifecycle.
10.Model Checking
Model checking is a formal verification technique used in software engineering and computer
science to check whether a given system or model satisfies a desired property or specification. It
involves systematically exploring all possible states of a model to verify whether certain
properties hold, such as safety, liveness, or temporal logic properties. Here's a detailed explanation
of model checking:
Background:
A medium-sized e-commerce company operates a web-based platform for selling products online.
The platform includes features such as product catalog browsing, user authentication, shopping
cart management, order processing, and payment processing. The application is critical to the
company's business operations and revenue generation.