How to use the Dynamic Rules Tracer?

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Bizagi Studio user interface explained > Advanced settings > Tools > Dynamic Rules Tracer >

How to use the Dynamic Rules Tracer?

Overview

The Dynamic Rule Tracer (DRT) is embedded in Bizagi Studio, hence it is only available in the Development environment. To use the DRT, open the project in Bizagi Studio. Select the Tools tab at and click Dynamic Rules Tracer:

 

Bizagi Studio tools menu with DRT

 

The Dynamic Rules Tracer uses the OAuth 2.0 protocol to authenticate as a client of the BPM application server. The first time that you open the DRT from Bizagi Studio, Bizagi generates a new set of OAuth 2.0 keys. If you want to edit the keys or generate them again, open the Work Portal and open the OAuth 2.0 Applications option in the Admin menu. Here you find the keys associated with the Dynamic Rules Tracer:

 

OAuth 2.0 keys for the DRT

 

After the OAuth keys are generated the first time, the Dynamic Rules Tracer opens. We suggest you open the Work Portal before the Dynamic Rules Tracer and have the case ready just before the expression you want to trace is executed. When the DRT opens, you can register the case number related to the process where the rule is located. When you click Search, all the expressions on Activity Actions are displayed. Select the rule and click Select:

 

note_pin

The DRT can only trace user or manual tasks. Other automatic tasks such as service or script tasks are not considered.

 

 

Select the case number to trace the rule

 

In the tracer window you see three main areas: Tracing options, Traced expressions and Watchers.

 

Dynamic Rules Tracer interface

 

1.Tracing options are described as follows:

 

Button

Description

Connect

Here you can change the OAuth 2.0 credentials to connect the DRT with the Application Server. If the icon is not active means that the DRT is already connected.

Go to case

Open Work Portal in the case of the current traced rule.

Select rule

If the tracer has not started, you can select another rule to trace.

Start tracer

Start the tracer to capture the expression and inject the code in the DRT.

Stop

Stops the tracer ignoring breakpoints.

Step over

Executes the expression line by line.

Run

Executes the expression until the next breakpoint or the last code line.

 

2.The traced expression’s code as parsed by the DRT. If the expression contains graphic coding modules like If, While or For statements the expression code is parsed in one script.

DRT_8

 

3.Watchers of variables and XPaths: After the DRT starts tracing a rule, not all the variables and XPaths are displayed by default. They are displayed as soon as the line, where the variable is declared or assigned, is executed by the tracer.

 

Before starting the tracer, locate the breakpoints needed in any line number of the expression at the left-hand side, that is not a variable declaration:

 

DRT_9

 

Make sure that the DRT is connected before start tracing the rule. Then click Start tracer:

 

DRT_10

 

A prompt reminds you to trigger the rule in the Work Portal:

 

DRT_11

 

After the rule is executed in the Work Portal, the debugger options are active:

 

DRT_12

 

note_pin

If you start the tracer, and the expression is not triggered in the Work Portal, the rule is not traced in the DRT. Once the DRT starts tracing an expression, the expression cannot be edited.

 

After the DRT initiates rule debugging, it stops at the first defined breakpoint. If there are no breakpoints, the tracer stops at the first variable or Xpath assignment:

 

DRT_13

 

If the variable is an array or object type, you can inspect its content by clicking the options icon located in the value column of the watcher area:

 

DRT_14

 

After the DRT finishes tracing the rule, the case rolls back to its initial state. This means that variables and Xpaths return to their initial state before the DRT traces the rule, and the Scope remains unaffected, as if the rule was never executed. A warning message alerts the user that the tracer is done.

 

Tracing XPaths values

By default, the Dynamic Rule Tracer does not automatically detect Xpaths coded in the expression. If you want to see the values of Xpaths, you must add the Xpath in the watcher area on the right-hand side without diamond brackets < >:

 

DRT_15

 

You can only trace Xpaths if the tracer is started, and the rule triggered in the Work Portal and captured by the Dynamic Rule Tracer.

 

note_pin

Xpath functions are also traceable if the function is wrapped with diamond brackets < >. Like, <sum( )>.  Other functions from other objects like CHelper, or Me, are not traceable by the Dynamic Rule Tracer.

 

Good practices and considerations in rules traced by the Dynamic Rules Tracer

The Dynamic Rules Tracer traces an expression is it is validated correctly in the expression designer. If there are validation errors, the DRT does not trace the rule. Additionally, there are some good practices and considerations to bear in mind when you use the Dynamic Rules Tracer.

1.Always use semicolons at the end of each executable statement:

 

DRT_16

 

Multiple statements separated by semicolons are traceable by the DRT:

 

DRT_17

 

If you declare variables in multiple lines without using semicolon, they are not traceable:

 

DRT_18

 

2.The DRT ignores multiple spaces, for example, these lines are equivalent after the expressions is parsed by the DRT:

 

DRT_19

 

3.The DRT identifies differences in names using capital letters, that is, it is case sensitive. For example, lastName and lastname are recognized as two different variables.

 

4.Always use curly brackets { } in statements. If, While or For statements without these brackets are not traceable:

 

DRT_20

 

5.If you re-declare a variable, this is considered as another variable in the watcher area. When the expression assigns a value to the variable, it is displayed twice in the watcher area:

 

DRT_21

 

6.If the expression has a Switch statement, it is only possible to watch variables and Xpaths after the Switch breaks:

 

DRT_22

 

7.Do not use variables with special characters.

 

Dynamic Rules Tracer executed outside Bizagi Studio

In developing scenarios where a tester needs to trace a rule dynamically without accessing Bizagi Studio, the Dynamic Rules Tracer is also available as an executable at: C:\Program Files\Bizagi\Bizagi Studio\Studio

 

DRT_23

 

When you open the DRT the OAuth 2.0 credentials are required:

 

DRT_24

 

Then, click the Connect button and you can use the DRT as described previously. If the OAuth keys are not generated yet, you must create them in the OAuth 2 Applications option in the Admin menu of the Work Portal. The Grant Type must be All and the Allowed Scope LOGIN:

 

DRT_25

 

Reconnect to other URL

The Dynamic Rules Tracer has the option to reconnect to a different URL. For example, if you set secure sockets to your Work Portal URL (from HTTP to HTTPS), The DRT window shows the actual connection, but if you need to change the URL you can click the Connect button.

 

DRT_29

 

Bizagi warns that the current connection must be disconnected.

 

DRT_30


Last Updated 1/23/2024 5:01:24 PM