What is error collector in JUnit and why it is used

0 votes
What is error collector in JUnit and why it is used?
Jun 19, 2019 in Selenium by Ekanshi
684 views

1 answer to this question.

0 votes

Hey Ekanshi, Error collector collects all error objects and reports it only once after the test execution is over. The benefit of adding all errors in an Error Collector is that you can verify all the errors at once. Also, if the script fails in the middle, it can still continue executing it. If you want to execute all the tests even if any line of code fails due to network failure, assertion failure, or any other reason, you can still continue executing test script using a special feature provided by JUnit known as "error collector". 

JUnit uses @Rule annotation which is used to create an object of error collector. Once the object for error collector is created, you can easily add all the errors into the object using method addError (Throwable error). As we know that Throwable is the super class of Exception and Error class in Java. When you add errors in this way, these errors will be logged in JUnit test result .

answered Jun 19, 2019 by anonymous
• 28,060 points

Related Questions In Selenium

0 votes
1 answer

What is TestNG and why it is used in selenium?

Hello @User, Talking about TestNG, it is an ...READ MORE

answered Dec 24, 2018 in Selenium by Shuvodip
568 views
0 votes
1 answer

What is Robot Class in selenium webdriver and why it is used?

Hello Akanksha, Robot Class is used for those ...READ MORE

answered May 9, 2019 in Selenium by Pratibha
• 3,690 points
915 views
0 votes
1 answer

What is POM in Selenium and what it is used for?

Hello Rubina, POM is Page Object Model which ...READ MORE

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

What is IWebElement and how it is used in Selenium C#?

Hello Paul, IWebElement is an Interface in ...READ MORE

answered Jun 11, 2019 in Selenium by Esha
6,215 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
6,237 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
6,591 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,890 points
4,222 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
5,219 views
0 votes
1 answer

What is Apache POI in Selenium and what it is used for?

Hi Raj, Apache POI is the most commonly ...READ MORE

answered May 8, 2019 in Selenium by Abha
• 28,060 points
1,642 views
0 votes
1 answer

What is a Modular Framework and why it is useful in Selenium webdriver?

Hi Junaid, as the name suggests, Modular ...READ MORE

answered May 13, 2019 in Selenium by Abha
• 28,060 points
7,070 views