excel reports? i'm not sure which reports are those.
but if you want reports from maven use this.
1. go to this link <http://relevantcodes.com/testng-listener-using-extentreports/>
2. create class "ExtentReporterNG". This is Listener class and put second block code in it from upper link and save it.
3. put ExtentReporterNG this listener in your testneg.xml. change package name with your package name.
<listeners>
<listener class-name="package.ExtentReporterNG" />
</listeners>
4. Add dependency in you POM.xml
<!-- Extent Reports -->
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.40.1</version>
</dependency>
5. now open cmd prompt and go to your project location and run command "mvn compile" and after it run "mvn package"
6. go in eclipse and refresh your project and run your testng.xml
7. after running refresh your project and check report in test output folder.
8. a folder generate with your class name. check extent.html in it and open this in web browser.
Hi Ashish:
The Excel report you generate under source folder under \target\reports which uses the ReportTemplate.xlsx. This gets generated only when right clicking on TestNg.xml and are not generated when running the script thru Maven/command prompt.
Even the Extent reports are not generated by Maven but are generated when running thru TestNg.xml.
Please help.
I already have that plugin in pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<!-- Skip the normal tests, we'll run them in the integration-test phase -->
<skip>true</skip>
</configuration>
</plugin>
When I run thru pom.xml, folder by name 'null' is generated with the log files but the excel report is not generated.
send a screen shot of sunfire plugin and console output when you are running it.
Here is the pom.xml I have
<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.company.datadriven</groupId>
<artifactId>DataDrivenFramework_TestNG</artifactId>
<version>1</version>
<packaging>jar</packaging>
<name>DataDrivenFramework_TestNG</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.8</version>
<scope>test</scope>
</dependency>
<!-- Selenium -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.48.2</version>
</dependency>
<!-- POI -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
<!-- Log4J -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<!-- JavaMail -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.04</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<!-- Skip the normal tests, we'll run them in the integration-test phase -->
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<!-- TestNG-xslt related configuration. -->
<plugin>
<groupId>org.reportyng</groupId>
<artifactId>reporty-ng</artifactId>
<version>1.2</version>
<configuration>
<!-- Output directory for the testng xslt report -->
<outputdir>/target/testng-xslt-report</outputdir>
<sorttestcaselinks>true</sorttestcaselinks>
<testdetailsfilter>FAIL,SKIP,PASS,CONF,BY_CLASS</testdetailsfilter>
<showruntimetotals>true</showruntimetotals>
</configuration>
</plugin>
</plugins>
</reporting>
<pluginRepositories>
<pluginRepository>
<id>reporty-ng</id>
<url>https://github.com/cosminaru/reporty-ng/raw/master/dist/maven</url>
</pluginRepository>
</pluginRepositories>
</project>
Here is the Console output:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.vivantech.datadriven:DataDrivenFramework_TestNG:jar:1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-report-plugin is missing. @ line 81, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DataDrivenFramework_TestNG 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ DataDrivenFramework_TestNG ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\workspace\DataDrivenFramework_TestNG\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ DataDrivenFramework_TestNG ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ DataDrivenFramework_TestNG ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ DataDrivenFramework_TestNG ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ DataDrivenFramework_TestNG ---
[INFO] Surefire report directory: C:\workspace\DataDrivenFramework_TestNG\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@5d1ddcf4
C:\TestData\Sample\
Total rows - 26
Test Starts from row Number - 1
Total rows of data are - 3
Total rows - 11
Test Starts from row Number - 1
Total rows of data are - 3
Total rows - 26
Test Starts from row Number - 1
Total rows of data are - 3
C:\TestData\Sample\
Total rows - 26
Test Starts from row Number - 7
Total rows of data are - 3
Total rows - 11
Test Starts from row Number - 7
Total rows of data are - 3
Tests run: 18, Failures: 0, Errors: 0, Skipped: 11, Time elapsed: 3.757 sec
Results :
Tests run: 18, Failures: 0, Errors: 0, Skipped: 11
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.127 s
[INFO] Finished at: 2016-03-06T13:42:22-08:00
[INFO] Final Memory: 12M/224M
[INFO] ------------------------------------------------------------------------
replace this
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
I replaced it but still the Excel report is not generated when running thru pom.xml. I am attaching the pom.xml file.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DataDrivenFramework_TestNG 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ DataDrivenFramework_TestNG ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\workspace\DataDrivenFramework_TestNG\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ DataDrivenFramework_TestNG ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ DataDrivenFramework_TestNG ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ DataDrivenFramework_TestNG ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ DataDrivenFramework_TestNG ---
[INFO] Surefire report directory: C:\workspace\DataDrivenFramework_TestNG\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@163f47e
C:\TestData\Sample\
Total rows - 26
Test Starts from row Number - 1
Total rows of data are - 3
Total rows - 11
Test Starts from row Number - 1
Total rows of data are - 3
Total rows - 26
Test Starts from row Number - 1
Total rows of data are - 3
C:\TestData\Sample\
Total rows - 26
Test Starts from row Number - 7
Total rows of data are - 3
Total rows - 11
Test Starts from row Number - 7
Total rows of data are - 3
Tests run: 18, Failures: 0, Errors: 0, Skipped: 11, Time elapsed: 3.688 sec
Results :
Tests run: 18, Failures: 0, Errors: 0, Skipped: 11
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.551 s
[INFO] Finished at: 2016-03-07T20:36:03-08:00
[INFO] Final Memory: 11M/219M
[INFO] ------------------------------------------------------------------------
No, the Excel report is not being generated. Under the projectfolder/target/reports. The java jdk version I am using is jdk 1.7.0.79. Is this the correct version?
check under all the folder the there should be [color=#FF0000:3t8x0qvt]extent.html[/color:3t8x0qvt] file present.
No both the excel report and extent report are not generated when running thru pom.xml.