[openstack-dev] unit tests
Kevin L. Mitchell
kevin.mitchell at rackspace.com
Mon Feb 11 16:27:39 UTC 2013
On Sat, 2013-02-09 at 14:59 -0500, Mark McLoughlin wrote:
> On Sat, 2013-02-09 at 12:15 -0700, John Griffith wrote:
> > We seem to be going down a path of requiring more and more infrastructure
> > and reliance from modules inside of the respective projects code base, and
> > lately (the most annoying thing to me) is actually requiring the
> > installation of the project and it's services in order for our unit tests
> > to run.
>
> Got an example?
One obvious example is this: at least half of the "unit" tests for the
API extensions set up the entire WSGI stack for every single test, then
tear it down at the end. The other half at least use a more reasonable
process of just calling the function being tested.
That said, I think the test suite should include functional tests, which
do things like setting up the WSGI stack and making sure everything
works together. However, these functional tests don't need to be
anywhere near as extensive as the unit tests. My own preference for
testing some of my projects is to split the tests directory in two; the
"unit" directory has all unit tests, which do exactly what John has
described, and the "function" directory has a handful of functional
tests, as I describe here.
--
Kevin L. Mitchell <kevin.mitchell at rackspace.com>
More information about the OpenStack-dev
mailing list