Reputation: 199
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.
Upvotes: 4
Views: 10907
Reputation: 594
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?
Upvotes: 3
Reputation: 1742
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.
Upvotes: 1