Forum Discussion

shiva_kakarla's avatar
shiva_kakarla
Contributor
17 years ago

Executing SOAP tests using Groovy script

Hi Ole,

I am trying to load a SOAP Project and execute tests from a Groovy Script.

I am using WsdlTestCaseRunner and it does not seem to recognize datasources and loops. I know only SoapUiProTestCaseRunner recognizes. I am not sure how to get the reference of it. 
1. Is there a documentation on how to use it?
2.  Also I need to know the testcase status if its passed or failed. Could you please let me know if there is a way to get the status too?

Here is the code snippet that I have written to execute tests.

WsdlProject project = new WsdlProject(soapTestProj);
 
println("wsdlprojct created")

Map testSuiteMap = project.getTestSuites();
Iterator x = testSuiteMap.keySet().iterator();
while( x.hasNext())
{

String testsuiteName = (String) x.next()
println("testsuite is::"+testsuiteName)


WsdlTestSuite wsdlTestSuite= project.getTestSuiteByName(testsuiteName);

Map testCaseMap=wsdlTestSuite.getTestCases();
Iterator tcase = testCaseMap.keySet().iterator();

while(tcase.hasNext())
{
    String testCase=(String) tcase.next()

    println("Executing:"+testCase);
    WsdlTestCaseRunner testcaseRunner=project.getTestSuiteByName(testsuiteName).getTestCaseByName(testCase).run(new StringToObjectMap() ,false)
println("Finished Executing:"+testCase);
    List stepResult=testcaseRunner.getResults()
    Iterator j=stepResult.iterator();
    while (j.hasNext())
{
  TestStepResult result=(TestStepResult)j.next();
  println("result:"+result.getStatus())

}

    }

}
No RepliesBe the first to reply