Hi
Ist es möglich, ein Unit Test Module (https://docs.basex.org/wiki/Unit_Module#Query) über ein XQuery Script zu starten und die Testausgabe in ein File umzuleiten?
(Ich kenne nur die Möglichkeiten, das Module über das TEST Kommando und die Command line unter Angabe der -t Option zu starten).
Danke für die Antwort.
Markus Schmid
Hi Markus,
Ist es möglich, ein Unit Test Module (https://docs.basex.org/wiki/Unit_Module#Query) über ein XQuery Script zu starten und die Testausgabe in ein File umzuleiten?
As you’ve already noted, unit tests must always be started outside an XQuery expression. The reason is that sequentially executed unit tests may have come with all kinds of side effects which go beyond the scope of a single query.
The following solution doesn’t necessarily distinguish itself through elegance, but you could launch a second BaseX instance with the Process Module [1] and convert the string output to an XML document via fn:parse-xml:
let $args := ('-cp', '/path/to/basex.jar', 'org.basex.BaseX', '-t', '/path/to/tests') let $result := proc:system('java', $args) return parse-xml($result)
This way, your tests will be run in an independent BaseX context. If you invoke the function from the directory in which your BaseX instance and the tests reside, you can omit the absolute paths (/path/to/).
Hoppe this helps, Christian
basex-talk@mailman.uni-konstanz.de