Difference between revisions of "Unit Module"

From BaseX Documentation
Jump to navigation Jump to search
Line 54: Line 54:
 
| '''Summary'''
 
| '''Summary'''
 
|Runs all functions in the specified modules that are annotated with {{Code|xqunit}} annotations.<br />A test report is generated and returned, which resembles the format returned by other xUnit testing frameworks, such as the Maven Surefire Plugin.
 
|Runs all functions in the specified modules that are annotated with {{Code|xqunit}} annotations.<br />A test report is generated and returned, which resembles the format returned by other xUnit testing frameworks, such as the Maven Surefire Plugin.
 +
|-
 +
| '''Errors'''
 +
|{{Error|XQUNIT0003|#Errors}} a test function must have no arguments.<br/>{{Error|XQUNIT0004|#Errors}} a test function must not be updating.<br/>{{Error|XQUNIT0005|#Errors}} an annotation was declared twice..<br/>{{Error|XQUNIT0006|#Errors}} an annotation has invalid arguments.
 
|}
 
|}
  

Revision as of 17:06, 8 March 2013

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.
Errors 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.

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 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.

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.