how do i fail a test if postman response status code is 500 server error?


I'm trying to set up a test where I make a POST request but getting a 500 Server Error​ (Response Body that I'm seeing is Unexpected 'T' [JSON]; Tests reporting "There was an error in evaluating the test script: SyntaxError: Unexpected token T in JSON at position 0") and so Tests should show Failed for all 5 of my tests. What can i do?

One of my tests isn't even run it looks like: tests["Status code is 201 Created"] = responseCode.code === 201;

Thanks in advance for your help. Tien.


You can check that HTTP code is not 500 with following:

tests["Status code is not 500"] = responseCode.code != 500;

Is this what you're looking for?


Error 500 means either you are sending some invalid JSON in your request body or some issue with your server. Could tell more by looking at the request and response body.

Do you have your test under any if condition? I don't any reason why the test didn't run except if you have any syntax error in test section.


Your test script probably contains invalid JSON. Validate it using a JSON validator.



  • Elastic Beanstalk not loading assets for Ruby on Rails
  • Open Source Java Reporting Framework [closed]
  • BroadcastReceiver on android.net.conn.CONNECTIVITY_CHANGE called multiple times
  • How can I add onKeyPress event to react material-ui textfield?
  • possible to create sql query with table wildcards?
  • Take picture automatically with no user interaction [closed]
  • GBP pound symbol appearing as uknown char in shop
  • Repeating Texture on Model/Mesh
  • Difference between Canvas and Grid to Move, Resize, Rotate UIElements
  • sql server back restore - login failed
  • How can I extend a Retrofit 2.0 Call?
  • Cycle R,G,B vales as HUE?
  • Spring + Tiles2 - put-attribute from model?
  • iOS - open another application that exists on the phone?
  • sec:authorize not being evaluated on spring-boot project
  • Google Apps Script fails to generate image from EmbeddedChartBuilder
  • Adding a click event to a dynamically created html element using angular2
  • Use PHP to Replace HTML with HTML
  • How to get the Owner of the ContextMenu (from Silverlight 4 toolkit)?
  • Modifying native query cannot have named parameter bindings?
  • How to define a custom accuracy in Keras to ignore samples with a particular gold label?
  • Controller or RestController
  • 'Edit' function for forum posts and such
  • Add font awesome icon to custom add to cart button in Woocommerce 3
  • how to read to huge file into buffer
  • JQuery: Infinite input select
  • how do i compare two rows and store the similarities of the two rows in another column
  • JavaScript Regex to Match Boundaries of Words with diacritics
  • Cloud Code: Creating a Parse.File from URL
  • how to run ejabberd with Erlang on Heroku?
  • Terminal run dalvikvm with am.jar
  • How do I add a mouse over tooltip to an Image using .DrawImage()
  • Google App Engine Datastore: Dealing with eventual consistency
  • How to handle div that is created dynamically in a table
  • Google App Engine backend servlet not responding
  • Comma decimal separator is ignored by ASP.NET MVC model binder
  • ssh remote server login script
  • Make checkout phone field optional for specific countries in WooCommerce
  • How to call different template for different category archive page in woocommerce
  • ReferenceError: TextEncoder is not defined