Variable

A variable is a named or differently addressable area of ​​memory that can be used to access data. In simple words, a variable is a data store. You can put any value here (for example, a number, a line, or another data type). Variables store certain data that can later be used in the program.

Variable is flexible:

  • it can store information;
  • you can extract information from it, which will not affect the value of the variable itself;
  • new data can be written into it.

How to create a variable in TESTLUM ?

Out of the <web>

You can specify the type and value of variable, that you want to use. There are 6 types of variables:

  • sql
  • expression
  • path
  • file
  • generate
  • constant

Variable with sql query example:

You can create variable from the result of SQL query.

XML
Copy

Variables with constant and expression example:

You can create both constant variables and variables with expressions, as shown in the example above.

XML
Copy

Variable with generate example:

You can create a variable with a specified length and value, using options like alphabetic, alphanumeric, numeric, or randomRegexp.

XML
Copy

Variable from path example:

You can create a variable with a value from the previous 'expected' file, using jpath.

XML
Copy

You can also create a variable with a html from the previous 'expected' file, using jpath and then create variable for URL inside html from this html.

XML
Copy

Variable from file example:

XML
Copy

Inside the <web>

There are 8 types of variables inside the <web>:

  • sql
  • expression
  • path
  • file
  • dom
  • url
  • cookie
  • element

Variable with DOM example:

You can create variable with full DOM of the current page or with DOM of the specific element from the current page.

XML
Copy

Variable wtih URL example:

You can fetch URL of the current page and create variable with it.

XML
Copy

Variable with cookie example:

Also, you can fetch cookie and create variable with it as well.

XML
Copy

Variable with element example:

If element is present on the page, then value of the variable will be 'true'. Otherwise, value will be 'false'.

With 'attribute' you can create a variable from an element attribute.

XML
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard