What is in the Automation Framework?
Get introduced to the automation framework for implementing standard purpose functionality for taking screenshots, saving logs, and creating a driver.
We'll cover the following
Why do we need an automation framework?
Running the automated tests is great but if tests fail, we need additional information to troubleshoot the root cause of the failure.
This information comes from different places:
- The screenshot of the page where the test failed shows us the page status at the time of failure.
- The exception provides information on why the failure was generated.
- The stack trace shows the class, method, and line of code that is responsible for the failure.
It is a bad idea to add code for taking screenshots and exceptions to the page or test classes because this leads to having duplicated code and to making the page/test classes have too many responsibilities.
It is better to implement these functionalities as separate classes that are part of an automation framework so they can be used in the page classes when needed.
The classes from the automation framework should be independent of the site to be tested so they can be used in any other automation project.
What is in the automation framework?
Our automation framework will include classes for
- Creating a driver object for a specific browser
- Taking screenshots
- Saving screenshots to files
- Collecting exceptions and stack traces
- Saving information to logs
A real automation project has many other components that are skipped in our case since our focus is not to implement a full automation framework. Our goal is to run Selenium tests in Azure DevOps.
To accomplish it, a minimal automation framework with just a few components is sufficient.
Each framework component is described separately in its own section.
Get hands-on with 1400+ tech skills courses.