Skip to content
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 removes leading zeros from string data that looks like a number #1346

Closed
mgroeneweg opened this issue Dec 14, 2017 · 4 comments
Closed
Assignees

Comments

@mgroeneweg
Copy link

  1. Newman Version (can be found via newman -v): 3.9.1
  2. OS details (type, version, and architecture): Windows 10, 64bits
  3. Are you using Newman as a library, or via the CLI? CLI
  4. Did you encounter this recently, or has this bug always been there: today
  5. Expected behaviour: Do not take off leading zeros from string values.
  6. Command / script used to run Newman: newman run TestLeadingZeros.postman_collection.json -d TestLeadingZeros.csv --reporters cli,json --reporter-json-export testreport.json
  7. Sample collection, and auxiliary files (minus the sensitive details):
  8. Screenshots (if applicable):

The CSV contains a value "008727100". It is enclosed in quotes. NewMan passes "8727100" to the server, which leads to a failure. These values are codes, not numbers.
When I run using collection runner, it leaves the value intact.

I reproduced this using a google search for 000123.
When running using collection runner, it searches for 000123.
When running using newman, it searches for 123

When a value is enclosed in quotes, it should not be interpreted but passed on to the service call as is.

I attached the files, but had to rename everything to txt extension.

TestLeadingZeros.txt
TestLeadingZeros.postman_collection.txt
TestLeadingZeros.postman_collectionrunner_test_run.txt
testreport newman.txt

@codenirvana
Copy link
Member

@mgroeneweg a fix has been added in #1609 which will be rolled out with the v4 release.

You can test this using v4.0.0-beta.2.

@codenirvana
Copy link
Member

@mgroeneweg This has been fixed in Newman v4.0.0.

@ajaygoeleb
Copy link

@codenirvana I just upgraded newman to 4.3.1 but it seems like it is still dropping leading zero :-(

@codenirvana
Copy link
Member

@ajaygoeleb Make sure you wrap your number in quotes. Example:

data1, data2
"00123", 00123

Will be converted to:

{
    "data1": "00123",
    "data2": 123
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants