Parameterizing tests
Author one test, run it for many inputs. How to design parameter names, where they're picked up from, and how to feed values from Run Test arguments or User-Defined instances.
The mechanism behind parameters is covered in Parameters & $placeholders. This page is the practical guide: how to design parameter names, where to put them, and how to feed values in.
Pick parameter names you can read
Mavster doesn't enforce naming conventions, but the test reads better when you do. A few practical rules:
- One concept per name.
emailis good;userInput1is not. - Lowercase or snake_case, consistent across the project.
$email,$plan_id,$amount. Avoid$Emailand$emailin the same test (they're different parameters and the alphabetical parameter list will read confusingly). - No leading digits. Names must start with a letter or underscore —
$1stItemis not a parameter, just literal text. - Escape literals with
$$. WritePrice is $$50to have Mavster substitutePrice is $50.
Where parameters live
Substitution scans:
- The test name.
- Every step's instruction.
- A Scroll step's Until field.
Anything else (mode pickers, run counts, region settings) is not scanned. If you need a parameter to flow somewhere not in this list, route it through the instruction of the relevant step.
Designing a parameterized test
A pattern that works well:
- Author the test with literal values first ("test@example.com", "hunter2"). Get it green.
- Replace the literals with
$placeholders($email,$password). - Confirm Mavster's parameter list shows the names you expect (the editor surfaces these as parameter slots).
- Author a parent test or a User-Defined instance that supplies values via arguments.
Feeding values
Two paths.
Run Test
A Run Test step has an arguments dictionary. Set the values for the called test's parameters and Mavster substitutes them at run time.
Multiple Run Test steps in the same parent test can each supply different arguments, giving you a data-driven matrix:
Step 1: Run Test (signup, Run Count = 1, arguments = email: alice@example.com, plan: free)
Step 2: Run Test (signup, Run Count = 1, arguments = email: bob@example.com, plan: pro)
Step 3: Run Test (signup, Run Count = 1, arguments = email: carol@example.com, plan: enterprise)
User-Defined instance
A User-Defined instance has its own arguments dictionary. Whatever you set on the instance is applied to its embedded steps when the instance runs.
This is the right path when the parameterized sequence is a building block (a "fill the credit-card form" template) rather than a standalone test.
Substitution timing
Values are substituted once, before the test starts running. Changing an argument mid-run has no effect on the in-flight test. Run history and costs stay attributed to the source test, not to a per-call copy.
Common patterns
- Credentials matrix.
$email/$passwordparameters; one parent test calls the samesignintest multiple times with different argument sets. - Localized assertions.
$welcomeTextparameter on a Visual Assert; supply the right localized string per locale via Run Test arguments. - Plan-tier coverage.
$planparameter on a sign-up test; one Run Test per tier in the parent.
