header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
October 14, 2008, 03:22:56 pm
Username: Password:
Login with username, password and session length

Forgot your password?
 
Adding service steps with groovy
Welcome, Guest. Please login or register.
October 14, 2008, 03:22:56 pm
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  Adding service steps with groovy
« previous next »
Pages: [1] Print
Author Topic: Adding service steps with groovy  (Read 462 times)
Jerry
Newbie
*
Posts: 1


« on: July 19, 2007, 06:19:05 pm »

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.

Code:
// 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  );

Logged
omatzura
soapui pro users
Hero Member
*
Posts: 1,326


« Reply #1 on: July 19, 2007, 08:48:11 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..

Code:
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
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header