2

testRunner.runTestStepByName (" Soap Request Name ")を使用して SOAP リクエスト テスト ステップ (テスト スイート -> テスト ケースの下) を実行した後の SoapUI で

そして、soap リクエストの実行後 10 秒間待機すると、testRunner.getStatus()はRUNNING statusを返します。以下はgroovyスクリプトです(同じテストスイートの下にあります->テストケース)

import groovy.sql.Sql;
import com.eviware.soapui.model.testsuite.TestRunner.Status

testRunner.runTestStepByName("GetCitiesByCountry - Request 1")
sleep(10000)
log.info( "...${testRunner.getStatus()}...")

while ( testRunner.getStatus() == Status.RUNNING ) {
    log.info(testRunner.getStatus())
}

出力は以下のとおりです

Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
Wed Apr 17 21:06:22 IST 2013:INFO:RUNNING
.
.
continuing for infinite time...

上記のテストステップが実行されるため、理想的にはFINISHED を返す必要があります。

これを手伝ってくれてありがとう

4

1 に答える 1

5

論理的に聞こえますが、ループにいる限り、テストは「実行中」です。これでステータスを取得できます:

import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus
myTestStepResult = testRunner.runTestStepByName("GetCitiesByCountry - Request 1")
myStatus = myTestStepResult.getStatus()
if (myStatus == TestStepStatus.OK)
log.info "The step status is: " + myStatus.toString()
else
log.error "The step status is: " + myStatus.toString()

また、runTestStepByName への呼び出しは同期的であるため、「実行中」ステータスはなく、「CANCELED」、「FAILED」、「OK」、または「UNKNOWN」のみがあります。

こちらのドキュメントをご覧ください

于 2013-04-23T12:00:41.643 に答える