1 Reply Latest reply on Jun 4, 2014 4:19 PM by gadon

    JUnit Testing Framework is needed for testing Drools Business Rules

    jrajput82

      Hi All,

       

             I have been working with drools 5.1 for almost 2 years for now. And I realized that we should have a very good,configurable and extensible JUnit testing framework for testing the rules written by developers.I had this idea in my mind for quite a sometime.

      So the idea goes as below-

       

      1. We should have a parametrized testcase(introduced in Junit 4) which will read the XMLs/JSONs templates from given directory and then we will also have a properties files in certain directory containing the various test scenarios i.e. Test Data(may be XML/JSON template name and input data) + Assertions to be done.

      2. These XMLs/JSONs would be nothing but representation of your Fact objects.

      3. These XMLs/JSONs would be parsed into java fact objects using XML/JSON parser with the input data provided in property file.

      4. The fact object created from XML/JSON template + input data, will be passed to Rules Engine, which will enrich the Fact object.

      5. Then we will fire the assertions for given test scenario using assertions configured in property file for that scenario.

          So this will essentially be a framework that will allow us to test all the rules written by a developer using JUnits.


      I want to create a framework in which developer, will specify is Fact object from which we will create XML/JSON template and Sample Test Scenario Props file.Based on that, he just need to add his test scenarios in forms of property file containing input data and assertions.

      When developer will run the JUNIT all business rules will be tested by JUNIT Rules Framework.


             Please let me know your thoughts/ideas on this.