CARVIEW |
Software Testing - Day 19 Basic
Software Testing
Question 1
What does the @BeforeClass
annotation in TestNG do?
Executes before each test method
Executes once before all test methods in a class
Executes after all test methods
Executes before the entire test suite
Question 2
Which annotation ensures a method runs after all the test methods in the current class?
@BeforeSuite
@AfterMethod
@BeforeTest
@AfterClass
Question 3
When does @BeforeMethod
get executed in TestNG?
Before all test classes
Before each test method
Only before failed tests
Before the suite starts
Question 4
What is the expected output if a class has two test methods and one @BeforeMethod
method?
The
@BeforeMethod
method runs only onceThe
@BeforeMethod
method runs twiceThe
@BeforeMethod
method runs after testsThe
@BeforeMethod
is skipped
Question 5
Which annotation runs after each test method completes?
@AfterClass
@BeforeMethod
@AfterMethod
@BeforeSuite
Question 6
Which annotation is most suitable to set up environment once for a group of tests like "authentication"?
@BeforeTest
@BeforeMethod
@AfterGroups
@BeforeGroups
Question 7
What output is expected if a class has 3 methods in the "authentication" group and a @BeforeGroups
hook?
The hook runs once before the first group method
The hook runs three times
The hook is skipped
The hook runs after all tests
There are 7 questions to complete.