You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chandresh Taunk <ta...@goowy.com> on 2006/06/14 22:28:04 UTC

maven2 & testng - tests not running

I'm using maven2 in a project and for unit tests I'm using testng.

When I execute 'mvn test' none of the tests run.

Here's the output:

Running FooTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running BarTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec
Running BazTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec

All of the test methods have @Test annotation applied.

Any idea why the tests are not running?

Re: maven2 & testng - tests not running

Posted by Marco Mistroni <mm...@gmail.com>.
hi,
 is maven picking up your testng.xml configuration file?
 where are your test located (in which dir?)

here's my pom.xml


<project>
   <modelVersion>4.0.0</modelVersion>
   <groupId>ExpenseControl</groupId>
   <artifactId>ejbs</artifactId>
   <packaging>jar</packaging>
   <version>1.0</version>
   <name>enterprise java beans</name>
   <parent>
      <groupId>ExpenseControl</groupId>
      <artifactId>project</artifactId>
      <version>1.0</version>
   </parent>
   <dependencies>
      <!-- JBoss Microcontainer dependencies (for tests)-->
      <dependency>
           <groupId>microcontainer</groupId>
           <artifactId>ehcache</artifactId>
           <version>alpha6</version>
           <scope>system</scope>
         <systemPath>${basedir}\microcontainer\optional-lib\ehcache-
alpha6.jar</systemPath>
      </dependency>
      <dependency>
            <groupId>microcontainer</groupId>
            <artifactId>hibernate-all</artifactId>
            <version>alpha6</version>
            <scope>system</scope>
         <systemPath>${basedir}\microcontainer\lib\hibernate-all-alpha6.jar
</systemPath>
      </dependency>
      <dependency>
         <groupId>microcontainer</groupId>
         <artifactId>jboss-ejb3-all</artifactId>
         <version>alpha6</version>
         <scope>system</scope>
         <systemPath>${basedir}\microcontainer\lib\jboss-ejb3-all-alpha6.jar
</systemPath>
      </dependency>
      <dependency>
           <groupId>microcontainer</groupId>
            <artifactId>thirdparty-all</artifactId>
            <version>alpha6</version>
            <scope>system</scope>
         <systemPath>${basedir}\microcontainer\lib\thirdparty-all-alpha6.jar
</systemPath>
      </dependency>
<!-- end of jboss microcontainer dependencies -->


      <dependency>
         <groupId>geronimo-spec</groupId>
         <artifactId>geronimo-spec-j2ee</artifactId>
     <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>myfaces</groupId>
         <artifactId>myfaces-all</artifactId>
         <version>1.1.1</version>
     <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>jboss-seam</groupId>
         <artifactId>jboss-seam-ui</artifactId>
     <version>1.0.0CR3</version>
     <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>jboss-seam</groupId>
         <artifactId>jboss-seam</artifactId>
     <version>1.0.0CR3</version>
      </dependency>

      <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
         <version>4.7</version>
         <scope>test</scope>
         <classifier>jdk15</classifier>
      </dependency>
      <dependency>
         <groupId>dbunit</groupId>
         <artifactId>dbunit</artifactId>
     <version>2.1</version>
     <scope>test</scope>
      </dependency>



   </dependencies>
   <build>
      <plugins>


         <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
               <encoding>iso-8859-1</encoding>
            </configuration>
         </plugin>




         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
        <!--    <version>2.2-SNAPSHOT</version>-->
            <configuration>
              <suiteXmlFiles>
                <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
              </suiteXmlFiles>
            </configuration>
         </plugin>


        <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
         <executions>
           <execution>
             <phase>generate-sources</phase>
                 <configuration>
                   <tasks>
                     <echo message="--------Properties Configured
----------"/>

                     <echo message="------- deploy.dir=${deploy.directory}
"/>
               <echo message="------- ear.name=${ear.name}"/>
               <echo message="-------
project.parent.version=${project.parent.version}"/>
               <echo message="------- project.version=${project.version}"/>

                   </tasks>
                 </configuration>
                 <goals>
                   <goal>run</goal>
                 </goals>
               </execution>
             </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
              <archive>
                <manifest>
                   <addClasspath>true</addClasspath>
                </manifest>
              </archive>
            </configuration>
        </plugin>
      </plugins>
   </build>
   <!--<reporting>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <configuration>
          <forkMode>once</forkMode>
          <childDelegation>false</childDelegation>
        </configuration>
      </plugin>
    </plugins>
  </reporting>-->
  <!-- The following two sections should be unnecessary shortly.
        surefire-2.2 is due for release yesterday. -->
  <repositories>
    <repository>
      <id>apache.snapshots</id>
      <url>http://cvs.apache.org/maven-snapshot-repository</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <url>http://cvs.apache.org/maven-snapshot-repository</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>


</project>

my tests are in  the src/test/java directory

my testng.xml is in src/test/resources

HTH
 marco