zoukankan      html  css  js  c++  java
  • 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,否则报参数不合法。

  • 相关阅读:
    使用Distinct()内置方法对List集合的去重 问题
    TCP连接与HTTP请求
    ASP.NET MVC 使用 Authorize 属性过滤器验证用户是否已登录
    C#进阶系列——WebApi 跨域问题解决方案:CORS
    关于设计模式的六大原则
    C# WebApi 接口传参详解
    数据库数据流量太大-问题诊断
    docker的build生成镜像和启动container
    docker生成dotnet core镜像
    NET Core 源码浏览站点工具
  • 原文地址:https://www.cnblogs.com/Alysa-lrr/p/12546398.html
Copyright © 2011-2022 走看看