How to Use Built-in Reusable Rules in testRigor
|
|
testRigor provides several built-in reusable rules for common actions such as logging in, signing up, logging out, and selecting dates. These rules simplify test creation by handling common workflows without requiring you to write every individual step.
In this article, we’ll cover the following built-in rules:
login– Log into an application using configured or stored credentials.sign up– Register a new account with automatically generated credentials.logout– Sign out of an application.pick– Select individual dates or date ranges.
Login
The built-in login rule automatically logs into your application using the credentials configured under Settings → Authentication → App-specific Authentication.
login
Alternatively, you can define the stored values username and password in your Test Data to override the default authentication credentials.
You can also explicitly specify which stored values to use:
login with stored value "newEmail" and stored value "newPassword"
Unlike the signup rule, the login rule does not generate new credentials. It uses the credentials provided to it.
You can also override the default credentials by assigning new values to username and password:
save "[email protected]" as "username" save "SecurePassword123!" as "password" login
Or provide the credentials directly:
login with username "[email protected]" and password "SecurePassword123!"
Signup
The built-in sign up rule automatically generates and saves the following stored values during registration:
Note: The rule first looks for a sign-up button to click, so make sure you’re on a page where the sign-up option is available.
generate unique email and save it as "newEmail"
generate by regex "[a-z0-9]{18}!" and save it as "newPassword"
save "James" as "user_name"
save "Gatsby" as "user_last_name"
These stored values are generated or assigned when the sign up rule executes. Any existing values with the same names will be overwritten.
Reusing Signup Credentials
Once registration is complete, you can reuse the generated credentials in subsequent test steps:
sign up enter stored value "newEmail" into "Email" enter stored value "newPassword" into "Password" click "Sign In"
Alternatively, you can pass these stored values directly to the built-in login rule:
sign up login with stored value "newEmail" and stored value "newPassword"
Logout
The built-in logout rule automatically looks for a logout button and clicks it to sign out of the application.
login with stored value "newEmail" and stored value "newPassword" logout
Dates
testRigor also provides built-in rules for selecting individual dates and date ranges.
pick "mm/dd/yyyy" from "element"
pick dates from "mm/dd/yyyy" to "mm/dd/yyyy"
| Achieve More Than 90% Test Automation | |
| Step by Step Walkthroughs and Help | |
| 14 Day Free Trial, Cancel Anytime |




