-
Notifications
You must be signed in to change notification settings - Fork 66
Unit Testing REST applications
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.
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.
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.
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.