Software Testing / Black Box Testing
Cause-Effect Graphing Basics
A tutorial about Cause-Effect Graphing Basics
Section overview
5 resourcesBlack Box Testing is a method of testing where the internal structure/ design/ implementation of the item being tested is not known to the tester.
Cause-Effect Graphing Basics
1. Introduction
This tutorial aims to introduce you to the basics of Cause-Effect Graphing, a structured and systematic approach to generating test cases. It's a black-box testing technique used in system testing and integration testing.
Goals of this Tutorial:
- Understand what cause-effect graphing is and its benefits
- Learn how to create a cause-effect graph
- Translate cause-effect graphs into decision tables
- Understand how to generate test cases from cause-effect graphs
Prerequisites:
- Basic knowledge of software testing concepts
- Understanding of decision tables is beneficial but not mandatory
2. Step-by-Step Guide
What is Cause-Effect Graphing?
Cause-Effect Graphing is a testing technique that visualizes the relationship between different conditions (causes) and their outcomes (effects). The graph is a directed graph with nodes representing causes and effects, and the edges represent the relations between them.
Creating a Cause-Effect Graph
Creating a cause-effect graph involves the following steps:
- Identify and list down all the causes (inputs) and effects (outputs).
- Draw the cause-effect graph using nodes and edges.
- Simplify the graph if necessary by eliminating redundant conditions and effects.
Translating Cause-Effect Graphs into Decision Tables
A decision table is a good way to deal with different combination inputs with their associated outputs for a given system. It's a structured exercise to prepare test cases from a complex nested if-else condition.
- Write down all the causes and effects in a table format.
- Map the relations between causes and effects.
- Verify the table for completeness and correctness.
Generating Test Cases from Cause-Effect Graphs
The final step is to generate the test cases. Each path from cause to effect in the graph represents a potential test case.
3. Code Examples
Since cause-effect graphing is a testing technique, it is more about design and does not directly involve coding. However, understanding how test cases derived from cause-effect graphing would look in code can be beneficial.
Example 1: Simple Login System
# Let's consider a simple login system with two causes: 'valid_username' and 'valid_password'.
# The effect is 'access_granted'.
# Test Case 1: Both username and password are valid
valid_username = True
valid_password = True
if valid_username and valid_password:
access_granted = True
else:
access_granted = False
print(access_granted) # Expected output is True (access is granted)
# Test Case 2: Username is valid, but password is not
valid_username = True
valid_password = False
if valid_username and valid_password:
access_granted = True
else:
access_granted = False
print(access_granted) # Expected output is False (access is not granted)
4. Summary
In this tutorial, we've covered the basics of cause-effect graphing, how to create a cause-effect graph, how to translate it into a decision table, and how to generate test cases from it. We also went through a simple example of how test cases derived from cause-effect graphing would look in code.
5. Practice Exercises
-
Create a cause-effect graph for a system that takes three inputs: a, b, and c. The system outputs True if at least two inputs are True. Generate all possible test cases.
-
Create a cause-effect graph for a system that takes a number as input. The system outputs 'positive' if the number is greater than 0, 'negative' if the number is less than 0, and 'zero' if the number is 0. Generate all possible test cases.
For further practice, try to create cause-effect graphs and generate test cases for more complex systems.
Need Help Implementing This?
We build custom systems, plugins, and scalable infrastructure.
Related topics
Keep learning with adjacent tracks.
Popular tools
Helpful utilities for quick tasks.
Latest articles
Fresh insights from the CodiWiki team.
AI in Drug Discovery: Accelerating Medical Breakthroughs
In the rapidly evolving landscape of healthcare and pharmaceuticals, Artificial Intelligence (AI) in drug dis…
Read articleAI in Retail: Personalized Shopping and Inventory Management
In the rapidly evolving retail landscape, the integration of Artificial Intelligence (AI) is revolutionizing …
Read articleAI in Public Safety: Predictive Policing and Crime Prevention
In the realm of public safety, the integration of Artificial Intelligence (AI) stands as a beacon of innovati…
Read articleAI in Mental Health: Assisting with Therapy and Diagnostics
In the realm of mental health, the integration of Artificial Intelligence (AI) stands as a beacon of hope and…
Read articleAI in Legal Compliance: Ensuring Regulatory Adherence
In an era where technology continually reshapes the boundaries of industries, Artificial Intelligence (AI) in…
Read article