簡體   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