Questions tagged [postman-testcase]
283 questions
1
vote
1 answer
Postman tests - Assert response is a valid XML
I would like to verify that the response of my webservice is a valid xml.
I know that it can be simply done for json responses using the following snippet:
pm.response.to.be.json;
What about XML ?
pm.test("The body of the response is a valid…

Hassan ALAMI
- 318
- 1
- 5
- 18
1
vote
1 answer
Find creation date for a Postman test-case
Is it possible to find when a Postman test request was created? Does the Postman keep history of changes for a test-case?

georgeliatsos
- 1,168
- 3
- 15
- 34
1
vote
1 answer
Receive Callback request inside Postman automated test
I am trying to write automated tests with Postman. I am new to postman automation world so sorry if the question will seem dumb.
In the api that I need to test when I send a request I immediately receive a response with a transactionID, no matter…

Andranik
- 2,729
- 1
- 29
- 45
1
vote
1 answer
How to use response assertion in postman by using " to.be"?
I am trying to validate the positive and negative test cases using response assertion, but it didn't give me the expected result.
I am trying to confirm the response using "pm.response.to.be.ok" to get the response as "200" an so on as listed in…

DEV QC
- 21
- 4
1
vote
1 answer
Postman - Validate value from Response and print on Console
From below Response, I want to fetch the value of "responseCode" and store temporarily. If a value is 1 then on Console, I want to write "Test PASS". Can anyone share code for this test?
{
"data":{
"transactionId":"$1"
},
…

Kunal Jadav
- 13
- 4
1
vote
1 answer
Why does PostMan always show "too many errors" after 100 lines of code?
Im quite confused about an error message in the PostMan Code-Editor. It becomes visible after 100 lines of code:
e.g.
tests["good test"] = true; //written 100 times
Postman displays a warning marker on line 100:
On mouseover, this error message is…

DieGraueEminenz
- 830
- 2
- 8
- 18
1
vote
1 answer
how to write a test to match for data in array within postman test
I have created a variable called values, this value contains an array below:
var values = ["A","B", "C","D","E","F"]
I want to write a test to match json response data to one of the values in values.
var jsonData = pm.response.json();
pm.test("risk…

Jhanz
- 127
- 3
- 3
- 12
1
vote
1 answer
How to access environmental variables in test field
I want to access environmental variables in tests. For ex. check if values are signed to the correct fields.
I've tried to get variable values different way and the only one working is to set a variable inside the test but then I won't be able to…

Damian Budzinski
- 17
- 1
- 7
1
vote
1 answer
Postman setNextRequest and workflow conditional workflow
I am trying to create a conditional workflow using setNextRequest. This workflow should do subsequent API call only when statuscode of current call is 201
My test looks something like this
var returnData = JSON.parse(responseBody);
tests["status…

Ankit
- 11
- 1
1
vote
1 answer
How to access content of an external csv file in an API request body using postman?
I need to run the test case by reading data from an external CSV data file(By uploading the data file from collection runner). I'm able to read the values of an external CSV file in 'pre-request script' as well as in 'tests'. But facing difficulty…

viz
- 51
- 8
0
votes
1 answer
How to set an accessToken in postman by passing the credentials in newman
I have a pre-request Script in my postmancollections.json file which does the following:
const executedOnce = pm.environment.get('executedOnce');
if(executedOnce == 0)
{
console.log("Getting Access Token");
const tokenUrl =…

Cherylaksh
- 248
- 5
- 20
0
votes
0 answers
How to customize allure report name?
I am running a postman collection using newman and generating the reports using Allure framework. My command looks something like this:
newman run $collection_filename -e $environment_filename -r allure --reporter-allure-export…

Abhinaba Chakraborty
- 3,488
- 2
- 16
- 37
0
votes
0 answers
I failed to send request to sandbox url with proxy in gitlab run, but the same could succeed at local run
my request code is mocha framework, in local run using vs code, just npm run test by manually setting the proxy (export http_proxy=**), it could succeed to get 200 status code,, but the same failed at gitlab runner please advice me on this. your…

Tony8879418
- 11
- 1
0
votes
1 answer
How to expect an test fail if I have a test case not implemented in Postman?
I'm writing API testing using Postman. I plan to write a failed test when I'm not implement the API yet.
I'm writing this at this moment.
pm.test("Not implement yet", function () {
pm.expect(true).to.eql(false);
});
Is there something like this…

Will Huang
- 2,955
- 2
- 37
- 90
0
votes
0 answers
Read Array json file uploaded on runner (Postman)
Currently I'm working with writing test script that can read and compare the values return from api and json file I provided. The problem is that I'm not sure the error is in the script or json file.
error returning : JSONError: Unexpected token u…

Rhowin
- 1
- 1