Questions tagged [postman-testcase]

283 questions
0
votes
4 answers

How to get current year in the Postman script

I have a requirement to get current year in the Postman pre-req script. I'm planning to get the current date, then convert the date to string and apply sub-string to get year value I would like to know, is this the right way of doing it, or is there…
0
votes
0 answers

How do we test multiple scenarios for an API using postman?

Using postman we can test individual API's and check its response which I am aware of. However, now in order to test multiple scenarios for an API, are we supposed to create different API requests altogether or pass test data through JSON and run in…
0
votes
0 answers

In postman-test section, can we read excel and fetch the data for validation purpose?

In postman-Tests section, I want to read excel and fetch the data into one variable. Then use that data for response validation purpose. can anyone suggest a possible way to do that?
Jagadeesh
  • 358
  • 5
  • 17
0
votes
2 answers

Validate response in Postman test script

I am inserting data in postman. I want to apply validation from post method in test script. I am new to postman, I am not able to understand. Here is the JSON. { "firstname": "pradeep", "lastname": "tiwari", "mobile_no": 9911844349, "email":…
pradeep
  • 3
  • 5
0
votes
0 answers

Postman.setNextRequest() unable to pass request id

I wrote a script in the test tab to set an access token from the login request. After setting access token I want to call logout API to revoke my session or access token. I have mentioned .setNextRequest("Requestname" i.e logout) and logout request…
0
votes
2 answers

Trying to get two postman.setNextRequest (not chained) or two Actions in Workspace

I’m quite new to postman (and coding) and was trying to find and piece together many snippets of scripts to make it work the way I want. What I want is very simple: I have a list of IDs that I want to make a POST in each of them, get one of the…
0
votes
4 answers

Can we Increment the global variable name inside a for loop like a variable when using Postman

I am trying to parse the response data and getting the values for the "id". Since I am expecting multiple values for the same response I am putting it into an array. Inside a for loop I increment the array with the index set to i. Each of these…
0
votes
2 answers

How to get JSON object from array of JSON objects in postman?

Looked for while on other threads and questions didn't get how to get JSON object in array questions I have already looked at - How to get JSONobject from JSONArray in postman How to get array from JSON Object? what I have tried so far - var…
Dev
  • 2,739
  • 2
  • 21
  • 34
0
votes
4 answers

How to count number of values in array?

I am trying to count the values a json array. I want to count the number of id's in the data array of "sierra" if "beta = b". Hence checking the value of data[].beta against the environment variable ("B") set to value 'b'. The issue here is I do…
Siva
  • 113
  • 1
  • 16
0
votes
1 answer

Postman polling for a limited number of times before failing a test and moving to next request

I am writing a test for an Async GET request. This test needs to retry every 5 seconds for up to 120 seconds before it fails and moves on to the next request. At the moment as a quick fix, I keep retrying without a limiter and that means it would…
0
votes
1 answer

How do I write a Postman test to verify that a request returns '400 Bad Request'?

I need a test case that verifies that a '400 Bad Request' is returned when an API call is made without the required field. (Previously there was a bug where the field was needed, but requests without were being accepted) It's a simple POST call…
kittenchops
  • 180
  • 1
  • 8
0
votes
1 answer

Validating JSON schema in Postman

When using Postman I validate the JSON response like so: tv4.addSchema(globalSchema); const valResult = tv4.validate(data, schema); // schema is an object, which is a subschema from the larger globalSchema which works fine,…
Friso
  • 1,080
  • 6
  • 37
0
votes
1 answer

Set Environment var from headers response

I'm executing a post call which returns a list of headers. One of those headers is called "Bunny-id" and returns a number. (Let's suppose Bunny-id --> 159). I'm trying to take that number and paste it automatically to my environment..Environment var…
Andrea
  • 49
  • 8
0
votes
3 answers

Not able to get value from postman response body

I have an API which has response as below: "message": "Success!", "user": { "id": 17, "first_name_kanji_or_hiragana": "Hiragana", "last_name_kanji_or_hiragana": "Name", "first_name_katakana": null, …
0
votes
1 answer

Postman test never returns "no pass"

I'm trying make a test to my API server and I don't get test result no pass. My code: var data = JSON.parse(responseBody); var days = data["days"]; var total_distance = 0; days.forEach(function(value,index,array){ total_distance =…
Miliow
  • 15
  • 3
1 2 3
18
19