b从上面可以运行一次测试计划如果要连续运行小时呢?其中加了一个sleep目的就是想在每次运行完后暂停一下这个根据你的系统要求估算
c从基本思想上大家可以想象如果ant有loop或for的话也可设定运行次数来达到这个目的但是目前Ant没有此功能所以达不到通过我查看文档其中有ant和antcall的task是不是可以利用这个来达到目的呢?
即buildxml中写为
< target name=test>
< taskdef
name=jmeter
classname=orgprogrammerplanetanttaskdefsjmeterJMeterTask/>
< jmeter
jmeterhome=D:\ProgramFiles\jakartajmeter
testplan=${basedir}/webjmx
resultlog=${out}/webjtl>
< jvmarg value=Dgroupthreads=/>
< /jmeter>
< echo message=jmeter webjmx finished/>
< antcall target=interval/>
< antcall target=test/> < !循环调用自已来达到持续运行的目的>
< !ant antfile=buildxml/>
< /target>
结果是使用ant或是antCall都不行错误如下
antcall运行报错
BUILD FAILED
D:\ProgramFiles\jakartajmeter\mytest\web\buildxml:: antcall task call
ing its own parent target
ant 运行报错
BUILD FAILED
D:\ProgramFiles\jakartajmeter\mytest\web\buildxml:: ant task calling
a target that depends on its parent target test
d不过从前者的结果看是不能call its own因此我将原target test一样考贝一份取名test
则在test中< antcall target=test/>在test中< antcall target=test/>这样运行就可以达到
我想要的连续测试的要求
只是这样也有缺陷因为这没有编程功能不能在之中加入比如测次或测小时后就不再antcall
而结束的功能所以要在你想停止的时候手动停止了
这样xslt转换就不能写在这个功能中了最后手动停止后再做xslt转换或直接在xml中加入xsl显示即可
D:\ProgramFiles\jakartajmeter\mytest\web>ant
Buildfile: buildxml
test:
[jmeter] Executing test plan: D:\ProgramFiles\jakartajmeter\mytest\web
\webjmx
[jmeter] Created the tree successfully
[jmeter] Starting the test
[jmeter] Tidying up
[jmeter] end of run
[echo] jmeter webjmx finished
interval:
[echo] sleep seconds
[echo] continue
test:
[jmeter] Executing test plan: D:\ProgramFiles\jakartajmeter\mytest\web
\webjmx
[jmeter] Created the tree successfully
[jmeter] Starting the test
[jmeter] Tidying up
[jmeter] end of run
[echo] jmeter webjmx finished
interval:
[echo] sleep seconds
[echo] continue
test:
[jmeter] Executing test plan: D:\ProgramFiles\jakartajmeter\mytest\web
\webjmx
[jmeter] Created the tree successfully
[jmeter] Starting the test
[jmeter] Tidying up
[jmeter] end of run
[echo] jmeter webjmx finished
interval:
[echo] sleep seconds
[echo] continue
test:
[jmeter] Executing test plan: D:\ProgramFiles\jakartajmeter\mytest\web
[] [] [] []