Reusable Rules

Reusable Rules

testRigor has a built-in rule called login, which uses credentials stored in the Settings.

You can also create reusable rules. There are two types: for filling forms, and rules containing execution steps. It makes sense to create a reusable rule for frequently performed actions that are the same in multiple test cases.

Example: The first 6 steps of the example below will take you to your checkout page. If you frequently perform this process, create one rule to simulate all of those steps.
login
click "Men Clothing"
scroll down
click "Men's cargo shorts"
click "brown"
click "Size 34"
click "Add to cart"
check that page contains "Your order is nearly complete!"
Then, go to the Reusable Rules section in testRigor, assign the name “go to checkout page” to your rule, and add the first 6 steps above. From then on, you can simply use the syntax below to trigger all 6 steps:
go to checkout page
check page contains "Add to cart"
Upon creating the rule, you will notice three options:
  • Save
  • Save, then Find and Update Name
  • Save, then Find and Replace Steps – will scan for “go to checkout page” throughout your test suite and replace steps with the ones you just created in the rule.

You can also parameterize rules, as well as use rules inside rules.

Auto-apply rules in pre-condition

When creating a reusable rule, there’s a section below the steps called “Fields related to auto-apply rules and auto-discovery.” Open this section and enable “Auto apply on every step of every test case” These rules are never written in test cases. They are added automatically when the preconditions are met. This is to deal with unpredictable situations like ads and popups that appear at random times.

Empty rules for BDD

Just add the rule names in the test case and you will be prompted with creation of an empty rule.

Note: It’s recommended to use standardized language so that everyone on the organization’s team understands it and there is no confusion.

Using test cases as reusable rules for dependencies

You can create a test, put some steps into a rule and use that rule inside a different test case.

Test your knowledge

To apply CSS styles to the page.
To perform frequently executed actions that are identical across multiple test cases.
To access developer features.
To debug failed tests.
execute rule “go to checkout page”
run “go to checkout page”
go to checkout page
activate “go to checkout page”