cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chip Childers <>
Subject Re: Unit tests
Date Fri, 09 Nov 2012 19:56:23 GMT
On Fri, Nov 9, 2012 at 2:46 PM, Alex Huang <> wrote:
>> 1 - Do we want tests to run each time mvn install is run?
> No.  I like to have choices.
>> 2 - Do we want to get stricter about what exactly is considered to be
>> a unit test (vs an automated test that may or may not be based on the
>> junit framework)?
> I actually consider db tests to be unit tests as long as the db is setup and cleaned
up by the unit test itself.

Having a real DB as a requirement for low level unit tests does two
things that I don't like.

First, it requires the configuration of a database (in our case,
MySQL) as part of running the test.  That's a build dependency that
(IMO) shouldn't be needed.

Second, configuring and using a real database significantly slows down
the unit test process.  For unit tests to be useful, they have to be
as fast as possible.  We simply don't have enough unit tests for this
to be a major problem right now, but as the coverage increases (true
unit tests, not integration tests) this will get much worse.

In my ideal world, unit tests are limited in their test scope to only
cover code within a particular object (inherited or directly
accessed).  Imported objects should usually be mocked.  We might be
arguing about nuance of definition here, but I've always tried to keep
a bright red line between unit and integration tests.  Both matter,
but they test different things.

> I think anything that requires starting of jetty is definitely not a unit test.

Completely agree with this one.

> --Alex

View raw message