[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

[Testing XML] XUnit, your new companion...

  • From: Philippe Poulard <Philippe.Poulard@s...>
  • To: xml-dev <xml-dev@l...>
  • Date: Tue, 21 Nov 2006 14:42:06 +0100

xunit
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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.