当我运行dredd时,似乎只是在第一次api调用后挂起。我不确定如何调试或诊断。我正在使用dnx web
命令运行asp.net 5 mvc 6 api服务。我怎样才能看到发生了什么或问题是什么?
我尝试添加用于调试的钩子并看到它调用第一个api然后从不触发after事件。我用邮递员和卷曲测试了api并得到了正确的结果。如果我使用的是express node.js服务器,Dredd也可以使用相同的蓝图。
失败的唯一组合是使用asp.net kestrel服务器响应进行Dredd。服务器记录发出请求并发送响应,因此它会触发测试,但永远不会完成。
Dredd是否正在寻找某种后处理挂钩,因为我看到服务器使用dredd接收请求,而不管.net或node.js.即使我在另一个进程中启动.net api进程它也不起作用,为什么会这么重要?它应该只是对dredd的http请求吗?
是否关心它是从红隼服务器回来的?
红隼反应
Content-Type → application/json; charset=utf-8
Date → Wed, 06 Jan 2016 17:14:10 GMT
Server → Kestrel
Transfer-Encoding → chunked
Body {"foo":"bar"}
dredd.yml
dry-run: null
hookfiles: null
language: nodejs
sandbox: false
server: dnx web
server-wait: 3
init: false
names: false
only: []
output: []
header: []
sorted: false
user: null
inline-errors: false
details: false
method: []
color: true
level: verbose
timestamp: false
silent: false
path: []
blueprint: test.apib
endpoint: 'http://localhost:5000'
dredd
命令的控制台输出
Starting server with command: dnx web
Waiting 3 seconds for server command to start...
Hosting environment: Production
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
info: Beginning Dredd testing...
info: Found Hookfiles: hooks.js
hook: before all
hook: before each
info: Microsoft.AspNet.Hosting.Internal.HostingEngine[1]
Request starting HTTP/1.1 GET http://localhost:5000/message
info: Microsoft.AspNet.Mvc.Controllers.ControllerActionInvoker[1]
Executing action method Foo.Controllers.HelloController.Get with arguments () - ModelState is Valid'
info: Microsoft.AspNet.Mvc.Infrastructure.ObjectResultExecutor[1]
Executing ObjectResult, writing value Microsoft.AspNet.Mvc.ActionContext.
info: Microsoft.AspNet.Mvc.Infrastructure.MvcRouteHandler[2]
Executed action Foo.Controllers.HelloController.Get in 0.0165ms
info: Microsoft.AspNet.Hosting.Internal.HostingEngine[2]
Request finished in 0.041ms 200 application/json; charset=utf-8
test.apib
# GET /message
+ Response 200 (application/json; charset=utf-8)
{"foo":"bar"}
答案 0 :(得分:0)
正确传递我的机器(带有coreclr mono rc2的MacOSX) 您在repo中提供的nodejs版本也是如此。
我在应用程序中唯一需要更改的是启动命令:
dnx run --server Microsoft.AspNet.Server.Kestrel
但我真的不认为这是问题所在。