简体   繁体   中英

Tsung Issue with Dyn_Variable

I am very new to ERLANG and TSung, I never worked in this areas, but I am very much keen to know the fundamentals and do distributed load test for my web application. I am in half the way to complete, but I have a big hurdle and not able to moving forward , please read below tsung.xml file and advise me where & what I am missing?

**===> 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>*

When I run this url (it is web service call) " http://_127.000.000.112/Create_Rec " in the web browser, I get the following similar response from Server (in the back ground it creates the record in database and generates new id ie myId). When I run above tsung.xml, the first request working perfectly fine as I expected.

===> response (browser response)

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

What I am looking here, I need to grab the myId from first request and pass into second request myId=%%_myId%%, but it is never working and myId always empty string. I am beyond of dyn_variable since two days, no clue and proper examples/documentation on it. Please suggest me, what I am missing.

You will have to set up the subst="true" in your request for substitution to work. So, your request should change to..

<request subst="true">

If still it doesn't work then I would suggest you to see the tsung.dump file and check the response which you are getting from server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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