apitestingcurljmeterload

Testign Curl API load testing with Jmeter


How should I test this in jemeter? When I import curl from tool, data not displayed in jemeter.

curl --location --request POST 'https://bruh.uselotus.io/api/track/' \

--header 'X-API-KEY: 6tZu1NaQ.PicT21tPHTHfLrYzoLzbSk2vHhvXt7Hc' \

--header 'Content-Type: application/json' \

--data-raw '{

"batch": [

    {

        "customer_id": "d21b769b-b824-48ad-98f1-99a4ce93eac0",

        "event_name": "task_run3",

        "idempotency_id": "07f92995-8b8f-41ad-afdc-406993b31b75",

        "properties": {

            "run_count": 4000

        },

        "time_created": "2023-03-17T01:16:41.408Z"

    }

]

}'

I import this curl from the tool menu of jmeter, but I am not able to see any provided data in jmeter, how can I do that?


Solution

  • Try putting everything into a single line, you're using some characters which are specific to Unix shell and JMeter doesn't recognize them

    curl --location --request POST 'https://bruh.uselotus.io/api/track/' --header 'X-API-KEY: 6tZu1NaQ.PicT21tPHTHfLrYzoLzbSk2vHhvXt7Hc' --header 'Content-Type: application/json' --data-raw '{"batch":[{"customer_id":"d21b769b-b824-48ad-98f1-99a4ce93eac0","event_name":"task_run3","idempotency_id":"07f92995-8b8f-41ad-afdc-406993b31b75","properties":{"run_count":4000},"time_created":"2023-03-17T01:16:41.408Z"}]}'
    

    Alternatively you can use JMeter's HTTP(S) Test Script Recorder for recording the request, just start JMeter's proxy and make cURL aware of this proxy via -x command-line argument.

    curl -k -x http://localhost:8888 --location --request POST 'https://bruh.uselotus.io/api/track/' --header 'X-API-KEY: 6tZu1NaQ.PicT21tPHTHfLrYzoLzbSk2vHhvXt7Hc' --header 'Content-Type: application/json' --data-raw '{"batch":[{"customer_id":"d21b769b-b824-48ad-98f1-99a4ce93eac0","event_name":"task_run3","idempotency_id":"07f92995-8b8f-41ad-afdc-406993b31b75","properties":{"run_count":4000},"time_created":"2023-03-17T01:16:41.408Z"}]}'