Skip to main content
Skip table of contents

Code Structure

The XNAT REST tests rely on two custom libraries:

  • grxnat: . If you're familiar with PyXNAT or xnatpy, this is a similar project where interacting with XNAT over REST is exposed in groovy (rather than python). While grxnat is written in groovy, it's compiled to a Java jar so it can be used within the Java-based REST tests. The mechanism for actually building, issuing, and validating the HTTP calls is done using the REST-assured ( library. The functionality for interacting with XNAT is all accessible via the XnatInterface class. The following library offers several easy ways to grab XnatInterface objects corresponding to standard test accounts.

  • nrg_test: . This library is also groovy-based but compiled as a jar. The library extends the functionality of TestNG ( to provide the testing framework for XNAT. It provides:
    • Base test classes to be used for writing XNAT tests
    • Annotations for customizing various aspects of XNAT tests (see Test control/specification via annotations)
    • Additional code for issuing direct commands to the tested XNAT instance over SSH, or for issuing direct database calls
    • Various other reusable shortcuts for bridging the gap between grxnat (which is intended to be more of a general-use XNAT groovy SDK) and desired functionality for testing

The XNAT REST tests themselves ( are fully Java, so adding/modifying tests requires no knowledge of groovy.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.