Questions tagged [postman-testcase]

283 questions
1
vote
0 answers

Testing API using postman: I want to validate language code in url(href) using postman

I am sending request in multiple language(say en,de) and I have stored res of all href link present in body.I want to validate if href in response has valid language code or not. href appears in response has language code as…
1
vote
1 answer

How to skip particular set of test cases in a collection in terminal using newman?

I am having a postman collection which consists of request and test cases for each requests. I have two test case for each request. one for validating status code and other for validating response time. I need to execute status code test case…
muthu
  • 723
  • 10
  • 27
1
vote
1 answer

Request body variable from JSON not accepting integer values

My sample JSON file for postman runner: [ { "name": "runner", "hitler_id": "4006abc", "year": "2017", "boolean": "false", "expected": 717962 } ] Pre request script: var member = data.name; var booking = data.boolean; var fyyear = data.year; var sid…
1
vote
1 answer

Visualize multi-level response object as Table in Postman

I would like to visualize the data below in Postman Tests as a Table with product, price and quantity in columns and Items in rows. There might be multiple shippingGroups. { ... "companyGroups": [ { ... …
Quang T
  • 15
  • 6
1
vote
2 answers

Postman - Test to Match Number of Objects in Nested Object

I want to write a test to validate the number of objects nested in "children" is equal to what I am expecting. Let's say in this case it is 2. This is the response body I am testing against: { "result": { "line_item": { …
1
vote
1 answer

Check property of a nested element - Postman test

Please assist in getting the property type of a nested element from a JSON response in postman. Below is my response after doing a POST. { "MyList": [ [ { "id": 1, "name": "Test" …
1
vote
1 answer

Parsing nested elements from JSON response using a postman test script

I'm using the following Postman test script to check and log the status of a POST. pm.environment.unset("uuid"); var jsonData = JSON.parse(responseBody); postman.setEnvironmentVariable("uuid", jsonData.id); var base = pm.request.url var url = base…
j8d
  • 446
  • 7
  • 23
1
vote
1 answer

In Postman Test script Can we execute another request in collection

In collection I have 5 requests. In one of a request I want to script in Test tab that after getting a response to execute a request already in the collection. I cant find references/blogs/article for accessing requests in collection. Alternatively…
Siva Sankaran
  • 1,521
  • 4
  • 21
  • 40
1
vote
0 answers

How to use Bcrypt in Postman pre-request script?

CryptoJS doesn't support Bcrypt, what can I do to use Bcrypt in Postman pre-request script?
Vladimir Hidalgo
  • 579
  • 2
  • 8
  • 22
1
vote
0 answers

How To dynamic the Postman Request name from reading the csv?

How To dynamic the Postman Request name from reading the CSV? We have one request in postman collection and we are trying to run with the external data source (CSV) with different scenarios added in that. CSV contains the following fields (Test ID,…
1
vote
0 answers

cant parse reqbody json object when request variable is dynamic

i am working on test unit in postman ( test script ) the request body is : { "sessionKey": {{varsessionKey}}, "project_id": {{varproject_id}} } so i gave them data from json file and in test script :…
1
vote
1 answer

How can I validate JSON array value in postman?

{ "success": { "text": "successfully! deleted Records" } } Want to validate text value is "successfully! deleted Records" I tried with this pm.test("Your test name", function () { var jsonData = pm.response.json(); …
Abhram
  • 49
  • 1
  • 1
  • 6
1
vote
1 answer

Postman: More advanced data driven testing - how should one structure and run tests?

I have a lot of experience writing automated tests suites for APIs in Postman. I have always used data-driven testing and as such have always been a little frustrated with Postmans limitations in this area. When I say data-driven I am trying to…
1
vote
1 answer

"Postman -How to check the typeof any key is 'string' or 'null' at same time"

In given response snippet "parentName" type is sometimes null or sometimes string. How to check/write testcase to check the typeof string as well as null at a time. tests["Verify parentName is string"] = typeof(jsonData.parentName) === "string" ||…
scorpio7
  • 13
  • 1
  • 6
1
vote
1 answer

How to validate the attributes which starts with @ in postman JS tests

I need to validate the value of "@type" attribute in the below response through POSTMAN JS tests.but when am trying to write tests am getting a syntax error(Invalid or unexpected token) JS Test line: var jsonData =…