Parametrized Reusable Rules | Bondar Academy
Course: AI-based testing with testRigor
Module: Reusability and Optimization
Instructor: Artem Bondar
Lesson Summary
In this lesson, we explore how to make reusable rules smarter by parametrizing them, enhancing their flexibility in test cases. Creating a Reusable Rule We start by creating a new test case for the login functionality: Navigate to the Login page. Enter [email protected] as the email and welcome as the password. Click the Login button and validate redirection to the dashboard . Defining the Rule The rule is named Fill username and password, and click Login button . Steps include: Enter email and password. Click the Login button. Assert that the header contains playground . Parametrizing the Rule To avoid hard-coding credentials, we can parametrize the rule: fill username with "username" and password with "password" This allows us to pass different credentials when invoking the rule. Using Global Variables We can also utilize global variables like super_username and super_password as parameters in our reusable rules. Example of Form Submission We create a rule for submitting forms that can handle different form layouts: Define a rule called submit form with super user credentials . Parametrize the form name to allow submission of different forms. Summary In summary, we learned how to: Parameterize reusable rules for better reusability. Use global variables as parameters. Adapt rules for different user interfaces. These techniques enhance the efficiency and flexibility of our testing processes.