how to generate report with maven

828 views
Skip to first unread message

cynthia

unread,
Nov 1, 2010, 5:12:12 AM11/1/10
to testng-users
Hi All
Anyone could help me to set up report with reportNG in maven? How to
update following pom.xml or configuration? thanks a lot
------
Following are my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.study.testng</groupId>
<artifactId>MyStudy</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>MyStudy</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- update default maven repository -->
<repositories>
<repository>
<id>default</id>
<name>repo1 Maven Repository</name>
<url>http://repo1.maven.org/maven2</url>
<layout>default</layout>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>testng Repository for Maven</name>
<url>http://download.java.net/maven/2</url>
<layout>default</layout>

</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.14.2</version>
<type>jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.5</version>
</dependency>

<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.2</version>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>

</dependencies>

</project>

Cédric Beust ♔

unread,
Nov 1, 2010, 12:14:43 PM11/1/10
to testng...@googlegroups.com, Daniel Dyer
Dan can probably help.

-- 
Cédric



--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


Daniel Dyer

unread,
Nov 1, 2010, 12:28:52 PM11/1/10
to testng...@googlegroups.com, Cédric Beust ♔
On Mon, 01 Nov 2010 16:14:43 -0000, Cédric Beust ♔ <ced...@beust.com>
wrote:

> Dan can probably help.

I probably have less of an idea than you do. I'm not a fan of Maven and
try to avoid using it.

How would you normally attach a TestNG reporter with Maven?

I found this linked from the TestNG site:

http://maven.apache.org/plugins/maven-surefire-plugin/examples/testng.html

So I would guess that you have to add something like this:

<property>
<name>reporter</name>
<value>org.uncommons.reportng.HTMLReporter</value>
</property>

Dan.

--
Daniel Dyer

cynthia

unread,
Nov 2, 2010, 10:25:46 PM11/2/10
to testng-users
Thanx Dan.
I'm a fresher for Maven, and I update my pom.xml as your
suggestion,After I run "mvn test" ,I will view a info that
Please refer to /home/workspace/MyStudy/target/surefire-reports for
the individual test results.
I couldn't find any report generated by reportNG. Could you give more
idea for me? thanks
------------------------------------------
My pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/main/java/myStudyNG.xml</
suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>usedefaultlisteners</name>
<value>false</value> <!-- disabling default
listeners is optional -->
</property>
<property>
<name>listener</name>
<value>
org.uncommons.reportng.HTMLReporter,org
</value>
</property>
<property>
<name>reporter</name>
<value>listenReport.Reporter</value>
</property>
</properties>

</configuration>
</plugin>
On Nov 2, 12:28 am, "Daniel Dyer" <british...@gmail.com> wrote:
> On Mon, 01 Nov 2010 16:14:43 -0000, Cédric Beust ♔ <ced...@beust.com>  
> wrote:
>
> > Dan can probably help.
>
> I probably have less of an idea than you do.  I'm not a fan of Maven and  
> try to avoid using it.
>
> How would you normally attach a TestNG reporter with Maven?
>
> I found this linked from the TestNG site:
>
> http://maven.apache.org/plugins/maven-surefire-plugin/examples/testng...

Cédric Beust ♔

unread,
Nov 2, 2010, 10:29:10 PM11/2/10
to testng...@googlegroups.com
Cynthia,

Maven generates all its files under target/, typically in the directory you ran it from. Look for a surefire-reports/ directory under that.

-- 
Cédric


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.




--
Cédric


陈抒

unread,
Nov 2, 2010, 10:39:50 PM11/2/10
to testng...@googlegroups.com
Yes.In my Maven2 project,the emailable-report.html file is under target/surefire-reports folder.


陈抒
Best regards
http://blog.csdn.net/sheismylife


2010/11/3 Cédric Beust ♔ <ced...@beust.com>

cynthia

unread,
Nov 2, 2010, 10:40:38 PM11/2/10
to testng-users
I'm so sorry,I find my HTML report in /target/surefire-reports. My
report is OK now.
Thanks so much
Reply all
Reply to author
Forward
0 new messages