Extending your script with static test data
Most test plans will depend on some form of static data. Static data is any type of external data that is referenced by your load scripts. Examples include things such as post codes, user logins/passwords. You can upload multiple files for your Flood which are then distributed to each Grid node during execution.
Common use cases are things like static data stored in an external CSV, file attachments to send with a request as a multipart form request or custom scripts included or referenced by your main test plan and the like.
Whenever you create a new Flood, simply drag or click to upload multiple files to your Flood. These will then be retrieved and stored in the same path relative to the test plan itself on each Grid node during execution.
To save you time you can upload supporting files in
.7zcompression formats and we will automatically decompress these on the target file system of the grid nodes.
In most cases you can use files you have upload via a relative path to your test plan. In some cases you may need to specify the absolute path which the prefix will always be
/data/flood/files/on the grid nodes. You can also save and view custom results on the grid during the flood test.
You can upload a CSV file along with your flood test and this will be made available to each node in the grid. The test data API presented in this article is more to help overcome issues such as guaranteeing uniqueness of data or sharing data from a single source across multiple grid nodes.
It is possible to partition your CSVs into files that then become available to specific grid nodes. This is done via system properties Tricentis Flood will set for each node:
- node_index is the ID assigned to nodes and is unique on the grid
- grid_index is the ID assigned to all grids
- thread_id is assigned to the thread per node per grid and is unique on the node.
For example, on a 3 node grid, you would create 3 individual CSV files, one for each node e.g. node0.csv, node1.csv and node2.csv to partition your data. You then upload them all with your test plan and in the CSV Data Set Config just refer to the filename programatically using:
If you run a test on multiple grids, there is an additional property called grid_uuid to indicate which grid specified by UUID the test is being run on.
You can see these properties amongst others being set in your log files e.g.
2016/01/20 01:11:16 INFO - jmeter.util.JMeterUtils: Setting Locale to en_US
2016/01/20 01:11:16 WARN - jmeter.JMeter: Removing JMeter property: threads
2016/01/20 01:11:16 WARN - jmeter.JMeter: Removing JMeter property: rampup
2016/01/20 01:11:16 WARN - jmeter.JMeter: Removing JMeter property: duration
2016/01/20 01:11:16 INFO - jmeter.JMeter: Setting JMeter property: uuid=ANnbWoJQxutUGCT4jd5s8Q
2016/01/20 01:11:16 INFO - jmeter.JMeter: Setting JMeter property: node_index=0
2016/01/20 01:11:16 INFO - jmeter.JMeter: Setting JMeter property: grid_uuid=NKIdcWrrvP2HdctdnatYqw
To get the node index in Selenium, you can use this code:
public static final String HOSTNAME = System.getProperty("node_index");
To get the node index in Gatling, you can use this: