Using variables while reading request data from file

Issue #142 closed
Former user created an issue

Firstly I want to thank you for the great plug in.

I use Websocket Single Write Sampler in Jmeter Test plan. The request has a field named account that is passed as below:

  "account": "test-account",

I use a file that has the request. When I tried to use a variable acct that is defined at the Test plan level it is causing error. I tried to use it this way in the request file: "account": $acct

The error on the response: "payload":[{"error":"The message has incorrect format or not supported by server. com.fasterxml.jackson.core.JsonParseException: Unrecognized token '$acct': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n at [Source: (StringReader); line: 7, column: 23]"}]}

Could you please suggest if there is a different way I can use the variable. Thank you.

Comments (2)

  1. Peter Doornbosch repo owner

    Hi,

    Are you using the “read request data from file” option? In that case, the value that you enter there should be the file name (path) or a JMeter variable that holds the file name (path). It seems (if i understand your explanation correctly) that you are trying to enter the data-to-be-send in the file name input field, and expecting it to automatically insert the content of the file? This will not work, the (value in) the input field must refer to an existing file.

    Hth.

    Peter

  2. Log in to comment