[xsl] RE: [xml-dev] Announce: Unit Testing Framework - XSLT (UTF-X)

Subject: [xsl] RE: [xml-dev] Announce: Unit Testing Framework - XSLT (UTF-X)
From: "Jacek Radajewski" <jacek.radajewski@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Oct 2005 08:49:40 +1000
Hi Michael,

Thank you for your questions.

>>> "Michael Kay" <mike@xxxxxxxxxxxx> 10/10/2005 8:02:08 am >>>
> You can download UTF-X from http://utf-x.sf.org 

http://utf-x.sf.net  sorry.  It should resolve to
utf-x.sourceforge.net

I think you mean http://utf-x.sourceforge.net/ 


I'm afraid that in the course of 10 minutes browsing, I wasn't able to
get a
grasp of what the product does - documentation seems to assume the
reader
already knows. For example I couldn't see:

Documentation (or lack of it) is currently the bigest problem with
UTF-X.  There'll be more in release 0.0.7.  The existing 2 pages of
documentation does assume one has used JUinit and XSLT with Java 

* how to specify which XSLT processor to use
UTF-X uses standard JAXP API and therefore should work with all JAXP
compliant processors.  You just need to pass
javax.xml.transform.TransformerFactory property to the JVM.  If you
don't pass this then Java will use the default configured for your Java
installation or the first found in your classpath.  Having said that let
me add that I've only tested UTF-X with xerces/xalan cobination.


* how to supply stylesheet parameters
not yet supported.  Will be most likely shipped with 0.0.8

* how to specify other XSLT processor options
My guess is some sort of properties file; depends on processor.  Some
things are set in the framework.  What exactly did you want to set?


* how results are canonicalized before comparison
Using a class utfx.util.CanonicalForm which is shipped with the
framework.  Do you want to use your own class/method?


* how to handle stylesheets whose output is HTML
Just like any other stylesheet except with HTML generating stylesheets
you can render the tests to see the output generated by <utfx:expected>

The system seems to require source XML documents to be included inline
within a <utfx:source> element of the test catalogue. So how do you
handle
DOCTYPE declarations, entity definitions, etc?
Have a look at samples/utfxdoc/test/utfxdoc_xhtml_test.xml (see below).
 Both <utfx:source> and <utfx:expected> elements have content model of
ANY.  You can include your own and xhtml DTDs in the doctype like the
example below shows, and your XML editor should read all three DTDs 
(Oxygen XML does).  UTF-X uses <utfx:source-validation> and
<utfx:expected-validation> to specify how to validate source and
expected fragments.  You can disable this validation on individual tests
by setting validate attribute to 'false'.

Also you should NOT include whole XML documents in <utfx:source>, only
small XML fragments.  The best stategy is to test at template level,
i.e. one or more tests for each template.  Have a look at the samples.

When running the tests you may need to comment out your own and xhtml
DTDs from the doctype because of a bug (issue 12).  When the tests are
parsed the parser automatically resolves all default attribute values
from the DTD so <utfx:expected> changes after initial parsing.  One
should be able to disable this in the parser, but this does not work
with xerces shipped with the framework.  May work with other parsers.


<!DOCTYPE utfx:tests PUBLIC "-//UTF-X//DTD utfx-tests 1.0//EN"
"utfx_tests.dtd" [

<!-- import utfxdoc.dtd so we can validate <utfx:source> content in an
XML editor -->
<!ENTITY % utfxdoc PUBLIC "-//UTF-X//DTD utfxdoc 1.0//EN"
"utfxdoc.dtd">
	%utfxdoc;
 
 <!-- import XHTML 1.0 DTD so we can validate <utfx:expected> content
in an XML editor -->
<!ENTITY % xhtml1_dtd PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"xhtml1-transitional.dtd">
    <!-- leave commented out when running tests: see issue 12 -->
    <!-- %xhtml1_dtd; -->
]>


<utfx:tests xmlns:utfx="http://utfx.org/test-definition";>
	<utfx:stylesheet src="utfxdoc_xhtml.xsl" />

<utfx:source-validation>
    <utfx:dtd system="utfxdoc.dtd" 
	    public="-//UTF-X//DTD utfxdoc 1.0//EN"/>
</utfx:source-validation>

<utfx:expected-validation>
    <utfx:dtd system="xhtml1-transitional.dtd" 
    public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
</utfx:expected-validation>

 

And surely the utfx namespace
will leak into the document under test, affecting the test results?
I don't think it does, why would this be a problem?

Once again thank you for your feedback.  I hope I've answered at least
some of your question.

Cheers

Jacek


Michael Kay 
http://www.saxonica.com/ 


> -----Original Message-----
> From: Jacek Radajewski [mailto:jacek.radajewski@xxxxxxxxxxxxxxxxxxx]

> Sent: 09 October 2005 22:19
> To: xml-dev@xxxxxxxxxxxxx 
> Subject: [xml-dev] Announce: Unit Testing Framework - XSLT (UTF-X)
> 
> Hi All,
> 
> UTF-X is a JUnit extension for testing XSLT stylesheets.  We've
> developed it at USQ for unit testing our stylesheets about three
years
> ago, and two years ago released it under GPL.  Although still in
Alpha
> versions UTF-X works well and has been used in reasonable 
> size projects
> (over 1500 templates/tests).  UTF-X tests or Test Definition Files
> (TDFs) are XML documents which can be validated and rendered.  Being
> able to render your tests works well for the 
> test-first-design approach
> as you can write all your tests, validate them against your 
> and/or xhtml
> DTD and render them for visual inspection.  If everything is 
> OK you can
> write your templates untill all tests pass.  UTF-X requires Java
5.0.
> 
> You can download UTF-X from http://utf-x.sf.org 
> 
> Mailing lists, CVS and bug tracking are available at
> https://utf-x.dev.java.net 
> 
> Enjoy!
> 
> Jacek
> 
> 
> 
> **************************************************************
> *************
> Messages included in this e-mail and any of its attachments are
those
> of the author unless specifically stated to represent 
> WorkCover Queensland. The contents of this message are to be 
> used for the intended purpose only and are to be kept 
> confidential at all times.
> This message may contain privileged information directed only 
> to the intended addressee/s. Accidental receipt of this 
> information should be deleted promptly and the sender notified.
> This e-mail has been scanned by Sophos for known viruses.
> However, no warranty nor liability is implied in this respect.
> **************************************************************
> **************
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/ 
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
> 
> 








***************************************************************************
Messages included in this e-mail and any of its attachments are those
of the author unless specifically stated to represent WorkCover Queensland. The contents of this message are to be used for the intended purpose only and are to be kept confidential at all times.
This message may contain privileged information directed only to the intended addressee/s. Accidental receipt of this information should be deleted promptly and the sender notified.
This e-mail has been scanned by Sophos for known viruses.
However, no warranty nor liability is implied in this respect.
****************************************************************************

Current Thread