Uploaded by Nishil Dsilva

unit-2 chapter 3 SE

advertisement
UNIT-2
CHAPTER-3 SOFTWARE TESTING STRATEGIES
• Introduction
• Strategic Approach To Software Testing
• Test Strategies For Conventional Software
• Test Strategies For Object-Oriented Software
• Test Strategies For Web apps
• System Testing
• Software Testing Fundamentals
• White-Box Testing
• Black-Box Testing
Introduction:
Software Testing is the process of exercising a program with the specific intent
of finding errors prior to delivery to the end user.
Importance:
Ensures Quality
Customer Satisfaction
Reduce Costs
Improves Reliability
Minimizes Risks
Enhances Performance
Easy Maintenance
Software Testing Strategy:
It is a comprehensive approach to testing that outlines the steps to be
taken during the testing process.
It Includes test planning, test-case design, test execution, and
resultant data collection and evaluation
The goal of a software testing strategies is to ensure that the software
meets quality standards and works as intended.
Characteristics:
To Perform effective testing, a software team should conduct effective
formal technical reviews.
Testing begins at component level and work outward toward the
integration of entire computer based system.
Different testing techniques are appropriate at different points in time.
Testing is conducted by the developer of the software and by an
independent test group.
Testing and debugging are different activities, but debugging must be
accommodated in any testing strategy.
Verification and Validation
Software testing is a part of a broader group of activities called
verification and validation that are involved in software quality
assurance.
Verification(Are the algorithms coded correctly?)
The set of activities that ensure that software correctly implements a
specific function or algorithm.
Validation(Does it meet user requirements?)
The set of activities that ensure that the software that has been built
is meets to customer requirements.
Organizing for Software Testing
Developers aims to prove that their software is error-free and satisfies
customer requirements and completed within schedule time and
budget.
Focusing on completing the project quickly and within budget can lead
to inadequate testing.
To overcome form this problem a separate team is established for
testing and ensuring the software’s quality.
Independent Test Group(ITG)
ITG works independently from the development team and it has own
set of objectives and goals for ensuring that the software is thoroughly
tested and meets customer needs.
Roles and Responsibilities of the ITG:
1. Developing a Test Plan:
How testing will be conducted
What types of tests will be performed
What criteria will be used to determine the software quality standards.
2. Conducting Testing:
Unit testing, Integration testing, system testing, acceptance testing and
regression testing.
They use variety of tools and techniques to identify defects in the software.
3. Reporting Defects:
After identifying the defects, ITG reports them to development team
using defect tracking system.
They provide detail information about each defect including how to
reproduce and what impact it has on software.
4. Coordinating with the Development Team:
ITG work closely with development team to ensure that defects are fixed in
a timely manner.
They provide feedback to improve processes and practices to prevent
defects in future projects.
5. Providing Feedback on Quality:
ITG provide feedback on overall software quality base on testing
results.
They may recommend changes to requirements or design.
Software Testing strategy-Big Picture
Unit testingUnit testing starts at the centre and each unit is
implemented in source code.
Integration testingAn integration testing focuses on the construction
and design of the software.
Validation testingCheck all the requirements like functional,
behavioral and performance requirement are validate against the
construction software.
System testingSystem testing confirms all system elements and
performance are tested entirely
Test Strategies for Conventional Software
It is a traditional software which involves a hierarchical structure and a
specific way of organizing code.
It is Hierarchical and Call-and-Return Software Architecture.
1. Hierarchical architecture :
The Software is organized in hierarchy of modules, With each model
responsible for a specific function . And are arranged in a tree-like
structure with higher-level modules calling lower-level modules to
perform specific tasks.
2. Call-and-return:
The software is organized around the concept of functions or
procedures.
Each function performs a specific task and returns control to the
calling functions when it is complete. This allows for modularization of
code and makes it easier to manage complex system.
Different Strategies of Testing Conventional Software
1. Big Bang Approach:
It Involves waiting until the system is fully constructed before
conducting tests on the overall system.
It can result in buggy software.
2. Continuous Testing:
It involves conducting tests on a daily basis whenever any part of the
system is constructed.
It allows for early detection of errors and can save time and resources.
3. Incremental Testing:
It involves starting with
Unit testing
Integration testing
End-to-end or system–level tests.
Unit Testing:
It focuses on verifying the smallest part of a software program called
as component or module. Or how the component processes
information and stored data.
Goal is to find errors within that part of the program by testing
important control paths using a description of how the component
works.
Limited scope because it only tests a small part of the program at a
time.
This type of testing can be done for multiple components at once
which saves time and resources.
Considerations:
Developers can conduct effective unit testing which helps find errors
early in the development process and easier and less expensive to fix
which leads to better software quality and reliability.
Module Interface:
Test strategy conducted on each module interface to access
the flow of input and output.
Local data structure:
It is accessible to verify integrity during execution.
Boundary conditions are tested.
It refers to limits or restrictions established for processing
within the module and ensures module operates properly
within given boundaries.
Error handling paths are tested.
It refers to how a module handles errors and exceptions
during its execution without crashing or causing other issues
in programs.
An Independent path is tested.
It refers to all possible paths through a module’s control
structure that do not depend on other part of the program.
Steps involved in Unit Test Procedure:
1. Design of Unit Tests:
It is used to verify the functionality of the code.
This can be done before coding begins or after source code
has been generated.
2. Test ases and Expected Results:
Once the tests have been designed, each test case should be
coupled with a set of expected results.
This ensures that any errors or issues are identified early in
the development process
3.Development of Drivers and Stubs:
Stub
Stub is considered as subprogram.
Stub does not accept test case data.
It replace the modules of the program into subprograms and are
tested by the next driver
Driver
It is a simple main program.
Driver accepts test case data
Pass the data to the tested components and print the returned result.
4. Unit Test Environment:
Here Developers can effectively test their code in isolation from other
parts of the program using drivers and stubs as necessary.
And they ensure that code works as expected before integrating it into
Larger systems.
5. Testing process:
Once everything has been setup, developers can begin testing their
code using various inputs and scenarios.
2. Integration Testing
It is the process of testing the interactions between different components or
modules of a software system.
It aims to identify issues that may arise when these components work
together.
Two types are:
Top-Down Integration Testing
Bottom-Up Integration Testing
Top-Down Integration Testing:
It is an incremental approach for building the software architecture.
It starts with the main control module or program.
Modules are merged by moving downward through the control hierarchy.
The integration process is performed in a series of
five steps:
The main control module is used as a test driver and stubs are substituted
for all components directly subordinate to the main control module.
Depending on the integration approach selected (i.e., depth or breadth
first), subordinate stubs are replaced one at a time with actual
components.
Tests are conducted as each component is integrated.
On completion of each set of tests, another stub is replaced with the real
component.
Regression testing may be conducted to ensure that new errors have not
been introduced.
Bottom-Up Integration Testing:
In bottom up integration testing the components are combined
from the lowest level in the program structure.
This Strategy is implemented the following steps:
a) Combine small components into clusters that perform
specific functions.
b) Write the driver program to Test the clusters.
c) Test each clusters to make sure it works properly.
d) Remove the drivers and combine the clusters into larger
ones moving upward in the program structures.
Regression testing
Smoke testing
Regression testing is used to At the time of developing a
check defects generated to
software product smoke
other modules by making the testing is used.
changes in existing programs.
In regression tested
components are tested again
to verify the errors.
Regression testing needs
extra manpower because the
cost of the project increases.
Testers conduct the
regression testing.
It permit the software
development team to test
projects on a regular basis.
Smoke testing does not need
an extra manpower because it
does not affect the cost of
project.
Developer conducts smoke
testing just before releasing
the product.
3. System Testing:
The activities involved in system level testing includes:
a) Test planning involves defining the scope of the system test,
identifying test cases, and creating a test plan.
b) Test case development involves creating detailed test cases that
cover all aspects of the system’s functionality.
c) Test execution involves running the test cases and recording the
results.
d) Defect management involves tracking defects found during testing,
prioritizing them based on severity and working with developers to
resolve them.
e) Reporting involves summarizing the results of testing and
communicating them to stakeholders
Test strategies for Object-Oriented Software
Introduction:
The objective of testing, stated simply, is to find the greatest possible
number of errors with a manageable amount of effort applied over a
realistic time span.
Although this fundamental objective remains unchanged for object-oriented
software.
The nature of object-oriented software changes both testing strategy and
testing tactics (Plan).
Unit Testing in the OO Context
When object-oriented software is considered, the concept of the unit
changes. Encapsulation drives the definition of classes and objects.
This means that each class and each instance of a class packages
attributes (data) and the operations that manipulate these data.
An encapsulated class is usually the focus of unit testing.
However, operations (methods) within the class are the smallest testable
units. Because a class can contain a number of different operations, and a
particular operation may exist as part of a number of different classes.
Class testing for OO software is the equivalent of unit testing for
conventional software.
Unlike unit testing of conventional software, which tends to focus on the
algorithmic detail of a module and the data that flow across the module
interface.
Class testing for OO software is driven by the operations encapsulated
by the class and the state behavior of the class.
Integration Testing in the OO Context :
Different strategies for integration testing of OO systems.
Thread-based testing
Use-based testing
Cluster testing
The first, thread-based testing, integrates the set of classes required to respond to
one input or event for the system.
Each thread is integrated and tested individually.
Regression testing is applied to ensure that no side effects occur.
The second integration approach, use-based testing, begins the construction of
the system by testing those classes (called independent classes) that use very few (if
any) server classes.
After the independent classes are tested, the next layer of classes, called
dependent classes, that use the independent classes are tested.
This sequence of testing layers of dependent classes continues until the entire system
is constructed.
Cluster testing
Cluster testing is one step in the integration testing of OO software.
Here, a cluster of collaborating classes is exercised by designing test cases that
attempt to uncover errors in the collaborations.
Test Strategies for WebApps
The strategy for WebApp testing adopts the basic principles for all software
testing and applies a strategy that are used for object-oriented systems.
The following steps summarize the approach :
The content model for the WebApp is reviewed to uncover errors.
The interface model is reviewed to ensure that all use cases can be
accommodated.
The design model for the WebApp is reviewed to uncover navigation errors.
The user interface is tested to uncover errors in presentation and/or navigation
mechanics.
Each functional component is unit tested.
Navigation throughout the architecture is tested.
The WebApp is implemented in a variety of different environmental
configurations and is tested for compatibility with each configuration.
Security tests are conducted.
Performance tests are conducted.
The WebApp is tested by a controlled and monitored population of end users .
System Testing
1. Recovery Testing
2. Security Testing
3. Stress Testing
4. Performance Testing
5. Deployment Testing
1. Recovery Testing:
It checks whether software can recover properly from unexpected failures or errors.
Developers evaluate weather the software automatically reinitializes, checkpoints data
correctly and restarts without any issues.
If recovery needs Human Intervention developers might evaluate the mean-time-torepair(MTTR) to determine whether it is within acceptable limits.
Example: Intentionally corrupting data within the software and then verifying that it can
be recovered properly. It is to ensure if data corruption occurs during normal use of the
software, It can be recovered without any loss.
2. Security Testing:
It checks whether a system is protected from attackers who might try to hack into it.
Developers evaluate various aspects of system’s security including authentication
mechanisms,access controls,encryption methods, and data protection measures.
Example: Try to hack into website and try to break into system knowing weaknesses,
they might also use tools to find potential weakness.
3. Stress Testing:
It checks how well a system can handle abnormal situations.
The goal i sto find out how much pressure a system can take before it fails.
Situations such as slow response times, errors or crashes.,memory usage or
network traffic.
Example: E-commerce website wants to conduct stress testing to ensure their
website can handle traffic during holiday sales.
4. Performance Testing:
It checks how well a system performs under normal conditions.
The goal is to ensure that system meets the required performance.
Developers checks the system’s response time,throughput and resource
utilization.,CPU Usage,memory usage.
To test tools like load generators are used.
Example:
Mobile application to ensure that it runs smoothly and quikly on different
devices, like how long it takes to load and how well it quickly responds to user
input and handles different types of data.
5. Deployment Testing:
It is known as configuration testing, it checks how well a system performs in
different environments and under different operating systems.
Developers examine all installation procedures and configurations, compatibility
issues with hardware and software components.
To conduct this test they use virtual machines pr cloud-based services to
simulate different environments.
Example:
To deploy new accounting software across multiple locations with different
hardware configurations and checks it works properly.
Characteristics of Testable Software:
1. Operability:
It refers to how well system works and how few bugs it has that could hinder
testing progress.
When a system is designed and implemented iwth quality ,There will be less
errors .
Hoghly operable system is essential for efficient and effective testing.
2. Simplicity:
This refers to three different sorts of simplicity: functional, structural, and coding
simplicity.
Functional- Minimum necessary features
Structural- Modularized architecture
Coding- Coding standards for ease of inspection and maintenance.
Highly simple system is easier to understand, test and maintain.
3. Stability:
It refers to how well the software performs under different conditions over time
without crashing or without producing incorrect results.
4. Observability:
It refers to the ability to observe the system’s behavior during execution,
including inputs, outputs, system states and variables.
5. Controllability:
It refers to the ability to control the software through input combinations and
consistent I/O formats.
6. Decomposability:
It refers to control the scope of testing by building independent modules that can
be tested independently.
7. Understandability:
It refers to ease of understanding the architectural design and dependencies
between internal, external and shared components.
White-Box Testing
Definition:
It tests the codes’s structure and intended flows. or is the type of testing carried
out to test the structure of code.
It is also known as Sructural Testing or Glass Box Testing or Clear or
Transparent Testing.
This testing done by the developers who have knowledge about the code.
Purpose:
It ensure that all aspects of the software application are tested including
Internal Logic
Data Structures
Algorithms.
Characteristics of White-Box Testing
It focuses on internal working of application such as code , architecture and
design.
It test in all possible paths to ensure that every line of code is executed at lest
once during testing, so that errors related to control flo structures such as loops
abd conditional statements are identified and corrected.
It requires technical expertise in software development and coding to be carried
out effectively.
It can be automated using tools such as unit test frameworks or code coverage
which helps in reducing manual testing.
It is used for identifying complex defects.
It can be time consuming because it involves all possible paths through the
software applications.
Control Flow Graph
It is a graphical representation of the control flow or execution flow of program.
It is used to visualize the paths that a program can take during its execution.
It consists of Basic Block or Node and Edge.
Node is the set of statements that are to be executed.
Edge shows the flow of contro; throughout.
It has one entry point and whe execution all statements is carried out and the
control gets to exit.
White-Box Testing Techniques:
1. Statement Coverage:
It involves testing each line of code in the software and executed atleast
once suring testing.
This helps to identify any coding errors such as syntax error, logic errors
etc. that occur at individual statement level.
Testers create test cases that exercise each line of code in the software.
2. Branch Coverage or Decision Coverage:
It involves testing all possible branches or decision points within the code.
It helps to identify issues such as missing or incorrect conditional
statements, infinite loops, and other control flow related errors.
3. Conditional Coverage:
It involves testing all possible outcomes of a boolean expression or
condition within the code are executed atleat once during testing.
It helps to identify issues related to logical flow of the software,
incorrect logical operators.
It ensures all boolean conditions is evaluated to both true and false at
least once.
4. Path Coverage:
It involves testing all the possible paths or sequence of execution
within the code are executed atleast once during testing.
It helps to identify any issues realted to controlflow of the software.
Advantages and Disadvantages of White-Box
Testing
Testing can commence even before the GUI is ready.
As internal functionality is considered, all the possible conditions are
considered and test cases are generated. Hence all the functionalities
are being tested.
It identifies the specific procedure accuracy within the application.
It minutely verifies whether the program can be successfully executed
with other parts of the application.
It identifies error in the hidden code and thus makes debugging
process swift.
It removes extra lines of code which are not required in the program
thereby optimizing the program and increases the efficiency.
As the internal coding of the application is considered while preparing
test cases, it becomes very easy to identify the input and the expected
output data.
It helps in evaluating all the loops and paths.
Thoroughness achieved in white box testing is far more than black
box testing.
Various hidden defects get unearth while conducting clear box
testing.
Disadvantages:
As the internal code of the application has to be considered while
preparing the test cases, skilled testers are required who have
knowledge of programming also. Hence the cost of the resources is
high.
It is not possible for the tester to look into every bit of the code and
identify the hidden errors. This may result in failure of the application.
Sometimes a change in the code may be required and thus all the
scenarios may need to be tested again.
White box testing is an exhaustive method.
It takes time to tester to develop the test cases.
Test cases are a waste if changes in the implementation code are
done frequently.
If the application is large then complete testing through white box
techniques is not feasible.
Black-Box Testing
Definition:
It is testing technique that tests the functionality of a software
application without knowing the internal structure of the code or how it
has been implemented.
It is named a “BlockBox” because tester cannot see inside software.
It was designed to analyze Clients’s requirements, Specifications and
high-level strategies.
Example:
In Search Engines(Google), The user enters text in the browser
then search engine located and retrieves information but the user is
not aware of how Google retrieves information.
Characteristics of Black Box Testing
It focuses on testing software from outside, without the knowledge of
how the internal code works.
It verifies whether the software system meets the functional
requirements specified by the customer or user.
It tests the software system based on its inputs and outputs without
examine the internal working.
This testing method is tested by the testers who have no knowledge of
the programming language.
This testing is based on requirements and specifications provided by
the customer, and test cases are designed to cover all possible
scenarios.
It identify defects or errors that are missed during design and coding
phase.
Testing is performed manually or using automated tools, depending on
the complexity of the software and available resources.
Types of Black-Box Testing
Functional testing This black box testing type is related to the functional
requirements(input,output,operations)of a system; it is done by
software testers.
Non-functional testing This type of black box testing is not related to testing of specific
functionality, but non-functional requirements such as performance,
scalability, usability, reliability and to check how many people can login
into a software simultaneously.
Regression testing Regression Testing is done after code fixes, upgrades or any other
system maintenance to check the new code has not affected the
existing code.
Levels of Black Box Testing
System Testing:
Testing complete and fully integrated software product.
Testing is done by Quality Assurance Team.
2. Integration Testing:
Testing is done by both QA team and developers.
Teams make sure that each individual module then connected to other
modules are still working as expected.
3. User Acceptance Testing(UAT):
This is done by UAT team with the help of QA team.
The business users or end users write their own test cases and
perform tetsing more geared towards user’s perspective.
Black Box Testing Techniques
1. Equivalence Testing:
Testers can divide possible inputs into groups or “partitions”,
of equivalent value.
Each group represents a different test case.
This technique is used to reduce the number of test cases, while still ensuring all
possible scenarios are covered.
For example:
if a system requires a user’s birth date and provides the same response for all
users under the age of 18, and a different response for users over 18, it is
sufficient for testers to check one birth date in the “under 18” group and one
date in the “over 18” group.
2. Boundary Value Analysis(BVA)
It focuses on testing the software system at the boundaries of the
input, where eroors are likely to occur.
This technique is used to ensure that the software system can handle
extreme values of input data and produces expected output.
Example:
A specific field may accept only values between 0 and 99. Testers can
focus on the boundary values (-1, 0, 99 and 100), to see if the system
is accepting and rejecting inputs correctly.
3. Decision Table Testing
It involves creating a table that shows all possible combinations of
inputs and theit corresponding output.
This technique is used for testing complex software systems where
behavior depends on multiple inputs or conditions.
Example:
Suppose we have an appplication that determines whether a
customer is eligible for a credit cars as per age and income.
The customer must be atleat 18 years old.
The customer must have and income atleast 2lakh per year.
Decision table:
Age
Income
Eligibility
<18
Any value
Not Eligible
>=18
<200000
Not Eligible
>=18
>=200000
Eligible
4. State Transition Testing
It test the behavior of the software system as it moves from one state
to another.
Each software is modelled as finite state machine. where each state
represnts a different mode or condition of the system.
This technique is to identify errors related to incorrect handling of
transition between states.
Example
Login mechanism which allows users to authenticate, but after a
specific number of login attempts, transition to a different state,
locking the account.
For a system that locks the account after five failed login attempts, a
test case can check what happens at the sixth login attempt.
5. Error Guessing
This technique involves testing for common mistakes developers
make when building similar systems.
Example:
Testing login page or website
-Entering an incorrect username or password.
-Leaving username or password fields blank.
-Entering username or password that contains spaces.
Advantages
Independence: it is independent of software’s design or
implementation. testers does not require knowledge of programming
language, algorithms etc.
Focus on End-User Perspective: It ensures that the software
system meets their requirements and expectations.
Helps Detect Interface Issues: Such as errors in input/output data
handling or communication with other software system.
Comprehensive Testing: It covers all possible inputs and outputs.
Suitable for Large Systems: Which have complex internal structure
or algorithms
Disadvantages
Limited Coverage: It has limited coverage of internal code making it
difficult to test all possible scenarios.
Incomplete Testing: It may not test all possible paths or states of software
system.
Limited Accuracy: It may not be accurate in detecting defects or errors
that are not related to the input/output interface.
Dependent on Requirements: It dependent on the accuracy and
completeness of the software requirements.
Time Consuming: It requires large number of test cases to cover all
possible inputs and outputs
Black Box Testing Vs White Box Testing
Download