How Listener annotation can be used in TestNG

0 votes
Jun 10, 2019 in Selenium by Barkha
1,620 views

1 answer to this question.

0 votes

Hey Barkha, TestNG @listeners are used to configure reports and logging. One of the most widely used listeners in TestNG is ITestListener interface. Listener is basically an interface that modifies the default TestNG's behavior. As the name suggests Listeners "listen" to the event defined in the selenium script and behave accordingly. It is used in selenium by implementing Listeners Interface. It allows customizing TestNG reports or logs. There are many types of TestNG listeners available. ITestListener has following methods: 

  • OnStart- OnStart method is called when any Test starts.
  • onTestSuccess- onTestSuccess method is called on the success of any Test.
  • onTestFailure- onTestFailure method is called on the failure of any Test.
  • onTestSkipped- onTestSkipped method is called on skipped of any Test.
  • onTestFailedButWithinSuccessPercentage- method is called each time Test fails but is within success percentage.
  • onFinish- onFinish method is called after all Tests are executed.
answered Jun 10, 2019 by Abha
• 28,140 points

Related Questions In Selenium

0 votes
1 answer

How @FindBy annotation of Page Factory can be used in Selenium?

Hey Mridul, Page Factory uses annotation @FindBy to ...READ MORE

answered Jul 4, 2019 in Selenium by Anvi
• 14,150 points
10,310 views
0 votes
1 answer

How selenium can be used in devops lifecycle?

Hey Catherine, as we know that a ...READ MORE

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
1,869 views
0 votes
1 answer
0 votes
1 answer

How reports can be produced in different ways for TestNG results?

Hey Suraj, TestNG offers two ways to produce ...READ MORE

answered Jun 19, 2019 in Selenium by anonymous
• 14,150 points
1,814 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,676 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,144 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,875 views
0 votes
1 answer

How can Custom Firefox Profiles be created and used in Selenium?

Hi Vijay, to create Custom Firefox Profile ...READ MORE

answered May 24, 2019 in Selenium by Abha
• 28,140 points
1,203 views
0 votes
1 answer

How Parametermizing tests can be done in TestNG using Data Provider?

Hi Devashish, you can parameterize tests with ...READ MORE

answered Jul 8, 2019 in Selenium by Abha
• 28,140 points
2,553 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP