Environment variables

At the start of your flood we will initialize some environment variables and system properties which can be of use when designing your tests.

In addition to the following system properties and environment variables, you can also pass in your own environment variables by uploading a KEY=VALUE format text file called environment (with no file extension) along with your other test assets.

Some further guidelines about syntax and configuration:

  • each line in an env file to be in VAR=VAL format.

  • Lines beginning with # (i.e. comments) are ignored.

  • Blank lines are ignored.

  • There is no special handling of quotation marks.

  • Please do not use special characters such as periods (.) in the variable name.

  • Please do not upload a conf/gatling.conf file in your user files as this will override the node's own configuration and most likely break the reporting plugin (by not specifying the correct writers). If there's something you need in there just let us know.

When providing an environment file, this is loaded into the container's OS environment the same as any system environment variable. So these aren't JVM properties / parameters, rather they are system environment variables. ā€‹

Examples

JMeter Environment Example

In order to retrieve a system environment variable in JMeter you can refer to the variable in your script as follows:

${__P("VARIABLE")}

Gatling Environment Example

In Scala, you are able to refer to the variable as follows:

sys.env.get("VARIABLE")

This will return an Option[String].

Element Environment Example

ENV.VARIABLE

Note that with Element you'll also have to import ENV like this:

import { step, TestSettings, Until, By, Browser, TestData, ENV } from '@flood/element'

Default Flood Environment Variables

The following environment variables will also be set across all tools.

Grid region

FLOOD_GRID_REGION=us-east-1

The canonical AWS region in which the grid is located.

Grid sequence ID

FLOOD_GRID_SEQUENCE_ID=N

The grid's sequential ID expressed as an integer for your account.

Node sequence ID

FLOOD_GRID_NODE_SEQUENCE_ID=N

The grid node's sequential ID expressed as an integer for your account.

Grid index

FLOOD_GRID_INDEX=N

A zero based index to indicate which grid the flood is running on based on the total number of grids the flood is distributed to.

Node index

FLOOD_NODE_INDEX=N

A zero based index to indicate which node of a grid the flood is running on based on the total number of nodes in any particular grid the flood is distributed to.

Flood sequence ID

FLOOD_SEQUENCE_ID=N

The flood's sequential ID expressed as an integer for your account.

Project ID

FLOOD_PROJECT_ID=N

The flood's project ID expressed as an integer for your account.

Thread ID

THREAD_ID=N

For Selenium tests, a one based index to indicate the browser / thread ID, expressed as an integer.

System Properties

The following system properties are set at the start of your test:

-Dgrid_index=N

grid_index is a zero based index to indicate which grid the flood is running on based on the total number of grids the flood is distributed to.

-Dnode_index=N

node_index is a zero based index to indicate which node of a grid the flood is running on based on the total number of nodes in any particular grid the flood is distributed to.

-Dthreads=N

threads is an integer value that corresponds to the threads parameter you set in the Flood user interface.

-Drampup=N

rampup is an integer value that corresponds to the rampup parameter you set in the Flood user interface, expressed as seconds.

-Dduration=N

duration is an integer value that corresponds to the duration parameter you set in the Flood user interface, expressed as seconds.

Note: these same properties are expressed as JMeter properties at run time

e.g. -Jthreads=100