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:
test element to the
api element in the
xins-projects.xml. For example:
<project name="myprojects" domain="com.mycompany"> <api name="allinone"> <impl /> <test /> </api> </project>
Run the API. For example: xins run-allinone.
Execute the test target. For example: xins test-allinone.
The test target will generate the unit tests in the directory
apis\<api name>\test\<package name>. The
main test case executed is
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
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
To be able for the test target to work correctly, you have to copy
junit.jar file located in xins
lib directory to the
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>
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 /> element should be added
<impl /> and
<environments /> elements if defined.