Testing and Coverage

“An application without tests, is a dead-born application.”
Someone very serious

Writing tests is important, maybe more important than coding.

And this for a lot of reasons, but I’m not here to convince you about the benefits of software testing, some prophets will do it better than me.

Of course Zinnia is tested using the unittest approach. All the tests belong in the directory zinnia/tests/.

Launching the test suite

If you have run the buildout script bundled in Zinnia, the tests are run under nose by launching this command:

$ ./bin/test

But the tests can also be launched within a Django project with the default test runner:

$ django-admin.py test zinnia --settings=zinnia.testsettings

Using the ./bin/test script is usefull when you develop because the tests are calibrated to run fast, but testing Zinnia within a Django project even if it’s slow, can prevent some integration issues.


Despite my best efforts, some functionnalities are not yet tested, that’s why I need your help !

As I write these lines the 282 tests in Zinnia cover 100% of the code bundled in Zinnia. A real effort has been made to obtain this percentage, for ensuring the quality of the code.

I know that a coverage percent does not represent the quality of the tests, but maintaining or increasing this percentage ensures the quality of Zinnia and his future evolutions. For information, you can check the actual coverage percent on Python 2.7 online.

I hope that you will write some tests and find some bugs. :)