You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Alex Karasulu <ak...@apache.org> on 2008/07/29 18:20:05 UTC

[ApacheDS] [Testing] What's the difference between [core|server]-[unit|integ] modules?

Hi all,

Emmanuel had a few questions on IRC about all the different test frameworks
and what their differentiations are.  He asked me to summarize and post them
to the dev list.

We have the following modules that have some kind of test harness code:

    o core-unit
    o core-integ
    o server-unit
    o server-integ

The core-unit and server-unit modules both used the older JUnit 3.8.x to run
integration tests (long running tests that started up large systems).

The core-unit tests the DirectoryService (core).  The module contained an
abstract JUnit test case which started up a DirectoryService and provided
some utility methods for configuring it.  This is in the src/main/java
area.  In the src/test/java area were located a bunch of tests using this
abstract test case.  The abstract test case was more for integration testing
rathre than unit testing since it created, started, stopped and destroyed a
DirectoryService for each test method.  This took forever.

The server-unit module is similar to core-unit except it starts up an
LdapServer which has a DirectoryService.  Here the networking is enabled and
tests are performed over the wire unlike the core which performs tests
directly against the DirectoryService API without going through the
network.  Again a special AbstractServerTestCase was used to create, start,
stop, and delete an LdapServer for each test method.  Very slow!

About 8-12 months ago we created the ChangeLog service and added a feature
to ApacheDS which enabled server snapshoting and rollbacks.  This feature
was first created with a trivial implementation to rollback changes during
tests so the slow create, start, stop, destroy cycle for each test method
can be replaced with a faster, create (tag, revert)*, destroy cycle for
suites.  The server did not need to be stopped, destroyed, recreated and
restarted for each test anymore.  A sweet framework was devised to
automatically startup a DirectoryService and inject it into your test.  The
DirectoryService was managed by the framework for you and you can just
operate on it.  Annotations were also provided to enable you to be able to
inject LDIFs as strings or via files referrenced in the annotations without
having to write code.  It really was nice and turned 12 minutes of core
tests into less than 2 mintues of core tests on my workstation.

Then just a few days ago I finally whipped together a server-integ module
which does the same thing but it manages the LdapServer for you in addition
to the directoryService the LdapServer contains.  The ldapServer is injected
into your test class as a static public member.  You just use that and it is
reverted to a clean state as if the server was first started.  All the same
annotations are available.

These are the distinctions between these 4 modules.  Hope that clarifies
things.

Regards,
Alex


-- 
Microsoft gives you Windows, Linux gives you the whole house ...