Skip to content

Feat enhance xsuite#6036

Open
duncdrum wants to merge 10 commits intoeXist-db:developfrom
duncdrum:feat-enhance-xsuite
Open

Feat enhance xsuite#6036
duncdrum wants to merge 10 commits intoeXist-db:developfrom
duncdrum:feat-enhance-xsuite

Conversation

@duncdrum
Copy link
Contributor

@duncdrum duncdrum commented Feb 7, 2026

in a nutshell this adds line and file reporting to XQsuite tests reports (xml and xq).

IDE

Screenshot 2026-02-07 at 15 37 07

maven

cd exist-core
mvn -q test -Dtest=org.exist.test.runner.DebuggabilityNavigabilitySuite

then

[ERROR] Tests run: 2, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 0.720 s <<< FAILURE! -- in org.exist.test.runner.DebuggabilityNavigabilitySuite
[ERROR] xqts.org.exist-db.xquery.failing-both-module.assertionFails -- Time elapsed: 0.030 s <<< FAILURE!
org.junit.ComparisonFailure: 
XQuery failure: failing-both.xq:34 assertionFails
        at (failing-both.xq:34) expected:<[expected (assertEquals failed.)]> but was:<[actual]>
        at  . (failing-both.xq:34)

[ERROR] DebuggabilityNavigabilitySuite.throwsUnexpectedError -- Time elapsed: 0.010 s <<< ERROR!
org.exist.xquery.XPathException: err:INTENTIONAL intentional error for test [at line 43, column 5]
        at xqts.org.exist-db.xquery.failing-both-module.throwsUnexpectedError(failing-both.xq:43)
        at org.exist.xquery.functions.fn.FunError.eval(FunError.java:144)
        at org.exist.xquery.BasicFunction.eval(BasicFunction.java:73)
        at org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:62)
        at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:155)
        at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:289)
        at org.exist.xquery.FunctionCall.eval(FunctionCall.java:207)
        at org.exist.xquery.value.FunctionReference.eval(FunctionReference.java:125)
        at org.exist.xquery.DynamicFunctionCall.eval(DynamicFunctionCall.java:116)
        at org.exist.xquery.PathExpr.eval(PathExpr.java:280)
        at org.exist.xquery.SwitchExpression.eval(SwitchExpression.java:109)
        
        [ stack trace shortened for here ]

[ERROR] Failures: 
[ERROR]   XQuery failure: failing-both.xq:34 assertionFails expected:<[expected (assertEquals failed.)]> but was:<[actual]>
[ERROR] Errors: 
[ERROR]   err:INTENTIONAL intentional error for test [at line 43, column 5]
[ERROR] Tests run: 2, Failures: 1, Errors: 1, Skipped: 0
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.2:test (default-test) on project exist-core: There are test failures.
[ERROR] 
[ERROR] See ~/Documents/GitHub/exist/exist-core/target/surefire-reports for the individual test results.
[ERROR] See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.

Surefire

<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" version="3.0.2" name="org.exist.test.runner.DebuggabilityNavigabilitySuite" time="0.786" tests="2" errors="1" skipped="0" failures="1">
  [ properties shortened for here ]
  <testcase name="assertionFails" classname="xqts.org.exist-db.xquery.failing-both-module" time="0.034">
    <failure message="XQuery failure: failing-both.xq:34 assertionFails expected:&lt;[expected (assertEquals failed.)]&gt; but was:&lt;[actual]&gt;" type="org.junit.ComparisonFailure"><![CDATA[org.junit.ComparisonFailure: XQuery failure: failing-both.xq:34 assertionFails expected:<[expected (assertEquals failed.)]> but was:<[actual]>
	at xqts.org.exist-db.xquery.failing-both-module.assertionFails(~/Documents/GitHub/exist/exist-core/src/test/resources/org/exist/test/runner/failing-both.xq:34)
]]></failure>
  </testcase>
  <testcase name="throwsUnexpectedError" classname="DebuggabilityNavigabilitySuite" time="0.01">
    <error message="err:INTENTIONAL intentional error for test [at line 43, column 5]" type="org.exist.xquery.XPathException"><![CDATA[org.exist.xquery.XPathException: err:INTENTIONAL intentional error for test [at line 43, column 5]
	at xqts.org.exist-db.xquery.failing-both-module.throwsUnexpectedError(failing-both.xq:43)
	at org.exist.xquery.functions.fn.FunError.eval(FunError.java:144)
	at org.exist.xquery.BasicFunction.eval(BasicFunction.java:73)
	at org.exist.xquery.InternalFunctionCall.eval(InternalFunctionCall.java:62)
	at org.exist.xquery.UserDefinedFunction.eval(UserDefinedFunction.java:155)
	at org.exist.xquery.FunctionCall.evalFunction(FunctionCall.java:289)
	at org.exist.xquery.FunctionCall.eval(FunctionCall.java:207)
	at org.exist.xquery.value.FunctionReference.eval(FunctionReference.java:125)
	at org.exist.xquery.DynamicFunctionCall.eval(DynamicFunctionCall.java:116)
	at org.exist.xquery.PathExpr.eval(PathExpr.java:280)
	at org.exist.xquery.SwitchExpression.eval(SwitchExpression.java:109)

	[ stack trace shortened for here ]

]]></error>
  </testcase>
</testsuite>

eXide

<testsuites>
    <testsuite package="http://exist-db.org/xquery/failing-both-module" timestamp="2026-02-07T13:44:20.043Z" tests="2" failures="1" errors="1" pending="0" time="PT0.006S">
        <testcase name="assertionFails" class="both:assertionFails" line="34" source="/db/fabo.xq">
            <failure message="assertEquals failed." type="failure-error-code-1">expected</failure>
            <output>actual</output>
        </testcase>
        <testcase name="throwsUnexpectedError" class="both:throwsError" line="42" source="/db/fabo.xq">
            <error type="err:INTENTIONAL" message="intentional error for test"/>
        </testcase>
    </testsuite>
</testsuites>

so jenv users can rebase
ignore local folder
…ources

so that Intellij maven executer can run test target
 to include source path in stack trace for better debuggability;

add new tests for assertion and error handling
add getSourcePath method to AbstractTestRunner
imrpove hang detection
…nce XSuite to manage embedded DB lifecycle and add tests for discovery functionality
- Added XQueryFailureLog class to log test failures with concise messages.
- Enhanced ExtTestErrorFunction and ExtTestFailureFunction to utilize this logging mechanism, providing clearer error context in test results.
- Updated xqsuite.xql to conditionally emit source and line attributes for better traceability.
- Refactored logging to use short file names for better IDE stack trace navigation.
- Enhanced failure message formatting to include line numbers in a more readable way.
@duncdrum duncdrum marked this pull request as ready for review February 7, 2026 14:57
@duncdrum duncdrum requested a review from a team as a code owner February 7, 2026 14:57
@duncdrum duncdrum added this to the eXist-7.0.0 milestone Feb 7, 2026
@duncdrum duncdrum requested review from dizzzz and line-o February 7, 2026 15:05
@duncdrum duncdrum changed the title [WIP] Feat enhance xsuite Feat enhance xsuite Feb 7, 2026
@dizzzz dizzzz requested review from a team and reinhapa February 8, 2026 17:31
@dizzzz
Copy link
Member

dizzzz commented Feb 9, 2026

related to #6035

@line-o
Copy link
Member

line-o commented Feb 11, 2026

This looks really good but I want to test the reporting for tests with multiple assertions first.
That may be a valuable test case to ensure this in the future too @duncdrum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants