1. Zenoss Unit Tests

1.1. Introduction

Standard unit test Tests

Support for doctest Tests

Testing.ZopeTestCase Tests

Integrating with zopectl test

1.2. Zenoss' Test Runner

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:

  1. Make sure your tests run by themselves:

    zopectl test --libdir /usr/local/zenoss/Products/ZenNewProduct

  2. Go to the tests directory:

    cd /usr/local/zenoss/Products/ZenTestRunner/tests

  3. Copy one of the existing tests to a name reflecting the product for which you are adding tests:

    cp testZenModel.py testZenNewProduct.py

  4. Change the import line in the new file to reflect the new product name:

    from Products import ZenNewProduct as product
  5. Save and quit, then run the suites to make sure everything is passing:

    zopectl test --libdir /usr/local/zenoss/Products/ZenTestRunner

1.3. Integrating With Buildbot