Configure ReportNG to Eclipse+Selenium

3,233 views
Skip to first unread message

Baskar.R

unread,
Jul 29, 2011, 3:43:36 PM7/29/11
to Selenium Users
Hi All,

PLEASE HELP ME TO GET TEST RESULTS IN REPORTNG.it would be a great
help for me.

I am trying to setup the test results to ReportNG,the test is
executing sucessfully, but at the end of the test i am getting the
following error.

Configuration used: Eclipse,TestNG,ReportNG

i copied the ReportNG.jar and velocity.jar to the lib directory and
added to class path.

in testng.xml i have configured two java classes and two listenere
class of ReportNG

This is my testng.xml(Test Suite):
-----------------------------------
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1" >
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
<test name="Nopackage" >
<classes>
<class name="test.Default" />
<class name="test.google" />
</classes>
</test>
</suite>

Getting the following Error message after running the Test, getting
normal TestNG report.But not getting ReportNG result.
================================================================
01:05:12.437 INFO - Stopped HttpContext[/wd,/wd]
01:05:12.437 INFO - Stopped org.openqa.jetty.jetty.Server@17b0998
java.lang.NoClassDefFoundError: com/google/inject/Module
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
at
org.apache.velocity.util.introspection.ClassMap.getAccessibleMethods(ClassMap.java:
258)
at
org.apache.velocity.util.introspection.ClassMap.populateMethodCache(ClassMap.java:
151)
at
org.apache.velocity.util.introspection.ClassMap.<init>(ClassMap.java:
64)
at
org.apache.velocity.util.introspection.IntrospectorBase.createClassMap(IntrospectorBase.java:
126)
at
org.apache.velocity.util.introspection.IntrospectorBase.getMethod(IntrospectorBase.java:
112)
at
org.apache.velocity.util.introspection.Introspector.getMethod(Introspector.java:
100)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.discover(PropertyExecutor.java:
65)
at
org.apache.velocity.runtime.parser.node.PropertyExecutor.<init>(PropertyExecutor.java:
39)
at
org.apache.velocity.util.introspection.UberspectImpl.getPropertyGet(UberspectImpl.java:
156)
at
org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:
125)
at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:
175)
at
org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:
327)
at
org.apache.velocity.runtime.parser.node.ASTAddNode.value(ASTAddNode.java:
66)
at
org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:
51)
at
org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:
95)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:
55)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:
166)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:
114)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:
55)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:
166)
at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:
114)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:
230)
at org.apache.velocity.Template.merge(Template.java:256)
at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:449)
at
org.uncommons.reportng.AbstractReporter.generateFile(AbstractReporter.java:
108)
at
org.uncommons.reportng.HTMLReporter.createOverview(HTMLReporter.java:
142)
at
org.uncommons.reportng.HTMLReporter.generateReport(HTMLReporter.java:
107)
at org.testng.TestNG.generateReports(TestNG.java:1064)
at org.testng.TestNG.run(TestNG.java:1023)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:107)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:199)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:170)
Caused by: java.lang.ClassNotFoundException: com.google.inject.Module
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 36 more
RemoteTestNG finishing: 55235 ms

Thanks,
Baskar

Baskar.R

unread,
Aug 1, 2011, 1:04:50 PM8/1/11
to seleniu...@googlegroups.com
Hi All,

PLEASE HELP ME TO GET TEST RESULTS INREPORTNG.it would be a great
help for me.

I am trying to setup the test results toReportNG,the test is


executing sucessfully, but at the end of the test i am getting the
following error.

Configuration used: Eclipse,TestNG,ReportNG

i copied theReportNG.jar and velocity.jar to the lib directory and

Baskar.R

unread,
Aug 1, 2011, 4:19:17 PM8/1/11
to Selenium Users
issue resolved.

if we get the below error

java.lang.NoClassDefFoundError: com/google/inject/Module
>         at java.lang.Class.getDeclaredMethods0(Native Method)

Please download google juice jar and add to your eclipse lib folder.
Then select Project properties ->testNG->Disable default listeners.

then you will get the ReportNG test results in the "test-output\html"
directory. Note: this is the default test results directory for
TestNG.

Thanks,
Baskar
> org.apache.velocity.util.introspection.ClassMap.getAccessibleMethods(ClassM ap.java:
> 258)
>         at
> org.apache.velocity.util.introspection.ClassMap.populateMethodCache(ClassMa p.java:
> 151)
>         at
> org.apache.velocity.util.introspection.ClassMap.<init>(ClassMap.java:
> 64)
>         at
> 327)
>         at
> org.apache.velocity.runtime.parser.node.ASTAddNode.value(ASTAddNode.java:
> 66)
>         at
> org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.j ava:
> 51)
>         at
> org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirect ive.java:

