Mini Case Study - Gnorion/BizVR GitHub Wiki

Mini Case Study

Specification

Suppose we are given these rules by the business:

  1. if color = 'red' and size = 'small' then price is 1
  2. if color = 'green' then price is 2
  3. if color = 'blue' and size = 'large' then price is 3

Decision

image

Decision Table

image

Analysis

Summary

image

Warnings

Attribute size is tested in a rule but is never set in a rule or declared as a decision input. How does it get its value?

Add size as a decision input

image

Missing Rules

        "summary" : "There are 7 missing rules",
        "gaps" : ["color is (=other)", "size is (=other)"],
         "rule" : "if color='red' and size='large' then result not specified"
         "rule" : "if color='red' and size=other then result not specified"
          "rule" : "if color='blue' and size='small' then result not specified"
          "rule" : "if color='blue' and size=other then result not specified"
          "rule" : "if color=other and size='small' then result not specified"
          "rule" : "if color=other and size='large' then result not specified"
          "rule" : "if color=other and size=other then result not specified"

Update the Rules to Cover other

image

Analysis

Now there are only 2 missing rules "rule" : "if color='red' and size='large' then result not specified" "rule" : "if color='blue' and size='small' then result not specified"

Add Rules to Cover these

image So now the table looks like this image

Analysis

Now there are no missing rules image

But what about rule conflicts? "summary" : "ACTION CONFLICT - between R2 DT1 and R7 DT1", "severity" : "warning", "explanation" : "price is set to 2 by R2 and 0 by R7 when color ='green' and size =other",

We can make rule 2 more specific since it really only applies to large and small things

image

Final Analysis

Now everything is good

image

Test Data

The validator also suggested the following 12 test cases that should be run to prove the rules produce the expected results

image