Unit 4 SE
Unit 4 SE
Software Testing
Software Testing is a method to check whether the actual software product matches expected
requirements and to ensure that software product is Defect free. It involves execution of
software/system components using manual or automated tools to evaluate one or more
properties of interest. The purpose of software testing is to identify errors, gaps or missing
requirements in contrast to actual requirements.
Why Software Testing is Important?
Software Testing is Important because if there are any bugs or errors in the software, it can
be identified early and can be solved before delivery of the software product. Properly tested
software product ensures reliability, security and high performance which further results in
time saving, cost effectiveness and customer satisfaction.
What are the benefits of Software Testing?
Here are the benefits of using software testing:
Cost-Effective: It is one of the important advantages of software testing. Testing any
IT project on time helps you to save your money for the long term. In case if the bugs
caught in the earlier stage of software testing, it costs less to fix.
Security: It is the most vulnerable and sensitive benefit of software testing. People
are looking for trusted products. It helps in removing risks and problems earlier.
Product quality: It is an essential requirement of any software product. Testing
ensures a quality product is delivered to customers.
Customer Satisfaction: The main aim of any product is to give satisfaction to their
customers. UI/UX Testing ensures the best user experience.
7 Principles of Software Testing
1. Testing shows presence of defects
2. Exhaustive testing is not possible
3. Early testing
4. Defect clustering
5. Pesticide paradox
6. Testing is context dependent
7. Absence of errors fallacy
Testing in Software Engineering
As per ANSI/IEEE 1059, Testing in Software Engineering is a process of evaluating a
software product to find whether the current software product meets the required conditions
or not. The testing process involves evaluating the features of the software product for
requirements in terms of any missing requirements, bugs or errors, security, reliability and
performance.
Software Testing has different goals and objectives. The major objectives of Software testing
are as follows:
Finding defects which may get created by the programmer while developing the
software.
Gaining confidence in and providing information about the level of quality.
To prevent defects.
To make sure that the end result meets the business and user requirements.
To ensure that it satisfies the BRS that is Business Requirement Specification and
SRS that is System Requirement Specifications.
To gain the confidence of the customers by providing them a quality product.
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.
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.
Here, are the key reasons to perform unit testing in software engineering:
1. Unit tests help to fix bugs early in the development cycle and save costs.
2. It helps the developers to understand the testing code base and enables them to make
changes quickly
3. Good unit tests serve as project documentation
4. Unit tests help with code re-use. Migrate both your code and your tests to your new
project. Tweak the code until the tests run again.
The pros and cons of unit testing are as follows:
Advantages
o Unit testing uses module approach due to that any part can be tested without waiting
for completion of another parts testing.
o 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.
o Unit testing allows the developer to refactor code after a number of days and ensure
the module still working without any defect.
Disadvantages
o It cannot identify integration or broad level error as it works on units of the code.
o In the unit testing, evaluation of all execution paths is not possible, so unit testing is
not able to catch each error in a program.
o It is best suitable for conjunction with other testing activities.
S.No
. Stubs Drivers
Stubs are basically known as a “called While, drivers are the “calling
2. programs” and are used in the Top-down program” and are used in bottom-up
integration testing. integration testing.
S.No
. Stubs Drivers
The stubs are taken into concern if The drivers are taken into concern if
testing of upper-levels of the modules testing of lower-levels of the modules
6.
are done and the lower-levels of the are done and the upper-levels of the
modules are under developing process. modules are under developing process.
Stubs are used when lower-level of Drivers are used when higher-level of
modules are missing or in a partially modules are missing or in a partially
7.
developed phase, and we want to test the developed phase, and we want to test
main module. the lower(sub)- module.
Advantages:
Fault localization is easier.
No time is wasted waiting for all modules to be developed unlike Big-bang approach
Disadvantages:
Critical modules (at the top level of software architecture) which control the flow of
application are tested last and may be prone to defects.
An early prototype is not possible
2. Top-down Integration Testing
Top Down Integration Testing is a method in which integration testing takes place from top
to bottom following the control flow of software system. The higher level modules are tested
first and then lower level modules are tested and integrated in order to check the software
functionality. Stubs are used for testing if some modules are not ready.
Advantages:
Fault Localization is easier.
Possibility to obtain an early prototype.
Critical Modules are tested on priority; major design flaws could be found and fixed
first.
Disadvantages:
Needs many Stubs.
Modules at a lower level are tested inadequately.
Sandwich Testing
Sandwich Testing is a strategy in which top level modules are tested with lower-level
modules at the same time lower modules are integrated with top modules and tested as a
system. It is a combination of Top-down and Bottom-up approaches therefore it is called
Hybrid Integration Testing. It makes use of both stubs as well as drivers.
Acceptance Testing
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.
Objectives of Acceptance Testing:
1. Verify compliance with customer requirements
2. Ensure product functionality and performance
3. Provide evidence of product quality and reliability
4. Identify and resolve any issues before product release
5. Establish confidence in the product among stakeholders.
Types of Acceptance Testing:
1. User Acceptance Testing (UAT): User acceptance testing is used to determine
whether the product is working for the user correctly. Specific requirements which are
quite often used by the customers are primarily picked for the testing purpose. This is
also termed as End-User Testing.
2. Business Acceptance Testing (BAT): BAT is used to determine whether the product
meets the business goals and purposes or not. BAT mainly focuses on business profits
which are quite challenging due to the changing market conditions and new
technologies so the current implementation may have to being changed which results
in extra budgets.
3. Contract Acceptance Testing (CAT): CAT is a contract that specifies that once the
product goes live, within a predetermined period, the acceptance test must be
performed and it should pass all the acceptance use cases.
4. Regulations Acceptance Testing (RAT): RAT is used to determine whether the
product violates the rules and regulations that are defined by the government of the
country where it is being released. This may be unintentional but will impact
negatively on the business. Generally, the product or application that is to be released
in the market, must go under RAT, as different countries or regions have different
rules and regulations defined by its governing bodies.
5. Operational Acceptance Testing (OAT): OAT is used to determine the operational
readiness of the product and is non-functional testing. It mainly includes testing of
recovery, compatibility, maintainability, reliability, etc. OAT assures the stability of
the product before it is released to production.
6. Alpha Testing: Alpha testing is used to determine the product in the development
testing environment by a specialized testers team usually called alpha testers.
7. Beta Testing: Beta testing is used to assess the product by exposing it to the real end-
users, usually called beta testers in their environment. Feedback is collected from the
users and the defects are fixed. Also, this helps in enhancing the product to give a rich
user experience.
Use of Acceptance Testing:
To find the defects missed during the functional testing phase.
How well the product is developed.
A product is what the customers need.
Feedback help in improving the product performance and user experience.
Minimize or eliminate the issues arising from the production.
Advantages of Acceptance Testing:
This testing helps the project team to know the further requirements from the users
directly as it involves the users for testing.
Automated test execution.
It brings confidence and satisfaction to the clients as they are directly involved in the
testing process.
It is easier for the user to describe their requirement.
It covers only the Black-Box testing process and hence the entire functionality of the
product will be tested.
Disadvantages of Acceptance Testing:
Users should have basic knowledge about the product or application.
Sometimes, users don’t want to participate in the testing process.
The feedback for the testing takes long time as it involves many users and the
opinions may differ from one user to another user.
Development team is not participated in this testing process.
Regression Testing
Regression testing refers to a type of software testing that is used to verify any modification
or update in a software without affecting the overall working functionality of the said
software.
Regression testing is performed when there is a code change in a software application.
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 it’s working.
Advantages of Regression Testing:
It ensures that no new bugs have been introduced after adding new functionalities to
the system.
As most of the test cases used in Regression Testing are selected from the existing test
suite and we already know their expected outputs. Hence, it can be easily automated
by the automated tools.
It helps to maintain the quality of the source code.
Disadvantages of Regression Testing:
It can be time and resource consuming if automated tools are not used.
It is required even after very small changes in the code.
Test Execution Sequence Done after functional testing Done before performance testing
Sl
Functional Testing Performance Testing
NO
1 To verify the accuracy of the software with To verify the behaviour of the system at
definite inputs against expected output various load conditions
2 It can be manual or automated It can be performed effectively if automated
3 One user performing all the operations Several users performing desired operations
4 Involvement required from Customer, Involvement required from Customer, Tester,
Tester, and Developer Developer, DBA and N/W Management team
5 Production sized test environment not Requires close to production test environment
mandatory and H/W requirements are & several H/W facilities to populate the load
minimal
Basis Fault Error Failure
Definition
Failure is the
accumulation of
several defects that
A Fault is a state that causes An Error is a mistake ultimately lead to
the software to fail and made in the code due Software failure and
therefore it does not achieve to which compilation results in the loss of
its necessary function. or execution fails, information in critical
modules thereby
making the system
unresponsive.
Syntactic Error
UI screen error
Business Logic Faults Error handling
Functional and Logical error
Faults Flow control
Different types Graphical User error
NA
Interface (GUI) Faults Calculation
Performance Faults error
Security Faults Hardware error
Hardware Faults
ng of
requirements
software. Faulty design
and architecture
Logical error
Confirmation
of Re-testing
Conduct peer the process end
reviews and to end,
Peer review of the Test
code-reviews Carefully
documents and
requirements. Need for review the
Way to prevent validation of requirements as
Verifying the well as the
the reasons bug fixes and
correctness of software specifications.
enhancing the
design and coding.
overall quality Categorizing
of the software. and evaluating
the errors and
issues.
Following are the significant differences between white box testing and black box testing:
White-box testing Black box testing
The developers can perform white box The test engineers perform the black box testing.
testing.
To perform WBT, we should understand the To perform BBT, there is no need to understand the
programming languages. programming languages.
In this, we will investigate the source code In this, we will verify the functionality of the application
and test the logic of the code. based on the requirement specification.
In this, the developer should know about the In this, there is no need to know about the internal design
internal design of the code. of the code.
Alpha testing performed by Testers who are Beta testing is performed by Clients or End Users
usually internal employees of the organization who are not employees of the organization
Reliability and Security Testing are not Reliability, Security, Robustness are checked during
performed in-depth Alpha Testing Beta Testing
Long execution cycle may be required for Only a few weeks of execution are required for Beta
Alpha testing testing
Alpha testing is to ensure the quality of the Beta testing also concentrates on the quality of the
product, but gathers users input on the product and
product before moving to Beta testing
ensures that the product is ready for real time users.
Static Testing
Static Testing is a type of a Software Testing method which is performed to check the defects
in software without executing the code of the software application.
Static Testing Techniques: There are mainly two type techniques used in Static Testing:
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: 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 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.
Static Analysis is of three types:
Data Flow: Data flow is related to the stream processing.
Control Flow: Control flow is basically how the statements or instructions are
executed.
Cyclomatic Complexity: Cyclomatic complexity defines the number of independent
paths in the control flow graph made from the code or flowchart so that minimum
number of test cases can be designed for each independent path.
Why we need Static Testing?
We required Static testing whenever we encounter the following situation while testing an
application or the software:
Dynamic Testing is time-consuming
Flaws at earlier stages/identification of Bugs
Dynamic Testing is expensive
Increased size of the software
Formal Technical Review (FTR)
Formal Technical Review (FTR) is a software quality control activity performed by software
engineers.
Objectives of formal technical review (FTR): Some of these are:
1. Useful to uncover error in logic, function and implementation for any representation
of the software.
2. The purpose of FTR is to verify that the software meets specified requirements.
3. To ensure that software is represented according to predefined standards.
4. It helps to review the uniformity in software that is development in a uniform manner.
5. To makes the project more manageable.
Review guidelines: -
Guidelines for the conducting of formal technical reviews should be established in advance.
These guidelines must be distributed to all reviewers, agreed upon, and then followed. A
review that is unregistered can often be worse than a review that does not minimum set of
guidelines for FTR.
1. Review the product, not the manufacture (producer).
2. Take written notes (record purpose)
3. Limit the number of participants and insists upon advance preparation.
4. Develop a checklist for each product that is likely to be reviewed.
5. Allocate resources and time schedule for FTRs in order to maintain time schedule.
6. Conduct meaningful training for all reviewers in order to make reviews effective.
7. Reviews earlier reviews which serve as the base for the current review being
conducted.
8. Set an agenda and maintain it.
9. Separate the problem areas, but do not attempt to solve every problem notes.
Phases of Formal Review:
Walk Through
The walkthrough is a review meeting process but it is different from the Inspection, as it
does not involve any formal process i.e. it is a nonformal process. Basically, the walkthrough
[review meeting process] is started by the Author of the code.
In the walkthrough, the code or document is read by the author, and others who are present in
the meeting can note down the important points or can write notes on the defects and can give
suggestions about them. The walkthrough is an informal way of testing, no formal authority
is been involved in this testing.
Objectives of Walkthrough:
Following are some of the objectives of the walkthrough.
To detect defects in developed software products.
To fully understand and learn the development of software products.
To properly explain and discuss the information present in the document.
To verify the validity of the proposed system.
To give suggestions and report them appropriately with new solutions and ideas.
To provide an early “proof of concept”.
Advantages
Incorporates multiple perspectives
Fosters communication between the team
Increases the knowledge of the entire team related to the code in question
Disadvantages
Areas where questions are not raised may go unnoticed
Lack of diversity, as the author leads the meeting and everyone merely verifies if what
is being said matches the code
Meetings can be time-consuming
Software Inspection
Software inspection is a process in which other developers or team members review the code
written by a developer to identify potential errors or areas for improvement. This process can
help improve the overall quality of the software by identifying and resolving faults early in
the development process.
There are several ways that software inspection can improve software quality:
1. Identifying and resolving defects early: By identifying and resolving defects early
in the development process, inspection can prevent costly rework and delays later in
the project.
2. Enhancing code readability: Inspection can help improve the readability of the code,
making it easier for other developers to understand and maintain.
3. Improving team collaboration: Inspection can help improve team collaboration by
encouraging developers to share their ideas and knowledge.
4. Enhancing code maintainability: Inspection can help identify areas where code is
difficult to maintain and suggest improvements to make it more maintainable.
5. Improving code efficiency: Inspection can help identify areas where code is
inefficient and suggest improvements to make it more efficient.
6. Enhancing security: Inspection can help identify security vulnerabilities in the code
and suggest improvements to make the software more secure.
7. Improving the overall quality of the software: By identifying and resolving defects
early in the development process, inspection can help improve the overall quality of
the software and ensure that it meets the needs of its users.
Disadvantages of Software Inspection:
1. It is a time-consuming process.
2. Software inspection requires discipline.
3. Time-consuming: Software inspection can be time-consuming, especially for large
and complex systems, as it involves a thorough review of the code.
4. Dependence on human interpretation: Software inspection is often dependent on
human interpretation, which can lead to inconsistencies and errors.
5. Can be subject to bias: Reviewers might have their own biases, which can affect their
interpretation of the code and the defects they identify.
6. Limited scope: Software inspection is limited to the code that is reviewed, and may
not identify all defects in the system.
7. Limited to detecting syntax errors: Software inspection is not able to detect all types
of errors, particularly semantic errors, which are caused by incorrect logic or design.
8. Can be costly: Software inspection can be costly, especially if it requires the
involvement of external experts or specialized tools.
9. Can be tedious and demotivating: Reviewing code can be tedious, and constant
reviews can demotivate the team members.
10. Can lead to a lack of creativity: Software inspection can stifle creativity, as developers
may feel constrained by the need to conform to established standards and practices.
Coding Standards and Guidelines
coding standards are given below:
1. Limited use of global:
These rules talk about which types of data that can be declared global and the data
that can’t be.
4. Indentation:
Proper indentation is very important to increase the readability of the code. For
making the code readable, programmers should use White spaces properly. Some of
the spacing conventions are given below:
There must be a space after giving a comma between two function arguments.
Each nested block should be properly indented and spaced.
Proper Indentation should be there at the beginning and at the end of each
block in the program.
All braces should start from a new line and the code following the end of
braces also start from a new line.