Using FlexRule Designer debugger you can:
- Visually track the execution of rules and logic
- Navigate to different rules within your RuleSet during debugging
- Inspect the values and parameters during debugging
- Check the log for your rules execution
You can debug the following rules types using Debugger:
- Natural Language
and so on...
In this section we loaded the Car Insurance using DMN project and then we opened a document named Car Premium.xml.
To access the debugging capability you can use the Toolboar:
Or "Debug" menu:
Debug with JSON Composer
Using this method, makes debugging logic straight forward. The JSON Composer screen appears and allows you to enter values for parameters directly:
To debug any logic using JSON Composer:
- Select and Open the logic
- Press Debug with JSON Composer from Debug menu
- The above screen for your logic will be loaded
- Press OK to start the debugging
Data Feed Provider
Data Feed Provider allows you to connect your data with different methods to the logic for debugging purpose. When your data is ready, you need to provide this to the logic for execution. Using FlexRule Designer, your application does not interact with the logic. Instead, FlexRule Designer allows you to provide data for running and debugging purposes using a screen called Data Feed Provider.
When you have a logic document open and it has the ability to be debugged/run, then you can use the above method to start the debugger.
In the data feed provider screen, there are multiple ways of providing data feed as input to the current logic document:
- Compiled Code
- Procedural Rule
- Data Composer
- Excel Sheet
In this section, we use Data Composer to feed the data in, but if you select other types from the data feeder, the steps are the same. As you select different options on the Data Feed Provider screen, an error message on the bottom left of the screen will guide you if necessary.
Follow the steps below to load prepared data into the Data Feed Provider.
Once you finish the above steps, the Data feed Provider Screen will be in the status shown below:
If you press the OK button, it starts the debugger by passing the input values. You can also see that a Save Template button is enabled. This allows you to save the Data Feed Provider screen for later reuse, so you don't need to go through all of these steps every time you need to run or debug this logic document.
Some engines like Validation and Decision require more information to be executed and debugged rather than only input [parameter]s. These two engines provide more mechanisms with which to interact.
Debugger uses the following method to execute rules:
/// Validates a default object as the main reference to complete a decision logic or validation behaviour
/// <param name="defaultObject"/><param name="logicName"/><param name="inputParameters"/>
/// true if the default object is validated. Otherwise false
public bool Validate(object defaultObject, string logicName, params object inputParameters)
As this contract requires more details, on execution you would need to provide additional information via the data feed provider. Therefore, to provide data using debugger, you need to implement the following interface instead of the simple IRuleFeeder.
/// When the logic is a validation, feeding it during a test requires more information. This interface provides that capability.
public interface IValidationRuleFeeder : IRuleFeeder
/// The object that is going to be validated
/// The logic name to be used on validation
When you are in debug mode, you can step through different parts of the logic and navigate the Yellow Arrow and Highlight by:
- F11 key
- Debug menu
For more detailed information please check the debugging tutorial
The Run Template allows you to associated prepared data that is created using Designer: Data Composer to:
- Execution of a logic
- A Workflow Task (i.e. Human Task, Receive Task...)
Create and Save a Template
To Create a Run Template,
- Put the Logic into Debug and setup the Data Feed Provider screen
- Save Template button will appear
Use the Save and enter a details:
This allows you to save the Data Feed Provider's settings for later reuse.
If you are configuring a Workflow, then you have an option to associate the data to a specific Task (i.e. Human Task, Receive Task, etc.) By saving this Template, the Data Feed Provider Configuration will be reusable in future for running or debugging the logic document.
Logic run template
On FlexRule Designer Toolbar, there is an icon called: Logic Run template:
By clicking on the "Logic Run Template", a new page will appear in which you can choose your created Template. Also, as highlighted on the screenshot below, we can filter all Templates which are related to a current Document:
- Introduction to debugging
- Debugging using Designer
- Debugging using code
- Debugging in Visual Studio
- Inspection Windows
- Debugging Workflow