Back to Browse

Basic To Advanced Selenium Java Full Course - Session 12 - Introduction To TestNG

1.8K views
Jun 9, 2022
23:05

What is TestNG? It is a testing framework which is similar to Junit but it has some additional functionalities which makes it more powerful and easy to use. Why TestNG? More Annotations Test Groups Data Driven Testing Parameters Reporting Parallel Execution & Multithreading Exception Handling Test NG Annotations: @BeforeSuite: Annotated method will be run before all tests in this suite have run @AfterSuite: Annotated method will be run after all tests in this suite have run @BeforeTest: The annotated method will be run before any test method belonging to the classes inside the test tag is run. @AfterTest: The annotated method will be run after all the test methods belonging to the classes inside the test tag have run. @BeforeGroups : Annotated method will be run before the test cases of that group @AfterGoups: Annotated method will be run after the test cases of that group @BeforeClass: Annotated method will be run before the first test method in current class is invoked. @AfterClass: Annotated method will be run after all test methods in the current class is invoked. @BeforeMethod: The annotated method will be run before each test @AfterMethod: The annotated method will be run after each test @DataProvider, @Factory, @Listeners, @Parameters, @Test Test NG Groups: It allows grouping of different test methods Groups can contain other groups Groups are specified in testng.xml under the test or suite tag Groups specified in the suite tag apply to all test tags within the suite TestNG allows to include groups as well as exclude groups Test NG Dependencies TestNG allows to specify dependencies either with annotations or in xml Two types of dependencies: Hard dependencies All methods which depend on must run successfully or will be marked SKIP in report Soft dependencies Test methods will always run even if some of the depend methods fail. It can be implemented by using “alwaysRun =true” in test annotation

Download

0 formats

No download links available.

Basic To Advanced Selenium Java Full Course - Session 12 - Introduction To TestNG | NatokHD