I am trying to monitor all methods ran by TestNG. So far by using ITestListener.OnTestStart I can only see the main test methods. Those methods annotated by @BeforeMethod/@BeforeClass does not trigger the listener.
Is there any more general Listener Interface that can help me in this case?
Thanks.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=67875&messageID=128481#128481
org.testng.internal.IConfigurationListener respectively
org.testng.internal.IResultListener.
Can you tell us what are you planning to do? This will help me decide
if the above methods should become public and so stable over time.
HTH,
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
-haison
On Feb 28, 2:04 pm, "Alexandru Popescu"
<the.mindstorm.mailingl...@gmail.com> wrote:
> Yep, there are but currently they are internal to TestNG:
>
> org.testng.internal.IConfigurationListener respectively
> org.testng.internal.IResultListener.
>
> Can you tell us what are you planning to do? This will help me decide
> if the above methods should become public and so stable over time.
>
> HTH,
>
> ./alex
> --
> .w( the_mindstorm )p.
> TestNG co-founder
> EclipseTestNG Creator
>
> On 2/28/07, Son Le <testng-us...@opensymphony.com> wrote:
>
>
>
> > Hi,
>
> > I am trying to monitor all methods ran by TestNG. So far by using ITestListener.OnTestStart I can only see the main test methods. Those methods annotated by @BeforeMethod/@BeforeClass does not trigger the listener.
>
> > Is there any more general Listener Interface that can help me in this case?
>
> > Thanks.
> > ---------------------------------------------------------------------
> > Posted via Jive Forums
> >http://forums.opensymphony.com/thread.jspa?threadID=67875&messageID=1...
I want to write a Logger for every test/methods. My approach is to use
a static Logger class and maintain a map from a Test to a log.
Therefore, I need to know when a test is ran so that I add an entry to
the map.
cheerio,
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
- I want to Log exceptions/debug messages for every methods invoked by
TestNG( including configuration methods).
- Therefore, I want to be notified when a method is invoked so I can
add a new entry to the hashmap corresponding to this method, and after
just log all messages to this entry.
Currently, by using ITestListener, I am only be notified by the @Test
method, by not @before and @after configuration methods.
I think your suggestion using IReporter is not possible since it is
called only once after everything is done. The Reporter class log
method does not do everything I want. I want to log more than just a
String.
I looked/stepped into the current implementation of TestNG, it seems
that just an extra line in Invoker class to invoke the listeners and
add some more methods to ITestListener interface would do the job.
I also think about extending TestRunner & Invoker but its m_invoker is
private and is tightly coupled with the original Invoker.
On 28 Feb, 15:44, "Alexandru Popescu"
<the.mindstorm.mailingl...@gmail.com> wrote:
> Have you checked the Reporter class in TestNG?
>
> cheerio,
>
> ./alex
> --
> .w( the_mindstorm )p.
> TestNG co-founder
> EclipseTestNG Creator
>
> On 2/28/07, Son Le <testng-us...@opensymphony.com> wrote:
>
>
>
> > Hi,
>
> > I am trying to monitor all methods ran by TestNG. So far by using ITestListener.OnTestStart I can only see the main test methods. Those methods annotated by @BeforeMethod/@BeforeClass does not trigger the listener.
>
> > Is there any more general Listener Interface that can help me in this case?
>
> > Thanks.
> > ---------------------------------------------------------------------
> > Posted via Jive Forums
> >http://forums.opensymphony.com/thread.jspa?threadID=67875&messageID=1...
[quote]
Yep, there are but currently they are internal to TestNG:
org.testng.internal.IConfigurationListener respectively
org.testng.internal.IResultListener.
Can you tell us what are you planning to do? This will help me decide
if the above methods should become public and so stable over time.
[/quote]
./alex
--
.w( the_mindstorm )p.
TestNG co-founder
EclipseTestNG Creator
-haison
On 7 Mar, 11:55, "Alexandru Popescu"
<the.mindstorm.mailingl...@gmail.com> wrote:
> It looks like you are completely ignoring my suggestion... and I wondering why.
>
> [quote]
> Yep, there are but currently they are internal to TestNG:
>
> org.testng.internal.IConfigurationListener respectively
> org.testng.internal.IResultListener.
>
> Can you tell us what are you planning to do? This will help me decide
> if the above methods should become public and so stable over time.
> [/quote]
>
> ./alex
> --
> .w( the_mindstorm )p.
> TestNG co-founder
> EclipseTestNG Creator
>
As already suggested: pls try out a custom implementation of
IResultListener (you should get notification for both @Test and
configuration methods). If it fulfilles your needs just let me know
and I will move those interfaces in the public package of TestNG.
toodle oo,
I havent looked at the source, but does testng use something like
log4j for its internal output?
> I looked/stepped into the current implementation of TestNG, it seems
> that just an extra line in Invoker class to invoke the listeners and
> add some more methods to ITestListener interface would do the job.
Adding new methods to an interface is a no-no for backwards
compatibility. You'd need an ITestListener2 with extra methods...
-Steve
> I also think about extending TestRunner & Invoker but its m_invoker is
> private and is tightly coupled with the original Invoker.
Short term, patching your own source may be the best option.
We have an internal logging class, but it is for internal use only.
> > I looked/stepped into the current implementation of TestNG, it seems
> > that just an extra line in Invoker class to invoke the listeners and
> > add some more methods to ITestListener interface would do the job.
>
> Adding new methods to an interface is a no-no for backwards
> compatibility. You'd need an ITestListener2 with extra methods...
>
> -Steve
>
> > I also think about extending TestRunner & Invoker but its m_invoker is
> > private and is tightly coupled with the original Invoker.
>
> Short term, patching your own source may be the best option.
>
No, it is not an option... at least as long as there are a lot better solutions.
I solved my first problem. Now I can log all messages with @Test and
@configuration methods.
Unfortunately, I ran into another problem. I use ITestContext to get
all the ITestResult for all methods.
Is there anyway I can get the methods executed in chronological order?
The reason is that I want to know which
@configuration methods associated with each @Test method.
-haison
On 7 Mar, 12:11, "Alexandru Popescu"
On 7 Mar, 23:49, "Cédric Beust ♔ " <cbe...@google.com> wrote:
> You should have the time in milliseconds when they started, isn't this
> enough?
>
> --
> Cedric
>
> --
> Cédric
--
Cédric
Not sure what you mean. Even if they are run in parallel the start
time will give you the correct order. Am I missing something?
Is there a simpler solution?
On 8 Mar, 11:19, "Alexandru Popescu"
<the.mindstorm.mailingl...@gmail.com> wrote: