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:
Data Feed Provider
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
Create and Save a Template
As we mentioned in the Feeding Data section, after configuring the Data Feed Provider screen, the Save Template button will be visible. This allows you to save the Data Feed Provider's settings for later reuse. As you can see below, Save Template is enabled:
By clicking on the "Save template" button, the page below will appear. Here you need to insert the Template name:
By saving this Template, the Data Feed Provider Configuration will be reusable in future for running or debugging documents.
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