-
Notifications
You must be signed in to change notification settings - Fork 100
Debugging the program rules
A common problem users encounter is how the Program Rules behave differently in the web and in the Android version. This is due to the current misalignment in terms of the RuleEngine.
A quick way of verifying if your current program rules are being affected by this is debugging the App and checking if the Program Rule that is giving you problems behaves as you expect it to.
Connect your device to the computer and launch Android studio on the computer and the training App on your device.
On Android studio launch and attach the debugger:
On the code, search for the class RuleEngine.java and set a breakpoint inside the evaluate function:
!(Visual Studio Code - Breakpoint)[images/vscode_breakpoint.png]
If you now use the application, it should stop whenever it reaches the process of a program rule. This would allow you to inspect the expression (by going deeper in the debugging process) and see if it's behaving as you expect. Check the image below for a quick example of a simplified case. In this case we have stopped the debugging process in a Program Rule which condition we were not sure if it should work or not.
With the debugger stopped at that step we can go by each of the Program Rules and see how they behave by seeing inside them. This combined with the possibility of adding watchers we can see how the Program Rules are evaluated.