Viewing Test Results

Nicole Luneburg <[email protected]> Fri, 23 Jan 2009 14:44:16 +1030
Newsgroups gmane.comp.jakarta.cactus.user
Message-ID <[email protected]>
--_000_CB506E813C77E9498F043F1F951BB27683BE1215optimusmsa2endc_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi all,

I'm running cactus 1.8.0, jboss 4.2.3.
I am able to run my test however all tests fail.

For simplicity I just had one test class and one test method:

package myapp.ejb.service;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import junit.framework.Assert;

import org.apache.cactus.ServletTestCase;
import org.apache.cactus.WebRequest;
import org.apache.cactus.client.authentication.FormAuthentication;
import org.apache.log4j.Logger;

public class UserTest extends ServletTestCase {

                private static final Logger log =3D Logger.getLogger(UserTe=
st.class);

                public UserTest(final String name) {
                                System.out.println("inside constructor");
                                log.info("inside constructor");
                                super(name);
                }

                public void begin(WebRequest theRequest) {
                    System.out.println("inside begin()");
                    log.info("inside begin()");
                }

                public void setUp() throws Exception {
                                System.out.println("inside setUp() ");
                                log.info("inside setUp() ");

                                super.setUp();
                }

                protected void tearDown() throws Exception {
                                System.out.println("inside tearDown() ");
                                log.info("inside tearDown() ");

                                super.tearDown();
                }

                public void testGetUserString() {
                                System.out.println("inside testGetUserStrin=
g()");
                                log.info("inside testGetUserString()");

                                Assert.assertTrue(true);
                }
}

When I run my ant test target I get the following output (extract):

cactus.test:
     [echo] Cargo gets JBoss for running the tests...
   [cactus] ---------------------------------------------------------------=
--
   [cactus] Parsed JBoss version =3D [4.2.3]
   [cactus] Running tests against JBoss 4.2.3 @ http://localhost:8080
   [cactus] ---------------------------------------------------------------=
--
   [cactus] Deploying [.//cactus/myapp-cactified.ear] to [C:\DOCUME~1\mynam=
e\LOCALS~1\Temp\cargo\conf/deploy]...
   [cactus] JBoss 4.2.3 starting...
Server [Apache-Coyote/1.1] started
   [cactus] Running myapp.ejb.service.UserTest
   [cactus] JBoss 4.2.3 started on port [8080]
   [cactus] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.375 sec
   [cactus] Test myapp.ejb.service.UserTest FAILED
   [cactus] JBoss 4.2.3 is stopping...

BUILD SUCCESSFUL
Total time: 1 minute 52 seconds

As you can see it fails even though I'm not really "testing" anything.
In the cactus sample ejb3 project, running the test target generated a jbos=
s42x directory in the target directory.
This directory contained files like:

TEST-org.apache.cactus.sample.ejb3.TestConverterEJB.xml

That look like test results.

So I have two questions:

1) How do I see the output of my log4j log.info or System.out.println state=
ments?
2) If I can't see the output of my statements anywhere, is the only way to =
see the results in greater detail through generating xml files such as the =
one shown above?
3) I have almost an identical ant test target as the one that does generate=
 those xml files, but they aren't generating :(

--------------- In relation to question 3, my ant test target is:

<target name=3D"cactus.test" depends=3D"cactus.cactifyear">
      <echo>Cargo gets JBoss for running the tests...</echo>
      <mkdir dir=3D"${reports.dir}" />

      <cactus earfile=3D"${cactified.archive.name}" printsummary=3D"yes">
            <classpath>
                  <path refid=3D"cactus.classpath" />
                  <pathelement location=3D"${cactus.dir}/classes" />
            </classpath>
            <containerset>
                  <cargo containerId=3D"${jboss.container.id}" output=3D"${=
cactus.logs.dir}/output.log" log=3D"${cactus.logs.dir}/cargo.log" home=3D"$=
{cactus.jboss.dir}">
                        <configuration>
                              <property name=3D"cargo.servlet.port" value=
=3D"${cargo.servlet.port}" />
                              <property name=3D"cargo.logging" value=3D"${c=
argo.logging}" />
                              <deployable type=3D"ear" file=3D"${cactified.=
archive.name}" />
                        </configuration>
                  </cargo>
            </containerset>

            <formatter type=3D"${cactus.formatter.type}" />
            <batchtest todir=3D"${reports.dir}">
                  <fileset dir=3D"${project.test.dir}">
                        <include name=3D"**/*Test.java" />
                  </fileset>
            </batchtest>
      </cactus>
</target>

--------------

I hope what I am asking here makes sense.

Thanks!
Nic

________________________________
The contents of this email are confidential and may be subject to legal or =
professional privilege and copyright. No representation is made that this e=
mail is free of viruses or other defects. If you have received this communi=
cation in error, you may not copy or distribute any part of it or otherwise=
 disclose its contents to anyone. Please advise the sender of your incorrec=
t receipt of this correspondence.

--_000_CB506E813C77E9498F043F1F951BB27683BE1215optimusmsa2endc_--