Hi,

I have the following M2 2.0.4 project containing the following 3 files:

A. $PROJECT_ROOT/src/test/java/testgroup/AppTest.java :

package testgroup;

public class AppTest
{
 /**
  * @testng.test
  */
 public void doSomething()
 {
   System.out.println("doSomething() called");
 }
}

B. $PROJECT_ROOT/testng.xml :

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"; >
<suite name="Suite1"  verbose="1" >
 <test name="Regression1">
   <classes>
     <class name="testgroup.AppTest"/>
   </classes>
 </test>
</suite>

C. $PROJECT_ROOT/pom.xml :

<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>testgroup</groupId>
 <artifactId>testapp</artifactId>
 <packaging>jar</packaging>
 <version>1.0-SNAPSHOT</version>
 <name>Maven Quick Start Archetype</name>
 <url>http://maven.apache.org</url>
 <dependencies>
   <dependency>
     <groupId>org.testng</groupId>
     <artifactId>testng</artifactId>
     <version>5.1</version>
     <scope>test</scope>
     <classifier>jdk14</classifier>
   </dependency>
 </dependencies>
 <build>
   <plugins>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-surefire-plugin</artifactId>
       <configuration>
         <suiteXmlFiles>
           <suiteXmlFile>testng.xml</suiteXmlFile>
         </suiteXmlFiles>
       </configuration>
     </plugin>
   </plugins>
 </build>
</project>

When running the tests I get:

$mvn test
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Quick Start Archetype
[INFO]    task-segment: [test]
[INFO] ----------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
Compiling 1 source file to C:\tmp\xxx\testapp\testapp\target\test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory: C:\tmp\xxx\testapp\testapp\target\surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running Regression1
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.09 sec

Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Tue Sep 26 21:16:26 CEST 2006
[INFO] Final Memory: 3M/10M
[INFO] ------------------------------------------------------------------------

So no tests were found by M2! However if I directly run the TestNG tests from
the command-line, e.g.:

$c:\devtools\j2sdk1.4.2_10\bin\java.exe -cp \
 target\test-classes;c:\devtools\testng-5.1\testng-5.1-jdk14.jar \
 org.testng.TestNG \
 -sourcedir src\test\java testng.xml

then I get :

doSomething() called

===============================================
Suite1
Total tests run: 1, Failures: 0, Skips: 0
===============================================

Remark that before I ran the above tests, I completely deleted ~/.m2, so the
local repository would be reinitialized from scratch based on what's available
in http://www.ibiblio.org/maven2.

Regards,
Davy Toch

Davy Toch wrote:
Hi,

I was just wondering whether TestNG support in M2 is already
stable and can be used as a viable replacement of JUnit? I
already tried using TestNG in M2 but I had different problems
(tests not being run, ClassCastException, ...).

So before I start posting my TestNG-related problems in detail,
I just have this simple question : is M2 2.0.4 already supposed
to fully support TestNG or is it recommended to wait until M2
2.0.5 or higher?

Regards and thanks,
Davy Toch





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to