junitreport missing package and class names

216 views
Skip to first unread message

JEEWEZ

unread,
May 3, 2007, 6:51:08 AM5/3/07
to testng-users
I've managed to get TestNG to produce an output somewhat like
junitreport. However, my reports are missing package and class names.


If I used a testng.xml file, the classname is set to Regression in my
junitreport

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="TemplateSuite" verbose="1">
<test name="Regression">
<packages>
<package name="com.example.template.businessservices" />
</packages>
</test>
</suite>

Looking at TESTS-TestSuites.xml, and the testsuite element, I can see
that package is not set


<?xml version="1.0" encoding="UTF-8" ?>
<testsuites>
<testsuite errors="0" failures="2" id="0" name="Regression"
package="" tests="4" time="0.422">
<properties />
<testcase
classname="com.example.template.businessservices.UserServicesImplTest"
name="testUpdateUser" time="0.14">
<failure message="Batch update returned unexpected row count
from update [0]; actual row count: 0; expected: 1; nested exception is
org.hibernate.StaleStateException: Batch update returned unexpected
row count from update [0]; actual row count: 0; expected: 1"
type="org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException"><!
[CDATA[org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException:
Batch update returned unexpected row count from update [0]; actual row
count: 0; expected: 1; nested exception is
org.hibernate.StaleStateException: Batch update returned unexpected
row count from update [0]; actual row count: 0; expected: 1

Caused by: org.hibernate.StaleStateException: Batch update returned
unexpected row count from update [0]; actual row count: 0; expected: 1

--- SNIP _--
</failure>
</testcase>
<testcase
classname="com.example.template.businessservices.UserServicesImplTest"
name="testAddUser" time="0.078" />
<testcase
classname="com.example.template.businessservices.UserServicesImplTest"
name="testDeleteUser" time="0.031" />
</testsuite>
</testsuites>


This is the ant target I'm using

<target name="testng" depends="clean, compile">
<echo>${basedir}</echo>

<!--
<testng classpathref="project.classpath" outputDir="$
{junit.output.dir}" haltOnfailure="false">
<xmlfileset dir="${basedir}" includes="testng.xml" />
</testng>
-->


<testng classpathref="project.classpath" outputDir="$
{junit.output.dir}" haltOnFailure="false" verbose="2">
<classfileset dir="${build.dir}" includes="**/*.class" />
</testng>

<antcall target="testng-report" />
</target>

<target name="testng-report">
<junitreport todir="${junit.output.dir}">
<fileset dir="${junit.output.dir}">
<include name="*.xml" />
<include name="**/*.xml" />
<exclude name="**/testng-failed.xml" />
</fileset>
<report format="frames" todir="${junit.output.dir}" />
</junitreport>
</target>

Anyone able to help?

Dies Koper

unread,
May 8, 2007, 11:56:43 PM5/8/07
to testng...@googlegroups.com
Hello Jeewez,

I am not sure whether it is related to your issue, but I once tried to
customize the package names in the left frame of the JUnit reports, and
noticed that they refer to the suite and test names.

I do not remember the details, but I believe the test name should
consist of the suite name + "." + the test name as follows.

<suite name="test" verbose="1">

<test name="test.TestA">
<method-selectors>
[...]
</method-selectors>

<classes>
<class name="test.TestA"/>
</classes>
</test>

<test name="test.TestB">
<method-selectors>
[...]
</method-selectors>

<classes>
<class name="test.TestB"/>
</classes>
</test>
</suite>

In your example, I suppose renaming the test name to
"TemplateSuite.Regression" should do the trick.

Regards,
Dies

spidey

unread,
May 14, 2007, 1:48:45 PM5/14/07
to testng...@googlegroups.com

I am not able to get this to work either.
Anyone know what the issue might be.

--
View this message in context: http://www.nabble.com/junitreport-missing-package-and-class-names-tf3686968.html#a10608858
Sent from the testng-users mailing list archive at Nabble.com.

Alexandru Popescu ☀

unread,
May 14, 2007, 2:38:04 PM5/14/07
to testng...@googlegroups.com
On 5/14/07, spidey <rshan...@gmail.com> wrote:
>
>
> I am not able to get this to work either.
> Anyone know what the issue might be.
>

Maybe you can send us a small example of what exactly would you like
the output to be.

./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator

spidey

unread,
May 18, 2007, 12:57:47 PM5/18/07
to testng...@googlegroups.com

Here is the test definition I am using:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite verbose="1" name="Test Suite" annotations="javadoc">
<test name = "Package Test" junit="false" verbose="1">
<packages>
<package name="test.biz.sample" junit="false"/>
</packages>
</test>
</suite>

I am generating a junit report after the test completes but when I look at
the report:
1. The Packages section of the report shows <none> as the package name
I was expecting "test.biz.sample" as the package name
2. Under the classes section of the report, "Package Test" shows up as the
class name
I was expecting all the qualified class names from the package to show
up here
3. If I click on Package Test, I see all the test method from all the
classes in the package
I was expecting a list of classes here which I could drill down to see
the respective test methods

I have both junit and testng tests and I am trying to get them all in one
report. I am hoping to move all my test to testng in the near future but I
am not able to generate a consistent report. For the time being I am
creating a testng.xml file and listing out each of classes in their on
<test> blocks to acheive this.

Here is my junit report definition:
<junitreport todir="${reports}">
<fileset dir="${reports}">
<include name="TEST-*.xml"/>
<include name="test-output/**/*.xml"/>
<exclude name="test-output/**/testng-failed.xml"/>
</fileset>
<report format="frames" todir="${reports.html}"/>
</junitreport>

Please let me know if I am doing something wrong.

Thanks,
Ramnath.

--
View this message in context: http://www.nabble.com/junitreport-missing-package-and-class-names-tf3686968.html#a10686175

Reply all
Reply to author
Forward
0 new messages