熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java開源技術 >> 正文

關於Ant+JMeter進行Web應用的穩定性測試[2]

2022-06-13   來源: Java開源技術 

  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

[]  []  []  []  


From:http://tw.wingwit.com/Article/program/Java/ky/201311/29208.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.