OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
[Testing XML] XUnit, your new companion...

XUnit has been announced with the new release of RefleX, the Active Tags 


XUnit is to XML-oriented Programming as JUnit is to Java programs : you 
run the program to test with given datas, and check that the result get 
are those expected.

The programs that you can test with XUnit are :
-Active Tags programs, that is to say programs made of XML tags
-XSLT stylesheets : XUnit can help you to test your templates individually
-Java programs that are dealing with XML datas : just expose your class 
as a tag inside the engine and you will be able to test it easily with XUnit

Like JUnit, there are assertions that check basic types such as :
and <xunit:assert-string-equals>.
Unlike JUnit, there are also assertions that check types related to XML 
such as :
and <xunit:assert-attributes-equals>.
There is also a mean for testing XSLT templates with

Example :

<xunit:test-case name="myTest" label="My test">
     <!--run whatever to test here...-->
     <!--...say that this application is producing an XML file-->

     <!--retrieve the result and the output expected-->
     <xcl:parse name="result" source="purchase-order.xml"/>
     <xcl:parse name="output-expected" 
     <!--check if they are equals-->
     <xunit:assert-node-equals result="{ $result }" expected="{ 
$output-expected }" recurse="true"/>

If some nodes differ, you'll have the differences notified in the error 
report that you can transform to HTML, as shown in the tutorial 
available with the full distribution of RefleX.

Enjoy !


              (. .)
|      Philippe Poulard       |
        Have the RefleX !

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS