2015-11-09 71 views
0

我有一個SoapUI項目,我想循環x次數。我如何去做這件事?我可以通過這樣做測試案例 -如何循環完整的SoapUI項目?

if(context.loopIndex == null) 
context.loopIndex = 0 

if(++context.loopIndex < 10) 
testRunner.gotoStepByName("Step to start looping from") 

log.info(context.loopIndex) 

有沒有辦法讓它從項目的開始處開始?

+0

什麼是你的使用情況? – Rao

+0

我有一個完整的腳本,我只是想讓它做同樣的事情10次。我猜這是不允許的,因爲loadui存在 – namesake

回答

0

這是java代碼片段,它將運行一個soapui項目,計數次數爲。

com.eviware.soapui.tools.SoapUITestCaseRunner runner = new com.eviware.soapui.tools.SoapUITestCaseRunner(); 
runner.setProjectFile("project/path/sample-soapui-project.xml"); 
for(int i=0;i<count;i++){ 
    runner.run(); 
} 

你可以看看更多細節 http://www.soapui.org/test-automation/junit/junit-integration.html