tencent cloud

All product documents
Tencent Cloud Observability Platform
Use a Parameter File
Last updated: 2025-03-10 22:20:38
Use a Parameter File
Last updated: 2025-03-10 22:20:38

Upload Parameter File

By uploading a CSV parameter file, you can dynamically reference the test data within for use with variables in your scripts.
This way, when the load generator executes this code concurrently, each request can dynamically fetch each row of data from the CSV file to use as request parameters.
Parameter Definition:
The first line of the default CSV is used as the parameter name. In this mode, when PTS reads data, it will skip the first line.
If you don't use the first line of the CSV file as the parameter name, you can uncheck "First Line as Parameter Name" as shown below, then check the row where the parameter file is located, and a parameter name editing box will expand on the page for you to edit the parameter name yourself.



Parameter Usage:
In the code, you can use the parameter name as the variable name to obtain the variable value.
Each VU takes a row of data from the CSV in sequence with each iteration.
After the last row of data in the csv file is read, it will go back to the first row and continue to read in a loop next time.
Combination and Splitting of Parameter Files :
If the stress test concurrency is high, you can check "split file" to split the large file and distribute it to each load generator for use.
Multiple csv parameter files can be uploaded in one scenario for cross-file parameter combination.
Column names (parameter names) in different csv files need to be globally unique.
If different csv files have different row counts, the one with the larger row count is used as the benchmark by default, and the csv file with fewer rows will be automatically replicated to match the row count of the benchmark file, ensuring that the data for each VU iteration is predictable.

Use Parameter File

Simple Mode Scenario

In simple mode scenarios, you can use parameters from the parameter file in the form of ${}.
Take the following dataset.csv as an example:
MyKey,MyValue
key1,value1
key2,value2
After the upload is complete, it will look as shown below:




Script Mode Scenario

The example code is as follows: Use dataset.get("MyKey") to obtain the parameter value for the parameter name/column name MyKey from the CSV file, which serves as the value in the request body.
import dataset from 'pts/dataset';

export default function () {
const value = dataset.get("MyKey")
//@ts-ignore
const postResponse = http.post("http://httpbin.org/post", {data: value});
console.log(postResponse)
};

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon