0
votes

I have a back end application (only back end) which sends data to customers by WebSocket. I testing this application using JMeter. In Jmeter I added plugin WebSocket Sampler by Peter.. Previously I am sending this data to customers by Postman. In my Json file incluge data about event, in which customers can subscribe. I have one question: How can I do it, that data, which is send in postman (in json file) will be send in JMeter?

Is it correctly way to read my json file in Jmeter? If not: Why not and how I can improve this?

  1. How I can the best to process data - to variable from my json file?
3
anyone help me?JuniorDev

3 Answers

0
votes

There is __FileToString() function, you can kill two birds with one with it, to wit:

  1. Read a file from the file system
  2. Store file contents into a JMeter Variable

For example the following expression:

${__FileToString(file.json,,myVar)}

will read file.json from JMeter's "bin" folder and store its contents into ${myVar} JMeter Variable:

enter image description here


If you have multiple JSON files and want multiple JMeter threads to send different files - the easiest way is going for Directory Listing Config plugin (can be installed using JMeter Plugins Manager)

enter image description here

0
votes

in attachmnent I show, what I set this

enter image description here enter image description here what is wrong and how is the easiest way to improve this? I'm not understand exactly, how I can add ${__FileToString(file.json,,myVar)} and variable myVar, and how exactly must be set FileToString and myVar in Thread group, as what of type test plan? how improve exactly?

0
votes

OK I set this, and in View Result Three in ERR in Response Body is correctly return body json, so I dont know, why is **ERR* name It is correctly? and if not, why is wrong and how I can improve this?