TestNG appends instance count to the test name in reports

34 views
Skip to first unread message

zathras

unread,
Mar 18, 2019, 4:07:19 PM3/18/19
to testng-dev
TestNG appends instance count to the test name in reports, and this is not what I want. I can't use a report listener,because I'm running in ADO, and they only use the default report builder. I don't want this number appended, because it effectly changes the test name, so test case history is skewed, if I have retries on failure. 

I've tried all of the renaming techniques I could find, and they work fine, except for the [<incident>] number appended to the name. 

Here's and example of what I'm seeing. The ones with dataproviders have the unwanted appendage. 

<testsuite name="test.RetryExperiment" tests="7" skipped="0" failures="0" errors="0" timestamp="2019-03-18T11:57:07" hostname="ebishop" time="38.206">
<properties/>
<testcase name="RetryExperiment.dataProviderRetryTest [0](a, thing for a)" classname="test.RetryExperiment" time="0.002"/>
<testcase name="RetryExperiment.dataProviderRetryTest [1](b, thing for b)" classname="test.RetryExperiment" time="0.001"/>
<testcase name="RetryExperiment.dataProviderRetryTest [2](x, thing for x)" classname="test.RetryExperiment" time="0.001"/>
<testcase name="RetryExperiment.dataProviderRetryTest2 [0](Durok, red)" classname="test.RetryExperiment" time="0.0"/>
<testcase name="RetryExperiment.dataProviderRetryTest2 [1](Hampshire, Black with white stripe.)" classname="test.RetryExperiment" time="0.001"/>
<testcase name="RetryExperiment.dataProviderRetryTest2 [2](Chester White, White)" classname="test.RetryExperiment" time="0.001"/>
<testcase name="RetryExperiment.simpleRetryTest " classname="test.RetryExperiment" time="0.0"/>

⇜Krishnan Mahadevan⇝

unread,
Mar 19, 2019, 10:51:02 PM3/19/19
to testn...@googlegroups.com
>>>> I can't use a report listener,because I'm running in ADO,

I didnt quite understand this. Why do you say you cannot use/build your own listener? 

Also can you please tell me what xml report are you referring to here?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-dev+...@googlegroups.com.
To post to this group, send email to testn...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.

Eddie Bishop

unread,
Mar 20, 2019, 5:17:57 PM3/20/19
to testn...@googlegroups.com
In ADO, they only use reports created from the default Junit reporter. I have not tried overriding the TestNG default reporter, but I assume it's the same deal. 

⇜Krishnan Mahadevan⇝

unread,
Mar 21, 2019, 12:37:52 AM3/21/19
to testn...@googlegroups.com
Have you tried extending the default JUnit Reporter that TestNG provides, customize it to your needs and then work with it ?
You could try disabling the default reports. That way the one that TestNG internally has is not used, and yours get used instead.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

Eddie Bishop

unread,
Mar 21, 2019, 8:54:24 PM3/21/19
to testn...@googlegroups.com
How do I disable the default?

⇜Krishnan Mahadevan⇝

unread,
Mar 21, 2019, 10:18:27 PM3/21/19
to testn...@googlegroups.com
If you are running with Maven, you can add it as a property to your surefire plugin section.

Something like this:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <executions>
        <execution>
            <phase>test</phase>
        </execution>
    </executions>
    <configuration>
        <properties>
            <property>
                <name>usedefaultlisteners</name>
                <value>false</value>
            </property>
        </properties>
    </configuration>
</plugin>

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/

Reply all
Reply to author
Forward
0 new messages