XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
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 
engine.

http://reflex.gforge.inria.fr/xunit.html

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 :
     <xunit:assert-boolean-equals>,
     <xunit:assert-number-equals>,
and <xunit:assert-string-equals>.
Unlike JUnit, there are also assertions that check types related to XML 
such as :
     <xunit:assert-node-equals>
and <xunit:assert-attributes-equals>.
There is also a mean for testing XSLT templates with
     <xunit:apply-xslt-template>.

Example :

<xunit:test-case name="myTest" label="My test">
     <!--run whatever to test here...-->
     <do:it-like-this/>
     <!--...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" 
source="purchase-order-expected.xml"/>
     <!--check if they are equals-->
     <xunit:assert-node-equals result="{ $result }" expected="{ 
$output-expected }" recurse="true"/>
</xunit:test-case>

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 !

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        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