怎樣讓xml文件的屬性值隨機生成

怎樣讓xml文件的屬性值隨機生成


如:<request><jabber type="raw" ack="no_ack" data="&lt;message id='a98d8bed-ac21-4851-a8b3-6e4bd6523174' to='xm@dc01' ><//request> id爲隨機值,而不是固定值




解答:

 首先dtd文件裏要有random屬性

然後設置random="true"

<thinktime min="2" max="10" random="true"></thinktime>
這時 thinktime的取值爲2-10之間

If you want to use a fixed seed for the random generator, you can use the seed option, like this (by default, tsung will
use the current time to set the seed, therefore random numbers should be different for every test)

如果你想使用一個固定的種子隨機發生器,你可以使用種子標籤option,tsung使用當前時間,設置種子,這樣隨機數每次都不一樣
<option name="seed" value="42"/>

搞定

前提條件,解析此xml的工具或軟件得支持random關鍵字,並對其進行隨機策略處理。

發佈了29 篇原創文章 · 獲贊 8 · 訪問量 9萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章