Forum Discussion

Frank_Cohen's avatar
Frank_Cohen
Occasional Contributor
13 years ago

WsdlTestCaseRunner not returning a result code

TestMaker's soapUI script runner is not seeing the result code when an assertion fails in the soapUI TestSuite. What API should we use to get the assertion failure message? Here is a snippet of code we use to call soapUI.

Thanks, in advance.

-Frank

---

This is the code we are using to figure soapui assertion but does not work:

WsdlTestCaseRunner runner = testcase.run(pmap, false);

if (TestRunner.Status.FINISHED.compareTo(runner.getStatus()) != 0) {
if (runner.getError() instanceof Exception) {
throw (Exception) runner.getError();
}

throw new Exception(runner.getError());
}

2 Replies

  • Frank_Cohen's avatar
    Frank_Cohen
    Occasional Contributor
    I see 9 reads of this and not suggestion on a solution. Anyone want to offer some advice?

    -Frank
  • Frank_Cohen's avatar
    Frank_Cohen
    Occasional Contributor
    I'm making a little progress here using this code:

    WsdlTestCaseRunner runner = testcase.run(pmap, false);

    if (TestRunner.Status.FAILED.compareTo(runner.getStatus()) != 0) {
    // We never get here. Appears to be a bug.
    }

    if (TestRunner.Status.FINISHED.compareTo(runner.getStatus()) != 0) {
    Iterator it=runner.getResults().iterator();
    while(it.hasNext())
    {
    TestStepResult tsr=(TestStepResult)it.next();

    System.out.println( "Frankolo3: " + tsr.getError() );

    for(String n: tsr.getMessages())
    {
    System.out.println( "frankolo5: " + n+" ");
    }
    }
    }

    I added an XPath assertion that purposely fails. Here's what I see logged:

    Frankolo3: null
    frankolo5: [XPath Match] XPathContains assertion failed for path [//part[1]] : Exception:org.custommonkey.xmlunit.Diff
    [different] Expected attribute value '20' but was '10' - comparing <part location="20"...> at /part[1]/@location to <part location="10"...> at /part[1]/@location

    Next I'm going to look for how to detect this as an exception.

    Hey! At 34 views of this thread, someone else should have solve this! Anyone?!#@ :-)

    -Frank