exist
exist copied to clipboard
XQSuite: %test:stats causes NullPointerException
What is the problem
Using XQSuite Unit tests in eXist 4.0.0 with %test:stats causes an NullPointerException. All tests will fail until db restart.
Describe how to reproduce or add a test
xquery version "3.1";
(:~ Test Module :)
module namespace tests="https://sade.textgrid.de/ns/test";
import module namespace config="https://sade.textgrid.de/ns/config" at "config.xqm";
import module namespace app="https://sade.textgrid.de/ns/app" at "app.xqm";
declare namespace test="http://exist-db.org/xquery/xqsuite";
declare variable $tests:node := <node/>;
declare variable $tests:model := map{};
(: ******* :)
(: * APP * :)
(: ******* :)
declare
%test:assertXPath("matches($result, ""^20\d{2}$"")")
function test:app-currentyear() {
app:currentyear($tests:node, $tests:model)
};
(: ********** :)
(: * CONFIG * :)
(: ********** :)
declare
%test:stats
%test:assertExists
function tests:config-app-root() {
$config:app-root
};
returns on first run:
<testsuites>
<testsuite package="http://exist-db.org/xquery/xqsuite" timestamp="2018-02-26T08:10:51.921+01:00" failures="0" pending="0" tests="1" time="PT0.03S">
<testcase name="app-currentyear" class="test:app-currentyear"/>
</testsuite>
<testsuite package="https://sade.textgrid.de/ns/test" timestamp="2018-02-26T08:10:51.934+01:00" failures="0" pending="0" tests="1" time="PT0.01S">
<testcase name="config-app-root" class="tests:config-app-root">
<error type="java:java.lang.NullPointerException" message=""/>
</testcase>
</testsuite>
</testsuites>
on any later run until restarting eXist:
<testsuites>
<testsuite package="http://exist-db.org/xquery/xqsuite" timestamp="2018-02-26T08:12:24.472+01:00" failures="0" pending="0" tests="1" time="PT0.008S">
<testcase name="app-currentyear" class="test:app-currentyear">
<error type="java:java.lang.NullPointerException" message=""/>
</testcase>
</testsuite>
<testsuite package="https://sade.textgrid.de/ns/test" timestamp="2018-02-26T08:12:24.483+01:00" failures="0" pending="0" tests="1" time="PT0.007S">
<testcase name="config-app-root" class="tests:config-app-root">
<error type="java:java.lang.NullPointerException" message=""/>
</testcase
</testsuite>
</testsuites>
Context information
Please always add the following information
- eXist-db 4.0.0
- openjdk version "1.8.0_151"
- OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.17.10.2-b12)
- OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
- Linux
- 64 bit
- No custom changes in e.g. conf.xml