traver salder
traver salder

Reputation: 31

TestNG @Listeners ordering issue

I have multiple listeners in my TestNG test class and its using @Listeners annotations to load the listeners.

My listeners are dependent each others, so i need to make sure listener1 is executing before listener2 always.

I have tried to give the order when we defining the listeners array. but seems like its not consistent. Sometimes Listener2 is getting called before Listener1.

@Listeners({ Listener1.class, Listener2.class })

It will be helpful if some expertise on a workaround for this issue.

Using Java1.6/TestNg6.1.1

Thanks,

Upvotes: 3

Views: 3980

Answers (1)

Jaroslav Cincera
Jaroslav Cincera

Reputation: 1036

TestNG does not guarantee Listeners order as answered here by author Is there a way to define the runorder of two different Testng Listeners? So workaround depends on actions which you do in your listeners, but most probably you have to change these logic (merge listeners etc.).

Upvotes: 4

Related Questions