简体   繁体   中英

JMeter to test java rest Api

How can i pass the json for post method if my json is like:

{
"REQUEST":{"REQUEST_BODY":{"Account_Name":"ak"}}
}

It gives me an error at time of parsing json value

In postman it run properly

In HTTP Request use Body Data tab and of course fill-in Server Name, Port Number, Path and Update Method if needed:

在此处输入图片说明

And under HTTP Request add a Header Manager:

在此处输入图片说明

And add to it required headers:

在此处输入图片说明

Note Content-type might be different for you.

If your request works in Postman you can just record it in JMeter:

  1. Configure JMeter for recording, the fastest way is using JMeter Templates feature

    • From JMeter's main menu choose File - Templates - Recording - Create
    • Expand Workbench - HTTP(S) Test Script Recorder and click "Start
  2. Configure Postman for recording. You can "tell" Postman which proxy server to use (JMeter in your case) via --proxy-server command-line argument

     C:\\Users\\your_user_name\\AppData\\Local\\Postman\\app-xxx\\Postman.exe --proxy-server=localhost:8888
  3. Execute your request in Postman
  4. JMeter will capture the request and store it under Test Plan - Thread Group - Recording Controller

References:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM