2

自動化のギャップを埋めるために、テスト スイートで groovy スクリプトを使用しています。ここでは、あるテスト ケースから別のテスト ケースにプロパティを複製する必要があります。たとえば..プロパティから値を取得するために、プロパティ テスト ステップを TestCase1 から TestCase2 に複製します。

ある TC から別の TC にプロパティの値を取得しようとしましたが、SOAPUI ではその操作を実行できません。プロパティ値をある TC から別の TC に転送することはできません。そこで、groovy を使用して Test ステップを複製します。

あなたの助けは大歓迎です..誰かからの応答を待っています..

ありがとう、マダン

4

2 に答える 2

1

テスト ステップ「Run TestCase」を使用して、TestCase1 から TestCase2 を実行できます。TestCase2 で必要なプロパティを直接作成して、TestCase1 の「プロパティ転送」テスト ステップで設定できるようにします。テスト ケースの実行に関する詳細はこちら、プロパティの転送に関する詳細はこちらをご覧ください

もう 1 つの方法は、プロパティを設定し、TestCase をプログラムで実行することです。このようなもの:

// get properties from testCase, testSuite or project if you need
def testCaseProperty = testRunner.testCase.getPropertyValue( "MyProp" )
def testSuiteProperty = testRunner.testCase.testSuite.getPropertyValue( "MyProp" )
def projectProperty = testRunner.testCase.testSuite.project.getPropertyValue( "MyProp" )
def globalProperty = com.eviware.soapui.SoapUI.globalProperties.getPropertyValue( "MyProp" )

//get test case from other project or from the same one
project = testRunner.getTestCase().getTestSuite().getProject().getWorkspace().getProjectByName(project_name)
testSuite = project.getTestSuiteByName(suite_name);
testCase = testSuite.getTestCaseByName(testcase_name);

//set properties if you need
testRunner.testCase.setPropertyValue(property_name, property_value);
testRunner.testCase.setPropertyValue(another_property_name, another_property_value);

// run test case
runner = testCase.run(new com.eviware.soapui.support.types.StringToObjectMap(), false);
于 2013-08-13T06:36:01.047 に答える