Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
51 views

Software Testing

This document provides an introduction to software testing and discusses different types of testing including unit testing, black-box testing, and white-box testing. It defines software testing as executing a program under various conditions to assess quality, functionality, and performance. The primary goal is to ensure the software meets requirements and is free of critical issues before deployment. Testing takes place throughout the software development life cycle from validating requirements to integration, system, and user acceptance testing.

Uploaded by

bright.keswani
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Software Testing

This document provides an introduction to software testing and discusses different types of testing including unit testing, black-box testing, and white-box testing. It defines software testing as executing a program under various conditions to assess quality, functionality, and performance. The primary goal is to ensure the software meets requirements and is free of critical issues before deployment. Testing takes place throughout the software development life cycle from validating requirements to integration, system, and user acceptance testing.

Uploaded by

bright.keswani
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Unit – IV

Testing : An Introduction
Unit Testing,
Black-box Testing,
White-Box Testing
Introduction to Testing

Software testing is a crucial process in the field of software


development that aims to identify defects, errors, and
vulnerabilities in a software application.
It involves executing the software under various conditions to
assess its quality, functionality, and performance.
The primary goal of software testing is to ensure that the
software meets the specified requirements, performs as
expected, and is free from critical issues before it is deployed to
users or customers.
Testing is an iterative and systematic process that takes place
throughout the entire software development life cycle.

It starts with the validation of requirements and continues with


testing at different stages of development, such as unit testing,
integration testing, system testing, and user acceptance testing.

Each testing phase targets specific aspects of the software to


identify and rectify potential issues
The importance of software testing lies in the following aspects:

1. Bug Identification: Software testing helps in identifying bugs, errors, and issues in the
code early in the development process. Finding and fixing defects at an early stage reduces
the cost and effort of later bug fixing.
2. Quality Assurance: Testing ensures that the software meets quality standards and
adheres to user expectations and requirements, resulting in a reliable and robust product.
3. Risk Reduction: By evaluating the software under various scenarios, testing helps
mitigate potential risks and prevents failures or breakdowns in critical situations.
4. Customer Satisfaction: High-quality software that undergoes rigorous testing leads to
improved customer satisfaction and trust in the product.
5. Continuous Improvement: Feedback from testing allows developers to continuously
improve the software, enhancing its performance and user experience.
Software testing involves various techniques and methodologies,
such as black-box testing, white-box testing, functional testing,
performance testing, security testing, and usability testing. The
choice of testing techniques depends on the specific goals and
characteristics of the software being developed.

So, software testing is a fundamental and integral part of software


development, ensuring that software applications are reliable,
functional, and perform as expected. It plays a critical role in
delivering high-quality products that meet user requirements and
expectations while minimizing the risk of defects and failures in
production environments.
UNIT TESTING

Unit testing is a software testing technique where individual


units or components of a software application are tested in
isolation to ensure their correctness and functionality. In unit
testing, each unit, which is the smallest testable part of the
software, is tested independently to validate that it works as
intended.
The main objectives of unit testing are:

1. Early Detection of Defects: Unit testing allows developers to identify and fix bugs
and issues in the code early in the development process, which reduces the cost and
effort of later bug fixing.
2. Isolation of Defects: By testing individual units in isolation, unit testing helps to
pinpoint the source of defects more easily, making debugging and troubleshooting
more efficient.
3. Regression Testing: Unit tests act as a safety net when changes are made to the
codebase. By rerunning the unit tests after modifications, developers can quickly
determine if the changes introduced new defects or affected existing functionality.
4. Documentation and Understanding: Unit tests serve as executable documentation,
providing insights into the behavior and usage of individual units. They also help in
understanding the purpose and functionality of the code.
Various characteristics of Unit Testing:

1. Isolation: Each unit test should be independent and not


dependent on external systems or components.
2. Automated: Unit tests are typically automated, enabling
developers to run them frequently during development without
significant manual effort.
3. Fast and Lightweight: Unit tests should be quick to execute,
allowing developers to get immediate feedback on the correctness of
their changes.
Unit Testing Frameworks:

Unit testing is facilitated by various testing frameworks that provide tools and utilities
to write, organize, and execute unit tests. Some popular unit testing frameworks for
different programming languages include:
- JUnit (Java)
- NUnit (C#)
- pytest (Python)
- Mocha (JavaScript)
Unit testing is a fundamental practice in modern software development, especially in
agile methodologies. It is the foundation for ensuring the reliability and
maintainability of software applications by verifying the correctness of individual
code units before they are integrated into the larger system.
BLACK-BOX TESTING
Black-box testing is a software testing technique where the
internal workings and implementation details of the software
are not known to the tester. In this type of testing, the tester
focuses on the software's external behavior, functionality, and
specifications without having access to its source code or design.

The term "black-box" refers to the idea that the software is


treated as a sealed box, and the tester is only concerned with
what goes in and what comes out, without any knowledge of
what happens inside the box.
Characteristics of Black-Box Testing:
1. No Knowledge of Internal Structure: The tester does not have access to the software's
internal code, architecture, or design. The testing is based solely on the software's
external interfaces.
2. Test Cases Based on Requirements: Test cases are designed based on the software's
functional and non-functional requirements. The tester focuses on ensuring that the
software meets its specified behavior and performs according to the expected outcomes.
3. Independent Testing: Black-box testing is typically performed independently of the
development team. Testers may not have a deep understanding of the system's internals,
making it a useful technique for ensuring an unbiased evaluation.
4. Emphasis on User's Perspective: Black-box testing aims to assess the software from the
end-user's perspective, focusing on its usability and correctness from a user's point of
view.
5. Testing Levels: Black-box testing can be performed at various testing levels, such as unit
testing, integration testing, system testing, and acceptance testing.
Black-box testing techniques:
There are various black-box testing techniques that testers can use, including:
- Equivalence Partitioning: Dividing input data into groups to design test cases that
represent each group.
- Boundary Value Analysis: Selecting test cases based on the boundaries of input
ranges to identify issues near the edges of valid ranges.
- Decision Table Testing: Creating tables that map inputs to corresponding actions or
outputs, enabling systematic test case generation.
- State Transition Testing: Focusing on the transitions between different states of the
software to design relevant test scenarios.
- Use Case Testing: Designing test cases based on the different use cases or scenarios
that the software must support.
Benefits of Black-box Testing:
- Tester Independence: Testers do not need knowledge of the software's internal
implementation, making it possible to use non-developer testers.
- Focus on Requirements: Black-box testing ensures that the software meets its
specified requirements and behaves as expected.
- Encourages Comprehensive Testing: Various techniques can help generate test
cases that cover multiple scenarios, increasing test coverage.

Overall, black-box testing is a valuable testing technique to ensure that software


meets user expectations and functions correctly from an external perspective. It
complements other testing methods like white-box testing, which focuses on the
internal code and logic of the software.
WHITE-BOX TESTING
White-box testing, also known as structural testing or clear-box testing, is
a software testing technique that examines the internal structure, design,
and implementation details of the software application. In white-box
testing, the tester has access to the source code, algorithms, and data
structures used in the software and can use this knowledge to design test
cases that exercise specific paths and conditions within the code.
Unlike black-box testing, which focuses on the external behavior of the
software, white-box testing is concerned with validating the correctness of
the code logic, ensuring that all code paths are executed, and verifying
that the code adheres to coding standards and best practices.
Key characteristics of white-box testing:
1. Knowledge of Internal Structure: Testers performing white-box testing have access to the source code
and other internal components of the software, allowing them to understand the system's internals and
make informed testing decisions.
2. Code Coverage: One of the main goals of white-box testing is to achieve high code coverage, ensuring
that all lines of code, branches, and logical conditions are exercised during testing.
3. Test Case Design Based on Code Analysis: Test cases in white-box testing are often designed based on
the code's structure and logic. Techniques such as code inspection, code reviews, and static code analysis
may be used to identify potential areas for testing.
4. Targeted Testing: White-box testing allows testers to focus on specific parts of the code that are more
likely to contain defects or where important functionality is implemented.
5. Integration with Development: White-box testing is often performed by developers or testers who
work closely with the development team. This facilitates collaboration and helps in identifying and fixing
issues early in the development process.
White-box testing Techniques:
There are several white-box testing techniques used to design test cases,
including:
- Statement Coverage: Ensuring that each line of code is executed at least
once during testing.
- Branch Coverage: Verifying that every decision point in the code is
exercised by taking both true and false branches.
- Path Coverage: Ensuring that all possible execution paths through the
code are tested.
- Condition Coverage: Validating that all possible combinations of
conditions in a decision statement are tested.
Benefits of White-box Testing:
- Detailed Analysis: White-box testing allows for a detailed examination of the
software's internals, uncovering potential defects and issues related to the code logic.
- Early Detection of Bugs: White-box testing can help identify and fix bugs early in the
development process, reducing the cost and effort of later bug fixing.
- Code Optimization: White-box testing can provide insights into optimizing the code
for better performance and efficiency.

Overall, white-box testing is a valuable testing technique for verifying the correctness
and quality of the software's internal logic, ensuring that the code functions as
intended and meets the design specifications. It complements other testing methods
like black-box testing, which focuses on the external behavior of the software.
Difference between ERROR, FAULT and FAILURE

Errors - These are actual coding mistakes made by


developers. In addition, there is a difference in output of
software and desired output, is considered as an error.

Fault - When error exists fault occurs. A fault, also known


as a bug, is a result of an error which can cause system to
fail.

Failure - failure is said to be the inability of the system to


perform the desired task. Failure occurs when fault exists
in the system.
Manual Vs Automated Testing
Testing can either be done manually or using an automated testing tool:

Manual - This testing is performed without taking help of automated


testing tools. The software tester prepares test cases for different
sections and levels of the code, executes the tests and reports the
result to the manager. Manual testing is time and resource consuming.
The tester needs to confirm whether or not right test cases are used.
Major portion of testing involves manual testing.

Automated This testing is a testing procedure done with aid of automated


testing tools. The limitations with manual testing can be overcome
using automated test tools.

You might also like