responseTime and responseBody result in "ReferenceError in test-script" when timed out
See original GitHub issue(Newman 3.2.0, node 6.9.1, win 10)
Even if Tests
contains any of these, the tests will throw ReferenceError in test-script
when timed out.
tests[`WTF!!`] = responseBody || false;
tests[`WTF!!`] = responseBody != null;
tests[`WTF!!`] = responseBody ? true : false;
if (!responseBody) {
// xxx
}
Same is true for responseTime
“Thanks” to this, my boss thought I didn’t write any assertions…
For now, I use this to work around it.
But it will be much better to have a better official html report template. : )
tests[`server does return something before timeout`] = postman.getResponseHeader('Content-Type') || false;
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Test script examples - Postman Learning Center
Your tests can check various aspects of a request response, including the body, status codes, headers, cookies, response times, and more. Testing response...
Read more >There was an error in evaluating the Pre-request Script
Try putting your script under the Tests tab, which is ran after a response is received. Share.
Read more >JavaScript policy runtime error troubleshooting | Apigee Edge
The error type ReferenceError is thrown when an undefined variable in your JavaScript is used (referenced) or operated on. Error response body.
Read more >ReferenceError: $http is not defined - New Relic Explorers Hub
I am try to write a simple script in new relic synthetics and am getting : ReferenceError: $http is not defined. Part of...
Read more >Error and Warning Dictionary | Twilio
HTTP communication total time out triggered ... Conference Event: Error Response to Callback URL ... Address Validation Error - Check Suggested Address.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have one more point here. Even if things timed out, is it okay to have RefeferenceError? Instead, should the global variables not be set to undefined (or whatever appropriate to indicate timed out)? By that, scripts will not error out and will fail tests properly.
Update on the issue. Since 2017, a lot has changed.
The above two combined, this issue will be auto addressed.