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.