R: R: [Webtest] Validating SOAP response against XML Schema

Caleandro Caleandro" <kalosandros@katamail.com
Mon, 27 Nov 2006 11:18:28 +0100


Hi Marc,

The answer is that if I set failonerror="yes", on failing a xmlvalidation I
get a Webtest break with a long console output like:
Test failed.
Exception raised: com.canoo.webtest.engine.StepExecutionException:
Unexpected exception caught: D:\TestsRoot\TG4\BatchTests\Wrap
tsRoot\TG4\BatchTests\soap001.xml is not a valid XML document., Step:
AntWrapper at D:\TestsRoot\TG4\BatchTests\WrappingAnt.xml:
="prova di ANT Wrapping",
taskName="antWrapper")com.canoo.webtest.engine.StepExecutionException:
Unexpected exception caught: D:
sts\WrappingAnt.xml:26: D:\TestsRoot\TG4\BatchTests\soap001.xml is not a
valid XML document., Step: AntWrapper at D:\TestsRoot\T
Ant.xml:24:  with (description="prova di ANT Wrapping",
taskName="antWrapper")
        at
com.canoo.webtest.steps.Step.handleUnexpectedException(Step.java:463)
        at com.canoo.webtest.steps.Step.execute(Step.java:139)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at
com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:58
)
        at
com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:39)
        at com.canoo.webtest.steps.Step.execute(Step.java:132)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:155)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckEx
ecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: D:\TestsRoot\TG4\BatchTests\WrappingAnt.xml:26:
D:\TestsRoot\TG4\BatchTests\soap001.xml is not a valid XML document.
        at
org.apache.tools.ant.taskdefs.optional.XMLValidateTask.doValidate(XMLValidat
eTask.java:474)
        at
org.apache.tools.ant.taskdefs.optional.XMLValidateTask.execute(XMLValidateTa
sk.java:277)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at
com.canoo.webtest.extension.AntWrapper.doExecute(AntWrapper.java:96)
        at com.canoo.webtest.steps.Step.execute(Step.java:132)


But I simply wish something like :

.... step failed...(maybe "...due to xml-validation error ....")

I will try if new Webtest  build (I downloaded 1393) can help me.

Bye,
Vito







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


Hi Vito,

why do you use failonerror="no"?

Marc.

Caleandro wrote:
> 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
>
> _______________________________________________
> 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