Documentation

Documentation

›Advanced

Web Tests

  • How to create Web Tests
  • Finding elements in Web Applications
  • How to execute Web Tests
  • Assertions for Web Tests
  • IF Statements for Web Tests
  • Web Applications with restricted access
  • How to test File Uploads
  • How to test Emails
  • How to test PDF files
  • How to test Chrome Extensions
  • Dealing with reCAPTCHA
  • Execute SQL queries
  • Dealing with Dynamic Locators
  • Dealing with Canvas Elements
  • Performing a Drag and Drop

Mobile Tests

  • How to create Mobile Tests
  • Finding elements in Mobile Applications
  • How to execute Mobile Tests
  • Assertions for Mobile Tests
  • IF Statements for Mobile Tests

Advanced

  • Variables
  • Endtest API
  • Scheduler
  • Drive
  • Adding Collaborators
  • Screenshot Comparison
  • Importing Test Cases
  • Using Loops
  • Data-driven Testing
  • Self-Healing Tests
  • Email Notifications
  • Slack Notifications
  • Webhook Notifications
  • Automatic Backup
  • Advanced Settings

Integrations

  • Slack
  • Jenkins
  • GitHub
  • GitLab
  • TeamCity
  • CircleCI
  • TravisCI
  • Bitbucket
  • Heroku
  • Bamboo Server
  • BrowserStack
  • Sauce Labs
  • Experitest

Variables

Introduction

It's considered a best practice to use variables in your tests.

This helps you avoid situations where you need to update the same value in multiple places.

Declaring variables

You can use the Set Variable action to declare a new variable.

The options from the Set Variable action allow you to enter, extract or even generate values.

All variable names must start with the $ character.

Once declared, a variable can be used across the entire test suite.

If you want to use it in other test suites, you have to import the test case in which the variable was declared.

The following Variable Types are available for Web Tests:

  • Set Value
  • Set Password
  • Random Number
  • Random String
  • Random Email
  • Timestamp
  • Extract value from Element
  • Extract value from JS Variable
  • Extract CSS Selector from Focused Element
  • Extract Result from SQL Query

The following Variable Types are available for Mobile Tests:

  • Set Value
  • Set Password
  • Random Number
  • Random String
  • Random Email
  • Timestamp
  • Extract Value from Element
  • Extract Coordinates from Focused Element

The Variable Types which involve randomness have mandatory inputs for rules which control that randomness.

For example, the Randomn Number option requires users to declare a value for the Length of Number.

And the Random Email option requires users to declare a value for the Email Domain.

You can also declare variables directly in the Endtest API request for starting a new test execution.

Using variables

After you set a variable, you can use it in other steps or cases by simply entering its name in any input.

Simply typing $ inside an input will display a dropdown with the available variables.

You can concatenate variables with strings or with other variables by placing the variable name between double curly brackets:
My name is {{$username}} and my email is {{$email}}

You can also print the variables in the Results by using the Variable or All Variables options from the Print in Results action.

System variables

System variables automatically generated for each Web Test:

  • $systemType
  • $systemPlatform
  • $systemBrowser
  • $systemGeolocation
  • $systemResolution
  • $systemYear
  • $systemMonth
  • $systemDate
  • $systemDay
  • $systemCurrentLoopIteration

System variables automatically generated for each Mobile Test:

  • $systemPlatform
  • $systemDevice
  • $systemYear
  • $systemMonth
  • $systemDate
  • $systemDay
  • $systemCurrentLoopIteration

Transfer variables to JavaScript

You can even transfer a variable to JavaScript, by using the Transfer to JavaScript action.

← IF Statements for Mobile TestsEndtest API →
  • Introduction
  • Declaring variables
  • Using variables
  • System variables
  • Transfer variables to JavaScript
Copyright © 2019 Endtest