Questions tagged [postman-testcase]

283 questions
3
votes
2 answers

Value of an environment variable is reset to null in Postman

I have a login request that returns a token that gets saved to environment variables via the following script added in Postman - Tests tab: var jsonData = JSON.parse(responseBody); postman.setEnvironmentVariable("token_abc",…
Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
3
votes
1 answer

PostMan UI Shows a Variable with a Strikethrough Text After Test

I run a PostMan query and receive a Bearer Token. The test sets the global variable named BearerToken as such: if (responseBody !== "undefined") { tests["Bearer Token = " + responseBody] = true; pm.globals.set("BearerToken",…
ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
3
votes
1 answer

In postman, how can i run a new test based on whether another test has passed or failed?

I have two tests test A and test B. I want B to run only if A has passed. How can i do that in postman? pm.test("Status code is 200", function() { pm.response.to.have.status(200); }); pm.test("Check if fruits found with this search criteria",…
Rohith R Nair
  • 43
  • 1
  • 10
3
votes
0 answers

How to retrieve final URL in Postman test with Redirect turned on

I wish to test the URL at the end of a series of redirects. With Automatically follow redirects on, this appears not to be possible. I have a number of redirects when my Postman request is made and I would like them to be executed automatically, so…
Matt W
  • 11,753
  • 25
  • 118
  • 215
3
votes
1 answer

Postman test is always passing even though it fails

While running postman Tests, Test case seems to be always passing The response body is provided below. I am trying to fetch id when the name is "Erin" and validate that id is 800. Small piece of code that i wrote is below the response body written…
aak
  • 75
  • 7
3
votes
1 answer

How to Iterate through each JSON key-value pair in Postman

I'm writing tests in POSTMAN against a POST API request by sending JSON body data of the following format: "data": { "name": "Amber Joseph", "dob": "1988-10-13", "addressLine1": "Ap #770-9459 Quis Av.", "state": "WA", …
Muzna Zafar
  • 45
  • 1
  • 6
3
votes
1 answer

How to set and get JSON.parse(request.data) in global variable in postman?

Can anyone let me know how to set and get the 'request.data' into a global variable as I am intended to access the request body of a post request in a subsequent get request later? I tried the below, but this is not…
Avai
  • 41
  • 3
3
votes
0 answers

postman password validation test with recaptcha response

Using postman I'm trying to test the password that inserted in the request by the user and check if its valid(6-14 characters and no spaces).I run post method test via postman with username and password in the body (RAW) and get a response with 403…
3
votes
2 answers

How to get local time of different timezone in Postman?

I want to get local time of Rome time zone. Didn't find any details on how to use moment sandbox built-in library in postman documentation here postman_sandbox_api_reference what I have tried so far var moment =…
Dev
  • 2,739
  • 2
  • 21
  • 34
2
votes
1 answer

How to add Postman test asset error or success message

In the postman I have following test. How to give assertion success or error message. I don't want to give message as console.log("my msg"). Coz console message goes to the console.I want to show the message as in the picture where postman shows…
Masi Boo
  • 635
  • 1
  • 10
  • 24
2
votes
0 answers

Postman datadriven tests

We are doing some assertion checks in Postman. For doing so, we created a collection which is having set of Api's . Now, in order to perform data driven tests , we created a excel file. Here comes an issue when we run the collection through excel .…
2
votes
1 answer

How to get the date/time of response in Postman?

I am testing this public API using postman. When I send a request to this endpoint: POST: https://reqres.in/api/users with the following request body: { "name": "Rose Thompson", "job": "Senior Markets Agent" } I get this as a response: { …
grigyan
  • 71
  • 7
2
votes
1 answer

Postman - Take the last id from response of a Get request and assign it to variable

I have to make a request to an endpoint with a non-existing id. The endpoint with all users returns a user list with the following structure: { "page": 1, "per_page": 10, "total": 100, "total_pages": 1000, "data": [ { …
2
votes
0 answers

Postman Tests: expect on SSL certificate expiry date

Is it possible to use Postman Monitors to check how many days the SSL certificate has left before it reaches its expiration date? When creating a request in Postman it is possible to see a popup called "Network". It contains information such as TLS…
2
votes
1 answer

POSTMAN - how to check response body for a value > 0

I'm fairly new to postman and am struggling to find an answer to the below I have a query that returns data such as the below: { "dailyProcessing":{ "2020-10-01":{ "Database":{ "list0":0, "list1":0, …
KDSP
  • 23
  • 5
1
2
3
18 19