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

Environment and Data doesn't work together. #1973

Closed
sid-ant opened this issue Apr 15, 2019 · 11 comments
Closed

Environment and Data doesn't work together. #1973

sid-ant opened this issue Apr 15, 2019 · 11 comments
Assignees

Comments

@sid-ant
Copy link

sid-ant commented Apr 15, 2019

Running newman run collection.json -e env.json -d userdata.csv doesn't take values from data file but instead use the initial value of the collection only.

Both the environment and data file contain 'user_id' variable which is used while forming the request.

  1. Newman Version (can be found via newman -v):
    4.4.1
  2. OS details (type, version, and architecture):
    Windows 10 Pro, 64Bit
  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:
    Always
  5. Expected behaviour:
    Data variables value take precedence over Environment value
  6. Command / script used to run Newman:
    newman run collection.json -e env.json -d userdata.json
  7. Sample collection, and auxiliary files (minus the sensitive details):

Sample Request :

{ username: "{{user_id}}", pwd: "{{pin}}" }

Environment contains variables : user_id, pin, url etc.

Data File:

user_id,pin
helloworld,1234
foobar,1234 

@sid-ant
Copy link
Author

sid-ant commented Apr 15, 2019

Do note the same collection and data file work perfectly fine in Postman.

@sid-ant
Copy link
Author

sid-ant commented Apr 15, 2019

Finally found a solution. I observed the first column of the csv is being ignored and so I just duplicated the first column, in nth column and it worked. Weird.

@shamasis
Copy link
Member

It’s weird. Can you post a sample collection and the errant data file as well as your fix?

cc @codenirvana

@sid-ant
Copy link
Author

sid-ant commented Apr 16, 2019

It contains confidential data. I'll try to make a similar request / data file. Can you confirm that it works as intended for you though?

@lucielavickova
Copy link

hi, I was having the same issue like you, but today it started working for me... maybe the issue got resolved in the meantime?

@shamasis
Copy link
Member

shamasis commented May 5, 2019

Nothing was released since March 25. @lucietriskova - can you share a scaled down variant of a collection that was causing this issue?

@lucielavickova
Copy link

@shamasis unfortunately it was also a collection for verification of login functionality, so confidential data :/
But I just tried to checkout an older version of my CSV data file from the repository and I could reproduce the problem again. So it looks like the problem is in the file itself.
I succeeded to fix the problem in following way:

  1. open Notepad++
  2. create a new file, copy and paste there the content of the file that was not working
  3. save it as a new file - in my case, I called it "login_data2.csv" and from the filetype dropdown selected "All Types (.)". Please note that just replacing the old file doesn't help.
  4. run the collection with the new file - it works!

@shamasis
Copy link
Member

shamasis commented May 5, 2019

Could this possibly be a file encoding issue @lucietriskova - perhaps it was generated on a non-windows machine or saved from a machine that has a locale setting that is not supported? I know that it got fixed for you, but I can also imagine that it must have been frustrating at the time when it wasn’t working. So, if you can remove the sensitive data from your CSV file and send me a copy. In fact, if you want, you can send it to help@getpostman.com referencing this issue and ping back here. I will check back with the team and try out the file.

@Avinger27
Copy link

This happens for me when, I copy data from an excel, save it in a csv file, specifically csv utf-8.

@codenirvana
Copy link
Member

Can you share a scaled-down collection using some echo endpoint which we can use to reproduce this issue?

@DannyDainton
Copy link
Collaborator

Hey @siddhant-curious, @Avinger27

If you're able to provide some steps/scaled-down collection to reproduce the issue, we can open it up and take a look but for now,I'm going to close the issue.

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

6 participants