3 Replies Latest reply on Dec 9, 2009 6:21 AM by Marcin Cetnarski

    Problem running jsfunit with maven project

    kickmetoandy Newbie

      Hello,

      i have some strange effects when running jsfunit via maven from the
      command line. One question in advance: Where do i have to put my
      testcases when using maven? I have set up my project just like
      described in http://www.jboss.org/community/wiki/JSFUnitWithMaven

      THe project containing the jsfunit tests is called frontend-jsfunit.

      Now back to the strage effects:

      1. if i put my testcase in the directory
      frontend-jsfunit/src/test/java/de
      and run maven with "mvn clean integration-test" i get the following
      exception because the testcase is not contained in the war:



      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running de.AuftragErfassenBeanTest
      30.11.2009 15:35:17 org.apache.cactus.internal.server.AbstractWebTestCaller getTestClassClass
      SCHWERWIEGEND: Error finding class [de.AuftragErfassenBeanTest] using both the Context classloader a
      nd the webapp classloader. Possible causes
       include:
       - Your webapp does not include your test classes,
       - The cactus.jar is not located in your WEB-INF/lib directory and your Container has not set
       the Context classloader to point to the webapp one
      java.lang.ClassNotFoundException: de.AuftragErfassenBeanTest
       at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
       at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:325)
       at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:242)
       at org.apache.cactus.internal.util.ClassLoaderUtils.loadClassFromContextClassLoader_aroundBo
      dy2(ClassLoaderUtils.java:78)
       at org.apache.cactus.internal.util.ClassLoaderUtils.loadClassFromContextClassLoader_aroundBo
      dy3$advice(ClassLoaderUtils.java:264)
       at org.apache.cactus.internal.util.ClassLoaderUtils.loadClassFromContextClassLoader(ClassLoa
      derUtils.java)





      2. if i put my testcase in the directory
      frontend-jsfunit/src/main/java/de
      (so the class will end up in the war file)
      and run maven with "mvn clean integration-test" no tests are executed !

      3. if i put the testcase in both directories
      frontend-jsfunit/src/test/java/de and
      frontend-jsfunit/src/main/java/de
      the test is executed!

      Obviously there is something that i miss. it looks like maven is only executing testcases
      that are in the test directory (which is ok), however it also expects the testclass also
      wihtin the war file. in order to write the testcase how do i properly configure
      maven to execute the testcase properly ? obivously i do not want to
      duplicate my testcase class and have it in 2 directories.

      thanks in advance,
      cheers,
      andy