A web app that automatically runs verification tests against a Drools rules package created in Drools Guvnor.
Drools 5.6.0.Final is supported. More details about Drools Guvnor can be found in documentation.
-
Clone the repository:
git clone [email protected]:ailabitmo/drools-tester.git
-
Create MySQL database and configure the connection. Take a look at "Configure database" section below.
-
Compile and package to
.war
file:mvn clean install
-
Find the
.war
file in/target/
folder.
-
Create and configure MySQL. Take a look at "Configure database" section below.
-
Compile the app from source code or download the latest pre-packaged
.war
file. -
Copy the
.war
file in/webapp/
folder in Tomcat 7 -
Create
tests
folder in Tomcat 7's root folder and a folder for each test, e.g.assignment-<test number>
. Example folder structure:/opt/tomcat7/tests/ /opt/tomcat7/assignment-1/ /opt/tomcat7/assignment-2/ ...
-
Run Tomcat 7
By default the application connects to MySQL on localhost
to dt-db
database with dt-user
username and dt-password
password. The all tables are created automatically.
If you want to change the database settings then edit src/main/resources/META-INF/persistence.xml
file and recompile the application.
A verification test is set of files containing one models.json
file and several test<number>.json
files, e.g. test1.json
, test2.json
. Each verification test should be placed in a folder with assignment-<number>
name in the ${CATALINA.HOME}/tests
folder.
Sets requirements to classes and their fields, such the class name, the name and the type of a field. Some supported types: BigDecimal, String, Boolean and etc. More in documentation. An example:
[
{
"className": "Input",
"fields": {
"id": "BigDecimal",
"color": "String"
}
},
{
"className": "Output",
"fields": {
"isTarget": "Boolean"
}
}
]
This file consists of two parts: insertions
and expectations
. The insertions
is a list of instances that are inserted in the working memory, each instance have:
className
- name of the classvariable
- name of the variable that the instance is assigned tovalues
- list of the fields and its values
The expectations
is a list of instances that are expected to be in the working memory at the end of execution.
An example:
{
"insertions": [
{
"className": "Input",
"variable": "input",
"values": {
"constancy": 0.5,
"consistency": 2,
"color": "белый"
}
}
],
"expectations": [
{
"className": "Output",
"values": {
"isTarget": false
}
}
]
}
Maxim Kolchin ([email protected])