Selenium Framework Design in Data-Driven Testing: Build data-driven test frameworks using Selenium WebDriver, AppiumDriver, Java, and TestNG by Carl Cocchiaro
Author:Carl Cocchiaro [Cocchiaro, Carl]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2018-01-23T00:00:00+00:00
Teardown methods
For all the methods in a suite of tests, there will be common actions that need to be executed after each suite, test, groups, class, or methods, and instead of calling the same cleanup method in each class or test, for instance, it makes sense to do them in one place. Using the TestNG teardown annotations will allow users to execute a routine in a central place, as it did with the setup annotations.
@AfterSuite, @AfterTest, @AfterGroups, @AfterClass, and @AfterMethod
Let's discuss all the annotations in detail:
@AfterSuite: All the methods called in this teardown will execute after everything else has completed in the suite. This is a good place to clean up the AUT, delete users, and accounts created during test runs, uninstall mobile applications, and close the browser or mobile device. If a report listener is being used, the report could be constructed in this method after all the TestNG results are collected.
@AfterTest: All the methods called in this teardown will run after all the test packages or classes defined in the <test> tag section of the XML file have completed. If running <test> sections in parallel, users can use this to close the browsers or mobile devices in each thread, provide cleanup, delete users, and so on.
@AfterGroups: All the methods called in this configuration teardown will run after a specific group or groups of tests run. Because test methods generally run in a random order with TestNG, this method will run at some point after the last test method runs in the <test> section of the XML file.
@AfterClass: All the methods called in this teardown will run after the last method runs in the current class. This teardown is very useful for cleaning up all leftover users, accounts, settings, or anything else the @AfterMethod routine fails to remove. This is also a good place to process TestNG results (ITestResult) for reporting purposes.
@AfterMethod: All the methods called in this teardown will run after each and every iteration of a test method has run. What that means is that when running data-driven tests, a single test method may execute multiple times, and this cleanup method will run after each iteration. This routine is useful for cleanup when exceptions occur during a test method run, taking screenshots, reporting results, and generally setting the application back to a known "base" state.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8299)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7780)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Windows APT Warfare by Sheng-Hao Ma(6847)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6582)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6452)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6416)
Kotlin in Action by Dmitry Jemerov(5065)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4317)
Functional Programming in JavaScript by Mantyla Dan(4038)
Solidity Programming Essentials by Ritesh Modi(4009)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3801)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3745)
The Ultimate iOS Interview Playbook by Avi Tsadok(3719)
