[rules-users] Drools for test case formulation

Dmitri Pissarenko dmitri.pissarenko at gmail.com
Wed Mar 2 04:38:03 EST 2011


Hello!

I am testing a rather complex system, which behaves according to some
business rules (written as semi-formal text).

The goal is to create test cases, which cover as many states of the
system as possible. I want to automate this task in the following way:

1) Formalize the business rules in Drools

2) Then use some mechanism to create a list of all possible situations
(which need to be tested)

For example, I have following business rule package with two rules
(this is only an example, real business rules are much more complex):

global List outErrorCodes;
global Boolean condition1;
global Boolean condition2;
global Boolean condition3;

rule "01"
    when
        eval( condition3 == false);
    then
        outErrorCodes.add("ERROR_CODE1");
end

rule "02"
    when
        eval((condition1 == true) && (condition2 == true));
    then
        outErrorCodes.add("ERROR_CODE2");
end

condition1, condition2 and condition3 are inputs. outErrorCode is the output.

That is, condition1, condition2 and condition3 describe a certain
situation, and outErrorCode describes the expected behaviour of the
system in that particular situation.

I want to create a mechanism, which automatically creates a list of
all possible tuples (condition1, condition2, condition3,
outErrorCodes), based on the logic in the rules. Each tuple represents
a state of the system.

These tuples will then be used as a basis for creating actual test cases.

Is it possible with Drools? If so - how?

Many thanks in advance

Dmitri



More information about the rules-users mailing list