Popular Posts

Friday, April 8, 2011

Unit Testing

I'm currently working on a project to reorganize the output of our automated Selenium QA test cases to something that has a finer resolution (each functional test case should have its own output, and that output should be helpful/understandable).

There are a few challenges to this.  The continuous integration package that we currently use is Jenkins (until very recently known as Hudson).  Jenkins can read in XML output from test results, but we don't have any idea what standards Jenkins is looking for- can it handle nests of test cases (called a test suite)?  If it can handle test suite structures in XML, do we have any output generating test runners that can deliver that output?

Unfortunately, as is so often the case with open source code, the documentation to go along with these packages is spare to nonexistent (to be fair, Jenkins has a pretty good Wiki that is just missing coverage on the pieces that I care about now).  I may have to resort to emailing/posting a message to the developer Kohsuke (who is really responsive, it seems) to figure out what Jenkins is looking for.

We've been looking at zope.test and zope.testrunner as possible candidates to speed up execution of our test cases (they allow an environment layer to be set and the unit test cases to run within that environment).  Currently, we use python's integrated unittest package to implement test cases and suites and because of the way unittest works, each test case is run on the same level (so suites of suites of test cases all just become a list of test cases that run in the order they were assembled- so Jenkins displays their results that way- all on the same level).  This is non-optimal because we want to assemble suites to organize sets of test cases based on testing a specific function or page completely, and view the output in the corresponding organizational fashion.

Because of the dependency on the intermediate XML output, we've been playing with subunit2pyunit within subunit, and before that collective.xmltestreport as a possible translator- we switched to looking at subunit because of that message.

In addition, I just found out how to use Setup Tools' easy_install which is pretty fun on installs, but absolutely a pain to uninstall- might as well call it difficult_uninstall as a warning to potential future users.  (The advantage of easy_install for Python developers is that it sets PYTHONPATH references to packages, downloads the appropriate version much like apt-get on Linux, and does a lot of the dirty work of integrating it all into one location- helpful PYTHONPATH link.)  Also, just a note zopepackage is not the same as zope.testrunner (in fact, the zope package doesn't include testrunner anymore just test.)

No comments:

Post a Comment