creating groovy teststep with code via groovy
How can I create a testsuite/testcase/groovy teststep via another groovy step.
I have a groovy step in testSuite1-->Testcase1-->'groovy step'
I need this groovy step to do the following
1. Create testsuite2
2. Create testcase2 (inside testsuite2)
3. Create 'groovy teststep' in testsuite2-->testcase2 with the following code
-- log.info('hello world')
4. Save project.
suite = context.testCase.testSuite.project.addNewTestSuite("ali")
tc = suite.addNewTestCase("test case ali")
gs = tc.addTestStep( GroovyScriptStepFactory.GROOVY_TYPE, "ali's GroovyScript" )
gs.properties["script"].value = 'log.info(\'hello world\')'
Try this, and let me know does it helps,
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Thanks for the example.
What I am trying to achieve is to dynamically create a SOAP UI request in its own test suite using groovy scripting. very similar to the example below but instead of GroovyScriptStepFactory, I need a SOAPScriptStepFactory if you know what I mean.
Because, in order to achieve whatever you are talking via groovy script, it is required to do you need to do the same.
what is your use case?
Is not it simple to create a test suite -> test case with dynamic steps in your case as needed.