XINS offers different ways to test your API.

The first way is using the generated test forms or the links provided with the examples on the function page of the generated specdocs.

XINS offers also the possibility to test the API using the JUnit library. XINS will generate the unit test based on the examples defined in the functions specification. To be able to test your API proceed as follow:

The test target will generate the unit tests in the directory apis\<api name>\test\<package name>. The main test case executed is APITests.java which includes the function tests. One example matches one test.

The generated unit tests are editable. You can adapt it to better fit the expected result or to add your own unit tests. Note that the test target won't overwrite files if the test directory already exists.

The result of the unit tests is located in the directory build\testresults. Results are provided in XML and HTML. The XML contains the configuration settings and the logs generated. The HTML contains the results of the test in a more human readable format.

To be able for the test target to work correctly, you have to copy the junit.jar file located in xins lib directory to the lib directory of ant.

The test target also have an option to run the API before starting the tests. To use it, add test.start.server=true to the build.properties. If this option is set, you don't need to execute the xins run-<api name> command.

If you want to execute the tests on another environment than you local machin, you can specify it in the build.properties by setting the properties test.environment.


The <test /> element should be added after the <impl /> and <environments /> elements if defined.