Standard unit test Tests
Support for doctest Tests
Testing.ZopeTestCase Tests
Integrating with zopectl test
Zenoss has a Zope product, ZenTestRunner , whose sole purpose it to run a specific group of tests. We did this in order to avoid running all the tests in the Products directory, such as with this command:
zopectl test --libdir /usr/local/zenoss/Products
Likewise, to run the collections of tests that are important to use, we didn't want to have to do the following:
zopectl test --libdir /usr/local/zenoss/Products/ZenModel
zopectl test --libdir /usr/local/zenoss/Products/ZenRelations
zopectl test --libdir /usr/local/zenoss/Products/Zen...
Now, all we have to do is run this:
zopectl test --libdir /usr/local/zenoss/Products/ZenTestRunner
All that is required by developers is that they add product tests to the test runner. This is done in the following manner:
-
Make sure your tests run by themselves:
zopectl test --libdir /usr/local/zenoss/Products/ZenNewProduct
-
Go to the tests directory:
cd /usr/local/zenoss/Products/ZenTestRunner/tests
-
Copy one of the existing tests to a name reflecting the product for which you are adding tests:
cp testZenModel.py testZenNewProduct.py
-
Change the import line in the new file to reflect the new product name:
from Products import ZenNewProduct as product
-
Save and quit, then run the suites to make sure everything is passing:
zopectl test --libdir /usr/local/zenoss/Products/ZenTestRunner