很多朋友在刚刚接触jmeter的时候会遇到各种各样感觉稀奇古怪的问题,明明请求对了却总是返回不如意的结果,jmeter功能强大,但没有postman那样的界面简洁易上手的特性,本文分享在最初接触jmeter时有可能会遇到的问题,让各位少走弯路。下方目录,点击可直接跳转到对应的问题解决方案上。
目录
2、提示{"code":"10010002","msg":"获取登陆用户信息失败"}
5、提示{"code":"30000000","msg":"JSON parse error: xxx}
1、提示java.net.URISyntaxException: Illegal character in authority at index 7:xxxx
java.net.URISyntaxException: Illegal character in authority at index 7: http:// xxxxx
at java.net.URI$Parser.fail(Unknown Source)
at java.net.URI$Parser.parseAuthority(Unknown Source)
at java.net.URI$Parser.parseHierarchical(Unknown Source)
at java.net.URI$Parser.parse(Unknown Source)
at java.net.URI.<init>(Unknown Source)
at java.net.URL.toURI(Unknown Source)
at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:620)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:66)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1296)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1285)
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:638)
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:558)
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
at java.lang.Thread.run(Unknown Source)
原因及解决方案:URL地址不正确(可能是由于域名或参数中使用了非法的字符;也有可能是在开头、结尾等地方多打了一个空格,这种情况的概率非常大,一定要检查空格)
2、提示{"code":"10010002","msg":"获取登陆用户信息失败"}
{"code":"10010002","msg":"获取登陆用户信息失败"}
原因及解决方案:提示登录用户信息失败类似的内容时,通常是访问的这个接口还需要和其它接口之间有关

本文介绍了在使用JMeter进行接口测试时可能会遇到的五个问题及其解决方案,包括URISyntaxException错误、登录信息失败、UnsupportedMediaType错误、响应内容乱码以及JSON解析错误。解决方法涉及检查URL、添加请求头、设置Content-Type、调整编码格式和验证JSON格式。

8825

被折叠的 条评论
为什么被折叠?



