Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Unit Testing REST applications

dmcassel edited this page Dec 19, 2014 · 1 revision

When you create a new Roxy project, you are required to specify an app-type of mvc, hybrid, or rest. If you choice app-type=rest, the src directory is initially empty, as the MVC code doesn't apply. Unfortunately, that means you don't get the unit testing code either. However, you can still use unit testing with REST applications.

Setup

You will need to copy the unit testing files from another copy of Roxy, or straight from GitHub. In particular, you will need the contents of src/test. Copy that directory into your src directory.

Configuration

In deploy/default.properties, you'll find "xquery-test.dir" pointing to src/test. If you'd like to change the location of your test files, copy that property to deploy/build.properties and change it there.

The Tests

When you copy src/test to your project, you'll get the testing framework, the user interface for it, and a sample set of tests. Note that all of the out-of-the-box tests are intended to test MVC code. If you're working with a REST application, you won't have that code, so all the tests will fail. Instead, delete the existing tests by removing everything under src/test/suites. In place of that stuff, create your own unit tests. You can use provided tests as examples.

For more information about Roxy Unit Testing, please review the Unit Testing wiki.