Local Variables & Global Variables
How to Use Local Variables in a Test Case in ContextQA
Local variables in ContextQA are temporary placeholders that exist only within a single test case. They let you store values, reuse them in multiple steps, and make your test flexible—all without relying on global settings. Follow these steps to declare and use local variables in your test cases.
Go to the Test Development section and open the test case you want to work with.
Click the Variables button to access local variable settings.
Enter a name for your variable—like `username`—and assign it a value.
Add another variable, for example `password`, and give it its password value.
Click Create to save your new variables.
Go to the test step where you want to use a local variable, then click Edit.
Remove the hardcoded value, select Runtime, and enter the variable name (for example, `username`).
Click Update to apply the change.
Repeat these editing steps for any step that needs the `password` variable—edit the step, remove the static value, pick Runtime, and provide the variable name.
With both the username and password fields now set to use local variables, your test steps are easier to update and maintain. If you need to change a value, just update it under the Variables button. All references throughout the test case will update automatically.
Local variables only work within the test case where you define them—they’re not accessible from other test cases. Using them instead of repeating static values keeps your test cases clean and makes updates faster and more consistent.
Local variables are a smart way to make your test cases dynamic while cutting down on repetitive work. Give them a try to streamline your test development process!
Last updated