java - TestNG tests don't run in Maven Project alongside JUnit4 projects -


this project uses both testng , junit4. not able run testng test suite reason. error stack trace given below.. advice gratefully appreciated.

-------------------------------------------------------  t e s t s ------------------------------------------------------- running testsuite exception in thread "threadedstreamconsumer" java.lang.nosuchmethoderror: org.ap ache.maven.surefire.report.stacktracewriter.getthrowable()ljava/lang/throwable;         @ org.apache.maven.surefire.report.xmlreporter.writetestproblems(xmlrep orter.java:272)         @ org.apache.maven.surefire.report.xmlreporter.testfailed(xmlreporter.j ava:249)         @ org.apache.maven.surefire.report.multicastingreporter.testfailed(mult icastingreporter.java:80)         @ org.apache.maven.surefire.report.testsetrunlistener.testfailed(testse trunlistener.java:157)         @ org.apache.maven.plugin.surefire.booterclient.output.forkclient.consu meline(forkclient.java:106)         @ org.apache.maven.plugin.surefire.booterclient.output.threadedstreamco nsumer$pumper.run(threadedstreamconsumer.java:67)         @ java.lang.thread.run(thread.java:722)  results :  tests run: 0, failures: 0, errors: 0, skipped: 0 

my pom set given below

<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>  <prerequisites>     <maven>3.0.4</maven>  </prerequisites>  <properties>     <project.build.sourceencoding>utf-8</project.build.sourceencoding>     <surefire.version>2.13</surefire.version>  </properties>  <parent>   <groupid>com.google</groupid>   <artifactid>google</artifactid>   <version>1</version>  </parent>  <groupid>com.google.testing</groupid>  <artifactid>test-libraries-for-java</artifactid>  <version>1.2</version>   <profiles>   <profile>   <id>junit4-only</id>   <build>    <finalname>tl4j</finalname>     <plugins>       <plugin>         <artifactid>maven-jar-plugin</artifactid>         <executions>           <execution>             <phase>package</phase>             <goals>               <goal>jar</goal>             </goals>             <configuration>               <classifier>junit4-only-${project.version}</classifier>               <includes>                 <include>**/junit4/*</include>               </includes>             </configuration>           </execution>         </executions>       </plugin>     </plugins>   </build> </profile>  <profile>   <id>agnostic</id>   <build>    <finalname>tl4j</finalname>     <plugins>       <plugin>         <artifactid>maven-jar-plugin</artifactid>         <executions>           <execution>             <phase>package</phase>             <goals>               <goal>jar</goal>             </goals>             <configuration>               <classifier>agnostic-${project.version}</classifier>               <includes>                 <include>**/common/testing/*.class</include>               </includes>             </configuration>           </execution>         </executions>       </plugin>     </plugins>   </build> </profile>   <profile>   <id>junit4</id>   <build>     <finalname>tl4j</finalname>     <plugins>       <plugin>         <artifactid>maven-jar-plugin</artifactid>         <executions>           <execution>             <phase>package</phase>             <goals>               <goal>jar</goal>             </goals>             <configuration>               <classifier>junit4-${project.version}</classifier>               <includes>                 <include>**/common/testing/*.class</include>                 <include>**/junit4/*</include>               </includes>             </configuration>           </execution>         </executions>       </plugin>     </plugins>   </build> </profile>  <profile>    <id>testng</id>    <build>        <finalname>tl4j</finalname>        <plugins>            <plugin>                <artifactid>maven-jar-plugin</artifactid>                <executions>                    <execution>                        <phase>package</phase>                        <goals>                            <goal>jar</goal>                        </goals>                        <configuration>                            <classifier>testng-${project.version}</classifier>                            <includes>                                <include>**/common/testing/*.class</include>                                <include>**/testng/*</include>                            </includes>                        </configuration>                    </execution>                </executions>            </plugin>        </plugins>    </build>   </profile>   <profile>       <id>testng-only</id>       <build>           <finalname>tl4j</finalname>           <plugins>               <plugin>                   <artifactid>maven-jar-plugin</artifactid>                   <executions>                       <execution>                           <phase>package</phase>                           <goals>                               <goal>jar</goal>                           </goals>                           <configuration>                               <classifier>testng-${project.version}</classifier>                               <includes>                                  <include>**/testng/*</include>                               </includes>                           </configuration>                       </execution>                   </executions>               </plugin>           </plugins>       </build>   </profile> </profiles> <dependencies>   <dependency>     <groupid>junit</groupid>     <artifactid>junit</artifactid>     <version>4.10</version>   </dependency>   <dependency>       <groupid>org.testng</groupid>       <artifactid>testng</artifactid>       <version>6.3.1</version>   </dependency>   <dependency>       <groupid>org.apache.maven.plugins</groupid>       <artifactid>maven-surefire-plugin</artifactid>       <version>2.15</version>       <type>maven-plugin</type>   </dependency> </dependencies>  <build> <!--  <finalname>tl4j</finalname>       -->   <plugins>     <plugin>       <artifactid>maven-compiler-plugin</artifactid>       <configuration>         <source>1.6</source>         <target>1.6</target>       </configuration>     </plugin>     <plugin>       <artifactid>maven-eclipse-plugin</artifactid>       <configuration>         <outputdirectory>${basedir}/target-eclipse/classes</outputdirectory>       </configuration>     </plugin>     <plugin>       <artifactid>maven-antrun-plugin</artifactid>       <executions>         <execution>           <id>deploy</id>           <phase>deploy</phase>           <configuration>             <tasks>               <echo                 message="please follow directions @ doc/how_to_release.txt make release" />             </tasks>           </configuration>           <goals>             <goal>run</goal>           </goals>         </execution>       </executions>     </plugin>     <plugin>        <artifactid>maven-surefire-plugin</artifactid>        <dependencies>           <dependency>             <groupid>org.apache.maven.surefire</groupid>             <artifactid>surefire-junit4</artifactid>             <version>${surefire.version}</version>           </dependency>            <dependency>              <groupid>org.apache.maven.surefire</groupid>              <artifactid>surefire-testng</artifactid>              <version>${surefire.version}</version>            </dependency>        </dependencies>     </plugin>   </plugins> </build> <reporting>   <plugins>     <plugin>       <groupid>org.apache.maven.plugins</groupid>       <artifactid>maven-javadoc-plugin</artifactid>       <version>2.7</version>       <configuration>         <show>private</show>         <nohelp>true</nohelp>       </configuration>     </plugin>   </plugins> </reporting> 

my unit test

import org.testng.assert; import org.testng.annotations.test;  public class teardowntestcasetest {    @test   public void asserttrue() {     assert.asserttrue(true);   } } 

funny thing if configure test run junit 3 test case, works, not junit 4.x or testng.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -