Domanda

I have problem with creating test via groovy script. I need generate url in code and get response to variable.

We can use existing test by next code.

def testRunnerMap = testRunner.testCase.getTestStepByName("REST Test Request")

Can we create test by groovy ?

please help me

È stato utile?

Soluzione

You may be looking for something like below. I got this code from http://forum.soapui.org/viewtopic.php?f=2&t=4579

import com.eviware.soapui.impl.wsdl.teststeps.registry.GroovyScriptStepFactory
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\')'
context.testCase.testSuite.project.save()
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top