XQuery Unit Testing

I work with a document repository using XQuery (through the Java and .NET interfaces), and wondered if anyone has any recommendations on unit testing XQuery modules?

+6
unit-testing xquery
source share
4 answers

Here is a quick DIY solution for this problem: Poor module testing with XQuery (dead link).

This approach appears to have been covered and extended for xprocxq project tests .

There are other tools, such as XTC .

+1
source share

There are several modules for testing XQuery modules, but most of them are designed specifically for a specific XQuery processor. This is not a complete list, but includes most of the popular ones that I know of:

Marklogic

Roxy Unit Tester https://github.com/marklogic/roxy/wiki/Unit-Testing

XQUT https://github.com/mblakele/xqut

xray https://github.com/robwhitby/xray

EXISTS

XQSuite http://exist-db.org/exist/apps/doc/xqsuite.xml

Basex

XQuery module module http://docs.basex.org/wiki/Unit_Module

+2
source share

This link can create your development. This is just an idea, but you can develop and expand it with various body design ideas.

Since Xml is the king in the world of metadata, it is fairly easy to design and run.

  • create a test case Xml, getting all the data

    • test data (input and expected result)
    • test case identifier
    • local test case methods
  • dynamically reference details.

the functions

sample test script

results

0
source share

Try XQSuite

This is a pretty spot; here is a "minimal example":

declare namespace test="http://exist-db.org/xquery/xqsuite";

declare function %test:assertEquals("Hello world") local:hello() { "Hello world" };

XSpec also works great for testing XSLT (for example, it provides well-formatted HTML test results). BUT it seems like a bit of work is needed with XQuery testing. Over the past few years, the project has become inactive.

0
source share

All Articles