postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.88k stars 1.17k forks source link

Newman vs. ASP.NET MVC Web API 2 "No HTTP resource was found" message #78

Closed jlampeatds closed 10 years ago

jlampeatds commented 10 years ago

Just tried running Newman 1.0.2 with node.js v0.10.28 on a 64-bit Windows 7 machine and received a "TypeError" error on a fairly common ASP.NET MVC Web API 2 error message.

D:\code>newman -c MVCWebApp03_test.json

Iteration 1 of 1 200 20ms Basic value to root http://localhost:26069/values/5 404 21ms Basic value http://localhost:26069/api/values/5

TypeError: Cannot read property 'two' of undefined at getKey (C:\Users\tehuser\AppData\Roaming\npm\node_modules\newman\src\uti lities\VariableProcessor.js:62:23) at String.replace (native) at Object.jsface.Class._findReplace (C:\Users\tehuser\AppData\Roaming\npm\n ode_modules\newman\src\utilities\VariableProcessor.js:64:31) at Object.jsface.Class._processPathVariable (C:\Users\tehuser\AppData\Roami ng\npm\node_modules\newman\src\utilities\VariableProcessor.js:33:23) at Object.jsface.Class.processRequestVariables (C:\Users\tehuser\AppData\Ro aming\npm\node_modules\newman\src\utilities\VariableProcessor.js:107:8) at Object.jsface.Class._processUrlUsingEnvVariables (C:\Users\tehuser\AppDa ta\Roaming\npm\node_modules\newman\src\runners\RequestRunner.js:128:21) at Object.jsface.Class.execute (C:\Users\tehuser\AppData\Roaming\npm\node modules\newman\src\runners\RequestRunner.js:46:9) at Object.jsface.Class._onRequestExecuted (C:\Users\tehuser\AppData\Roaming \npm\node_modules\newman\src\runners\RequestRunner.js:80:8) at EventEmitter.emit (events.js:117:20) at Object.jsface.Class.emit (C:\Users\tehuser\AppData\Roaming\npm\node_modu les\newman\src\utilities\EventEmitter.js:34:16)

Where “Basic value to root” returns: "value" …and “Basic value” returns: { "Message": "No HTTP resource was found that matches the request URI 'http://localhost:26069/api/values/5'.", "MessageDetail": "No type was found that matches the controller named 'api'." }

More info:

newman@1.0.2 C:\Users\jonathal\AppData\Roaming\npm\node_modules\newman ├── commander@2.2.0 ├── underscore@1.6.0 ├── tv4@1.0.18 ├── backbone@1.1.2 ├── jsface@2.2.0 ├── lodash@2.4.1 ├── json5@0.2.0 ├── jquery@2.1.1 ├── unirest@0.2.6 (mime@1.2.11, should@2.0.2, request@2.34.0) ├── jsdom-nogyp@0.8.3 (xmlhttprequest@1.6.0, cssom@0.2.5, nwmatcher@1.3.3, reque st@2.34.0, htmlparser2@3.7.1, cssstyle@0.2.11) ├── xml2js@0.4.2 (sax@0.5.8, xmlbuilder@2.2.1) └── cli-color@0.3.2 (d@0.1.1, timers-ext@0.1.0, memoizee@0.3.3, es5-ext@0.10.4)

prakhar1989 commented 10 years ago

Hi @jlampeatds, thanks for the stack trace. Looks like newman is failing at the third request. Is it possible for you to share the URL of the third request and make confirm if it is using any environment variable? Thanks!

jlampeatds commented 10 years ago

Yep, you're right - it's not failing during the second, it's failing at the third.

Here's a "clean third" request that fails right away. (The most unusual part about this seems to be that there is an ampersand and a pair of colons in the URL.)

{"id":"49928258-dfdb-b352-ee7c-f2fbf099dcb8","name":"MVCWebApp03","timestamp":1399047632403,"order":["eccdd237-29dd-625a-45c6-757231a6faa5"],"requests":[{"collectionId":"49928258-dfdb-b352-ee7c-f2fbf099dcb8","id":"eccdd237-29dd-625a-45c6-757231a6faa5","name":"Value with path","description":"","url":"http://localhost:26069/values/one:two@three:four/resource/pathone/pathtwo/pathlast","method":"GET","headers":"CustomClientToken: badGUID\n","data":[],"dataMode":"params","timestamp":0,"version":2}]}

prakhar1989 commented 10 years ago

Ah ok. Looks probably like a bug with the path variables. Just to confirm the url that you have mentioned is the clean url (i.e url in the exported collection) - "http://localhost:26069/values/one:two@three:four/resource/pathone/pathtwo/pathlast".

We will have a fix ready soon. Thanks again for reporting the issue.

prakhar1989 commented 10 years ago

Hi @jlampeatds, new version of Newman is out with this fix. You can update newman with npm install -g newman.

jlampeatds commented 10 years ago

Updated and tested great back at the ranch. You guys are awesome - thanks!!!