Forum Discussion

kamahade's avatar
kamahade
Regular Contributor
15 years ago

Adding Testcases to testsuite using API

I could able to create project, add testsuite..Now, how to add testcases for each operation to Testsuite and then add teststeps as well?

"testRunner" object is NOT visible outside SoapUI. I tried to unpack and learn "package com.eviware.soapui.config;" and I could not find anyuseful docs.

How to create new instance of Testsuiteconfig ?

public static TestSuiteConfig newInstance()
{
return (TestSuiteConfig)XmlBeans.getContextTypeLoader().newInstance(TestSuiteConfig.type, null);
}

any help would be appreciated..


 def iface= WsdlInterface[];
WsdlProject project = new WsdlProject();
iface= WsdlImporter.importWsdl( project, "D:\\Systest\\B\\wsdl\\PerformanceRoleService_SOAP.wsdl");
project.setName("PerformanceRoleService");

for ( operationName in project.getInterfaceAt(0).getOperationList() ) {
def testsuiteName=operationName.getName();
ws= project.addNewTestSuite(testsuiteName);
testStepName="request_" + operationName.getName()
op = project.interfaces[interfaceName].operations[operationName.getName()];
config = com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestRequestStepFactory.createConfig( op, testStepName );
//newTestStep = testRunner.testCase.addTestStep( config );
}
  • Hello,

    If you were able to create a TestSuite, you should be able to access the TestSuiteConfig for it by calling testSuite.getConfig(); To add a new TestCase to the TestSuite, you can call testSute.addNewTestCase( String name ), which returns a WsdlTestCase. Then to add a TestStep to the TestCase, call testCase.addTestStep( String type, String name ), or testCase.addTestStep( String type, String name, String endpoint, String method ); (for HttpRequestSteps).

    Regards,
    Dain
    eviware.com