You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Stephen McConnell <mc...@apache.org> on 2003/10/14 14:13:34 UTC

[merlin] abstract test case

An abstract Merlin Test Case is now available.  The abstract test case
provides support for unit test resolution of components.  The abstract
test case includes an embedded merlin kernel that creates and deploys
a container based on default or supplied arguments.  Components
established by Merlin are accessible via absolute or relative names
from a unit test class.

For example (adapted from turorials/hello):

  public class StandardTestCase extends AbstractMerlinTestCase
  {
      public StandardTestCase( String name )
      {
          super( name );
      }

      public void testServiceResolution() throws Exception
      {
          Object hello = resolve( "hello" ); // <-----------
          assertTrue( hello != null );
          getLogger().info( "Hello established." ); // <--------
      }
  }

Two noteable methods in the above include the "resolve" and "getLogger"
methods.  The resolve method returns a component by relative or absolute
name.  Relative names are resolved relative to a test container included
under ${basedir}/target/classes (or a supplied alternative path).  The
getLogger() operation is simply a convinience logger.

The unit test package is dependent on the latest build of Merlin.  If you
running against CVS, then a cvs update and build should bring everything
up-to-date using:

  $ cd merlin
  $ maven merlin:update

When using the abstract testcase you need to include the following 
dependency
statement in your project.xml file:

    <dependency>
      <groupId>merlin</groupId>
      <artifactId>merlin-unit</artifactId>
      <version>3.1-dev</version>
    </dependency>

It is strongly recommended that you remove any avalon-* and merlin-*
directories from you maven repository.  In addition, if your updating
Merlin to the latest binary release then please replace both the
MERLIN_HOME/bin directory and the MERLIN_HOME/system directory.

Merlin 20031014 is now availble for download at the following url:

  http://dpml.net/merlin/distributions/latest/

More detailed documentation about the usage of the merlin abstract
test case class should be available shortly (anytime in
the next six hours) at the following url:

  http://avalon.apache.org/merlin/starting/advanced/unit/index.html

Cheers, Steve.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org