Maven 1.x Test Plugin
  1. Maven 1.x Test Plugin
  2. MPTEST-53

Tests breaks when run under maven due to missing resources

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
    • Number of attachments :
      1

      Description

      I got a project with unit tests that require a bunch of resources in the classpath. When I run the tests through maven, then the test cant find the resources at all.

      The tests works when I run them with:

      • maven-clover-plugin, the test are successful.
      • "maven test:ui" - The tests works with the Swing test app when it is started from maven.

      It does not work when I run

      • "maven test"

      Ive verified that the goal "test:test-resources" copies the resource files to the target path "target/test-classes". So I cant understand why i cant get the goal "test" to work when the other does.

      (Ive also setup eclipse so it works, and tried the meven-ide to synchronize the changes from the eclipse project properties to the maven project-xml file. And it still doesnt work.)

      Maven test output ("maven test")
      ----------------------------------------------------------------------
      test:test:
      [junit] Running net.sourceforge.jsh3modtool.mod.DefaultGameModTest
      [junit] Tests run: 16, Failures: 0, Errors: 0, Time elapsed: 0,19 sec
      [junit] Running net.sourceforge.jsh3modtool.modpackage.FolderModPackageTest
      [junit] Tests run: 7, Failures: 0, Errors: 7, Time elapsed: 0,04 sec
      [junit] [ERROR] TEST net.sourceforge.jsh3modtool.modpackage.FolderModPackageTest FAILED
      [junit] Running net.sourceforge.jsh3modtool.modpackage.JarModPackageTest
      [junit] Tests run: 6, Failures: 0, Errors: 6, Time elapsed: 0,03 sec
      [junit] [ERROR] TEST net.sourceforge.jsh3modtool.modpackage.JarModPackageTest FAILED
      ----------------------------------------------------------------------

      Maven clover output ("maven clover")
      ----------------------------------------------------------------------
      test:test:
      [junit] Running net.sourceforge.jsh3modtool.mod.DefaultGameModTest
      [junit] Tests run: 16, Failures: 0, Errors: 0, Time elapsed: 1,408 sec
      [junit] Running net.sourceforge.jsh3modtool.modpackage.FolderModPackageTest
      [junit] Tests run: 7, Failures: 0, Errors: 0, Time elapsed: 0,57 sec
      [junit] Running net.sourceforge.jsh3modtool.modpackage.JarModPackageTest
      [junit] Tests run: 6, Failures: 0, Errors: 0, Time elapsed: 0,589 sec
      ----------------------------------------------------------------------

      Here is the project.xml:
      ----------------------------------------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>
      <project>
      <pomVersion>3</pomVersion>
      <id>jsh3modtool</id>
      <name>Silent Hunter III Mod Tool</name>
      <currentVersion>0.1</currentVersion>
      <organization><name>sourceforge.net</name></organization>
      <inceptionYear>2005</inceptionYear>
      <package>net.sourceforge.jsh3modtool</package>
      <shortDescription>Mod tool for Silent Hunter III</shortDescription>
      <url>http://jsh3modtool.sf.net</url>
      <dependencies>
      <dependency>
      <groupId>xerces</groupId>
      <artifactId>xerces</artifactId>
      <version>2.4.0</version>
      <type>jar</type>
      </dependency>
      </dependencies>
      <build>
      <nagEmailAddress>jsh3modtool</nagEmailAddress>
      <sourceDirectory>src/core/java</sourceDirectory>
      <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
      <unitTest>
      <includes>
      <include>**/*Test.java</include>
      </includes>
      <excludes>
      <exclude>**/Abstract*Test.java</exclude>
      </excludes>
      <resources>
      <resource>
      <directory>src/test/etc</directory>
      <includes>
      <include>*/</include>
      </includes>
      </resource>
      </resources>
      </unitTest>
      </build>
      <reports>
      <report>maven-junit-report-plugin</report>
      <report>maven-clover-plugin</report>
      </reports>
      </project>
      ----------------------------------------------------------------------

      The code in the tests looks like this
      ----------------------------------------------------------------------
      protected void setUp() throws Exception

      { File confFile = new File(ClassLoader.getSystemClassLoader().getResource("modpackages/folderpackage/gamemod.xml").getFile()); super.setUp(); }

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

      Directory structure
      ----------------------------------------------------------------------
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes
      2005-05-16 22:22 <DIR> modpackages
      2005-05-16 22:22 <DIR> modrepositories
      2005-05-16 22:22 <DIR> net
      0 File(s) 0 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\modpackages
      2005-05-16 22:22 <DIR> folderpackage
      2005-05-16 22:22 <DIR> jarpackage
      0 File(s) 0 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\modpackages\folderpackage
      2005-05-16 22:22 <DIR> gamefiles
      2005-05-16 22:22 1276 gamemod.xml
      2005-05-16 22:22 <DIR> screenshots
      1 File(s) 1276 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\modpackages\folderpackage\gamefiles
      2005-05-16 22:22 65580 data1.tga
      2005-05-16 22:22 65580 data2.tga
      2 File(s) 131160 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\modpackages\folderpackage\screenshots
      2005-05-16 22:22 121758 shot1.jpg
      2005-05-16 22:22 130078 shot2.jpg
      2 File(s) 251836 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\modpackages\jarpackage
      2005-05-16 22:22 338132 jarmod.jar
      1 File(s) 338132 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\modrepositories
      2005-05-16 22:22 <DIR> folderrepository
      2005-05-16 22:22 <DIR> ziprepository
      0 File(s) 0 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\net
      2005-05-16 22:22 <DIR> sourceforge
      0 File(s) 0 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\net\sourceforge
      2005-05-16 22:22 <DIR> jsh3modtool
      0 File(s) 0 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\net\sourceforge\jsh3modtool
      2005-05-16 22:22 <DIR> mod
      2005-05-16 22:22 <DIR> modpackage
      2005-05-16 22:22 797 ResourceTests.class
      1 File(s) 797 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\net\sourceforge\jsh3modtool\mod
      2005-05-16 22:22 1835 DefaultGameModTest$MockModPackage.class
      2005-05-16 22:22 9995 DefaultGameModTest.class
      2 File(s) 11830 bytes
      Directory of C:\Data\eclipse-cvs\jsh3modtool\target\test-classes\net\sourceforge\jsh3modtool\modpackage
      2005-05-16 22:22 1776 AbstractModPackageTest.class
      2005-05-16 22:22 1442 AllTests.class
      2005-05-16 22:22 2331 FolderModPackageTest.class
      2005-05-16 22:22 2125 JarModPackageTest.class
      4 File(s) 7674 bytes
      ----------------------------------------------------------------------

      Debug output from "maven -X test" is attached.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            Erik Ramfelt
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: