Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software Testing topic added in topic #762

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
278 changes: 278 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ If you're interested in contributing to this project, please take a moment to re
- [DBMS(Database Management System)](#dbms)
- [Cryptography](#cryptography)
- [Theory of Computation](#theory-of-computation)
- [Software Testing](#software-testing)


## Introduction
Expand Down Expand Up @@ -1072,6 +1073,282 @@ A problem is regarded as inherently difficult if its solution requires significa

Closely related fields in theoretical computer science are the analysis of algorithms and computability theory. A key distinction between the analysis of algorithms and computational complexity theory is that the former is devoted to analyzing the number of resources needed by a particular algorithm to solve a problem, whereas the latter asks a more general question about all possible algorithms that could be used to solve the same problem. More precisely, computational complexity theory tries to classify problems that can or cannot be solved with appropriately restricted resources. In turn, imposing restrictions on the available resources is what distinguishes computational complexity from computability theory: the latter theory asks what kinds of problems can, in principle, be solved algorithmically.

## Software Testing

Software testing is a critical process in software development that ensures the quality and functionality of software applications. It involves evaluating and verifying that a software program or application does what it is supposed to do. The goal is to identify any bugs or issues so they can be fixed before the software is released to users.

## What is Software Testing?

Software testing is the process of executing a program or application with the intent of finding software bugs. It can also be defined as the process of validating and verifying that a software program or application:

- Meets the requirements that guided its design and development
- Works as expected
- Can be implemented with the same characteristics
- Satisfies the needs of stakeholders

## Importance of Software Testing

1. **Quality Assurance**: Ensures that the software is of high quality.
2. **Security**: Identifies vulnerabilities and ensures that data is protected.
3. **Cost-Effective**: Detecting and fixing issues early in the development cycle is cheaper than doing so after release.
4. **Customer Satisfaction**: Delivers a product that meets user expectations and needs.
5. **Performance**: Ensures that the software performs well under various conditions.

## Types of Software Testing

### 1. Manual Testing

Manual testing involves manually executing test cases without using any automation tools. Testers play the role of end-users and use most of the application's features to ensure correct behavior.

### 2. Automated Testing

Automated testing uses specialized tools to execute test cases automatically. This is useful for large projects where manual testing would be time-consuming and less efficient.

## Common Testing Techniques

### 1. Unit Testing

- **Definition**: Tests individual units or components of the software.
- **Purpose**: Ensures that each part of the software performs as expected.
- **Tools**: JUnit, NUnit, TestNG.

### 2. Integration Testing

- **Definition**: Tests the integration of different modules or components of the software.
- **Purpose**: Ensures that integrated modules work together correctly.
- **Tools**: JUnit, NUnit, TestNG.

### 3. System Testing

- **Definition**: Tests the complete and fully integrated software product.
- **Purpose**: Ensures the system meets the specified requirements.
- **Tools**: Selenium, QTP.

### 4. Acceptance Testing

- **Definition**: Conducted to determine if the system satisfies the business requirements.
- **Purpose**: Validates the end-to-end business flow.
- **Tools**: Cucumber, FitNesse.

## Software Testing Life Cycle (STLC)

1. **Requirement Analysis**: Understanding the requirements and identifying the testable aspects.
2. **Test Planning**: Defining the strategy and planning resources.
3. **Test Case Development**: Writing detailed test cases.
4. **Test Environment Setup**: Preparing the environment in which tests will be executed.
5. **Test Execution**: Running the tests.
6. **Test Cycle Closure**: Closing the test cycle and evaluating the results.

## There Are Two Types of Testing That are
1. **WhiteBox Testing**
2. **BlackBox Testing**

## 1.White Box Testing

White box testing, also known as clear box testing, glass box testing, transparent box testing, or code-based testing, is a method of testing software that involves looking into the internal structures or workings of an application. Unlike black box testing, which focuses on the outputs generated in response to selected inputs and execution conditions, white box testing is performed by examining the code and the internal logic of the software.

### Key Concepts of White Box Testing

1. **Code Coverage**:
- White box testing aims to cover as much of the code as possible. This includes paths, branches, statements, and conditions within the code.
- Types of code coverage include:
- **Statement Coverage**: Ensures that each line of source code has been executed and tested.
- **Branch Coverage**: Ensures that every branch (i.e., each possible path) from each decision point is executed.
- **Path Coverage**: Ensures that every possible path through a given part of the code is executed.

2. **Internal Workings**:
- The tester needs to understand the internal implementation of the code, including the control flow, data flow, and how the different parts of the code interact with each other.
- Knowledge of programming languages, code structure, and the application's architecture is essential.

### Techniques of White Box Testing

1. **Unit Testing**:
- Focuses on testing individual functions or methods within the code.
- Usually performed by developers during the development phase.

2. **Integration Testing**:
- Tests the interaction between integrated units or components.
- Ensures that the units or components work together as intended.

3. **Static Analysis**:
- Involves examining the code without executing it.
- Tools can be used to analyze the code for potential errors or code quality issues.

4. **Dynamic Analysis**:
- Involves executing the code and examining its behavior.
- Helps in identifying runtime errors and performance issues.

### Advantages of White Box Testing

1. **Thorough Testing**:
- Since the tester has knowledge of the internal workings, more comprehensive testing is possible, covering more scenarios and edge cases.

2. **Early Bug Detection**:
- Issues can be detected and resolved early in the development cycle, reducing the cost of fixing bugs later.

3. **Optimization**:
- Helps in optimizing the code by identifying inefficient or unnecessary parts of the code.

4. **Security**:
- Allows for thorough security testing by examining the code for vulnerabilities.

### Disadvantages of White Box Testing

1. **Complexity**:
- Requires a deep understanding of the code and the technology stack, which can be complex and time-consuming.

2. **Limited Scope**:
- Focuses on the internal code structure, potentially missing issues related to the overall system behavior and user experience.

3. **Maintenance**:
- Test cases need to be updated with changes in the code, which can add to the maintenance overhead.

### When to Use White Box Testing

- **During Development**:
- White box testing is most effective during the development phase when the internal code structure is accessible and changes can be easily made.

- **For Critical Systems**:
- Systems that require a high level of reliability and security benefit greatly from white box testing.

- **Performance Optimization**:
- When performance is a key requirement, white box testing helps identify and optimize inefficient code.

## 2.Black Box Testing

Black box testing, also known as behavioral testing, is a method of software testing that examines the functionality of an application without peering into its internal structures or workings. This type of testing focuses on the input and output of the software system, ensuring that it behaves as expected according to the requirements.

### Key Concepts of Black Box Testing

1. **Functional Testing**:
- Focuses on testing the functional requirements of the software.
- Verifies that the application performs all intended functions correctly.

2. **Non-Functional Testing**:
- Focuses on testing non-functional aspects such as performance, usability, and reliability.
- Ensures that the application meets specific non-functional criteria.

3. **User Perspective**:
- Black box testing is performed from the user's perspective.
- The tester does not need knowledge of the internal code structure or implementation.

### Techniques of Black Box Testing

1. **Equivalence Partitioning**:
- Divides input data into equivalent partitions that can be tested.
- Assumes that all values within a partition behave similarly.

2. **Boundary Value Analysis**:
- Focuses on testing the boundaries between partitions.
- Identifies edge cases where bugs are more likely to occur.

3. **Decision Table Testing**:
- Uses decision tables to represent and analyze combinations of inputs and their corresponding outputs.
- Helps in testing complex business logic and rules.

4. **State Transition Testing**:
- Tests the software's behavior under various states and transitions between states.
- Useful for applications with a finite number of states and transitions.

5. **Use Case Testing**:
- Based on use cases that describe interactions between users and the software.
- Ensures that the software fulfills its intended use cases.

### Advantages of Black Box Testing

1. **User-Focused**:
- Ensures that the software meets user expectations and requirements.
- Tests the application from the end user's perspective.

2. **No Need for Internal Knowledge**:
- Testers do not need to understand the internal code or logic.
- Allows for independent testing by separate QA teams.

3. **Effective for Large Systems**:
- Suitable for large and complex systems where understanding the internal workings is impractical.

4. **Unbiased Testing**:
- Testers can identify issues without being influenced by the internal implementation.
- Encourages unbiased and objective testing.

### Disadvantages of Black Box Testing

1. **Limited Coverage**:
- May miss internal errors or issues that are not apparent from the external behavior.
- Focuses only on input and output, potentially overlooking underlying problems.

2. **Inefficiency in Identifying Certain Bugs**:
- Less effective in identifying hidden errors or performance issues within the code.
- Requires a large number of test cases to cover all possible scenarios.

3. **Test Case Creation**:
- Creating comprehensive test cases can be challenging without knowledge of the internal code.
- Relies heavily on requirements and specifications, which must be thorough and accurate.

### When to Use Black Box Testing

- **During Acceptance Testing**:
- Ensures that the software meets the specified requirements and is ready for deployment.

- **For User Interface Testing**:
- Validates that the user interface behaves as expected and is user-friendly.

- **For Functional Testing**:
- Verifies that the application performs its intended functions correctly.

## Failures, Errors, and Faults

In software testing, understanding the distinctions between failures, errors, and faults is crucial for identifying and addressing issues effectively. These terms, although often used interchangeably, have specific meanings in the context of software quality and testing.

### Faults (Bugs or Defects)

- **Definition**: A fault, also known as a bug or defect, is an incorrect step, process, or data definition in a software program. It is a flaw in the code or logic that can cause the software to behave unexpectedly or produce incorrect results.
- **Causes**: Faults can arise from various sources, including:
- Mistakes made by developers during coding or design.
- Incomplete or incorrect requirements.
- Miscommunication among team members.
- Lack of understanding of the system's intended functionality.

- **Example**: A developer might write an incorrect formula to calculate the total price, such as using addition instead of multiplication.

### Errors

- **Definition**: An error is a human action or omission that produces an incorrect result. In the context of software, an error typically refers to a discrepancy between the expected and actual behavior of the software during execution.
- **Causes**: Errors can be introduced by:
- Incorrect logic or algorithms.
- Typographical mistakes in the code.
- Incorrect assumptions about how the software should operate.
- Misinterpretation of requirements.

- **Example**: An error occurs when a user inputs invalid data, causing the software to perform an incorrect calculation or crash.

### Failures

- **Definition**: A failure is the manifestation of a fault during the execution of the software. It occurs when the software does not perform as expected or produces incorrect results due to the presence of one or more faults.
- **Causes**: Failures are caused by underlying faults in the software and can be triggered by:
- Specific conditions or inputs that expose the fault.
- Interactions between different parts of the software.
- Changes in the operating environment.

- **Example**: A failure happens when a shopping cart application incorrectly calculates the total price for items due to a fault in the pricing algorithm.

### Relationships Between Faults, Errors, and Failures

1. **Faults Lead to Errors**: Faults in the software code or design cause errors during the execution of the software.
2. **Errors Lead to Failures**: When an error occurs during execution, it can result in a failure if the software does not handle the error properly.
3. **Failures Indicate Faults**: The occurrence of a failure indicates that there is an underlying fault in the software that needs to be identified and corrected.

### Example Scenario

Consider an online banking application:

- **Fault**: A developer accidentally uses the wrong interest rate formula in the code.
- **Error**: When a user requests an interest calculation, the software calculates the interest incorrectly due to the faulty formula.
- **Failure**: The user receives an incorrect interest amount, leading to a failure in the application's functionality.






## Contributors
Expand Down Expand Up @@ -1285,6 +1562,7 @@ Closely related fields in theoretical computer science are the analysis of algor
<td align="center" valign="top" width="16.66%"><a href="http://namberino.github.io"><img src="https://avatars.githubusercontent.com/u/70761157?v=4?s=50" width="50px;" alt="nam"/><br /><sub><b>nam</b></sub></a><br /><a href="https://github.com/shhossain/computer_science/commits?author=namberino" title="Documentation">📖</a></td>
<td align="center" valign="top" width="16.66%"><a href="https://github.com/shaanrxx"><img src="https://avatars.githubusercontent.com/u/62669918?v=4?s=50" width="50px;" alt="Shaan Rehsi"/><br /><sub><b>Shaan Rehsi</b></sub></a><br /><a href="#content-shaanrxx" title="Content">🖋</a></td>
<td align="center" valign="top" width="16.66%"><a href="https://github.com/mjung1"><img src="https://avatars.githubusercontent.com/u/86390269?v=4?s=50" width="50px;" alt="mjung1"/><br /><sub><b>mjung1</b></sub></a><br /><a href="https://github.com/shhossain/computer_science/commits?author=mjung1" title="Documentation">📖</a></td>
<td align="center" valign="top" width="16.66%"><a href="https://github.com/karthi9772"><img src="https://avatars.githubusercontent.com/u/122985751?v=4" width="50px;" alt="karthi G"/><br /><sub><b>karthi9772</b></sub></a><br /><a href="https://github.com/shhossain/computer_science/commits?author=karthi9772" title="Documentation">📖</a></td>
</tr>
</tbody>
</table>
Expand Down
Loading
Loading