# Cause-Effect Graph Testing

## Cause-Effect Graph Testing in SDLC

In this article, I am going to discuss Cause-Effect Graph Testing in SDLC. Please read our previous article where we discussed All Pair Testing. At the end of this article, you will understand the following important pointers which are related to Cause-Effect Graph Testing in SDLC.

1. What is Cause-Effect Graph Testing?
2. What are the Circumstances under which Cause-Effect Graph Testing is used?
3. What are the Processes in this Technique for Generating Test Cases?
4. Notations Used in Cause-Effect Graph Testing
5. Constraints Used in Cause-Effect Graph Testing
6. Example of Cause-Effect Graph Testing
7. What are the Advantages of a Cause-Effect Graph?
8. What are the Disadvantages of a Cause-Effect Graph?
##### What is Cause-Effect Graph Testing?

Cause and Effect The relationship between a specific outcome and all of the variables that affect it is shown graphically using a black box testing approach known as a graph. It is frequently referred to as the fishbone diagram or the Ishikawa diagram because of how it appears and because Kaoru Ishikawa invented it. Cause and Effect A graph is used in a graphing-based technique to illustrate the outcomes of several input condition combinations. To obtain the test cases, the graph is then transformed into a decision table. Cause-effect graphing is used since boundary value analysis and equivalence class partitioning methods do not account for the combination of input conditions. But cause-effect graphing is utilized since it may be necessary to examine some crucial behavior when certain combinations of input conditions are taken into account.

##### What are the Circumstances under which Cause-Effect Graph Testing is used?
• To determine the possible underlying causes the factors that led to a certain impact, issue, or result.
• To connect the system’s interactions with the variables affecting a specific process or consequence.
• Analyze current issues so that immediate corrective action can be performed.
##### What are the Processes in this Technique for Generating Test Cases?
• Specification Division: The specifications are broken down into manageable portions and then transformed into cause-and-effect graphs separately since working with large specifications’ complex cause-and-effect graphs is challenging.
• Identification of Causes and Effects: This entails locating the specifications’ causes (clear input conditions) and effects (output conditions).
• Transforming the Specifications into a Cause-Effect Graph: The specifications are converted into a cause-and-effect graph to create a cause-effect graph, the causes and effects are connected using Boolean expressions. If possible, restrictions are also introduced between causes and consequences.
• Conversion into Decision Table: The cause-effect graph is then transformed into a decision table with a limited number of entries.
• Deriving Test Cases: A test case is created for each column of the decision table.
##### Basic Notations Used in Cause-Effect Graph Testing in SDLC

Here, c stands for causation and e for effect. A cause and an effect are always separated by the following notations:

Identity Function: If e is 1 then c must also be 1. E is 0 if not.

NOT Function: If c=1, e=0. If not, e is 1.

OR Operation: If c1, c2, or c3 are all 1, then e is also 1. E is 0 if not.

AND Function: If c1, c2, and c3 are all 1, then e is also 1. E is 0 if not.

##### Constraints Used in Cause-Effect Graph Testing

Cause-and-effect graphs make use of the following constraints:

Exclusive Constraint: Exclusive constraint, often known as the E-constraint, is a restriction that applies to causes. In other words, c1 and c2 cannot both be 1 at the same time. It specifies that c1 or c2 may equal 1.

I-constraint or Inclusive Constraint: This restriction applies to causes. It says that at least one of c1, c2, and c3 must always be 1, meaning that none of them may be 0 at the same time.

O-constraint or One and Only One Constraint: This restriction applies to causes. It specifies that only one of the values for c1 and c2 can be 1.

Requires Constrained or R-constrained: This restriction applies to causes. It says that c2 must be 1 in order for c1 to be 1. The values of c1 and c2 cannot be equal to 1.

Mask Restriction or M-Restriction: This restriction applies to effects. According to this statement, if effect e1 is 1, effect e2 must be 0.

##### Example of Cause-Effect Graph Testing

A or B should be the character in column 1, and a digit belongs in column 2. The update is made if both columns have the correct values. Message X will be shown if the input for column 1 is wrong, that is, neither A nor B. Message Y will be displayed if the input in column 2 is wrong, that is, if the input is not a digit.

1. The file has to be changed if the character in the first column is either “A” or “B” and the second column ought to include a digit.
2. If the first column’s value is incorrectâ€”that is, if the character is neither A nor Bâ€”then an X will be shown.
3. The message Y will be shown if the value in the second column is wrong (the character is not a number).
 Column 1 Column 2 Correct Value â€“ A or B Correct Value â€“ Any digit Incorrect value â€“ Any character except A or B Incorrect value â€“ Any character except the digit

We will now create a Cause-Effect diagram for the aforementioned circumstance:

Causes include

• C1: A is the character in column 1.
• C2: B is the character in column 1.
• C3 – A digit appears in column 2!

Effects:

• E1: Updated (C1 OR C2) AND C3 in E1.
• E2: Displays Message X (NOT C1 OR C2) in E2.
• E3: Shows the message Y (NOT C3)

Where the logical gates are AND, OR, and NOT.

1. Effect E1 â€“ Update Made: The update made with effect E1 Effect E1 is justified by the statement “(C1 OR C2) AND C3”. Any of C1 or C2 should be true for C1 OR C2. C3 must be true for logic AND C3 (Character in column 2 should be a digit) to hold. In other words, all of C1 and C2 except C3 must be true for effect E1 (Update made) to exist. As seen in the graph, cause C1 and cause C2 are linked together using OR logic, whereas effect E1 is linked using AND logic.
2. Effect E2 – Displays Massage X: “NOT C1 AND NOT C2” signifies that both C1 (the character in column 1 should be A) and C2 (the character in column 1 should be B) should be false in order for effect E2 to exist. In other words, neither A nor B should be the character in column 1 for effect E2 to exist. As can be seen in the graph, the NOT logic links C1 OR C2 to E2.
3. Effect E3 – Displays Massage Y: As “NOT C3” indicates, cause C3 (Character in column 2 is a digit) to be false in order for effect E3 to exist. In other words, the character in column 2 should not be a digit for effect E3 to exist. The graph shows that C3 is connected to impact E3 via NOT logic.

So, this is the cause-and-effect diagram for the scenario. A tester must translate causes and effects into logical propositions before creating a cause-and-effect diagram. Functions are deemed defect-free if they provide output (effect) in accordance with input (cause); otherwise, they are forwarded to the development team for rectification.

##### What are the Advantages of a Cause-Effect Graph?

The cause-effect graph technique in black box testing offers several advantages:

1. Efficiency: By identifying a limited number of inputs and conditions that may potentially result in particular outcomes, it enables efficient test case creation.
2. Coverage: By methodically examining all potential combinations of inputs and conditions, minimizing repetition, and eliminating pointless test cases, it ensures thorough test coverage.
3. Clarity: Testing professionals may more easily spot any gaps or missing situations thanks to the visual portrayal of cause-and-effect linkages that improves clarity and understanding.
4. Maintainability: Updating the cause-effect graph makes it simple to incorporate changes to the system or requirements, which reduces the time and effort needed for test maintenance.
5. Prioritization: Test cases can be ranked in order of importance according to how serious and likely the identified causes and consequences are, which enables the effective distribution of testing resources.
##### What are the Disadvantages of a Cause-Effect Graph?

The cause-effect graph technique in black box testing has a few disadvantages:

1. Complexity: Building a thorough cause-and-effect graph can be difficult and time-consuming. It necessitates careful examination and comprehension of the system’s interactions, which can be difficult with complex systems.
2. Subjectivity: There is some subjectivity involved in the process of determining and ranking causes and effects. The system may be interpreted or understood differently by several testers, which could result in discrepancies in the graph.
3. Limited Scope: Cause-effect diagrams are based on a limited number of causes and effects; therefore, they might not account for all scenarios or input combinations. Potential flaws might go unnoticed because some instances might be overlooked.
4. Maintenance Burden: The cause-effect graph needs to be updated when the system develops or undergoes modifications. For systems that undergo frequent upgrades or updates, this could mean increased maintenance costs.
5. Inaccuracy: Cause-effect graphs give a high-level overview of the system’s relationships and behavior. However, they might not have the accuracy to find particulars or identify precise reasons for errors, which can make troubleshooting and debugging more difficult.

In the next article, I am going to discuss State Transition Testing. Here, in this article, I try to explain Cause Effect Graph Testing in SDLC. I hope you enjoy this Cause Effect Graph Testing article.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}