XSpec 0.3.0 - A unit test framework for XSLT & XQuery

248 views
Skip to first unread message

Florent Georges

unread,
Sep 21, 2011, 3:58:11 PM9/21/11
to XSpec users list
Hi,

I am proud to announce a new version of XSpec, the XSLT and
XQuery unit testing framework. The main changes are:

- improved XQuery support
- delivered as an EXPath package
- new tests (of XSpec itself)
- numerous bug fixes
- new XProc harnesses for several processors
- improved shell scripts and Ant build file
- oXygen framework for editing
- RNC schema for Emacs nXML mode

You can download it, as usual, from the project website at:

http://code.google.com/p/xspec/downloads/

If your processor supports the EXPath packaging system, you can
just give it the XAR package contained in the release ZIP file.

New XProc pipeline "test harnesses" have developed. They have
been developed with XML Calabash, and allow you to run your tests
on (in alphabetical order):

- BaseX (using the standalone processor)
- eXist (by sending the query through the REST interface)
- MarkLogic (by using Calabash's extension steps)
- Saxon, both XSLT and XQuery
- Zorba

As always, feedback welcome on this list. Enjoy!

Thanks to the whole XSpec team! Regards,

--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/

Cosafina

unread,
Sep 22, 2011, 12:40:31 PM9/22/11
to XSpec
Hi,
I downloaded XSpec 3 but I can't get it to work - it can't seem to
find half the stylesheets used for producing the reports.
XSpec2 works just fine - I've integrated it with Oxygen and am
enjoying learning it!
Many thanks for your efforts.

Florent Georges

unread,
Sep 22, 2011, 12:49:14 PM9/22/11
to xspec...@googlegroups.com
On 22 September 2011 18:40, Cosafina wrote:

Hi,

> I downloaded XSpec 3 but I can't get it to work - it can't seem to
> find half the stylesheets used for producing the reports.

Mmh, quite weird. The structure of the delivery has changed between
0.2 and 0.3.0. The stylesheets to format the report to HTML are in
xspec-0.3.0/src/reporter/. The main stylesheets to "compile" the
XSpec test suites to either XSLT or XQuery are in
xspec-0.3.0/src/compiler/.

Unless you describe your problem more precisely, I'm afraid we don't
have enough information to solve it.

Thanks for your email, regards,

Cosafina

unread,
Sep 23, 2011, 11:43:27 AM9/23/11
to XSpec
Yes, I think it's the change of structure that might be causing the
problem.
I'm running Xspec within Oxygen (as described at
http://www.wordsinboxes.com/2008/12/getting-started-with-xspec.html)
and it's having difficulty.

If I run xspec2 I have no problems, but v3 can't seem to find generate-
xspec-tests.xsl nor format-xspec-report.xsl. I have set the Working
directory for Oxygen to be C:\XSLTest\xspec\xspec-0.3.0.

Here's the output from my latest attempt (I call my sandbox folder
Junk - please don't think it's a reflection on Xspec!):

Started: "C:\XSLTest\xspec\xspec-0.3.0\bin\xspec.bat" C:\Junk\tutorial
\helper-utilities.xspec
Creating Test Stylesheet...
"C:\Junk\tutorial\xspec\helper-utilities.xsl"
C:\Junk\tutorial\helper-utilities.xspec
Stylesheet file C:\XSLTest\xspec\xspec-0.3.0\bin\generate-xspec-
tests.xsl does not exist

Running Tests...
Stylesheet file C:\Junk\tutorial\xspec\helper-utilities.xsl does not
exist

Formatting Report...
Transformation failed: Source file C:\Junk\tutorial\xspec\helper-
utilities-result.xml does not exist
'"C:\Junk\tutorial\xspec\helper-utilities-result.html"' is not
recognized as an internal or external command,
operable program or batch file.
Done.
Process ended with exit code: 0

If I run xspec2 (using the same Junk directory) it produces all the
reports - which v3 will then use but it still can't find the
stylesheet for generating the tests nor formatting the report.

I'm not familiar with %~dp0 but xspec.bat (bundled with v3) seems to
be looking in the same directory for the two stylesheets (at lines 53
and 77)?
Line 53: java -cp "%CP%" net.sf.saxon.Transform -o:%TEST_STYLESHEET% -
s:%XSPEC% -xsl:"%~dp0\generate-xspec-tests.xsl"
Line 77: java -cp "%CP%" net.sf.saxon.Transform -o:%HTML% -s:%RESULT% -
xsl:"%~dp0\format-xspec-report.xsl"
even though those two files are in different directories.

Hope this helps,
Kate

Florent Georges

unread,
Sep 23, 2011, 4:26:16 PM9/23/11
to xspec...@googlegroups.com
On 23 September 2011 17:43, Cosafina wrote:

Hi,

> If I run xspec2 I have no problems, but v3 can't seem to find
> generate-xspec-tests.xsl nor format-xspec-report.xsl.

It seems you found a bug in 0.3.0. As the changes in structure
happended not a long time before the release, and I have no
Windows machine to test the Batch script, I missed some changes
in the Batch script regarding the relative paths between the
script and the stylesheets.

Can you please try to change the following paths:

%~dp0\generate-xspec-tests.xsl
%~dp0\format-xspec-report.xsl
%~dp0\coverage-report.xsl

into (resp. lines 53, 77 and 85):

%~dp0\..\src\compiler\generate-xspec-tests.xsl
%~dp0\..\src\reporter\format-xspec-report.xsl
%~dp0\..\src\reporter\coverage-report.xsl

That should hopefully solve your problem.

Thanks for your help! Regards,

Cosafina

unread,
Sep 26, 2011, 8:26:25 AM9/26/11
to XSpec
Yep, that's done the trick - thanks!
I also put the coverage stylesheet path into quotes (at line 85) since
I read somewhere that you found you needed the quotes at lines 53 and
77.
What param(s) am I meant to pass to coverage? I can't find anything
so far that tells me.
Thanks for YOUR help!
Kate

Florent Georges

unread,
Sep 26, 2011, 11:35:33 AM9/26/11
to xspec...@googlegroups.com
On 26 September 2011 14:26, Cosafina wrote:

Hi Kate,

> Yep, that's done the trick - thanks!

Good, I've just checked it in SVN.

> I also put the coverage stylesheet path into quotes (at line
> 85) since I read somewhere that you found you needed the quotes
> at lines 53 and 77.

That's right, I saw it to when looking for the paths.

> What param(s) am I meant to pass to coverage? I can't find
> anything so far that tells me.

Honestly, I never used it myself, and it seems it is not
maintained anymore. Normally you just have to call the script
with an extra param "coverage" at the end of the command line.

But the thing is that it relies on a Java class which is an
implementation of Saxon's TraceListener. The name of this
interface has changed between 9.2 and 9.3 so it is not possible
to have a portable class without knowing the version of Saxon.

Furthermore, the stylesheet that formats the coverage report
uses saxon:line-number() which is not available neither in 9.3
nor 9.2 (I am not sure excatly where it stopped to be available
in the free edition of Saxon, I bet in 9.2 when Saxon B switched
to Saxon HE).

For the first point (the Java class), I guess we can say that
Saxon 9.3 has been out for more than one year now, so it is time
to switch to it. For the second point (the saxon:line-number()),
we need to investigate further and find an alternative (that
could be an extension function as we already depends our own Java
classes for coverage).

Sorry I can't help you more on coverage. Maybe someone else?
If you find anything, we'd be interested to hear about it.

Reply all
Reply to author
Forward
0 new messages