Adding service steps with groovy
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007
10:19 AM
07-19-2007
10:19 AM
Adding service steps with groovy
I know that with groovy you can add any of the steps that come built in as is shown in the tutorial. But, let's say that I'm testing the amazon service and I want to add the CartAdd step to my testcase.
How do I add request steps to the test case? I tried to do something
crazy. See below for what I did.
How do I add request steps to the test case? I tried to do something
crazy. See below for what I did.
// add a properties step
def step = (com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep)(testRunner.getTestCase().getTestSuite().getTestCaseByName( "haha").getTestStepByName( "CartClear" ) )
((com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep)testRunner.testCase).importTestStep( (step), "CartAdd", 1 );
1 REPLY 1
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007
12:48 PM
07-19-2007
12:48 PM
Hi Jerry,
try the following for adding an existing "CartAdd" request named "Request 1" to the current testcase as a TestRequest with a SoapResponse assertion..
You need to be sure that the name specified in the createConfig call is unique for the testcase, otherwise a prompt will be displayed for a new name..
Hope this helps!
regards,
/Ole
eviware.com
try the following for adding an existing "CartAdd" request named "Request 1" to the current testcase as a TestRequest with a SoapResponse assertion..
import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory
import com.eviware.soapui.impl.wsdl.teststeps.assertions.SoapResponseAssertion
// get request
def iface = testRunner.testCase.testSuite.project.getInterfaceByName( "AWSECommerceServicePortType" )
def request = iface.getOperationByName( "CartAdd" ).getRequestByName( "Request 1" )
// create config and add teststep
def config = WsdlTestRequestStepFactory.createConfig( request, "CartAdd RequestStep" )
def testStep = testRunner.testCase.insertTestStep( config, -1 )
// add a soapresponse assertion
testStep.testRequest.addAssertion( SoapResponseAssertion.ID )
You need to be sure that the name specified in the createConfig call is unique for the testcase, otherwise a prompt will be displayed for a new name..
Hope this helps!
regards,
/Ole
eviware.com
