You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ian Shafer <ia...@1321.org> on 2006/04/16 09:11:25 UTC

m2.0.3 and TestNG

Hello,

I'm trying to use TestNG, but I'm having no luck. I'm using Java 1.5  
source and 1.5 compilation target and I'm using a 1.5 JVM (I don't  
have any other version of Java installed on the server that I'm  
working on).

It seems that my 1.5 annotations are not being recognized. Only tests  
that begin with 'test' are being run and @Configuration(beforeSuite =  
true) is ignored. Any idea what I'm doing wrong? I'm not clear how  
surefire knows whether to run TestNG or JUnit; that would be nice to  
know too. Any info would be greatly appreciated.

Thanks,

Ian



Here's a snippet from a test class:

package com.example.test;

// imports removed for brevity

public class Test {
     @Configuration(beforeSuite = true)
     public void suiteSetup() throws Exception {
         System.out.println("suiteSetup()");
     }

     @Test()
     public void testAppContext() {
         System.out.println("testAppContext");
     }
}

Here's a snippet from my pom.xml:

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


testng.xml:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="All" verbose="1">
     <test name="AllTests">
         <packages>
             <package name="com.example.test"/>
         </packages>
     </test>
</suite>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: m2.0.3 and TestNG

Posted by John Sanda <jo...@gmail.com>.
Brett,

I really appreciate the feedback. I made the change, and I am good to
go. Many thanks for the help.

On 4/17/06, Brett Porter <br...@gmail.com> wrote:
> Hi John,
>
> I'm not sure where you got the surefire plugin from - did you build it
> from source?
>
> That should have set the correct repository, being:
> http://cvs.apache.org/maven-snapshot-repository
> (instead of snapshots.maven.codehaus.org)
>
> - Brett
>
> On 4/18/06, John Sanda <jo...@gmail.com> wrote:
> > Hi Brett. I have run into the same situation as Ian, and I tried to
> > use the 2.2-SNAPSHOT version of the plugin, but I ran into some
> > problems. Here is what my pom.xml (with only relavant sections):
> >
> > <project xmlns="http://maven.apache.org/POM/4.0.0"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> > http://maven.apache.org/maven-v4_0_0.xsd">
> >   <modelVersion>4.0.0</modelVersion>
> >   <groupId>com.foo</groupId>
> >   <artifactId>maven-app</artifactId>
> >   <packaging>jar</packaging>
> >   <version>1.0-SNAPSHOT</version>
> >   <name>Maven Quick Start Archetype</name>
> >   <url>http://maven.apache.org</url>
> >   <dependencies>
> >       <groupId>org.testng</groupId>
> >       <artifactId>testng</artifactId>
> >       <version>4.6.1</version>
> >       <scope>test</scope>
> >       <classifier>jdk15</classifier>
> >     </dependency>
> >   </dependencies>
> >   <build>
> >     <plugins>
> >       <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-compiler-plugin</artifactId>
> >         <configuration>
> >           <source>1.5</source>
> >           <target>1.5</target>
> >         </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>
> >     </plugins>
> >   </build>
> >   <pluginRepositories>
> >     <pluginRepository>
> >       <id>apache.snapshots</id>
> >       <url>http://cvs.apache.org/maven-snapshot-repository</url>
> >       <snapshots>
> >         <enabled>true</enabled>
> >       </snapshots>
> >     </pluginRepository>
> >   </pluginRepositories>
> >   <repositories>
> >     <repository>
> >       <id>Maven Snapshots</id>
> >       <url>http://snapshots.maven.codehaus.org/maven2</url>
> >       <snapshots>
> >         <enabled>true</enabled>
> >       </snapshots>
> >     </repository>
> >   </repositories>
> > </project>
> >
> > Here is the error message that I get:
> >
> > Missing:
> > ----------
> > 1) org.apache.maven.surefire:surefire-testng:jar:2.0-SNAPSHOT
> >
> >   Try downloading the file manually from the project website.
> >
> >   Then, install it using the command:
> >       mvn install:install-file -DgroupId=org.apache.maven.surefire
> > -DartifactId=surefire-testng \
> >           -Dversion=2.0-20060304.160715-2 -Dpackaging=jar -Dfile=/path/to/file
> >
> >   Path to dependency:
> >         1) dummy:dummy:jar:1.0
> >         2) org.apache.maven.surefire:surefire-testng:jar:2.0-20060304.160715-2
> >
> > ----------
> > 1 required artifact is missing.
> >
> > for artifact:
> >   dummy:dummy:jar:1.0
> >
> > from the specified remote repositories:
> >   Maven Snapshots (http://snapshots.maven.codehaus.org/maven2),
> >   central (http://repo1.maven.org/maven2)
> >
> >
> > For the repositories that I am using, the latest snapshot release that
> > I saw was 1.5-SNAPSHOT. I should also mention that I am running Maven
> > 2.0.4, but I assume that that shouldn't be a problem.
> >
> > Just for the sake of learning more about Maven, I did manage to get my
> > annotations and testng.xml file recognized by executing the testng Ant
> > task using the antrun plugin. Of course, I am aware that the antrun
> > plugin is completely separaten from the SureFire plugin. I just wanted
> > to verify that it wasn't something I was doing wrong on my end.
> >
> > Thanks.
> >
> > On 4/16/06, Brett Porter <br...@gmail.com> wrote:
> > > Hi Ian,
> > >
> > > I'll roll these into the docs as it gets closer to release, but
> > > currently this support is only in a development snapshot of surefire.
> > >
> > > Basically, you need to be using 2.2-SNAPSHOT of the surefire plugin,
> > > and you must declare a testNG dependency (scoped test) in your
> > > project.
> > >
> > > - Brett
> > >
> > > On 4/16/06, Ian Shafer <ia...@1321.org> wrote:
> > > > Hello,
> > > >
> > > > I'm trying to use TestNG, but I'm having no luck. I'm using Java 1.5
> > > > source and 1.5 compilation target and I'm using a 1.5 JVM (I don't
> > > > have any other version of Java installed on the server that I'm
> > > > working on).
> > > >
> > > > It seems that my 1.5 annotations are not being recognized. Only tests
> > > > that begin with 'test' are being run and @Configuration(beforeSuite =
> > > > true) is ignored. Any idea what I'm doing wrong? I'm not clear how
> > > > surefire knows whether to run TestNG or JUnit; that would be nice to
> > > > know too. Any info would be greatly appreciated.
> > > >
> > > > Thanks,
> > > >
> > > > Ian
> > > >
> > > >
> > > >
> > > > Here's a snippet from a test class:
> > > >
> > > > package com.example.test;
> > > >
> > > > // imports removed for brevity
> > > >
> > > > public class Test {
> > > >      @Configuration(beforeSuite = true)
> > > >      public void suiteSetup() throws Exception {
> > > >          System.out.println("suiteSetup()");
> > > >      }
> > > >
> > > >      @Test()
> > > >      public void testAppContext() {
> > > >          System.out.println("testAppContext");
> > > >      }
> > > > }
> > > >
> > > > Here's a snippet from my pom.xml:
> > > >
> > > >              <plugin>
> > > >                  <groupId>org.apache.maven.plugins</groupId>
> > > >                  <artifactId>maven-surefire-plugin</artifactId>
> > > >                  <configuration>
> > > >                      <suiteXmlFiles>src/test/resources/testng.xml</
> > > > suiteXmlFiles>
> > > >                  </configuration>
> > > >              </plugin>
> > > >
> > > >
> > > > testng.xml:
> > > >
> > > > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
> > > >
> > > > <suite name="All" verbose="1">
> > > >      <test name="AllTests">
> > > >          <packages>
> > > >              <package name="com.example.test"/>
> > > >          </packages>
> > > >      </test>
> > > > </suite>
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> >
> > - John
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--

- John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: m2.0.3 and TestNG

Posted by Brett Porter <br...@gmail.com>.
Hi John,

I'm not sure where you got the surefire plugin from - did you build it
from source?

That should have set the correct repository, being:
http://cvs.apache.org/maven-snapshot-repository
(instead of snapshots.maven.codehaus.org)

- Brett

On 4/18/06, John Sanda <jo...@gmail.com> wrote:
> Hi Brett. I have run into the same situation as Ian, and I tried to
> use the 2.2-SNAPSHOT version of the plugin, but I ran into some
> problems. Here is what my pom.xml (with only relavant sections):
>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>com.foo</groupId>
>   <artifactId>maven-app</artifactId>
>   <packaging>jar</packaging>
>   <version>1.0-SNAPSHOT</version>
>   <name>Maven Quick Start Archetype</name>
>   <url>http://maven.apache.org</url>
>   <dependencies>
>       <groupId>org.testng</groupId>
>       <artifactId>testng</artifactId>
>       <version>4.6.1</version>
>       <scope>test</scope>
>       <classifier>jdk15</classifier>
>     </dependency>
>   </dependencies>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-compiler-plugin</artifactId>
>         <configuration>
>           <source>1.5</source>
>           <target>1.5</target>
>         </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>
>     </plugins>
>   </build>
>   <pluginRepositories>
>     <pluginRepository>
>       <id>apache.snapshots</id>
>       <url>http://cvs.apache.org/maven-snapshot-repository</url>
>       <snapshots>
>         <enabled>true</enabled>
>       </snapshots>
>     </pluginRepository>
>   </pluginRepositories>
>   <repositories>
>     <repository>
>       <id>Maven Snapshots</id>
>       <url>http://snapshots.maven.codehaus.org/maven2</url>
>       <snapshots>
>         <enabled>true</enabled>
>       </snapshots>
>     </repository>
>   </repositories>
> </project>
>
> Here is the error message that I get:
>
> Missing:
> ----------
> 1) org.apache.maven.surefire:surefire-testng:jar:2.0-SNAPSHOT
>
>   Try downloading the file manually from the project website.
>
>   Then, install it using the command:
>       mvn install:install-file -DgroupId=org.apache.maven.surefire
> -DartifactId=surefire-testng \
>           -Dversion=2.0-20060304.160715-2 -Dpackaging=jar -Dfile=/path/to/file
>
>   Path to dependency:
>         1) dummy:dummy:jar:1.0
>         2) org.apache.maven.surefire:surefire-testng:jar:2.0-20060304.160715-2
>
> ----------
> 1 required artifact is missing.
>
> for artifact:
>   dummy:dummy:jar:1.0
>
> from the specified remote repositories:
>   Maven Snapshots (http://snapshots.maven.codehaus.org/maven2),
>   central (http://repo1.maven.org/maven2)
>
>
> For the repositories that I am using, the latest snapshot release that
> I saw was 1.5-SNAPSHOT. I should also mention that I am running Maven
> 2.0.4, but I assume that that shouldn't be a problem.
>
> Just for the sake of learning more about Maven, I did manage to get my
> annotations and testng.xml file recognized by executing the testng Ant
> task using the antrun plugin. Of course, I am aware that the antrun
> plugin is completely separaten from the SureFire plugin. I just wanted
> to verify that it wasn't something I was doing wrong on my end.
>
> Thanks.
>
> On 4/16/06, Brett Porter <br...@gmail.com> wrote:
> > Hi Ian,
> >
> > I'll roll these into the docs as it gets closer to release, but
> > currently this support is only in a development snapshot of surefire.
> >
> > Basically, you need to be using 2.2-SNAPSHOT of the surefire plugin,
> > and you must declare a testNG dependency (scoped test) in your
> > project.
> >
> > - Brett
> >
> > On 4/16/06, Ian Shafer <ia...@1321.org> wrote:
> > > Hello,
> > >
> > > I'm trying to use TestNG, but I'm having no luck. I'm using Java 1.5
> > > source and 1.5 compilation target and I'm using a 1.5 JVM (I don't
> > > have any other version of Java installed on the server that I'm
> > > working on).
> > >
> > > It seems that my 1.5 annotations are not being recognized. Only tests
> > > that begin with 'test' are being run and @Configuration(beforeSuite =
> > > true) is ignored. Any idea what I'm doing wrong? I'm not clear how
> > > surefire knows whether to run TestNG or JUnit; that would be nice to
> > > know too. Any info would be greatly appreciated.
> > >
> > > Thanks,
> > >
> > > Ian
> > >
> > >
> > >
> > > Here's a snippet from a test class:
> > >
> > > package com.example.test;
> > >
> > > // imports removed for brevity
> > >
> > > public class Test {
> > >      @Configuration(beforeSuite = true)
> > >      public void suiteSetup() throws Exception {
> > >          System.out.println("suiteSetup()");
> > >      }
> > >
> > >      @Test()
> > >      public void testAppContext() {
> > >          System.out.println("testAppContext");
> > >      }
> > > }
> > >
> > > Here's a snippet from my pom.xml:
> > >
> > >              <plugin>
> > >                  <groupId>org.apache.maven.plugins</groupId>
> > >                  <artifactId>maven-surefire-plugin</artifactId>
> > >                  <configuration>
> > >                      <suiteXmlFiles>src/test/resources/testng.xml</
> > > suiteXmlFiles>
> > >                  </configuration>
> > >              </plugin>
> > >
> > >
> > > testng.xml:
> > >
> > > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
> > >
> > > <suite name="All" verbose="1">
> > >      <test name="AllTests">
> > >          <packages>
> > >              <package name="com.example.test"/>
> > >          </packages>
> > >      </test>
> > > </suite>
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
>
> - John
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: m2.0.3 and TestNG

Posted by John Sanda <jo...@gmail.com>.
Hi Brett. I have run into the same situation as Ian, and I tried to
use the 2.2-SNAPSHOT version of the plugin, but I ran into some
problems. Here is what my pom.xml (with only relavant sections):

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.foo</groupId>
  <artifactId>maven-app</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Maven Quick Start Archetype</name>
  <url>http://maven.apache.org</url>
  <dependencies>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <version>4.6.1</version>
      <scope>test</scope>
      <classifier>jdk15</classifier>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </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>
    </plugins>
  </build>
  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <url>http://cvs.apache.org/maven-snapshot-repository</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
  <repositories>
    <repository>
      <id>Maven Snapshots</id>
      <url>http://snapshots.maven.codehaus.org/maven2</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>
</project>

Here is the error message that I get:

Missing:
----------
1) org.apache.maven.surefire:surefire-testng:jar:2.0-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.apache.maven.surefire
-DartifactId=surefire-testng \
          -Dversion=2.0-20060304.160715-2 -Dpackaging=jar -Dfile=/path/to/file

  Path to dependency:
        1) dummy:dummy:jar:1.0
        2) org.apache.maven.surefire:surefire-testng:jar:2.0-20060304.160715-2

----------
1 required artifact is missing.

for artifact:
  dummy:dummy:jar:1.0

from the specified remote repositories:
  Maven Snapshots (http://snapshots.maven.codehaus.org/maven2),
  central (http://repo1.maven.org/maven2)


For the repositories that I am using, the latest snapshot release that
I saw was 1.5-SNAPSHOT. I should also mention that I am running Maven
2.0.4, but I assume that that shouldn't be a problem.

Just for the sake of learning more about Maven, I did manage to get my
annotations and testng.xml file recognized by executing the testng Ant
task using the antrun plugin. Of course, I am aware that the antrun
plugin is completely separaten from the SureFire plugin. I just wanted
to verify that it wasn't something I was doing wrong on my end.

Thanks.

On 4/16/06, Brett Porter <br...@gmail.com> wrote:
> Hi Ian,
>
> I'll roll these into the docs as it gets closer to release, but
> currently this support is only in a development snapshot of surefire.
>
> Basically, you need to be using 2.2-SNAPSHOT of the surefire plugin,
> and you must declare a testNG dependency (scoped test) in your
> project.
>
> - Brett
>
> On 4/16/06, Ian Shafer <ia...@1321.org> wrote:
> > Hello,
> >
> > I'm trying to use TestNG, but I'm having no luck. I'm using Java 1.5
> > source and 1.5 compilation target and I'm using a 1.5 JVM (I don't
> > have any other version of Java installed on the server that I'm
> > working on).
> >
> > It seems that my 1.5 annotations are not being recognized. Only tests
> > that begin with 'test' are being run and @Configuration(beforeSuite =
> > true) is ignored. Any idea what I'm doing wrong? I'm not clear how
> > surefire knows whether to run TestNG or JUnit; that would be nice to
> > know too. Any info would be greatly appreciated.
> >
> > Thanks,
> >
> > Ian
> >
> >
> >
> > Here's a snippet from a test class:
> >
> > package com.example.test;
> >
> > // imports removed for brevity
> >
> > public class Test {
> >      @Configuration(beforeSuite = true)
> >      public void suiteSetup() throws Exception {
> >          System.out.println("suiteSetup()");
> >      }
> >
> >      @Test()
> >      public void testAppContext() {
> >          System.out.println("testAppContext");
> >      }
> > }
> >
> > Here's a snippet from my pom.xml:
> >
> >              <plugin>
> >                  <groupId>org.apache.maven.plugins</groupId>
> >                  <artifactId>maven-surefire-plugin</artifactId>
> >                  <configuration>
> >                      <suiteXmlFiles>src/test/resources/testng.xml</
> > suiteXmlFiles>
> >                  </configuration>
> >              </plugin>
> >
> >
> > testng.xml:
> >
> > <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
> >
> > <suite name="All" verbose="1">
> >      <test name="AllTests">
> >          <packages>
> >              <package name="com.example.test"/>
> >          </packages>
> >      </test>
> > </suite>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


--

- John

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: m2.0.3 and TestNG

Posted by Ian Shafer <ia...@1321.org>.
Thanks, Brett. I'd been looking all over this mailing list and  
various web sites but I couldn't get a clear picture. Thanks, for  
clarifying.

Ian


On Apr 16, 2006, at 4:24 PM, Brett Porter wrote:

Hi Ian,

I'll roll these into the docs as it gets closer to release, but
currently this support is only in a development snapshot of surefire.

Basically, you need to be using 2.2-SNAPSHOT of the surefire plugin,
and you must declare a testNG dependency (scoped test) in your
project.

- Brett

On 4/16/06, Ian Shafer <ia...@1321.org> wrote:
> Hello,
>
> I'm trying to use TestNG, but I'm having no luck. I'm using Java 1.5
> source and 1.5 compilation target and I'm using a 1.5 JVM (I don't
> have any other version of Java installed on the server that I'm
> working on).
>
> It seems that my 1.5 annotations are not being recognized. Only tests
> that begin with 'test' are being run and @Configuration(beforeSuite =
> true) is ignored. Any idea what I'm doing wrong? I'm not clear how
> surefire knows whether to run TestNG or JUnit; that would be nice to
> know too. Any info would be greatly appreciated.
>
> Thanks,
>
> Ian
>
>
>
> Here's a snippet from a test class:
>
> package com.example.test;
>
> // imports removed for brevity
>
> public class Test {
>      @Configuration(beforeSuite = true)
>      public void suiteSetup() throws Exception {
>          System.out.println("suiteSetup()");
>      }
>
>      @Test()
>      public void testAppContext() {
>          System.out.println("testAppContext");
>      }
> }
>
> Here's a snippet from my pom.xml:
>
>              <plugin>
>                  <groupId>org.apache.maven.plugins</groupId>
>                  <artifactId>maven-surefire-plugin</artifactId>
>                  <configuration>
>                      <suiteXmlFiles>src/test/resources/testng.xml</
> suiteXmlFiles>
>                  </configuration>
>              </plugin>
>
>
> testng.xml:
>
> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
>
> <suite name="All" verbose="1">
>      <test name="AllTests">
>          <packages>
>              <package name="com.example.test"/>
>          </packages>
>      </test>
> </suite>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: m2.0.3 and TestNG

