jmeter測試遇到過的坑


1.在linux環境執行腳本時,一直報錯,問題是不清楚報的什么問題,只能看到很少的日志,但是接口又是通的(有CSV Data Set Config組件時)
# cat log.jtl 
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
1574846769407,33,HTTP請求,200,OK,線程組 1-1,text,false,"Test failed: text expected to contain /""code"":10000/",161,227,1,1,http://xxxxx/image/lrr271,33,0,21
復制代碼
# jmeter -n -t lrr1.jmx -l log.jtl
Creating summariser <summary>
Created the tree successfully using lrr20mubiao1.jmx
Starting the test @ Wed Nov 27 17:26:09 CST 2019 (1574846769002)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary =      1 in 00:00:00 =    5.5/s Avg:    33 Min:    33 Max:    33 Err:     1 (100.00%)
Tidying up ...    @ Wed Nov 27 17:26:09 CST 2019 (1574846769449)
... end of run
復制代碼

Body Data中的json引用的變量未加大括號$W

 <stringProp name="Argument.value">{&quot;base64&quot;:&quot;$w&quot;}</stringProp>

最后發現問題:json格式,上傳base64碼,Body Data中的json引用的變量必須要加大括號,{"base64":"${w}"};

<stringProp name="Argument.value">{&quot;base64&quot;:&quot;${w}&quot;}</stringProp>

最后執行成功

復制代碼
# jmeter -n -t lrr20mubiao1.jmx -l log.jtl
Creating summariser <summary>
Created the tree successfully using lrr20mubiao1.jmx
Starting the test @ Wed Nov 27 17:39:00 CST 2019 (1574847540263)
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
summary +      1 in 00:00:01 =    1.9/s Avg:   368 Min:   368 Max:   368 Err:     0 (0.00%) Active: 1 Started: 1 Finished: 0
summary =      1 in 00:00:01 =    1.9/s Avg:   368 Min:   368 Max:   368 Err:     0 (0.00%)
Tidying up ...    @ Wed Nov 27 17:39:01 CST 2019 (1574847541089)
... end of run
復制代碼

總結:上傳base64碼,body中引用變量,必須加大括號{};但是上傳文字未加大括號也是可以的

2.body中帶漢字,一定加編碼utf-8,否則報參數不合法。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM