1. Introduction
===============

Opengnsys features unittesting and it's based on Python unittest module. Unittests allows us to check everything continues to be working when some feature implementation changes, and it can be used for test-driven development.

2. Launching the tests
======================

Launching the tests is as easy as running the runtests.sh script in web/ directory, which should output something similar to:

 $ ./runtests.sh
test_has_permissions (testuserdecorators.TestUserDecorators) ... checking permissions for:  ['test_action']
checking permissions for:  ['test_action']
ok

----------------------------------------------------------------------
Ran 1 test in 0.136s

OK

3. Adding new tests
===================

When you want to test a set of related features in a module, you will typically create a file called test<feature>.py based on the test.skeleton file. Inside there, you can create one or more classes for testing related features. Each function called testXX is a test function, and setUp and tearDown functions will be called before and after running each test.

Finally, in the suite() function of your test module you need to add all the test classes, because that's the function that will be invoked when executing the tests. See in the test.skeleton how it's done. For more details about unit tests, refer to python unittest documentation.

You can run your test suite together with the others executing ./runtests.sh in admin/ directory as explained in previous section.


