Forum Discussion

HoldenHughes's avatar
HoldenHughes
New Contributor
8 years ago

How to validate a request before inserting it to the current test case in a groovy step?

Hello all,

 

So I have a groovy test step that essentially creates a bunch of different copies a SOAP request of a test step from another test case and inserts it to the current test case. What I want to know is if there is a way to validate the created request before inserting it to the test case?

 

Here is my sample code:

 

import com.eviware.soapui.support.XmlHolder
import groovy.util.*
import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory


//Get the testCase Reference
testCase = testRunner.testCase;
testSuite = testRunner.testCase.testSuite;
project = testSuite.project

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
sourceRequest = testSuite.testCases["addService TestCase"].testSteps["addService-1"].testRequest
String request = sourceRequest.getRequestContent();

def iface = testRunner.testCase.testSuite.project.getInterfaceByName( "WriteServiceBinding" )
def operation = iface.getOperationByName( "addService" );
def requestStep = operation.getRequestByName( "Request 1" )

*/ This request gets edited with Groovy magic not shown here*/


def config = WsdlTestRequestStepFactory.createConfig( requestStep, "New Request" )


*/ How do I validate this request? */

def testStep = testRunner.testCase.insertTestStep(config,-1);

 

 

 

No RepliesBe the first to reply