Peer review testing rule

For our DevOps Testing process the job includes a property 'LINES OF CODE', we want to create a rule to evaluate each job submitted and trigger a peer review in our process by setting the variable 'REVIEW NEEDED' to 'TRUE'. This decision is based on a job having more than fifty lines of code.

Let's get started!

Guided rules - add guided rule asset

Open new assets view and click on ADD ASSET button:

Guided rules - add new asset

Select guided rule from list by clicking on GUIDED RULE:

Guided rules - name guided rule

Fill in the pop-up with guided rule name devops-testing-review-rule and click on +OK to create rule:

Guided rules - data objects tab

  • The guided rule editor is now open before you
  • Note the green `+` signs on the right, these open lists of options
  • Switch tabs by clicking on Data Objects tab

Guided rules - reviewing data objects

  • This view is of the available date model objects for use in your rule
  • The JOB object is automatically added, if you have others you can import using +New Item
  • Return to Model tab to start designing guided rule

Guided rules - design WHEN section

Top right green `+` is for the WHEN (condition) section of our rule. Click on this top right green `+` to open pop-up for adding a condition:

Guided rules - condition on a job

The condition (WHEN) need is:
  • There is a Job
  • Assign a variable name $job to Job

Start by selecting Job from menu and click on +OK:

Guided rules - condition is added

The condition has now been added to the WHEN section:

Guided rules - assign a variable name

  • To assign the variable name $job, click on word Job for a pop-up
  • Fill in Variable name as shown and click on Set button:

Guided rules - lines of code constraint

The condition (WHEN) must measure the lines of code being greater than 50:
  • Add constraint by clicking on Job for pop-up
  • Select linesOfCode from top drop down menu to add the field

Guided rules - greater than property

  • Click on drop down menu and select greater than
  • Now we're measuring how linesOfCode property is greater than some number
  • Let's add a determining value to measure for greater than

Guided rules - assign greater than value

  • Click on the pencil icon to open pop-up
  • Click on Literal value to add box with value 0 (ZERO)
  • Change that value to 50

Don't forget to save

Click SAVE, add a comment, and click on SAVE:

Guided rules - design THEN section

Let's design what happens in the THEN section if rule fires. If the lines of code is greater than fifty, peer review set to true:
  • Click on green `+` on right of THEN (action) to open pop-up
  • Select Change field values of $job and click on +OK to add

Guided rules - add a THEN field

Click on pencil icon next to Set value of job to open pop-up and select codeReviewCompleted from drop down menu to add field:

Guided rules - value for review completed

Next we'll be adding a value to set for field 'codeReviewCompleted':

Guided rules - add literal value

  • Click on pencil icon next to codeReviewCompleted
  • In pop-up, select Literal value to add Boolean field

Guided rules - set value to false

  • Set the value of codeReviewCompleted to false
  • This means if false a peer review is required for this job
  • This completes the THEN (action) section of our rule

Don't forget to save

Click SAVE, add a comment, and click on SAVE:

Guided rules - setting rule options

  • The last section is hidden behind (show options...)
  • Click to expand, it's only got a single dialect attribute
  • Click bottom right green '+' for a pop-up to select more options

Guided rules - adding a few options

  • Select Attribute drop down menu and add no-loop
  • Click on the bottom right green '+' again to add ruleflow-group

Guided rules - finalizing rule options

  • The attributes are added to (options) section
  • Click in box to activate option no-loop
  • Type in name of ruleflow-group to be devopsTestingRules

Don't forget to save

Click SAVE, add a comment, and click on SAVE:

The finalized guided rule

Lab completed - results

Click on devops-testing project (use bread crumb menu at the top) and view the domain model assets, this ends lab 4:
Eric D. Schabell
Portfolio Architect Director
Other Red Hat Process Automation Manager Workshops

Red Hat Process Automation Manager Articles

Red Hat Process Automation Manager Demos:

Up next...

Lab 5 - Create a process