Explained TestNG annotations in sequence, very imp interview questions.
Execute the script and try to observe how @test @Method @Suite @Class works.
In the interview they may ask to tell how many time @test and @method will run. I have added the output after executing it to eclipse.As we have pass three pair of values in dataprovider so 3 times test script got executed.
Output:
BeforeSuite
BeforeTest:
Beforeclass:
Beforemethod:
1a
Aftermethod:
Beforemethod:
2b
Aftermethod:
Beforemethod:
02test
Aftermethod:
AfterClass
AfterTest
PASSED: f(1, "a")
PASSED: f(2, "b")
PASSED: f(0, "2test")
===============================================
Default test
Tests run: 3, Failures: 0, Skips: 0
===============================================
AfterSuite
===============================================
Default suite
Total tests run: 3, Failures: 0, Skips: 0
===============================================
No comments:
Post a Comment