cancel
Showing results for 
Search instead for 
Did you mean: 

Creating groovy Test Steps dynamically from setup script in SoapUI Pro.

SOLVED
Highlighted
Occasional Contributor

Creating groovy Test Steps dynamically from setup script in SoapUI Pro.

Hello,

 

Is it possible to create groovy Test steps from Setup script for all underlying Test cases in a perticular test suite?

 

I want to add a generic groovy code Test step in each Test case. If yes, can some one please share how we can achieve this.

 

Thanks, SumitM

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Expert

Depending on what exactly you want to do, you could create a custom event to be run before each test case.

View solution in original post

4 REPLIES 4
Highlighted
Frequent Contributor

Writing a Script to manage an Excel where the Flag (Yes/No) can decide on execution of the Test cases/Test Steps under Test Suite. 

 

Refer to my youtube video which I created for the same. SOAPUI Framework

With Regards
Vallalarasu Pandiyan | LinkedIn |Vallalarasu.p@gmail.com
Highlighted
Occasional Contributor

Hello @Vallalarasu_P,

 

Maybe I am not very clear in my issue. Appologies from my end.

 

Actually I need to create groovy Test steps in my Test cases dynamically (on the go).

 

The Test cases I am running now, do not have a perticular function, which is needed to execute. So I need to add 

 

a groovy Test Step to execute some groovy codes. I can manually add the groovy Test Step in each test case and

 

run my test suite. But, manually adding test step is taking too much of my effort. So i was wondering that if I can 

 

a groovy code in my Startup script, which will in turn add groovy Test steps in all my Test cases. if this scenario is

 

possible, then can someone please share how to achieve this.

 

Thanks, 

SumitM

Highlighted
Frequent Contributor

Adding New TestSuite
def suite = context.testCase.testSuite.project.addNewTestSuite("AutomatedTestSuite")

Adding New TestCase
def tc = suite.addNewTestCase("automatedTestCase")

// get a Test Step
def project = context.testCase.testSuite.project

Defining the Test Step for the Suite,Testcase and TestStep
def testStep = project.testSuites['TestSuiteName'].testCases['TestCaseName'].testSteps['testStepName']
// add it to your new generated testCase
tc.cloneStep(testStep,testStep.name + "_Copy")

 

Hope this helps

With Regards
Vallalarasu Pandiyan | LinkedIn |Vallalarasu.p@gmail.com
Highlighted
Community Expert

Depending on what exactly you want to do, you could create a custom event to be run before each test case.

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors