DaveLister
13 years agoNew Contributor
Validating Requests in TestSuite
Hi everyone. I've recently been using SoapUI's TestSuite to validate some of my webservices, and I have a fairly decent test coverage now. I have noticed one small problem, and haven't been able to find an adequate solution.
The problem is that if someone's changes a namespace in our WSDL, the SoapUI TestSuite still passes all tests successfully, even if one of the TestRequests now defines an invalid namespace. The SchemaCompliance assertion will pass, but if we validate the request (using Alt+V, or enabling it in preferences -> editor), we receive some errors.
A small sample of what I mean is the following:
Original Request
This passes the SchemaCompliance, and the request is validate using Alt+V. Now, we change the tst1 namespace (say we have versioned that schema to add a new mandatory element). The WSDL no longer contains the http://www.sample.com/some/example/dir/model/test namespace, but rather the http://www.sample.com/some/example/dir/model/test/v2 namespace. The SchemaCompliance assertion will still pass though, even though Alt+V provides an output similar to:
In the Preferences -> Editor, we can choose to abort the request if the validation fails. This, however, still flags the test as successful. I assume the SchemaCompliance only validates the response, and not the request (as I had initially thought).
I've noticed that my property transfer tests, however, will fail. They declare the namespaces (in order to use XPath or XQuery to transfer values).
Is there any way to test the request and fail if it doesn't validate? Or perhaps fail a TestRequest if it is aborted? Or perhaps use an XPath/XQuery check to emulate such a feature?
Apologies if this question has been asked before. I've searched back quite a bit on the forums and Google for an answer, but haven't found anything yet.
Edit: I mean to mention that I'm using the free version of 4.5.1.
The problem is that if someone's changes a namespace in our WSDL, the SoapUI TestSuite still passes all tests successfully, even if one of the TestRequests now defines an invalid namespace. The SchemaCompliance assertion will pass, but if we validate the request (using Alt+V, or enabling it in preferences -> editor), we receive some errors.
A small sample of what I mean is the following:
Original Request
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tst="http://www.sample.com/some/example/dir/service/test"
xmlns:tst1="http://www.sample.com/some/example/dir/model/test">
<soapenv:Body>
<tst:TestGroupRequest>
<tst:TestGroup>
<tst1:Test1>first</tst1:Test1>
<tst1:Test2>second</tst1:Test2>
</tst:TestGroup>
</tst:TestGroupRequest>
</soapenv:Body>
</soapenv:Envelope>
This passes the SchemaCompliance, and the request is validate using Alt+V. Now, we change the tst1 namespace (say we have versioned that schema to add a new mandatory element). The WSDL no longer contains the http://www.sample.com/some/example/dir/model/test namespace, but rather the http://www.sample.com/some/example/dir/model/test/v2 namespace. The SchemaCompliance assertion will still pass though, even though Alt+V provides an output similar to:
line 14: Expected element 'Test1@http://www.sample.com/some/example/dir/model/test/v2' instead of 'Test1@http://www.sample.com/some/example/dir/model/test' here in element TestGroup@http://www.sample.com/some/example/dir/service/test
line 15: Expected element 'Test1@http://www.sample.com/some/example/dir/model/test/v2' instead of 'Test2@http://www.sample.com/some/example/dir/model/test' here in element TestGroup@http://www.sample.com/some/example/dir/service/test
line 16: Expected element 'Test1@http://www.sample.com/some/example/dir/model/test/v2' before the end of the content in element TestGroup@http://www.sample.com/some/example/dir/service/test
In the Preferences -> Editor, we can choose to abort the request if the validation fails. This, however, still flags the test as successful. I assume the SchemaCompliance only validates the response, and not the request (as I had initially thought).
I've noticed that my property transfer tests, however, will fail. They declare the namespaces (in order to use XPath or XQuery to transfer values).
Is there any way to test the request and fail if it doesn't validate? Or perhaps fail a TestRequest if it is aborted? Or perhaps use an XPath/XQuery check to emulate such a feature?
Apologies if this question has been asked before. I've searched back quite a bit on the forums and Google for an answer, but haven't found anything yet.
Edit: I mean to mention that I'm using the free version of 4.5.1.