New listener result.getTestName() is null

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

New listener result.getTestName() is null

testnguser-5

I have  a listener extending TestListenerAdapter. Functions such as getMethod etc. work perfectly. But getTestName() shows null. My TestNGSuite.xml file specifies
<suite ....>
<test name="hellotest" ....>



//listener class
public void onTestFailure(ITestResult result) {
       
        System.out.println("Test Name :: "+result.getTestName());
       
    }

Am I specifying it wrong?


Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/RNK_92JwB2kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: New listener result.getTestName() is null

Krishnan Mahadevan
Harini,
getTestName() returns the value that you configure your Testclass to implement ITest interface and then have it return the desired test name.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Tue, Jul 24, 2012 at 10:15 PM, testnguser <[hidden email]> wrote:

I have  a listener extending TestListenerAdapter. Functions such as getMethod etc. work perfectly. But getTestName() shows null. My TestNGSuite.xml file specifies
<suite ....>
<test name="hellotest" ....>



//listener class
public void onTestFailure(ITestResult result) {
       
        System.out.println("Test Name :: "+result.getTestName());
       
    }

Am I specifying it wrong?


Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/RNK_92JwB2kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: New listener result.getTestName() is null

Krishnan Mahadevan
Javadocs : http://testng.org/javadoc/org/testng/ITestResult.html#getTestName%28%29


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Tue, Jul 24, 2012 at 10:28 PM, Krishnan Mahadevan <[hidden email]> wrote:
Harini,
getTestName() returns the value that you configure your Testclass to implement ITest interface and then have it return the desired test name.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




On Tue, Jul 24, 2012 at 10:15 PM, testnguser <[hidden email]> wrote:

I have  a listener extending TestListenerAdapter. Functions such as getMethod etc. work perfectly. But getTestName() shows null. My TestNGSuite.xml file specifies
<suite ....>
<test name="hellotest" ....>



//listener class
public void onTestFailure(ITestResult result) {
       
        System.out.println("Test Name :: "+result.getTestName());
       
    }

Am I specifying it wrong?


Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/RNK_92JwB2kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: New listener result.getTestName() is null

testnguser-5
Hello,

Thanks a lot for the tip. :) It works if I set the testName.
My bad, I did not notice the documentation. Is there a way I can receive the testName from my suite.xml file?
Thanks!

On Tuesday, July 24, 2012 10:00:28 AM UTC-7, Krishnan wrote:
Javadocs : http://testng.org/javadoc/org/testng/ITestResult.html#getTestName%28%29


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Tue, Jul 24, 2012 at 10:28 PM, Krishnan Mahadevan <[hidden email]> wrote:
Harini,
getTestName() returns the value that you configure your Testclass to implement ITest interface and then have it return the desired test name.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




On Tue, Jul 24, 2012 at 10:15 PM, testnguser <[hidden email]> wrote:

I have  a listener extending TestListenerAdapter. Functions such as getMethod etc. work perfectly. But getTestName() shows null. My TestNGSuite.xml file specifies
<suite ....>
<test name="hellotest" ....>



//listener class
public void onTestFailure(ITestResult result) {
       
        System.out.println("Test Name :: "+result.getTestName());
       
    }

Am I specifying it wrong?


Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/RNK_92JwB2kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/lOoWC_f_KI4J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: New listener result.getTestName() is null

Krishnan Mahadevan
You could try passing it via @Parameters and then have the @Test method set the value for the test name in a data member of your test class which can be returned back by the ITest interface method. 

Would that help?

On Wednesday, July 25, 2012, testnguser wrote:
Hello,

Thanks a lot for the tip. :) It works if I set the testName.
My bad, I did not notice the documentation. Is there a way I can receive the testName from my suite.xml file?
Thanks!

On Tuesday, July 24, 2012 10:00:28 AM UTC-7, Krishnan wrote:
Javadocs : http://testng.org/javadoc/org/testng/ITestResult.html#getTestName%28%29


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Tue, Jul 24, 2012 at 10:28 PM, Krishnan Mahadevan <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;krishnan.mahadevan1978@gmail.com&#39;);" target="_blank">krishnan.mahadevan1978@gmail.com> wrote:
Harini,
getTestName() returns the value that you configure your Testclass to implement ITest interface and then have it return the desired test name.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




On Tue, Jul 24, 2012 at 10:15 PM, testnguser <<a href="javascript:_e({}, &#39;cvml&#39;, &#39;techieharini@gmail.com&#39;);" target="_blank">techieharini@...> wrote:

I have  a listener extending TestListenerAdapter. Functions such as getMethod etc. work perfectly. But getTestName() shows null. My TestNGSuite.xml file specifies
<suite ....>
<test name="hellotest" ....>



//listener class
public void onTestFailure(ITestResult result) {
       
        System.out.println("Test Name :: "+result.getTestName());
       
    }

Am I specifying it wrong?


Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/RNK_92JwB2kJ.
To post to this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@....
To unsubscribe from this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">testng-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/lOoWC_f_KI4J.
To post to this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@....
To unsubscribe from this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">testng-users+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: New listener result.getTestName() is null

testnguser-5
I thought of that. I was wondering if a class/interface already does that. 
Thanks, Anyways! :)

On Tuesday, July 24, 2012 11:41:37 AM UTC-7, Krishnan wrote:
You could try passing it via @Parameters and then have the @Test method set the value for the test name in a data member of your test class which can be returned back by the ITest interface method. 

Would that help?

On Wednesday, July 25, 2012, testnguser wrote:
Hello,

Thanks a lot for the tip. :) It works if I set the testName.
My bad, I did not notice the documentation. Is there a way I can receive the testName from my suite.xml file?
Thanks!

On Tuesday, July 24, 2012 10:00:28 AM UTC-7, Krishnan wrote:
Javadocs : http://testng.org/javadoc/org/testng/ITestResult.html#getTestName%28%29


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Tue, Jul 24, 2012 at 10:28 PM, Krishnan Mahadevan <krishnan.mahadevan1978@gmail.com> wrote:
Harini,
getTestName() returns the value that you configure your Testclass to implement ITest interface and then have it return the desired test name.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




On Tue, Jul 24, 2012 at 10:15 PM, testnguser <[hidden email]> wrote:

I have  a listener extending TestListenerAdapter. Functions such as getMethod etc. work perfectly. But getTestName() shows null. My TestNGSuite.xml file specifies
<suite ....>
<test name="hellotest" ....>



//listener class
public void onTestFailure(ITestResult result) {
       
        System.out.println("Test Name :: "+result.getTestName());
       
    }

Am I specifying it wrong?


Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/RNK_92JwB2kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/lOoWC_f_KI4J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/E-1GqZg4IjgJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: New listener result.getTestName() is null

Krishnan Mahadevan
Am not aware of anything out there that could already do this for you in TestNG. . 
This was something that came up at the top of my head and on the fly :)

On Wednesday, July 25, 2012, testnguser wrote:
I thought of that. I was wondering if a class/interface already does that. 
Thanks, Anyways! :)

On Tuesday, July 24, 2012 11:41:37 AM UTC-7, Krishnan wrote:
You could try passing it via @Parameters and then have the @Test method set the value for the test name in a data member of your test class which can be returned back by the ITest interface method. 

Would that help?

On Wednesday, July 25, 2012, testnguser wrote:
Hello,

Thanks a lot for the tip. :) It works if I set the testName.
My bad, I did not notice the documentation. Is there a way I can receive the testName from my suite.xml file?
Thanks!

On Tuesday, July 24, 2012 10:00:28 AM UTC-7, Krishnan wrote:
Javadocs : http://testng.org/javadoc/org/testng/ITestResult.html#getTestName%28%29


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



On Tue, Jul 24, 2012 at 10:28 PM, Krishnan Mahadevan <krishnan.mahadevan1978@gmail.com> wrote:
Harini,
getTestName() returns the value that you configure your Testclass to implement ITest interface and then have it return the desired test name.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"




On Tue, Jul 24, 2012 at 10:15 PM, testnguser <[hidden email]> wrote:

I have  a listener extending TestListenerAdapter. Functions such as getMethod etc. work perfectly. But getTestName() shows null. My TestNGSuite.xml file specifies
<suite ....>
<test name="hellotest" ....>



//listener class
public void onTestFailure(ITestResult result) {
       
        System.out.println("Test Name :: "+result.getTestName());
       
    }

Am I specifying it wrong?


Thanks!

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/RNK_92JwB2kJ.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/lOoWC_f_KI4J.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to testng-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/testng-users/-/E-1GqZg4IjgJ.
To post to this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@....
To unsubscribe from this group, send email to <a href="javascript:_e({}, &#39;cvml&#39;, &#39;testng-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">testng-users+unsubscribe@....
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.


--
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/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.
nr
Reply | Threaded
Open this post in threaded view
|

Re: New listener result.getTestName() is null

nr
In reply to this post by Krishnan Mahadevan


Krishnan Mahadevan <krishnan.mahadevan1978@...> writes:

>
>
> You could try passing it via  <at> Parameters and then have the  <at> Test
method set the value for the test name in a data member of your test class which
can be returned back by the ITest interface method. 
>
> Would that help?On Wednesday, July 25, 2012, testnguser  wrote:Hello,
> Thanks a lot for the tip. :) It works if I set the testName.
> My bad, I did not notice the documentation. Is there a way I can receive the
testName from my suite.xml file?
> Thanks!
>
> On Tuesday, July 24, 2012 10:00:28 AM UTC-7, Krishnan wrote:
> Javadocs : http://testng.org/javadoc/org/testng/ITestResult.html#getTestName%28%29
>
>
> Thanks & Regards
> Krishnan Mahadevan"All the desirable things in life are either illegal,
expensive, fattening or in love with someone else!"On Tue, Jul 24, 2012 at 10:28
PM, Krishnan Mahadevan <krishnan.mahadevan1978 <at> gmail.com>
wrote:Harini,getTestName() returns the value that you configure your Testclass
to implement ITest interface and then have it return the desired test name.
>
>
> https://groups.google.com/forum/#!topic/testng-users/y2ImcNn9AWY
>
>
> Thanks & RegardsKrishnan Mahadevan"All the desirable things in life are either
illegal, expensive, fattening or in love with someone else!"
> On Tue, Jul 24, 2012 at 10:15 PM, testnguser
<[hidden email]> wrote:
>
> I have  a listener extending TestListenerAdapter. Functions such as getMethod
etc. work perfectly. But getTestName() shows null. My TestNGSuite.xml file
specifies <suite ....><test name="hellotest" ....>//listener classpublic void
onTestFailure(ITestResult result) {                System.out.println("Test Name
:: "+result.getTestName());            }Am I specifying it wrong?Thanks!
>


Hi Krishnan,

i have tried the same but for the first set of data i am getting the name as
"defaultTestName" and second set of data i am getting testcase name from first
set of dataprovider data.

can you please share some code how you have done.

here is the sample code snippet how i did. I want the first parameter of the
dataprovider to be set as testcase name in the report.

public class AuditIntegrationTest implements ITest{
        private String name;
       
       
          public AuditIntegrationTest(String name) {
          this.name = name;
      }
        @Test(groups = { "Smoke", "Positive","Regression","example"}, dataProvider =
"sampleProvider")
        public void testSampleTestcase(String testCase,
                        String testDesc) throws Exception {
                //ITestAnnotation.setTestName(testDesc);
                this.name=testCase;
                assertNotNull(testDesc);

        }


        @DataProvider(name = "sampleProvider")
        public static Object[][] getSampleProvider() {
                Object[][] retObjArr = new Object[][] {
                                {"Testcase1", "sample1"},
                                {"Testcase2", "sample2"},
                                {"Testcase3", "sample3"},
                                                               
                };

                return (retObjArr);
        }

        @Override
        public String getTestName() {
                // TODO Auto-generated method stub
                return name;
        }

}

Thanks in advance,
Neeraja



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