How often does @BeforeTest run?
QuizEasy-MediumJava onlyAsked in: Accenture, BrowserStack, Capgemini, Cognizant, Infosys, TCS, Wipro
A class has three @Test methods and one @BeforeTest method. testng.xml lists the class in exactly one <test> block. How many times does the @BeforeTest method run?
- Once, because it runs before the <test> block, not before each method
- Three times, once per @Test method
- Never, unless a group is set
- Once per class in the whole project
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.