0 Replies Latest reply on Sep 1, 2006 7:58 AM by sdd erfgdfg

    in-container test with JbossTestCase

    sdd erfgdfg Newbie

      I would like to run in-container tests with the jboss testsuite. I'm using
      a simple JbossTestCase class and an ant script to build it.
      I'm using:
      Java 1.5, Jboss 4.0.4GA, Ant 1.6.5, Junit 3.8.1,
      Eclipse 3.12, Fedora Core 5.

      My build.xml looks like this (only the test target):

      <target name="test-run" depends="jar">
       <delete dir="${test_classes.dir}"/>
       <mkdir dir="${test_classes.dir}" />
       <javac srcdir="${test.src.dir}"
       <classpath refid="compile.classpath" />
       <pathelement location="${classes.dir}" />
       <jar jarfile="${jarfile_test}/JbossTest.jar">
       <fileset dir="${test_classes.dir}/">
       <include name="testing/*.class" />
       <delete file="${jboss.deploy.dir}/JbossTest.jar" />
       <copy todir="${jboss.deploy.dir}"
       file="${jarfile_test}/JbossTest.jar" />
       <!-- Jboss Config -->
       <config javaHome="${java_home}" jbossHome="${jboss.base.dir}">
       <server name="default" host="${node0}">
       <jvmarg value="${jpda.cmdline}" />
       <jvmarg value="-Xmx256m" />
       <sysproperty key="java.endorsed.dirs" value="${jboss.base.dir}/lib/endorsed" />
       <!-- Jboss Start -->
       <start name="default"/>
       <junit fork="yes"
       <sysproperty key="java.naming.provider.url" value="${node0.jndi.url}"/>
       <pathelement path="${jboss-test}"/>
       <pathelement path="${jboss_testcase}" />
       <path refid="compile.classpath" />
       <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"/>
       <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter"
       extension="-${jboss-junit-configuration}.xml" />
       <formatter type="xml"/>
       <test fork="yes"
       <!-- Jboss Stop -->
       <stop name="default"/>

      My JbossTestCase is the SimpleUnitTestCase.class within the

      The error stack:

      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
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
      at javax.naming.InitialContext.addToEnvironment(InitialContext.java:474)
      at testing.SimpleUnitTestCase.testCreateSubcontext(Unknown Source)

      Its the same for all 5 test cases...
      For me it looks like this JbossTestCase is not executed inside the ejb container.
      Where do i have to set the link between the jboss container and the test cases??
      Or how do i get the test code in my container?
      I didn't find anything about this specific problem, so i started a new topic.
      I would be grateful for some help.