In Jmeter, What would be syntax of parameters in Body Data section of HTTP Request Sampler, if I am using Rest APIs and taking input from CSV files?

后端 未结 2 1953
没有蜡笔的小新
没有蜡笔的小新 2020-12-28 15:24

I am trying to create 10 users at the same time in Jmeter, using REST APIs.

Test Data i.e. input is taken from CSV files (The details of users like user name, last na

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 16:07

    If your CSV file looks like:

    9998885551,john25,azp25@gmail.com,ricky25,9820420420
    9998885552,john26,azp26@gmail.com,ricky26,9820420421
    ....
    

    Configuration should be the following:

    • Filename: full path to your source .csv file
    • Variable Names: phone,lastname,email,firstname,mobile
    • Delimiter: ,

    Populate other values according to your test scenario i.e. whether you want test to stop on .csv file end or re-spin or whatever.

    CSV Config

    And your HTTP Request should look like:

    Using CSV Variables in HTTP Request

    The main point is that variables defined in the CSV Data Set Config need to match the ones in the HTTP Request.

    See Using CSV DATA SET CONFIG guide for detailed instructions.

    I would also recommend adding the following entry to your HTTP Header Manager:

    • Name: Content-Type
    • Value: application/json

    elsewise your request will be treated like plain text and may fail.

    Also don't forget to disable View Results Tree listener for actual load test run as it consumes a lot of resources and may lead to out-of-memory errors on JMeter side.

提交回复
热议问题