amber soni

unread,
Aug 8, 2011, 1:19:26 AM8/8/11
to Selenium Users
Hi baskar,
Thanks for the above useful post its also worked fine for me.

Prakash Varma

unread,
Sep 13, 2011, 8:23:32 AM9/13/11
to Selenium Users
I have configured everything as needed for reportNG.
But while building the build.xml it thorws me the below error.


BUILD FAILED
C:\New_WorkSpace\SampleTestNG\build.xml:66: Reference test-path not
found.

Build.XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create
one in the same
directory with the processing instruction <?
eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="SampleTestNG">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="SampleTestNG.classpath">
<pathelement location="bin"/>
<pathelement location="../../Documents and Settings/bkasira/My
Documents/Technical_Apps/selenium-java-2.4.0/selenium-2.4.0/selenium-
java-2.4.0.jar"/>
<pathelement location="../../Documents and Settings/bkasira/My
Documents/Technical_Apps/selenium-server-standalone-2.4.0.jar"/>
<pathelement location="../../Documents and Settings/bkasira/My
Documents/Technical_Apps/ReportNG/ReportNG/reportng/lib/runtime/
velocity-dep-1.4.jar"/>
<pathelement location="../../Documents and Settings/bkasira/My
Documents/Technical_Apps/reportng-1.1.3.jar"/>
<pathelement location="../../Documents and Settings/bkasira/My
Documents/Technical_Apps/testng-5.14.10/testng-5.14.10/
testng-5.13.1.jar"/>
<pathelement location="../../Documents and Settings/bkasira/My
Documents/Technical_Apps/guice-1.0.jar"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin"
source="${source}" target="${target}">
<src path="src"/>
<classpath refid="SampleTestNG.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this
project. Useful to propagate changes." name="build-refprojects"/>
<target description="copy Eclipse compiler jars to ant lib
directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins"
includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins"
includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler"
name="build-eclipse-compiler">
<property name="build.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>

<!-- Runs the file and generates oReportng report -->
<target name="TestNG" description="Running tests" >
<echo>Running Tests...</echo>
<taskdef resource="testngtasks" classpath="${extralib.dir}/
testng-5.13.1.jar" />
<testng classpathref="test-path"
outputdir="${test-results.dir}"
haltonfailure="true"
useDefaultListeners="false"

listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
<xmlfileset dir="." includes="testng.xml"/>
<sysproperty key="org.uncommons.reportng.title" value="My
Test Report"/>
</testng>
</target>

<!-- Open the report in browser.-->
<target name="openReport">
<exec executable="${browser}" spawn="yes">
<arg line="'${report.dir}\html\index.html'" />
</exec>
</target>
</project>




On Aug 2, 1:19 am, "Baskar.R" <torgbas...@gmail.com> wrote:
> issue resolved.
>
> if we get the below error
>
>  java.lang.NoClassDefFoundError: com/google/inject/Module
>
> >         at java.lang.Class.getDeclaredMethods0(Native Method)
>
> Please download google juice jar and add to your eclipse lib folder.
> Then select Project properties ->testNG->Disable default listeners.
>
> then you will get theReportNGtest results in the "test-output\html"
> directory. Note: this is the default test results directory for
> TestNG.
>
> Thanks,
> Baskar
>
> On Jul 30, 12:43 am, "Baskar.R" <torgbas...@gmail.com> wrote:
>
> > Hi All,
>
> > PLEASE HELP ME TO GET TEST RESULTS INREPORTNG.it would be a great
> > help for me.
>
> > I am trying to setup the test results toReportNG,the test is
> > executing sucessfully, but at the end of the test i am getting the
> > following error.
>
> > Configuration used: Eclipse,TestNG,ReportNG
>
> > i copied theReportNG.jar and velocity.jar to the lib directory and

paritosh verma

unread,
Mar 22, 2018, 9:42:26 AM3/22/18
to Selenium Users


Hi All,

i m still getting this error in my project

[RemoteTestNG] detected TestNG version 6.14.2
org.testng.TestNGException: 
Listener org.uncommons.reportng.HTMLReporter was not found in project's classpath
at org.testng.TestNG.addListeners(TestNG.java:946)
at org.testng.TestNG.initializeConfiguration(TestNG.java:912)
at org.testng.TestNG.initializeEverything(TestNG.java:996)
at org.testng.remote.support.RemoteTestNG6_12.initialize(RemoteTestNG6_12.java:22)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:97)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

thanks
Paritosh
Reply all
Reply to author
Forward
0 new messages