[ 
http://jira.codehaus.org/browse/SUREFIRE-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=164171#action_164171
 ] 

James Kato commented on SUREFIRE-377:
-------------------------------------

Well, I've found a work around which is not too painful, just a little awkward.

Because it is the TestNG dependency that triggers surefire to use the TestNG 
runner to execute JUnit tests, I've moved this dependency out of the main 
project scope. In order to compile and run all JUnit tests, I exclude the 
TestNG tests from the compiler and surefire plugins.

Then in a profile, I add my TestNG dependency and adjust the compiler and 
surefire plugins to include the TestNG tests and the test suite file.

To run JUnit tests I use: mvn test
To run testNG tests I use: mvn test -P testng-profile

Simple when you know how. Any better solutions appreciated since I see problems 
with this as my number of tests increases.

James

> When JUnit and TestNG tests are in same project, only one set gets run
> ----------------------------------------------------------------------
>
>                 Key: SUREFIRE-377
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-377
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: TestNG support
>    Affects Versions: 2.4
>            Reporter: Dan Fabulich
>             Fix For: 2.4
>
>         Attachments: surefire377.patch, testng-junit-together.zip
>
>
> The attached Maven project has two tests: one JUnit test and one TestNG test. 
>  According to the documentation, in this case TestNG should run both tests.
> Run "mvn test".  Only the TestNG test will run.  If you modify the pom to set 
> the property "junit=true", only the JUnit test will run.
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-surefire-plugin</artifactId>
>   <version>2.4-SNAPSHOT</version>
>   <configuration>
>     <properties>
>       <property>
>         <name>junit</name>
>         <value>true</value>
>       </property>
>     </properties>
> </plugin>

-- 
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