Forum Discussion

sachin-chanchal's avatar
Occasional Contributor
8 years ago

How to copy HTTP test step from one test suite to another test suite


I am looking for a groovy code which will copy test step from one test suite and clone the same step to another test suite

for e.g



            ___Test Suite 1

                                    __Test Case1

                                                        ___Test Step1

            ___Test Suite2

                                   ___Test Case2


would like to clone Test Step1 from Test Case1 to Test Case2, please suggest


3 Replies

  • Nastya_Khovrina's avatar
    SmartBear Alumni (Retired)

    Hi Sachin,


    You need to use the cloneStep(com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep, java.lang.String) method.


    Please see a sample script:

    def sourceStep = testRunner.testCase.testSuite.project.getTestSuiteByName("Test Suite 1").getTestCaseByName("Test Case 1").getTestStepByName("Test Step 1");
    testRunner.testCase.testSuite.project.getTestSuiteByName("Test Suite 2").getTestCaseByName("Test Case 2").cloneStep(sourceStep,"NewTestStepName");




    • sachin-chanchal's avatar
      Occasional Contributor

      I have tried


      def workspace = testRunner.testCase.testSuite.project.workspace
      project = workspace.getProjectByName('ProjectName');
      apiTestSuite = project.getTestSuiteByName(TestSuite1);
      apiTestCase = apiTestSuite.getTestCaseByName('TestCase1');
      apiTestStep = apiTestCase.getTestStepByName('TestStep1');



      But, this code is not working