繁体   English   中英

带有Dyn_Variable的Tsung问题

[英]Tsung Issue with Dyn_Variable

我是ERLANG和TSung的新手,我从未在这方面工作,但我非常渴望了解基础知识,并为我的Web应用程序进行分布式负载测试。 我已经完成了一半的工作,但是我遇到了一个很大的障碍,无法继续前进,请阅读下面的tsung.xml文件并告诉我在哪里以及我缺少什么?

**===> tsung.xml  (this file perfectly working without any errors)**

*<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM  "/usr/share/tsung/tsung-1.0.dtd">
<tsung loglevel = "debug" dumptraffic="true" version="1.0">
<clients>
        <client host="localhost" weight ="1" maxusers="40000" cpu = "1" >
        <ip value = '127.000.000.111'/>
</client>
</clients>
<servers>
        <server host="127.000.000.112" port="80" type="tcp"></server>
</servers>
<load duration="1" unit="minute">
        <arrivalphase phase="1" duration="1" unit="minute">
        <users arrivalrate="10" unit="second"></users>
    </arrivalphase>
</load>

<sessions>
<session name="mySession" probability="100" type="ts_http">
<transaction name="trx">
        <request>
            <dyn_variable name="myId" re="&lt;myId&gt;(\.*)\&lt;/myId&gt;"/> <-- Trying with RegExp option, not getting the value myId
            <!--dyn_variable name="myId" xpath="//response/myId" /-->  <-- Trying with xpath option, not getting the value myId
            <!--dyn_variable name="myId" jsonpath="response.myId" /-->  <-- Trying with jsonpath option, not getting the value myId
            <http  url='http://127.000.000.112/Create_Rec' method='POST' version='1.1' content_type='text/xml'/>
        </request>
        <request subst="true">
        <http  url='http://999.000.000.999/Get_Rec/myId=%%_myId%%' method='GET' version='1.1' content_type='application/xml'/>
</request>
</transaction>
</session>
</sessions>
</tsung>*

当我在Web浏览器中运行此URL(它是Web服务调用)“ http://_127.000.000.112/Create_Rec ”时,我从服务器获得以下类似的响应(在后台它在数据库中创建记录并且生成新的id即myId)。 当我在tsung.xml上面运行时,第一个请求正如我预期的那样完美运行。

===>响应(浏览器响应)

<response id="SomeWebService">
    <status>
        <statusCode>1</statusCode>
        <statusMsg>SomeMessage</statusMsg>
        <statusTime>2013-06-20 02:52:25</statusTime>
    </status>
    <myId>298346728934734987</myId>
</response>

我在这里看到的,我需要从第一个请求获取myId并传递给第二个请求myId = %% _ myId %%,但它永远不会工作,myId总是空字符串。 自从两天以来,我超越了dyn_variable,没有任何线索和正确的示例/文档。 请建议我,我缺少什么。

您必须在替换工作请求中设置subst =“true”。 所以,您的请求应该更改为..

<request subst="true">

如果它仍然不起作用,那么我建议你看看tsung.dump文件并检查你从服务器获得的响应

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM