Test Logs in TestNG reports

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

Test Logs in TestNG reports

Nalin Makar

Hi,

Is it possible to get test logs in TestNG reports?

I am currently logging my test output using log4j to the console. Once
the test run finishes, TestNG reports only contain the exceptions for
failed tests. The test logs for passed test or logs up to the point of
exception for failed tests are lost.

Is there anyway of storing the complete logs? Will implementing
IListener or IReporter help?

Thanks.
--~--~---------~--~----~------------~-------~--~----~
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: Test Logs in TestNG reports

cosminaru

I assume you can use Reporter.log(...). This will store the messages in
the TestNG log and are available in the HTML reports.
ITestListener and IReporter are mainly for handling test execution
status (onTestFailure, etc) or to generate a final report at the end of
the execution (IReporter), so in this case they probably won't help.
More about all of these here:
http://testng.org/doc/documentation-main.html#logging

Cosmin

> Hi,
>
> Is it possible to get test logs in TestNG reports?
>
> I am currently logging my test output using log4j to the console. Once
> the test run finishes, TestNG reports only contain the exceptions for
> failed tests. The test logs for passed test or logs up to the point of
> exception for failed tests are lost.
>
> Is there anyway of storing the complete logs? Will implementing
> IListener or IReporter help?
>
> Thanks.
> >
>  


--~--~---------~--~----~------------~-------~--~----~
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: Test Logs in TestNG reports

Nalin Makar

After some snooping around I figured out the same. But I cant use
Reporter.log() because I need to ensure that tests and the execution
framework are loosely coupled.

I find it surprising that TestNG is not handling and storing the test
output to stdout. I think JUnit does that.

-nalin

On Apr 1, 12:38 am, Cosmin Marginean <[hidden email]> wrote:

> I assume you can use Reporter.log(...). This will store the messages in
> the TestNG log and are available in the HTML reports.
> ITestListener and IReporter are mainly for handling test execution
> status (onTestFailure, etc) or to generate a final report at the end of
> the execution (IReporter), so in this case they probably won't help.
> More about all of these here:http://testng.org/doc/documentation-main.html#logging
>
> Cosmin
>
> > Hi,
>
> > Is it possible to get test logs in TestNG reports?
>
> > I am currently logging my test output using log4j to the console. Once
> > the test run finishes, TestNG reports only contain the exceptions for
> > failed tests. The test logs for passed test or logs up to the point of
> > exception for failed tests are lost.
>
> > Is there anyway of storing the complete logs? Will implementing
> > IListener or IReporter help?
>
> > Thanks.
--~--~---------~--~----~------------~-------~--~----~
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: Test Logs in TestNG reports

Cédric Beust ♔
Hi Nalin,

The reasons why TestNG doesn't capture stdout/stderr are covered in this past discussion:


A typical way to do this is to set your own redirection in a @BeforeSuite method.  Would this work for you?

-- 
Cédric



On Wed, Apr 1, 2009 at 10:42 AM, Nalin <[hidden email]> wrote:

After some snooping around I figured out the same. But I cant use
Reporter.log() because I need to ensure that tests and the execution
framework are loosely coupled.

I find it surprising that TestNG is not handling and storing the test
output to stdout. I think JUnit does that.

-nalin

On Apr 1, 12:38 am, Cosmin Marginean <[hidden email]> wrote:
> I assume you can use Reporter.log(...). This will store the messages in
> the TestNG log and are available in the HTML reports.
> ITestListener and IReporter are mainly for handling test execution
> status (onTestFailure, etc) or to generate a final report at the end of
> the execution (IReporter), so in this case they probably won't help.
> More about all of these here:http://testng.org/doc/documentation-main.html#logging
>
> Cosmin
>
> > Hi,
>
> > Is it possible to get test logs in TestNG reports?
>
> > I am currently logging my test output using log4j to the console. Once
> > the test run finishes, TestNG reports only contain the exceptions for
> > failed tests. The test logs for passed test or logs up to the point of
> > exception for failed tests are lost.
>
> > Is there anyway of storing the complete logs? Will implementing
> > IListener or IReporter help?
>
> > Thanks.





--~--~---------~--~----~------------~-------~--~----~
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: Test Logs in TestNG reports

loneranger

if you are already using log4j to print stuff on console, why don't
you write custom log4j appender which internally calls reportng ? you
can even control it via log4j properties file and turn it on/off as
per your requirement.

On Apr 1, 10:55 am, Cédric Beust ♔ <[hidden email]> wrote:

> Hi Nalin,
> The reasons why TestNG doesn't capture stdout/stderr are covered in this
> past discussion:
>
> http://groups.google.com/group/testng-users/browse_thread/thread/ef2e...
>
> A typical way to do this is to set your own redirection in a @BeforeSuite
> method.  Would this work for you?
>
> --
> ***Cédric
> *
>
> On Wed, Apr 1, 2009 at 10:42 AM, Nalin <[hidden email]> wrote:
>
> > After some snooping around I figured out the same. But I cant use
> > Reporter.log() because I need to ensure that tests and the execution
> > framework are loosely coupled.
>
> > I find it surprising that TestNG is not handling and storing the test
> > output to stdout. I think JUnit does that.
>
> > -nalin
>
> > On Apr 1, 12:38 am, Cosmin Marginean <[hidden email]> wrote:
> > > I assume you can use Reporter.log(...). This will store the messages in
> > > the TestNG log and are available in the HTML reports.
> > > ITestListener and IReporter are mainly for handling test execution
> > > status (onTestFailure, etc) or to generate a final report at the end of
> > > the execution (IReporter), so in this case they probably won't help.
> > > More about all of these here:
> >http://testng.org/doc/documentation-main.html#logging
>
> > > Cosmin
>
> > > > Hi,
>
> > > > Is it possible to get test logs in TestNG reports?
>
> > > > I am currently logging my test output using log4j to the console. Once
> > > > the test run finishes, TestNG reports only contain the exceptions for
> > > > failed tests. The test logs for passed test or logs up to the point of
> > > > exception for failed tests are lost.
>
> > > > Is there anyway of storing the complete logs? Will implementing
> > > > IListener or IReporter help?
>
> > > > Thanks.

--~--~---------~--~----~------------~-------~--~----~
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: Test Logs in TestNG reports

Nalin Makar

Cedric & Talik,

Thanks for the ideas. I'll give them a try and see what works
best.. :-)

-nalin

On Apr 1, 11:22 am, loneranger <[hidden email]> wrote:

> if you are already using log4j to print stuff on console, why don't
> you write custom log4j appender which internally calls reportng ? you
> can even control it via log4j properties file and turn it on/off as
> per your requirement.
>
> On Apr 1, 10:55 am, Cédric Beust ♔ <[hidden email]> wrote:
>
> > Hi Nalin,
> > The reasons why TestNG doesn't capture stdout/stderr are covered in this
> > past discussion:
>
> >http://groups.google.com/group/testng-users/browse_thread/thread/ef2e...
>
> > A typical way to do this is to set your own redirection in a @BeforeSuite
> > method.  Would this work for you?
>
> > --
> > ***Cédric
> > *
>
> > On Wed, Apr 1, 2009 at 10:42 AM, Nalin <[hidden email]> wrote:
>
> > > After some snooping around I figured out the same. But I cant use
> > > Reporter.log() because I need to ensure that tests and the execution
> > > framework are loosely coupled.
>
> > > I find it surprising that TestNG is not handling and storing the test
> > > output to stdout. I think JUnit does that.
>
> > > -nalin
>
> > > On Apr 1, 12:38 am, Cosmin Marginean <[hidden email]> wrote:
> > > > I assume you can use Reporter.log(...). This will store the messages in
> > > > the TestNG log and are available in the HTML reports.
> > > > ITestListener and IReporter are mainly for handling test execution
> > > > status (onTestFailure, etc) or to generate a final report at the end of
> > > > the execution (IReporter), so in this case they probably won't help.
> > > > More about all of these here:
> > >http://testng.org/doc/documentation-main.html#logging
>
> > > > Cosmin
>
> > > > > Hi,
>
> > > > > Is it possible to get test logs in TestNG reports?
>
> > > > > I am currently logging my test output using log4j to the console. Once
> > > > > the test run finishes, TestNG reports only contain the exceptions for
> > > > > failed tests. The test logs for passed test or logs up to the point of
> > > > > exception for failed tests are lost.
>
> > > > > Is there anyway of storing the complete logs? Will implementing
> > > > > IListener or IReporter help?
>
> > > > > Thanks.
--~--~---------~--~----~------------~-------~--~----~
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: Test Logs in TestNG reports

Dhanushka Kumara
In reply to this post by Nalin Makar
Hi,
Can you tell me how you add TestNG logs into log4j?
I'm tired of finding..


On Wednesday, April 1, 2009 at 4:19:02 AM UTC+5:30, null.in wrote:
Hi,

Is it possible to get test logs in TestNG reports?

I am currently logging my test output using log4j to the console. Once
the test run finishes, TestNG reports only contain the exceptions for
failed tests. The test logs for passed test or logs up to the point of
exception for failed tests are lost.

Is there anyway of storing the complete logs? Will implementing
IListener or IReporter help?

Thanks.

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