How to write a request body test script?

Hi. I am new in the community. I am trying to get a request body assertions or test scripts with the following data:

{
   "login": { 
        "pUserID": "123", 
        "Ppassword": "123" 
   }
}

I want to get the field and the value of the field as assertions.

image

Postman has a Feature/AI assistant called Postbot you can generate test scripts and assertions in it, use it so you can learn how to write test scripts to get the value and assert the fields.

Or go through the Learning Centre which has examples of doing this.

Using the Postbot to generate you tests using AI is a good feature, but you really ought to learn the basics first, otherwise you won’t understand what the code is doing.

1 Like