Ask a Question

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

sachin-chanchal
Occasional Contributor

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

Hi,

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

    PROJECT1

            |

            ___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 3
nmrao
Community Hero

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

Have you tried any?


Regards,
Rao.
sachin-chanchal
Occasional Contributor

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

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');

testRunner.testCase.testSuite.project.getTestSuiteByName("TestSuite2").getTestCaseByName("TestCase2").cloneTesStep(TestStep1,TestStep1)

 

But, this code is not working

Nastya_Khovrina
Moderator

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

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");

 

 

 


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
cancel
Showing results for 
Search instead for 
Did you mean: