查询有关frisby测试用例结果的失败

时间:2014-09-26 09:57:19

标签: testing automated-tests

在运行具有必要验证的代码时,不会执行测试用例。它会抛出以下错误消息。

1) Frisby测试:单个帖子的测试用例

消息:

 Expected 500 to equal 201.

堆栈跟踪:

 Error: Expected 500 to equal 201.
at null.<anonymous> (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:462:42)
at null.<anonymous> (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:1043:43)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

2) Frisby测试:单个帖子的测试用例

消息:

Error: Error parsing JSON string: Unexpected '<'
Given: <html><head><title>Apache Tomcat/7.0.53 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.53</h3></body></html>

堆栈跟踪:

Error: Error parsing JSON string: Unexpected '<'
Given: <html><head><title>Apache Tomcat/7.0.53 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error that prevented it from fulfilling this request.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.53</h3></body></html>
at _jsonParse (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:1174:11)
at Frisby.<anonymous> (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:919:20)
at null.<anonymous> (/home/admin/wrkspc/api-tests/node_modules/frisby/lib/frisby.js:1081:18)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

2 个答案:

答案 0 :(得分:0)

Error: Expected 500 to equal 201.

意味着你正在测试的是抛出错误。

Error parsing JSON string: Unexpected '<'

只是意味着您收到的回复不是正确的JSON格式。在这种情况下,它似乎是HTML。第二个错误是预期您的系统正在以其熟悉的格式(html,而不是JSON格式)抛出错误消息。

真正的错误:

The server encountered an internal error that prevented it from fulfilling this request.

答案 1 :(得分:0)

您可以使用--track查看测试结果。

更多信息:http://frisbyjs.com/docs/api/#inspectBody()