Update test-oracles article with additional details and clarification

Added more details and clarified the types and benefits of Test Oracles. Improved explanation of how Test Oracles work and their importance in software testing
pull/7966/head
Yulia 2 weeks ago committed by GitHub
parent 5ac086036e
commit 3ae5343bad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 47
      src/data/roadmaps/qa/content/test-oracles@Zja25damM2vXMOYCyRZiq.md

@ -1,8 +1,49 @@
# Test Oracles # Test Oracles
A test oracle is a mechanism; different from the program itself that can be used to check the correctness of the program's output for the test cases. Conceptually, we can consider testing a process in which the test cases are given to the test oracle and the program under testing. A **Test Oracle** is a mechanism used to verify the correctness of a system during testing. It helps determine whether a test has passed by comparing the actual output of the system with the expected result.
Visit the following resources to learn more: ## **How it Works:**
- [@article@What are Test Oracles](https://ecomputernotes.com/software-engineering/what-are-test-oracles) A test oracle works by providing a standard to compare the system's output against. The goal is to determine whether the system is functioning correctly by verifying that its output aligns with the expected results.
Test Oracles can take several forms:
1. **A separate program** — A program distinct from the system under test that generates the same result when provided with the same input.
2. **Documentation** — Specific correct outputs are provided for given inputs in the form of manuals or requirement specifications.
3. **An algorithm** — A documented algorithm that a person could use to compute correct outputs for given inputs.
4. **A human domain expert** — Someone who can visually inspect the output and determine its correctness.
5. **Other methods** — Any other way of validating the correctness of output, such as comparing results with known benchmarks.
## **Types of Test Oracles:**
Test Oracles are categorized based on how the expected outcome is defined:
1. **Explicit Test Oracles**
These are clearly defined expectations that are explicitly outlined in documentation, such as specifications or user stories. For example, a requirement might specify, "The login page must display an error message for invalid credentials." This serves as an explicit oracle because the expected result is well defined in advance.
2. **Implicit Test Oracles**
When explicit oracles are not available, testers rely on their experience, intuition, or industry norms to predict the expected result. Implicit oracles are more subjective and may vary between testers. For instance, if no specification is provided for a login feature, an experienced tester might predict that the system should display a general error message if the login fails.
3. **Derived Test Oracles**
These oracles are derived from the system's logic, mathematical computations, or algorithms. For example, if the system is meant to calculate the total of a shopping cart, a derived oracle could be the sum of the items' prices. This oracle is based on the system's internal logic and the data being processed.
## **Benefits of Test Oracles:**
1. **Objective Evaluation:**
Test Oracles provide an objective standard for determining whether a test case has succeeded or failed. Without an oracle, testers may rely on subjective judgments, leading to inconsistent outcomes. By defining clear expectations, oracles ensure that tests are evaluated consistently and accurately.
2. **Early Detection of Defects:**
By defining expected results in advance, Test Oracles help identify defects early in the development process. Any deviation between the actual output and the expected result signals a potential bug, allowing testers to catch issues sooner rather than later in the development cycle.
3. **Enhanced Communication:**
Explicit Test Oracles improve communication between stakeholders, such as developers, testers, and business analysts, ensuring that there is a shared understanding of the software's intended behavior. This alignment reduces misunderstandings and helps ensure that everyone is on the same page regarding the software's functionality.
4. **Quality Assurance:**
Test Oracles are crucial in ensuring that the software meets its intended purpose. They validate that the system behaves as expected, adhering to requirements and specifications. This process is essential for maintaining high-quality standards in software development.
## **Conclusion:**
Test Oracles play a vital role in software testing by providing a reliable way to verify the correctness of the system under test. Whether explicit, implicit, or derived, oracles ensure that testers can objectively determine whether the system is functioning as expected. They help in early detection of defects, improve communication among team members, and provide a critical layer of quality assurance. By leveraging Test Oracles, teams can maintain high standards of quality and increase confidence in the software being developed.
- [@article@Test Oracles and Heuristic Test Strategies in Software Testing](https://www.linkedin.com/pulse/test-oracles-heuristic-strategies-software-testing-terrificminds-htn2c/)
- [@video@Test Oracle in Software Testing](https://www.youtube.com/watch?v=DR22zNNetp0&t=1s) - [@video@Test Oracle in Software Testing](https://www.youtube.com/watch?v=DR22zNNetp0&t=1s)

Loading…
Cancel
Save