首页 > 解决方案 > JMETER 错误:{"errorcode":9999,"errormessage":"JSON 中位置 0 处的意外标记 %"}

问题描述

我正在运行测试并在关联 sessionid 后运行它,我在“查看结果树侦听器”的“响应数据”选项卡中收到以下错误。

你能帮我解决这个错误吗:

采样器结果:

Thread Name: Xaas_No 1-1
Sample Start: 2018-06-14 14:57:20 IST
Load time: 1731
Connect Time: 1255
Latency: 1730
Size in bytes: 852
Sent bytes:957
Headers size in bytes: 776
Body size in bytes: 76
Sample Count: 1
Error Count: 1
Data type ("text"|"bin"|""): text
Response code: 500
Response message: Internal Server Error

Response headers:
HTTP/1.1 500 Internal Server Error
x-powered-by: Express
content-type: application/json; charset=utf-8
content-length: 76
etag: W/"4c-gdbCiVcDg5gx+63/uawAq4eRIu0"
date: Thu, 14 Jun 2018 09:27:12 GMT
connection: close
Set-Cookie: BIGipServeriapxaasbotbuildertest.accenture.com-443=1932329994.47873.0000;Path=/;Version=1;Secure;Httponly
Content-Security-Policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' *.accenture.com; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' *.accenture.com data:; connect-src 'self' *.accenture.com *.dialogflow.com
Cache-Control: private; max-age=31536000
Strict-Transport-Security: max-age=31536000;includeSubDomains
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block


HTTPSampleResult fields:
ContentType: application/json; charset=utf-8
DataEncoding: utf-8

要求:

发布https://iapxaasbotbuildertest.accenture.com/channelService/channelWeb/619e81efe7

发布数据:

%7B%22entry%22%3A%5B%7B%22sessionid%22%3A%22%22%2C%22tenantid%22%3A%22619e81efe7%22%2C%22botid%22%3A%229bb95dfba0%22%2C%22channel%22%3A%22Web%22%2C%22messaging%22%3A%5B%7B%22message%22%3A%7B%22messageId%22%3A123%2C%22text%22%3A%22hi%22%2C%22timestamp%22%3A1528967999992%7D%2C%22sender%22%3A%7B%22id%22%3A%22USR12%22%2C%22name%22%3A%22sylvin%22%7D%7D%5D%7D%5D%7D=

[没有饼干]

Request Headers:
Connection: keep-alive
Origin: https://iapxaasbotbuildertest.accenture.com
Accept: application/json, text/plain, */*
Referer: https://iapxaasbotbuildertest.accenture.com/demo/webtest/?tenantID=619e81efe7&botID=9bb95dfba0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 managedpc (Accenture)
Accept-Language: en-US,en;q=0.9
Accept-Encoding: gzip, deflate, br
Content-Type: application/json
Content-Length: 362
Host: iapxaasbotbuildertest.accenture.com

响应数据:

{ "errorcode": 9999, "errormessage": "JSON 中位置 0 的意外标记 %" }

标签: debuggingjmeterperformance-testingremote-debugging

解决方案


您不应该对JSON有效负载进行编码,它应该按原样进行

因此,请确保取消选中HTTP 请求采样器中的“编码”框

JMeter JSON 编码

还要确保将HTTP Cookie 管理器添加到您的测试计划中,因为您似乎收到了一些 cookie 但没有将它们发回。

如果需要,请参阅REST API 测试 - 如何正确操作文章以获取更多信息。


推荐阅读