Search code examples
restpostmannewman

Tests are passing in postman but not in newman


I am creating postman tests to upload a csv file, when running my code in postman the test passes and I get a fileId as response.

However when running the same test in newman I got the following error :

I have also noticed that an other error is displayed :

Form param `file0`, file load error: "/C/Workspace/scf/scf-everything-shared/src/test/simulation/DDT/tests/files/Newman.csv", no such file

I have copied the file in the same fodler as my colection and used both absolute and relative path!

{
  "error": {
    "code": "UnsupportedMediaType",
    "message": "application/csv content type is not supported for this request. Supported media types are: multipart/form-data"
  }
}

As I am using form-data in body postman sets the content-type automatically but this triggered the error above. I have also tried to set content type to application/csv instead but it still only passes in postman but not newman thanks for your help!


Solution

  • Sorry guys, I am launching a command from a docker container conataining newman.I should instead put the path referring the the file in my docker container after copying it (not in my localhost). After changing the path it works now.