蘇柏綸
蘇柏綸

Reputation: 49

Jenkins cannot read json file

I am trying to use postman/newman to auto test my API collection on Jenkins(build on docker),

I have successfully used the following shell (the url is the sample on postman Official website)

newman run "https://www.postman.com/collections/8a0c9bc08f062d12dcda"

but while I change the url to my own collection(I put in my git project),

url : newman run "http://localhost:8080/job/projectName/ws/pm/collection.json"

the eror messqge shows that

+ newman run http://localhost:8080/job/projectName/ws/pm/collection.json
error: collection could not be loaded
  the url "http://localhost:8080/job/xxx/ws/pm/collection.json" did not provide valid JSON data
  Unexpected token '<' at 1:1
<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2Fjob%2Fmone
^

Build step 'Execute shell' marked build as failure
Finished: FAILURE

I also tried

url : newman run "localhost:8080/job/projectName/ws/pm/collection.json"

and the error code become

error: collection could not be loaded
  unable to read data from file "localhost:8080/job/projectName/ws/pm/collection.json"
  ENOENT: no such file or directory, open 'localhost:8080/job/projectName/ws/pm/collection.json'

Anyone can help? Please!!!

Upvotes: 0

Views: 1140

Answers (1)

蘇柏綸
蘇柏綸

Reputation: 49

I just fix the path and it works! The path should be pm/collection.json http://localhost:8080/job/xxx/ws/pm/collection.json is from workspace

Upvotes: 0

Related Questions