Posted by Brett Porter <br...@gmail.com>.
Hi Ian,

I'll roll these into the docs as it gets closer to release, but
currently this support is only in a development snapshot of surefire.

Basically, you need to be using 2.2-SNAPSHOT of the surefire plugin,
and you must declare a testNG dependency (scoped test) in your
project.

- Brett

On 4/16/06, Ian Shafer <ia...@1321.org> wrote:
> Hello,
>
> I'm trying to use TestNG, but I'm having no luck. I'm using Java 1.5
> source and 1.5 compilation target and I'm using a 1.5 JVM (I don't
> have any other version of Java installed on the server that I'm
> working on).
>
> It seems that my 1.5 annotations are not being recognized. Only tests
> that begin with 'test' are being run and @Configuration(beforeSuite =
> true) is ignored. Any idea what I'm doing wrong? I'm not clear how
> surefire knows whether to run TestNG or JUnit; that would be nice to
> know too. Any info would be greatly appreciated.
>
> Thanks,
>
> Ian
>
>
>
> Here's a snippet from a test class:
>
> package com.example.test;
>
> // imports removed for brevity
>
> public class Test {
>      @Configuration(beforeSuite = true)
>      public void suiteSetup() throws Exception {
>          System.out.println("suiteSetup()");
>      }
>
>      @Test()
>      public void testAppContext() {
>          System.out.println("testAppContext");
>      }
> }
>
> Here's a snippet from my pom.xml:
>
>              <plugin>
>                  <groupId>org.apache.maven.plugins</groupId>
>                  <artifactId>maven-surefire-plugin</artifactId>
>                  <configuration>
>                      <suiteXmlFiles>src/test/resources/testng.xml</
> suiteXmlFiles>
>                  </configuration>
>              </plugin>
>
>
> testng.xml:
>
> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
>
> <suite name="All" verbose="1">
>      <test name="AllTests">
>          <packages>
>              <package name="com.example.test"/>
>          </packages>
>      </test>
> </suite>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org