Benefits of Testing Tables Individually - Gnorion/BizVR GitHub Wiki

Consider this simplervdecision which has three tables

image

If we examine the tested conditions for the four inputs A,B,C,G we will find that the rules handle the following values

A: < 0, in [0..100], > 100,
B: = 'red', = 'green',
C: < 0, > 0, = 0,
G: < 50, in [50..100], > 100

This means there there are in total 3 x 2 x 3 x 3 = 54 possible combinations we might need to test for in order to be sure the decision can handle every situation.

However if we do our testing on a table by table basis we can reduce this number considerably.

Here are the three decision tables

Table DT1

image

Tested in isolation this table only needs 3 x 2 = 6 test cases

Table DT2

image

Tested in isolation, this table needs 3 x 3 = 9 test cases

Table DT3

image

Tested in isolation, this table appears to need 3 x 5 = 15 test cases

However, if we run the validator it will tell us there are redundancies in this table and it can be simplified to this table

image

Which, if tested in isolation, would require 1 x 3 = 3 test cases

So by testing in isolation we can reduce the number of test cases to the sum of the tests required for each table i.e. 6 + 9 + 3 = 18 test cases

This works because once we have proved that each of the tables DT1,DT2 and DT3 produce the correct results for all their individual possible inputs we do not need to consider every conceivable combination of all of the inputs.

NOTE:

To keep things simple for now we are ignoring any missing rules or contradictory rules We are also choosing a representative value for each condition tested. In the case of a range we test the upper and lower number. You can always add more if you don't trust the execution engine to do the compares correctly.

Test Cases for Table DT1

{"testid": "T1","A": -1,"B": "red"},
{"testid": "T2","A": -1,"B": "green"},
{"testid": "T3","A": 1,"B": "red"},
{"testid": "T4","A": 1,"B": "green"},
{"testid": "T5","A": 101,"B": "red"},
{"testid": "T6","A": 101,"B": "green"}

Customizing the Test Case Generation

If you just want to generate test cases for a single table all you need to do is ensure that the specified inputs for the decision are only the ones tested in that table.

image

An even easier way to do this is simply to bring up the table you want to work with in the editor:

image

And then click the "Validate This Table" button image

This will run the validator logic on only this table and you will only get back the combinations of test cases for this specific table only.

⚠️ **GitHub.com Fallback** ⚠️