怎样让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关键字,并对其进行随机策略处理。

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念