R: [Webtest] Validating SOAP response against XML Schema

Caleandro Caleandro" <kalosandros@katamail.com
Fri, 24 Nov 2006 15:15:47 +0100


Hi, Marc
Yes, i need to obtain a test report where the step of xmlvalidation is shown
as succeeded o failed as the case.
Now I'm using the build 1245 of Webtest 2.0.

The portion of my script is, by example:
****************************************************************************
*******
<steps>
 <antWrapper description="prova di ANT Wrapping">
    <record name="validazione.txt" action="start"/>
    <xmlvalidate failonerror="no" warn="yes"
classname="org.apache.xerces.parsers.SAXParser"
file="D:\TestsRoot\...\soap002.xml">
    	<classpath path="D:\JavaTools\xerces-2_8_1" location="xercesImpl.jar"
/>
    	<attribute name="http://xml.org/sax/features/validation"
value="true"/>
      <attribute name="http://apache.org/xml/features/validation/schema"
value="true"/>
    	<attribute name="http://xml.org/sax/features/namespaces" value="true"/>
    	<property
name="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLoca
tion" value="D:\TestsRoot\...\Envelope.xsd"/>
    </xmlvalidate>
    <record name="log.txt" action="stop"/>
 </antWrapper>
 <invoke url="file://D:\CanooWebTest_2_0\jobScripts\validazione.txt"/>
 <not>
 		<verifyText text="is not a valid XML document" description="verifica
validazione XML"/>
 </not>
</steps>
****************************************************************************
*

As one can see, the script tries to verify the absence of invalidation
message in the ant-step log file, because of: if the same fail, Webtest
would report anyway the success of wrapped step.

This solution, I admit, is a bit tricky, and therefore I look for a more
elegant solution.

As soon  I can, I will download and try latest Webtest build.

Thank you very much for soggestions.
Greetings,
Vito



-----Messaggio originale-----
Da: webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com]Per conto di Marc Guillemot
Inviato: giovedý 23 novembre 2006 16.26
A: webtest@lists.canoo.com
Oggetto: Re: [Webtest] Validating SOAP response against XML Schema


Hi,

you want the test to fail if xmlvalidate fails? Is xmlvalidate's
failonerror set to true? If it is the case and if the validation fails,
then the webtest should fail too.

Btw, it probably works better with a post release 2.1 build of WebTest
(for instance the last one) as the normal ant task are now handled just
like WebTest steps.

Marc.


Caleandro wrote:
> Hi all,
>
> In a test-case  I have to validate a SOAP response message coming from a
> web-service against his XML Schema.
> I tried to do this with an <antWrapper> step by <xmlvalidate> task and all
> goes fine but, how could I obtain the Canoo step failure when the
validation
> fails?
> The wrapped step always return ok. Do Anyone knows a more suitable way to
do
> the same thing?
> Tanks in advance for any suggestion.
> Vito
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest
>

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest