I've been working with a document repository using XQuery (via Java and .NET interfaces) and was wondering if anyone has any recommendations for unit testing XQuery modules?
Here is a quick DIY type solution for this problem:
Poor man's unit testing with XQuery (dead link).
This approach seems to have been embraced and extended for the tests of the xprocxq project.
Other tools exist, for example XTC.
There are several XQuery unit testing frameworks, but most are special-purpose written for a specific XQuery Processor. This is not a complete list, but includes most of the popular ones I'm aware 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
eXist
XQSuite http://exist-db.org/exist/apps/doc/xqsuite.xml
BaseX
XQuery Unit Module http://docs.basex.org/wiki/Unit_Module
Here is a quick DIY type solution for this problem:
Poor man's unit testing with XQuery (dead link).
This approach seems to have been embraced and extended for the tests of the xprocxq project.
Other tools exist, for example XTC.
This link may spruce your development. This is just an idea but you can develope and enhance more on this with various unit-test case design ideas.
since Xml is a king in meta-data world its quite easy to design and run.
design a Test-Case Xml by having all details capture
- test-data ( input & expected result )
- test-case id
- test-case local methods
invoke dynamically based on the details.
Try XQSuite
It's pretty slick; here's the "minimal example":
declare namespace test="http://exist-db.org/xquery/xqsuite";
declare function %test:assertEquals("Hello world") local:hello() {
"Hello world"
};
Additionally, XSpec works wonderfully for XSLT testing (provides nicely formatted HTML test results, for example) BUT appears to need a bit of work with XQuery testing. The project appears to have become inactive in the past few years.
© 2022 - 2024 — McMap. All rights reserved.