jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "White, Melissa" <mwh...@triactive.com>
Subject Cactus/Ant vs. JUnitEE
Date Wed, 19 Feb 2003 16:20:49 GMT
Hello -

I currently have a set of JUnit tests that I run in my container (JRun)
because they require JNDI. I would like to integrate these tests into our
build (using Ant), so I've been trying to determine if Cactus would allow me
to do that. I have been reviewing the docs for a couple of days, and trying
to get something to work, but I'm still unclear as to whether this will even
be possible.

The first approach I tried was to define the testTarget called by my
runservertests Ant task as follows:

<target name="junit-persistence-tests"
  <junit printsummary="on" fork="true" haltonerror="true">
      <pathelement location="${portal.deploy}/classes" />
      <path refid="unittest.classpath" />
    <test name="com.triactive.test.CommonPersistenceTestDefinition" />

com.triactive.test.CommonPersistenceTestDefinition defines the suite of
JUnit tests that need to run in the container (via the suite() method).
There is a setup step that is performed prior to running the tests using a
subclass of the JUnit TestSetup class. This step reads some data from files
and inserts it into the database. That works fine. Then, an attempt is made
to store an object in the JNDI directory that will be used by subsequent
tests. That's where I run into trouble. I get the following exception:

[junit] javax.naming.NoInitialContextException: Need to specify class name
in environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
[junit]     at
[junit]     at
[junit]     at
[junit]     at
[junit]     at
[junit]     at
[junit]     at junit.extensions.TestSetup$1.protect(TestSetup.java:18)
[junit]     at junit.framework.TestResult.runProtected(TestResult.java:124)
[junit]     at junit.extensions.TestSetup.run(TestSetup.java:23)
[junit]     at
[junit]     at

Does the test in my testTarget need to be a subclass of ServletTestCase or
one of the other Cactus TestCase types? If so, I'm confused about how I
would define that test to run my existing JUnit test suite in the container.

Any help would be appreciated. I may be on the wrong track completely, but
the Cactus docs led me to think that this was something I should be able to
do. I was hoping I could use my existing test hierarchy to work within this
framework though.

Thanks!  Melissa

View raw message