Store Variable

Use cases where store variable can be used

  • When we need to generate a random email address/name/variable for a signup form, then wish to assert that email address later on.

  • Extract the contents value of an element(static or Dynamically generated) and store it in a variable for use in later steps

  • If you want to store the value generated in javascript

In CloudQA, using Store Variable you can store a value and use it anywhere in the text case.

How does it works

1. Add a step name called Store Variable, provide a value using CSS selector you want to store and give a unique name(eg: ordernumber)

Note: No spaces are allowed in the name

2. The store variable can be used directly in a step or script or asserted script

  • Usage in a step:

    • Declared store variable can be used in the same test case. Name of a store variable has to be replaced by values for type fields like textboxes, password, assertions.(Eg: __ordernumber__ )

  • Usage of store variable in script and assertion

    • To use the variable stored, in script use syntax window.cloudqa.variablename in above case it will be window.cloudqa.ordernumber

    • Assertion: Change the assertion type to the script and write a script that returns a value true below code shows an example of how to write the script.

    return (function validate() {
        try {
            //your code and return true if your validation check
            return true;
        } catch {
    return false;


  • Store variable names cannot be duplicate.
  • Store variables have to be declared before using them.

results matching ""

    No results matching ""