Running with BaseX
BaseX is an open source XML database engine and XPath/XQuery 3.1 processor. BaseX can be run as standalone, web application, database server, GUI application, etc.
Running XSpec tests with BaseX requires an XProc implementation. XML Calabash is used here as an example; follow these instructions to set up XML Calabash and store the XML Calabash jar file in a local directory (e.g. ~/xml/xmlcalabash
for Linux/macOS or C:\xmlcalabash
for Windows).
-
Download the ZIP package of BaseX and extract it to a local directory (e.g.
~/xml/basex
for Linux/macOS orC:\basex
for Windows). -
Make sure a required version of Java Runtime Environment is installed, e.g.:
java -version
-
Make sure XSpec is available in a local path (e.g.
~/xml/xspec
for Linux/macOS orC:\xspec
for Windows). -
Navigate to your XSpec directory.
-
Run an XSpec test for XQuery as follows:
For Linux/macOS:
java -jar ~/xml/xmlcalabash/xmlcalabash-1.2.5-99.jar \ -i source=tutorial/xquery-tutorial.xspec \ -p xspec-home=file:/home/myself/xml/xspec/ \ -p basex-jar=/home/myself/xml/basex/BaseX.jar \ -o result=tutorial/xquery-tutorial-result.html \ src/harnesses/basex/basex-standalone-xquery-harness.xproc
For Windows:
java -jar C:\xmlcalabash\xmlcalabash-1.2.5-99.jar ^ -i source=tutorial/xquery-tutorial.xspec ^ -p xspec-home=file:///C:/xspec/ ^ -p basex-jar=C:\basex\BaseX.jar ^ -o result=tutorial/xquery-tutorial-result.html ^ src\harnesses\basex\basex-standalone-xquery-harness.xproc
where:
-
-cp
is the classpath where XML Calabash is installed -
-i source
is the input port with the XSpec test for XQuery to be executed -
-o result
is the output port where the HTML report will be stored -
-p xspec-home
is the absolute URI of the XSpec installation -
-p basex-jar
is the jar file of BaseX -
basex-standalone-xquery-harness.xproc
is the XProc harness for BaseX standalone
-
The output result from the command line may look like this:
INFO : src/harnesses/harness-lib.xpl:267:45:passed: 1 / pending: 0 / failed: 0 / total: 1
And the HTML report file is created in the location specified by -o result=
.
To run XSpec with BaseX server using its RESTful API, run XProc just like the steps with BaseX standalone but with these differences:
- Instead of the
basex-jar
parameter, provideendpoint
,username
,password
andauth-method
- Instead of the
basex-standalone-xquery-harness.xproc
harness, usebasex-server-xquery-harness.xproc
For Linux/macOS:
java -jar ~/xml/xmlcalabash/xmlcalabash-1.2.5-99.jar \
-i source=tutorial/xquery-tutorial.xspec \
-p xspec-home=file:/home/myself/xml/xspec/ \
-p endpoint=http://localhost:8984/rest \
-p username=admin \
-p password=admin \
-p auth-method=Basic \
-o result=tutorial/xquery-tutorial-result.html \
src/harnesses/basex/basex-server-xquery-harness.xproc
For Windows:
java -jar C:\xmlcalabash\xmlcalabash-1.2.5-99.jar ^
-i source=tutorial/xquery-tutorial.xspec ^
-p xspec-home=file:///C:/xspec/ ^
-p endpoint=http://localhost:8984/rest ^
-p username=admin ^
-p password=admin ^
-p auth-method=Basic ^
-o result=tutorial/xquery-tutorial-result.html ^
src\harnesses\basex\basex-server-xquery-harness.xproc
If you have any questions about XSpec or want to discuss, contribute, and share information with the XSpec community, please go to our issue tracker.
For historical searches, the Google group might also be useful.
- Writing Scenarios
- Nesting Scenarios
- Focusing Your Efforts
- Global Context Item
- Selecting Nodes
- Whitespace-only Text Nodes
- Attribute Value Templates
- Text Value Templates
- Special Names
- Code Coverage
- XML Catalog Support
- Environment Variables
- Testing Dynamic Errors
- Integrating Your Own Test Helpers
- External Transformation
- Getting Started with XSpec and Schematron
- Writing Scenarios for Schematron
- Testing Schematron with Text Nodes
- Testing Schematron with Attributes
- Using Another Implementation of Schematron