jmeter遇到过的问题整理

1、beanShell断言执行结果,日志有报错

 beanShell断言执行结果,日志有报错:
Assertion failure message: org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval In file: inline evaluation of: `` if(prev.getResponseDataAsString().contains("{"code":-1,"message":"Id_Checker_Er . . . '' Encountered "code" at line 2, column 47.
---原因 用来做对比的响应结果中双引号前没有加斜杆
如:错误格式
{"code":19,"message":"User not found:[email protected]","result":{"var":null}}
改正后的格式

{\"code\":19,\"message\":\"User not found:[email protected]\",\"result\":{\"var\":null}}

2、csv读到的中文数据乱码

----解决方法,将csv编码设置从utf8改成gbk

3、 post 接口问题--响应数据post body is not json.

看了下请求的数据,有些是读到utf-8有些还是${strBody}

-----原因 csv那里多写了一个变量,所以读到uft-8的值,改了后,因为strBody格式问题,所以只读到"{,后续把json都写在同一行就可以了

4、一直没有执行到if逻辑控制器的内容

现象:一开始勾选了interpet Conditions  as Variable expression,结果查看结果树中一直都没有请求的相关信息。

jmeter遇到过的问题整理

原因:勾选interpet Conditions  as Variable expression,表示:判断变量值是否等于字符串true(不区分大小写)。

解决方法:不勾选interpet Conditions  as Variable expression