Designing base setup classes
When the Selenium page object classes were designed, we created an abstract base class to derive all the common components and methods for each subclass in the framework. This provided a way to reduce the number of elements and code being written, and a way to share common methods among pages.
Now we are dealing with the other side of things: the test classes and data. In this case, we want to design a common setup class using the TestNG annotations for methods, which will perform common setup and teardown for all the classes in a suite. Up to now, we've seen how each test class can create its own setup and teardown methods. Another layer of setup and teardown can precede the test class ones very easily.
Here are some examples:
- If the user wants to run a set of test classes as part of a
<test>
section in their suite file, then they would want to invoke and close the browser or mobile application before and after each set of tests execute. You wouldn't want...