Eray Kaya Eray Kaya - 1 year ago 192
ASP.NET (C#) Question

sending dictionary parameter with jmeter to rest service

First of all i am a newbie at jmeter. I searched a lot of documents but unfortunately i did not find to answer for my problem. I have a web api rest service with following sign. I can't send dictionary format parameter.

public Dictionary<string,string> DummyService([FromBody] Dictionary<string,string> parameters)

I used Parameters section and BodyData section but parameters are always null.

enter image description here

How can i achieve that?
Thanx in advance.

Answer Source

I believe you need to pass some form of a JSON Array to your web service, in order to do it:

  1. Switch to Body Data tab
  2. Put your JSON payload there like:

      "Parameters": [
          "Key": "Key1",
          "Value": "Value1"
          "Key": "Key2",
          "Value": "value2"
  3. Most likely you will need to add a HTTP Header Manager to your test plan and configure it to send Content-Type header with the value of application/json
  4. (optional) Consider upgrading to JMeter 3.0, looking into screenshot it seems you're sitting on an older version

    JSON Dictionary

See Testing SOAP/REST Web Services Using JMeter guide for more information on setting up JMeter for API testing

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download