Debugging a simple Ruleflow in Rule Designer
There are many ways to test our rules, we can use Excel DVS testsuites, decision operations, web services applications like SoapUI and more, but sometimes we need to debug our ruleflow to find a particular bug that is preventing us to continue. When developing a new rule project in Rule Designer we often need to see the output of our rules without having to deploy our solution and see the behavior of the ruleflow to compare the variables values.
In this article I am going to show how to debug a simple ruleflow using a decision operation to test your Rules.
Let’s assume we already have the ruleflow, variables and rules.
- Creating the Decision Operation
- Right click the “deployment” folder in your Rule Project and select New -> Decision Operation.
- Give a proper name, select the Rule Project and select the Ruleflow inside your Rule Project.
- Now open your Decision Operation and you should have one like this:
- Click “Define” or to the “Signature” tab.
- Expand your varible set and drag and drop the corresponding variables to the Input and Output Parameters.
- Tip: Is a good practice to name your input variable with “Request” at the end and “Response” for your output.
- Setting the breakpoints
- There a many places where we can define our breakpoints, it depends on what you need to test and where do you want the flow to stop execution. I will show some examples of places where you can put your breakpoints next.
- Action Rule:
- Decision Table:
- BOM member
- Ruleflow artifacts
- Creating the Debug Configuration
- Navigate to Run -> Debug Configurations… in your Rule Designer top bar.
- Locate the Decision Operation artifact, right click and select New.
- Give a proper name and Browse for your Decision Operation.
- Tip: The checkbox “Stop at first rule statement” guarantees you enter debug mode if you didn’t set any breakpoints.
- Now the most important step is to define the “Parameters and Arguments” for this configuration, select the tab and click “Edit Value”.
- You have to create and return a new object of your Input Parameter class, you can also assign testing values. Click “Function body” and add the proper code. Take a look at my sample:
- Click Apply and Debug.
Now you are in Debug mode, watch your variables and step through your code and rules!
I hope you enjoy this article, as always please feel free to contact me about any question or feedback. Thank you!
- Published in Debug, Decision Operation, Java, Rule Authoring, Rule Designer, Ruleflow