[ http://jira.codehaus.org/browse/MSUREFIRE-85?page=comments#action_64562 ] 

Andreas Guther commented on MSUREFIRE-85:
-----------------------------------------

I must admit that I can now (?) run the tests as expected as well.  I created a 
sample project and added two TestNG classes, one ending with Test and one 
without.  The one with Test at the end was run but the tests (two) were not 
executed:

 C:\workspace\my-app>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] Nothing to compile - all classes are up to date
 [INFO] [resources:testResources]
 [INFO] Using default encoding to copy filtered resources.
 [INFO] [compiler:testCompile]
 Compiling 2 source files to C:\workspace\my-app\target\test-classes
 [INFO] [surefire:test]
 [INFO] Surefire report directory: C:\workspace\my-app\target\surefire-reports
 
 -------------------------------------------------------
  T E S T S
 -------------------------------------------------------
 Running com.mycompany.app.AppTest 
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.015 sec
 Running com.mycompany.app.TestNgJavaOneTngTest
 Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
 
 Results :
 Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
 
 [INFO] ------------------------------------------------------------------------
 [INFO] BUILD SUCCESSFUL
 [INFO] ------------------------------------------------------------------------
 [INFO] Total time: 2 seconds
 [INFO] Finished at: Tue May 02 07:14:11 PDT 2006
 [INFO] Final Memory: 4M/508M
 [INFO] ------------------------------------------------------------------------


When I use a testng configuration file the tests are executed:

 -------------------------------------------------------
  T E S T S
 -------------------------------------------------------
 Running Test with JavaDoc Annotations under Java 1.4
 com.mycompany.app.JavaOneFourTngSample: beforeClass
 com.mycompany.app.JavaOneFourTngSample: beforeMethod
 com.mycompany.app.JavaOneFourTngSample: someTestMethod
 com.mycompany.app.JavaOneFourTngSample: beforeMethod
 Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.032 sec <<< 
FAILURE!
 
 Results :
 Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
 
 [ERROR] There are test failures.

It also appears that the JUnit test is not ignored.  Is there only an either/or 
but not JUnit and TestNG together?  I know, I can include JUnit tests in the 
TestNG file, but finding them based on a pattern and executing them both would 
be nice.

I will attache my example project with configuration and files.



> Surefire does not run TestNG tests with JavaDoc annotations under Java 5 
> -------------------------------------------------------------------------
>
>          Key: MSUREFIRE-85
>          URL: http://jira.codehaus.org/browse/MSUREFIRE-85
>      Project: Maven 2.x Surefire Plugin
>         Type: Bug

>  Environment: Windows XP, Maven 2.0.3, Surefire plug-in,  TestNG 4.7, Java 5
>     Reporter: Andreas Guther
>     Assignee: Brett Porter

>
>
> I have TestNG tests with Java 1.4 JavaDoc annotations.  The tests are 
> executed with a testng.xml file.  I need to be able to execute those tests 
> under Java 5.  As it appears Surefire seems not to be able to recognize those 
> TestNG tests with Java 1.4 annotations and does not execute a single test 
> listed in the TestNG.xml test suite file.
> Relevant parts of my configuration are as follows:
> <dependency>
>                       <groupId>org.testng</groupId>
>                       <artifactId>testng</artifactId>
>                       <version>4.7</version>
>                       <scope>test</scope>
>                       <classifier>jdk14</classifier>
> </dependency>
> <plugins>
>                       <plugin>
>                               <groupId>org.apache.maven.plugins</groupId>
>                               <artifactId>maven-compiler-plugin</artifactId>
>                               <configuration>
>                                       <source>1.4</source>
>                                       <target>1.4</target>
>                               </configuration>
>                       </plugin>
>                       <plugin>
>                               <artifactId>maven-surefire-plugin</artifactId>
>                               <configuration>
>                                       
> <testFailureIgnore>true</testFailureIgnore>
>                                       <suiteXmlFiles>
>                                               
> <suiteXmlFile>src/test/resources/testng-xml-export.xml</suiteXmlFile>
>                                       </suiteXmlFiles>
>                               </configuration>
>                       </plugin>
> ...
> <pluginRepositories>
>               <pluginRepository>
>                       <id>apache.snapshots</id>
>                       <url> 
> http://cvs.apache.org/maven-snapshot-repository</url>
>               </pluginRepository>
>               <pluginRepository>
>                       <id>Maven Snapshots</id>
>                       <url>http://snapshots.maven.codehaus.org/maven2/</url>
>                       <snapshots>
>                               <enabled>true</enabled>
>                       </snapshots>
>                       <releases>
>                               <enabled>false</enabled>
>                       </releases>
>               </pluginRepository>
>       </pluginRepositories>
> testng.xml
> <!DOCTYPE suite SYSTEM "testng-1.0.dtd" >
> <suite name="XML Export" annotations="javadoc">
>   <test name="Builder Test">
>     <classes>
>       <class 
> name="mt.ztelligence.questionnaire.SurveyProjectXMlDataInjectorTestNg" />
>       <class name="mt.ztelligence.questionnaire.xml.XmlExporterTestNg"/>
>       <class 
> name="mt.ztelligence.survey.util.SurveyBuilderDataExtractorTestNg"/>
>     </classes>
>   </test>
> </suite>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to