From FlexRule Wiki
Jump to: navigation, search


Using FlexRule Designer debugger you can:

  1. Visually track the execution of rules and logic
  2. Navigate to different rules within your RuleSet during debugging
  3. Inspect the values and parameters during debugging
  4. Check the log for your rules execution

You can debug the following rules types using Debugger:

  • Procedural
  • Validation
  • Flow
  • DRD
  • 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.png Debug: This allows you to debug the currently opened logic and go through it step-by-step by using options on Data Feed Provider

Debug json.png Debug with JSON Composer: Starts debugging with allowing users to visually build structure as input (No need to configure Data Feed Provider)

Media play.png Run: This runs the current opened logic

Media stop red.png Stop: This stops the debugging process

Navigate right.png Next Step: Goes to the next step of logic

Document gear.png Logic Run Template: Opens the screen to Run/Debug a run template

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:

Input JSON Composer.png

To debug any logic using JSON Composer:

  1. Select and Open the logic
  2. Press Debug with JSON Composer from Debug menu
  3. The above screen for your logic will be loaded
  4. Press OK to start the debugging
Bulbgraph.pngWhen JSON Composer is used and Fact Concept is defined for parameters, the concept structure of all parameters will be loaded automatically.

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:

  1. Compiled Code
  2. Procedural Rule
  3. Data Composer
  4. Excel Sheet

Feeding Data

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.

Data Composer

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.

Compiled Code

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:

  1. /// <summary>
  2. /// Validates a default object as the main reference to complete a decision logic or validation behaviour
  3. /// </summary>
  4. /// <param name="defaultObject"/><param name="logicName"/><param name="inputParameters"/>
  5. /// <returns>
  6. /// true if the default object is validated. Otherwise false
  7. /// </returns>
  8. 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.

  1. /// <summary>
  2. /// When the logic is a validation, feeding it during a test requires more information. This interface provides that capability.
  3. /// </summary>
  4. public interface IValidationRuleFeeder : IRuleFeeder
  5. {
  6.   /// <summary>
  7.   /// The object that is going to be validated
  8.   /// </summary>
  9.   object CreateTargetValue();
  11.   /// <summary>
  12.   /// The logic name to be used on validation
  13.   /// </summary>
  14.   string GetLogicName();
  15. }

Step Through

When you are in debug mode, you can step through different parts of the logic and navigate the Yellow Arrow and Highlight by:

  1. Toolbar
  2. F11 key
  3. Debug menu

For more detailed information please check the debugging tutorial

Run Template

The Run Template allows you to associated prepared data that is created using Designer: Data Composer to:

  1. Execution of a logic
  2. 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

DataFeedProvider-Loan Approval.png

Use the Save and enter a details:

Run Template-save.png

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:

Logic Run Template Icon.jpg

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:

Logic Run Template.jpg

Next sections

  1. Introduction to debugging
  2. Debugging using Designer
  3. Debugging using code
  4. Debugging in Visual Studio
  5. Inspection Windows
    1. Parameters window
    2. Watch window
  6. Debugging Workflow