I'd look into writing decision tables reflecting the rules. If you represent
them in spreadsheets according to Drools, you could generate the rules
from that. But the point is that it's much easier to extract the values for
your test case data from a spreadsheet than from investigating rules in
their internal form or in the XML dump format.

-W



On 2 March 2011 10:38, Dmitri Pissarenko <dmitri.pissarenko@gmail.com> wrote:
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
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users