How To Fix Common Errors In Postman

How To Fix Common Errors In Postman

In the previous articles on Postman Tutorial, we have covered “How To Generate Advanced HTML Reports, While Using Newman

In this “How To Fix Common Errors In Postman” article, I will be demonstrating how you can implement this concept and get a tight grip over this.

How To Fix Common Errors In Postman

Common Error in Postman 1:

If we have an environment variable as {{url}. We cannot write inside script as pm.sendRequest({{url}}/item/). The syntax {{url}} works only inside the request builder and not in scripts.

Example:

Common Error in Postman 2:

If we want to trigger another request from a pre-request script, we can do it by using postman.setNextRequest

Example:

Common Error in Postman 3:

If we want to compare already saved variables (eg. Username) with values from another API response, we can use a method.

Example:

Common Error in Postman 4:

If we have a script like this:

Sometimes we get the error “ReferenceError: jsonData is not defined” while setting the global variable. To fix this, we need to define jsonData outside the function.

Or we can set the environment or global variable inside the function.

Common Error in Postman 5:

If we want to set a delay while running a collection in Newman, we can use — delay parameter and specify delay in milliseconds.

Common Error in Postman 6:

If Jenkins shows weird characters in the console, it means output is in Unicode format. To fix this, either use View as Plain text option or add following flags: — disable-unicode

Example:

Next steps:

Learn “GUID in Postman” in the next tutorial.

Author Bio: This article is written by Harsha Mittal an ISTQB-CTFL Certified Software Test Engineer having 3.5+ years of experience in Software Testing.

Related posts:

How To Fix Common Errors In Postman

Guest Author SoftwareTestingMaterial This post is written by the above mentioned Guest Author.

Leave a Comment

Share via
Copy link
Powered by Social Snap