Professional Documents
Culture Documents
SE Unit4 Notes
SE Unit4 Notes
Software 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.
Software Testing is a method to assess the functionality of the software program. 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.
Principles of Testing
All the tests should meet the customer’s requirements.
To make our software, testing should be performed by a third party.
Exhaustive testing is not possible. As we need the optimal amount of testing based on
the risk assessment of the application.
All the tests to be conducted should be planned before implementing it
It follows the Pareto rule (80/20 rule) which states that 80% of errors come from 20%
of program components.
Start testing with small parts and extend it to large parts.
The goals of software testing may be classified into three major categories as follows:
1. Immediate Goals
2. Long-term Goals
3. Post-Implementation Goals
1. Immediate Goals: These objectives are the direct outcomes of testing. These
objectives may be set at any time during the SDLC process. Some of these are:
Bug Discovery: This is the immediate goal of software testing to find errors at any
stage of software development. The number of bugs is discovered in the early stage
of testing. The primary purpose of software testing is to detect flaws at any step of
the development process. The higher the number of issues detected at an early stage,
the higher the software testing success rate.
Bug Prevention: This is the immediate action of bug discovery, that occurs as a
result of bug discovery. Everyone in the software development team learns how to
code from the behavior and analysis of issues detected, ensuring that bugs are not
duplicated in subsequent phases or future projects.
2. Long-Term Goals: These objectives have an impact on product quality in the long run
after one cycle of the SDLC is completed. Some of these are:
Quality: This goal enhances the quality of the software product. Because software
is also a product, the user’s priority is its quality. Superior quality is ensured by
thorough testing. Correctness, integrity, efficiency, and reliability are all aspects that
influence quality.
Customer Satisfaction: This goal verifies the customer’s satisfaction with a
developed software product. The primary purpose of software testing, from the
user’s standpoint, is customer satisfaction. Testing should be extensive and thorough
if we want the client and customer to be happy with the software product.
Reliability: It is a matter of confidence that the software will not fail. In short,
reliability means gaining the confidence of the customers by providing them with a
quality product.
Risk Management: Risk is the probability of occurrence of uncertain events in the
organization and the potential loss that could result in negative consequences. Risk
management must be done to reduce the failure of the product and to manage risk in
different situations.
3. Post-Implemented Goals: After the product is released, these objectives become
critical. Some of these are:
Reduce Maintenance Cost: Post-released errors are costlier to fix and difficult to
identify. Because effective software does not wear out, the maintenance cost of any
software product is not the same as the physical cost. The failure of a software
product due to faults is the only expense of maintenance. Because they are difficult
to discover, post-release mistakes always cost more to rectify. As a result, if testing
is done thoroughly and effectively, the risk of failure is lowered, and maintenance
costs are reduced as a result.
Improved Software Testing Process: These goals improve the testing process for
future use or software projects. These goals are known as post-implementation
goals. A project’s testing procedure may not be completely successful, and there
may be room for improvement. As a result, the bug history and post-implementation
results can be evaluated to identify stumbling blocks in the current testing process
that can be avoided in future projects.
Different Types of Software Testing
Apart from the above classification, software testing can be further divided into 2 more
ways of testing:
1. Manual Testing: Manual testing includes testing software manually, i.e., without
using any automation tool or script. In this type, the tester takes over the role of an end-
user and tests the software to identify any unexpected behavior or bug. There are
different stages for manual testing such as unit testing, integration testing, system
testing, and user acceptance testing. Testers use test plans, test cases, or test scenarios
to test software to ensure the completeness of testing. Manual testing also includes
exploratory testing, as testers explore the software to identify errors in it.
2. Automation Testing: Automation testing, which is also known as Test Automation, is
when the tester writes scripts and uses another software to test the product. This
process involves the automation of a manual process. Automation Testing is used to re-
run the test scenarios quickly and repeatedly, that were performed manually in manual
testing.
Apart from regression testing, automation testing is also used to test the application
from a load, performance, and stress point of view. It increases the test coverage,
improves accuracy, and saves time and money when compared to manual testing.
Different Types of Manual Testing Techniques
1. Black Box Testing: Black box technique of testing in which the tester doesn’t have
access to the source code of the software and is conducted at the software interface
without any concern with the internal logical structure of the software known as black-
box testing.
2. White-Box Testing: White box technique of testing in which the tester is aware of the
internal workings of the product, has access to its source code, and is conducted by
making sure that all internal operations are performed according to the specifications is
known as white box testing.
3. Grey Box Testing: Grey Box technique is testing in which the testers should have
knowledge of implementation; however, they need not be experts.
This can only be done by a trial and Data domains and internal boundaries
4
error method. can be better tested.
Black Box testing is carried out to test functionality of the program. It is also called
‘Behavioral’ testing. The tester in this case, has a set of input values and respective desired
results. On providing input, if the output matches with the desired results, the program is
tested ‘ok’, and problematic otherwise. In this testing method, the design and structure of the
code are not known to the tester, and testing engineers and end users conduct this test on the
software. Black-box testing techniques are Equivalence class partitioning, Boundary value
analysis and cause effect testing.
Unit Testing
Unit testing is a method of testing individual units or components of a software application.
It is typically done by developers and is used to ensure that the individual units of the
software are working as intended. Unit tests are usually automated and are designed to test
specific parts of the code, such as a particular function or method. Unit testing is done at
the lowest level of the software development process, where individual units of code are
tested in isolation.
It’s important to keep in mind that Unit Testing is only one aspect of software testing and it
should be used in combination with other types of testing such as integration testing,
functional testing, and acceptance testing to ensure that the software meets the needs of its
users.
Example:
a) In a program we are checking if the loop, method, or function is working fine.
b) Misunderstood or incorrect, arithmetic precedence.
c) Incorrect initialization.
Integration Testing
Integration testing is a method of testing how different units or components of a software
application interact with each other. It is used to identify and resolve any issues that may
arise when different units of the software are combined. Integration testing is typically done
after unit testing and is used to verify that the different units of the software work together
as intended.
Incremental Approach
In the Incremental Approach, modules are added in ascending order one by one or according
to need. The selected modules must be logically related. Generally, two or more than two
modules are added and tested to determine the correctness of functions. The process
continues until the successful testing of all the modules. In this type of testing, there is a
strong relationship between the dependent modules. Suppose we take two or more modules
and verify that the data flow between them is working fine. If it is, then add more modules
and test again.
Incremental integration testing is carried out by further methods:
o Top-Down approach
o Bottom-Up approach
Top-Down Approach
The top-down testing strategy deals with the process in which higher level modules are tested
with lower level modules until the successful completion of testing of all the modules. Major
design flaws can be detected and fixed early because critical modules tested first. In this type
of method, we will add the modules incrementally or one by one and check the data flow in
the same order.
In the top-down approach, we will be ensuring that the module we are adding is the child of
the previous one like Child C is a child of Child B and so on as we can see in the above
image:
Advantages:
o Identification of defect is difficult.
o An early prototype is possible.
Disadvantages:
o Due to the high number of stubs, it gets quite complicated.
o Lower level modules are tested inadequately.
o Critical Modules are tested first so that fewer chances of defects.
Bottom-Up Method
The bottom to up testing strategy deals with the process in which lower level modules are
tested with higher level modules until the successful completion of testing of all the modules.
Top level critical modules are tested at last, so it may cause a defect. Or we can say that we
will be adding the modules from bottom to the top and check the data flow in the same order.
In the bottom-up method, we will ensure that the modules we are adding are the parent of the
previous one as we can see in the above image:
Advantages
o Identification of defect is easy.
o Do not need to wait for the development of all the modules as it saves time.
Disadvantages
o Critical modules are tested last due to which the defects can occur.
o There is no possibility of an early prototype.
Advantages
o The hybrid method provides features of both Bottom Up and Top Down methods.
o It is most time reducing method.
o It provides complete testing of all modules.
Disadvantages
o This method needs a higher level of concentration as the process carried out in both
directions simultaneously.
o Complicated method.
Non- incremental integration testing
We will go for this method, when the data flow is very complex and when it is difficult to
find who is a parent and who is a child. And in such case, we will create the data in any
module bang on all other existing modules and check if the data is present. Hence, it is also
known as the Big bang method.
In this approach, testing is done via integration of all modules at once. It is convenient for
small software systems, if used for large software systems identification of defects is
difficult.
Since this testing can be done after completion of all modules due to that testing team has less
time for execution of this process so that internally linked interfaces and high-risk critical
modules can be missed easily.
Advantages:
o It is convenient for small size software systems.
Disadvantages:
o Identification of defects is difficult because finding the error where it came from is a
problem, and we don't know the source of the bug.
o Small modules missed easily.
o Time provided for testing is very less.
o We may miss to test some of the interfaces.
Example
In the below example, the development team develops the application and sends it to the
CEO of the testing team. Then the CEO will log in to the application and generate the
username and password and send a mail to the manager. After that, the CEO will tell them to
start testing the application.
Then the manager manages the username and the password and produces a username and
password and sends it to the test leads. And the test leads will send it to the test engineers for
further testing purposes. This order from the CEO to the test engineer is top-down
incremental integrating testing.
In the same way, when the test engineers are done with testing, they send a report to the test
leads, who then submit a report to the manager, and the manager will send a report to
the CEO. This process is known as Bottom-up incremental integration testing as we can see
in the below image:
Acceptance Testing
Acceptance testing is done by the customers to check whether the delivered products
perform the desired tasks or not, as stated in the requirements. It 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.
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.
Regression Testing
Regression testing is a method of testing that is used to ensure that changes made to the
software do not introduce new bugs or cause existing functionality to break. It is typically
done after changes have been made to the code, such as bug fixes or new features, and is
used to verify that the software still works as intended. Regression testing is a black box
testing techniques. Test cases are re-executed to check the previous functionality of the
application is working fine, and the new changes have not produced any bugs.
Regression testing can be performed on a new build when there is a significant change in the
original functionality. It ensures that the code still works even when the changes are
occurring. Regression means Re-test those parts of the application, which are unchanged.
Regression tests are also known as the Verification Method. Test cases are often
automated. Test cases are required to execute many times and running the same test case
again and again manually, is time-consuming and tedious too.
1. Re-test All:
Re-Test is one of the approaches to do regression testing. In this approach, all the test
case suits should be re-executed. Here we can define re-test as when a test fails, and we
determine the cause of the failure is a software fault. The fault is reported, we can expect
a new version of the software in which defect fixed. In this case, we will need to execute
the test again to confirm that the fault fixed. This is known as re-testing. Some will refer
to this as confirmation testing. The re-test is very expensive, as it requires enormous time
and resources.
Performance Testing
Performance Testing is a type of software testing that ensures software applications
perform properly under their expected workload. It is a testing technique carried out to
determine system performance in terms of sensitivity, reactivity, and stability under a
particular workload.
Performance testing is a type of software testing that focuses on evaluating the performance
and scalability of a system or application. The goal of performance testing is to identify
bottlenecks, measure system performance under various loads and conditions, and ensure
that the system can handle the expected number of users or transactions.
Smoke Testing
Smoke Testing is done to make sure that the software under testing is ready or stable for
further testing. It is called a smoke test as the testing of an initial pass is done to check if it
did not catch fire or smoke in the initial switch-on.
Example: If the project has 2 modules so before going to the module 2 make sure that
module 1 works properly.
Object-Oriented Testing
Object-Oriented Testing testing is a combination of various testing techniques that help to
verify and validate object-oriented software. This testing is done in the following manner:
Testing of Requirements,
Design and Analysis of Testing,
Testing of Code,
Integration testing,
System testing,
User Testing.
Alpha Testing
Alpha testing is a type of validation testing. It is a type of acceptance testing that is done
before the product is released to customers. It is typically done by QA people.
Example: When software testing is performed internally within the organisation.
Beta Testing
The beta test is conducted at one or more customer sites by the end-user of the software.
This version is released for a limited number of users for testing in a real-time environment.
Example: When software testing is performed for the limited number of people.
Both Stubs and drivers are the essential part of the basic software development and software
testing process.
Stubs
o A stub is a replica of a module that collects the data and develops many possible data.
However, it executes like an actual module and is mainly used to test modules.
o Generally, stubs are created by software developers in order to use them instead of
modules if the particular modules are miss or not yet developed.
o By using these test stubs, the test engineers can simulate the performance of the lower-
level modules, which are not yet joined with the software. Furthermore, it helps us to
accelerate the activity of the missing modules.
Types of Stubs
In the top-down approach of incremental integration testing, the stubs are divided into four
essential parts, which are as follows:
o Demonstrate the trace message.
o Exhibits the parameter values.
o Returns the consistent values, which are handled by the modules or the components.
o Returns the values of the specific parameters, which were utilized by testing components
or modules.
Drivers
o The drivers establish the test environments and take care of the communication,
estimates results and also send the reports.
o These are just like stubs and used by software test engineers in order to accomplish the
missing or incomplete modules / components requirements.
o The drivers are mainly developed in the Bottom-up approach of incremental integration
testing.
o Generally, drivers are bit complex as compared to the stubs.
o These can test the lower levels of the code when the upper-level modules or codes are
not developed or missing.
o In other words, we can say that the Drivers perform as pseudo-codes, which are mainly
used when the stub modules are completed; however, the initial modules/components are
not prepared.
Examples of Stubs and Drivers
Suppose we have one web application that contains four different modules, such as:
o Module-P
o Module-Q
o Module-R
o Module-S
And all the modules, as mentioned earlier, are responsible for some individual activities or
functionality, as we can observe in the following table:
Different Modules Individual Activities
It is always a better approach to implement the testing or development of all the modules
equivalently. The minute each gets developed, they can be combined and tested according to
their similar dependencies with a module.
Once Module-P is developed, it will go through the testing process. But, to perform and
validate the testing methods regarding Module-P, they need Module-Q, which is not yet
developed entirely and still in the developing process.
And it is not possible to test Module-P on the lack of Module-Q. Thus, in such scenarios, we
will take the help of Stubs and Drivers in the software testing process.
The Stubs and drivers will replicate all the basic functionality and features displayed by the
real Module-Q. And subsequently, it is being combined with Module-P in order to execute
the testing process effectively.
Now, we can validate the estimated functionality of the Login page, which was in Module-
P, only if it is going to the Home Page, which is the activity of Module-Q as per the correct
and valid inputs.
In the same way, stubs and drivers are used to accomplish the requirements of other
modules, such as the Sign-out page, which comes under the Module-S and needs to be
aimed to the Login page (Module-P) after effectively logging out from the particular
application.
Likewise, we may also use Stubs or Drivers instead of Module-R and Module-S if they are
not available.
As the result of the inaccessibility of Module-P, stubs and drivers will work as an alternate
for it to perform the testing of Module-S.
Compare drivers and Stubs functionality
We can say that both stubs and drivers carry out similar features and objectives. Both of them
act as an alternative for the missing or absent module. But, the change between them can be
pictured throughout the integration testing process.
Stubs vs Drivers
Sn Stubs Drivers
1. A section of code that imitates the A section of code that imitates the calling
called function is known as Stubs. function is known as Drivers.
3. The stubs are developed during the The drivers are developed during the
Top-down approach of incremental bottom-up approach of incremental
integration testing. integration testing.
4. Stubs replicate the activity of not Drivers authorize test cases to another
developed and missing modules or system and which refer the modules under
components. testing.
5. The stubs are created by the team of Mostly, the drivers are created by the
test engineers. developer and the unit Test engineers.
6. Stubs are developed when high-level Drivers are acquired when lower-level
modules are tested, and lower-level modules are tested, and higher-level
modules are not formed. modules are not yet developed.
7. These are parallel to the modules of the On the other hand, the drivers are used to
software, which are under development reminding the component, which needs to
process. be tested.
8. The stubs signify the low-level The drivers signify the high-level
modules. modules.
9. Fundamentally, the Stubs are also The Drivers are also known as the calling
known as a called program and initially program and are mainly used in bottom-
used in the Top-down integration up integration testing.
testing.
10. These are reserved for testing the The drivers are used if the core module of
feature and functionality of the the software isn't established for testing.
modules.
Grouping tests into test suites helps in managing, executing, and reporting the test results
efficiently. Effectively acting as a container for these test cases, the suite showcases
precise details and objectives for each individual test case. Furthermore, it includes vital
information regarding the system configuration necessary for the testing process.
For a product purchase scenario, a well-structured test suite may encompass an array of
crucial test cases, seamlessly contributing to the overall validation process:
Test Case 1: Login.
Test Case 2: Adding Products.
Test Case 3: Checkout.
Test Case 4: Logout
There might be some instances when they are used to collect relevant test cases.
Depending on the system, it may be for all of the system's functionality or a smoke test
suite that includes smoke tests. Additionally, it may consist of all tests and indicate if a
test should be used as a smoke test or for a particular functionality.
As depicted in image below, a test plan is segregated into test suites, which may be
further segmented based on number of test cases.
Characteristics of a test suite
It provides several benefits for the testing team and the organization. Some of the
essential characteristics are:
They are developed after a test plan.
There are several tests and test cases included in it.
It explains the aims and objectives of the test cases.
Test parameters like application, environment, version, and others are incorporated in it.
These can be created based on the test cycle and scope.
It includes several kinds of testing, including functional testing and non-functional
testing.
It offers a way to test and evaluate the applications quickly.
It may be used with many automation testing tools, including JUnit and Selenium.
It is the
functionality of any A test case is a
Defines the scope, Test cases make up
software significant document
aim, and strategy of a test suite created
application's that contains necessary
testing. after the test plan.
features that may be testing-related details.
tested.
Reasons Following are The below The reasons for The reasons Following are
behind reasons which reason leads to having behind some of the
may cause the defects: an error are as the fault are as most important
the bugs: Giving incorrect follows: follows: reasons behind
Missing coding and wrong Errors in the A Fault may the failure:
Wrong coding inputs. code. occur by an Environmental
Extra coding Dilemmas and The Mistake of improper step in condition
errors in the some values. the initial stage, System usage
outside behavior If a developer is process, or data Users
and inside unable to definition. Human error
structure and compile or run Inconsistency or
design. a program issue in the
An error in successfully. program.
coding or logic Confusions and An irregularity
affects the issues in or loophole in
software and programming. the software that
causes it to Invalid login, leads the
breakdown or loop, and software to
the failure. syntax. perform
Inconsistency improperly.
between actual
and expected
outcomes.
Blunders in
design or
requirement
actions.
Misperception
in
understanding
the
requirements of
the application.
Way to Following are With the help of Below are ways The fault can be The way to
prevent the way to stop the following, to prevent prevented with prevent failure
the the bugs: we can prevent the Errors: the help of the are as follows:
reasons Test-driven the Defects: Enhance the following: Confirm re-
development. Implementing software quality Peer review. testing.
Offer several with system Assess the Review the
programming innovative review and functional requirements
language programming programming. necessities of and revisit the
support. methods. Detect the the software. specifications.
Adjusting, Use of primary issues and Execute the Implement
advanced, and and correct prepare a detailed code current
operative software suitable analysis. protective
development development mitigation plan. Verify the techniques.
procedures. techniques. Validate the correctness of Categorize and
Evaluating the Peer review fixes and verify software design evaluate errors
code It is executing their quality and and and issues
systematically. consistent code precision. programming.
reviews to
evaluate its
quality and
correctness.
1. Review: In static testing, review is a process or technique that is performed to find the
potential defects in the design of the software. It is process to detect and remove errors
and defects in the different supporting documents like software requirements
specifications. People examine the documents and sorted out errors, redundancies and
ambiguities. Review is of four types:
Informal: In informal review, the creator of the documents put the contents in
front of audience and everyone gives their opinion and thus defects are identified
in the early stage.
Walkthrough: It is basically performed by experienced person or expert to check
the defects so that there might not be problem further in the development or testing
phase.
Peer review (Formal Technical Review): Peer review means checking
documents of one-another to detect and fix the defects. It is basically done in a
team of colleagues.
Inspection: Inspection is basically the verification of document by the higher
authority like the verification of software requirement specifications (SRS).
2. Static Analysis: Static Analysis includes the evaluation of the code quality that is
written by developers. Different tools are used to do the analysis of the code and
comparison of the same with the standard. It also helps in following identification of
following defects:
(a) Unused variables
(b) Dead code
(c) Infinite loops
(d) Variable with undefined value
(e) Wrong syntax