-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Newman_undefined_while assertion {"bla":"12332105910416"} like this from JSON #1308
Comments
@sebokgabor84 Apologies for the delay. Could you confirm that this behaviour persists with v5.5.0 of the app and Newman v3.9.1 as well? Also, could you add the following statement above your failing tests so that we may get more context? console.log(pm.response.json(), JSON.parse(responseBody)); |
@sebokgabor84 Closing issue due to inactivity, feel free to revert if you're facing difficulties 😄 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version and environment information:
-->
newman -v
): 3.8.3Situation:
I'm using javascript tests inside the postman and thay will not fail if I execute it in the Runner as you can see in the screenshots, but if I do "newman run ..." in the CLI those tests are failing where newman tries to parse and assert an string that includes number like this:
{ "dispatchingWarehouse": "12", ---> this will fail
"modeMappingResult": "NORMAL" } ---> this not
I'm Using booth old and new test syntax, like this, for booth the behavior is the same as described before:
// instance the variable that holds the hole json esponse
//new Syntax:
var response = pm.response.json();
//old syntax:
//var response = JSON.parse(responseBody);
pm.test("response.dispatchingWarehouse has the correct value", function () {
pm.expect("12").to.eql(response.dispatchingWarehouse);
});
tests ["response.dispatchingWarehouse === 12"] = response.dispatchingWarehouse === "12";
console.log("response.dispatchingWarehouse" + response.dispatchingWarehouse);
I will get from newman if I do a console.log() this:
'response.dispatchingWarehouse undefined'
failure detail
6. AssertionFailure response.dispatchingWarehouse === 12
at assertion:14 in test-script
inside "Hermes_14_with_pre-request_and_tests"
I think the problem is that the "dispatchingWarehouse" is a string but it includes numbers and newman is not able to assert it corretly.
but Postman Runner is able to handle it correct.
The text was updated successfully, but these errors were encountered: