Define an application to override the default runner. It can connect to a data source,
and use a custom display format.
About this task
In Rule Designer,
you create a project to define a custom runner application that overrides the class
ilog.rules.studio.testing.execution.DefaultRunner. The new application connects to
a database and customizes the display of the results. You apply the application in the
Testing Decision Operation run configuration.
Procedure
-
Create a Java™ project with the custom runner application. The class must have a
java
main() method. Define the application as shown in the following
CustomExcelRunner.java example:
package custom;
import java.io.IOException;
import java.util.List;
import com.ibm.rules.cdi.core.service.output.ScenarioResult;
import ilog.rules.studio.testing.execution.DefaultRunner;
import ilog.rules.studio.testing.execution.ExcelFileExecutionConfiguration;
public class CustomExcelRunner {
static class CustomRunner extends DefaultRunner {
public CustomRunner() {
super();
System.out.println("CONNECT");
}
@Override
public void displayResults(ExcelFileExecutionConfiguration executionConfiguration,
List<ScenarioResult> results) {
super.displayResults(executionConfiguration, results);
System.out.println("ADD DISPLAY INFO...");
}
}
public static void main(String[] args) {
try {
CustomRunner runner = new CustomRunner();
ExcelFileExecutionConfiguration executionConfiguration = runner.createConfiguration(args);
runner.run(args, executionConfiguration);
System.exit(0);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
}
}
- Add the required external .jar files to the Java build path in the project.
Examples of external files:
- execusionserver/lib/testingrunner.jar
- execusionserver/lib/jrules-cdi-integration.jar
- Open Run Configurations in the toolbar.
- Select your decision operation under Testing Decision
Operation.
- In the Classpath tab, add the path to the class
CustomExcelRunner.java or its generated .jar file.
- In the Arguments tab, select
custom.CustomExcelRunner as the main class.
If you do not specify
the main class, the default runner application is used.
- Click Run. The results are displayed in the console.