Unit Module

From BaseX Documentation
Revision as of 16:04, 8 March 2013 by CG (talk | contribs) (Created page with "This XQuery Module contains functions to running XQUnit annotated functions in XQuery modules. =Conventions= Both functions and errors in this module are ass...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This XQuery Module contains functions to running XQUnit annotated functions in XQuery modules.

Conventions

Both functions and errors in this module are assigned to the http://basex.org/modules/xqunit namespace, which is statically bound to the xqunit prefix.

Functions

xqunit:assert

Signatures xqunit:assert($test as item()*) as empty-sequence()
xqunit:assert($test as item()*, $message as xs:string) as empty-sequence()
Summary Asserts that the effective boolean value of the specified test is true and returns an empty sequence. Otherwise, raises an error.
Errors XQUNIT0001: the assertion failed.
XQUNIT0002: the evaluated code raised an XQuery error.

xqunit:fail

Signatures xqunit:fail($message as xs:string) as empty-sequence()
Summary Raises an XQUnit error with the specified message.
Errors XQUNIT0001: default error raised by this function.

xqunit:test

Signatures xqunit:test() as element(testsuite)*
Summary Runs all functions in the current module that are annotated with xqunit annotations.
A test report is generated and returned, which resembles the format returned by other xUnit testing frameworks, such as the Maven Surefire Plugin.

xqunit:test-libraries

Signatures xqunit:test-libraries($uris as xs:string*) as element(testsuites)
Summary Runs all functions in the specified modules that are annotated with xqunit annotations.
A test report is generated and returned, which resembles the format returned by other xUnit testing frameworks, such as the Maven Surefire Plugin.

Errors

Code Description
XQUNIT0001 xqunit:fail()] was called.
XQUNIT0002 An error was raised within an XQUnit test function.
XQUNIT0003 A test function must have no arguments.
XQUNIT0004 A test function must not be updating.
XQUNIT0005 An annotation was declared twice.
XQUNIT0006 An annotation has invalid arguments.

Changelog

This module was introduced with Version 7.7.