Listener global onStart / onFinish methods

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

Listener global onStart / onFinish methods

pmendelson2

I am trying to implement a listener that needs to do some processing
at the very start and end of my testing run.

In my application thigs work pretty well if I implement the
ISuiteListener interface but I think it is possible for a test to have
multiple suites.

Short of writing a finalize() method, how can I define a method that
gets executed after the last test in the last suite has been completed?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-dev" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Listener global onStart / onFinish methods

Cédric Beust ♔
Hi Paul,

Since this question has come up a few times, I'm wondering if we shouldn't introduce an annotation for that as well...

Maybe @BeforeSuites and @AfterSuites?  (note the plural)

Other than that, as much as I hate giving a JUnit-sounding response, the only way is to wrap the current runner:

myBeforeSuites()
TestNG.main(argv);
myAfterSuites();

--
Cedric


On 2/24/07, Paul <[hidden email]> wrote:

I am trying to implement a listener that needs to do some processing
at the very start and end of my testing run.

In my application thigs work pretty well if I implement the
ISuiteListener interface but I think it is possible for a test to have
multiple suites.

Short of writing a finalize() method, how can I define a method that
gets executed after the last test in the last suite has been completed?







--
Cédric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-dev" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Listener global onStart / onFinish methods

pmendelson2

I agree with your logic.  I do not know of any real world cases of
running multiple suites at 1 time but I don't see any good reason to
disallow it.

My particular issue does not require a new annotation it just requires
add beforeEverything() and afterEverything() methods to a listener
interface.

Now that I look at it,  I suppose that if I implement the IReporter
interface my generateReport(java.util.List<XmlSuite> xmlSuites,
java.util.List<ISuite> suites, java.lang.String outputDirectory)
method would execute last.  I guess a beforeEverything() method is
equivalent to the onStart(ISuite) method just keeping track track of
its first invocation.

Maybe I don't really need anything afterall.

On Feb 24, 2:04 pm, "Cédric Beust ♔ " <[hidden email]> wrote:

> Hi Paul,
>
> Since this question has come up a few times, I'm wondering if we shouldn't
> introduce an annotation for that as well...
>
> Maybe @BeforeSuites and @AfterSuites?  (note the plural)
>
> Other than that, as much as I hate giving a JUnit-sounding response, the
> only way is to wrap the current runner:
>
> myBeforeSuites()
> TestNG.main(argv);
> myAfterSuites();
>
> --
> Cedric
>
> On 2/24/07, Paul <[hidden email]> wrote:
>
>
>
> > I am trying to implement a listener that needs to do some processing
> > at the very start and end of my testing run.
>
> > In my application thigs work pretty well if I implement the
> > ISuiteListener interface but I think it is possible for a test to have
> > multiple suites.
>
> > Short of writing a finalize() method, how can I define a method that
> > gets executed after the last test in the last suite has been completed?
>
> --
> Cédric


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "testng-dev" 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-dev?hl=en
-~----------~----~----~----~------~----~------~--~---