How To Create A Test Automation Framework Architecture With Selenium
Welcome to Software Test Automation Blog
In this Blog we Guide you how to answer confidently for most frequently and almost common Interview question related to Test Automation framework to more or less experience people while appearing Automation Testing Interviews.
Here we guide you on how to explain Test Automation Framework in the Interview.
First of all, let's see - What is a framework in simple words we could define Framework as a Set of Rules or Best Practices which we can follow in a systematic way to achieve the desired Goals.
Coming back to explaining the test automation framework in the interview. You will be asked this question to know your experience with the test automation tools in a Software Testing Services. You have to explain each component of your Framework Architecture and you have to specify right from the point of the Test Automation execution to generating the reports. If there is a whiteboard or white sheet then utilize the same. It will be better if you draw all the components of your Framework Architecture and make connections between each other components with arrow keys while you are explaining the framework.
Frameworks such as programming language as you all know selenium supports multiple languages so you need to specify which language you are using and Type of a framework that you have used.
There are many types of frameworks and major ones are Keyword-driven, Data-driven and Hybrid Framework test automation frameworks.
-
Test-Base Class: Every framework has a Base Class; we do initialize WebDriver and implicit waits and bloggers, reports, etc in the test base class.
So you need to give some stress on this part while explaining and coming to element locators.
-
Page Object Model: Do your tests independent of element locators. You have to specify where you store all your element your caters such as ID XPath CSS whatever, if you are using a Page Object model to separate element locators with tests then clearly explain that. Nowadays everyone is using the Page Object design model to do this. We can also keep Element locators in property files.
-
Functions Library: Every project has some Functions Library but in most of the cases, we do use separate Functions as Generic Functions and Project-Specific functions also called Business functions. Sometimes asked in an interview, what is the difference between Generic and Business Function?
Don't get confuse and reply Generic Functions are related to Operations we do perform like Click, Select etc of an Element and Business Functions are more related for B2B Business to Business applications nature. Example Transfer funds Functionality is more related to Banking Application, whereas Order booking Functionality more over related to Retail Business applications like Amazon and Flipkart. If you call Test data from the excel sheet comes under Generic Function and more technically we call it as Utility functions property.
-
Property Files: Details such as browser type URL could be placed in property files and also specify what are the Test NG Annotations that you have used in your Framework.
-
Test NG: In case if you are using Test NG Annotations you can explain how you do use Test NG Annotations into your Framework.
-
Parameterization: You can explain how you do Parameterize Test cases using Excel files or Test NG Annotations.
-
Screenshots: Explain how you captured Error screenshots image into Screenshot folder for the Pass or Failed Test Cases.
-
Test Reports: Explain how you Generate Reports like HTML, Extent Reports etc. in your Test Reports Folder and how you send those Reports to your peers like sending that email to your leads or related Peers.
-
Version Control: Mention what is the Version Control you have used as a GIT Repository or SVN.
-
Continuous Integration Tool: Mention continuous-integration tools like Jenkins if you use the same into your Project
You can specify these such things to show case your Practical knowledge related to Framework Architecture or your Framework. It is better to ask your Interviewer to provide a white sheet to draw the Architecture of your Project Framework. Explain clearly every component in Detail.
Let's get started with the language you can tell that in our selenium project. Like we are using Java language in our project because most of the Automation developers know selenium with Java type of framework or any language which you use Python, C# etc.
Types of Framework: In our project, we are using a Data-driven or Keyword-driven or Hybrid Framework by using the Page Object Model design pattern with Page Factory.
To continue in detail related Page Object Model you can mention for the Page Object Model. Under POM we have maintained a Class for Every Web Page separately under each Web Page has a separate Class and that Class holds the functionality and members of that Particular Web Page. We have separate classes for every individual Test case.
-
Packages: we have separate Packages for pages and Test scripts. All the web page related Classes comes under Pages Package and all the Tests related Classes comes under Tests Package. And all the Tests are kept in the SRC tests Java. Remaining files such as Config .properties Element locators Utility files Test data, etc. are kept in SRC may in Java.
-
For Example: Homepage and login page of the Application have a separate class to store element locators for the login Tests.
There would be a separate class that calls the method from the Homepage class and login page.
To continue about Test base class, Test base class deals with all the common functions used by all the pages. This class is responsible for loading the configurations from property files, Initializing the WebDriver implicit waits, External reports and to create the Object of a file Input stream. Which is responsible for pointing towards the file from which the data should be read?
To continue about Functions Library, Utility file class - which we also call it as Functions class it stores and handles the Functions. A code that is repetitive such as waits, actions or capturing screenshots or accessing Excel sheets and sending emails these are the repetitive Tasks. These repetitive tasks can be commonly used across the entire framework. These repetitive tasks we make it as a function and we use the entire framework. The main reason behind creating utility classes is to achieve with reusability of code. Like we create Login and Logout Functions and add in our Function's Library we can call the same and use for every Test case into our Project Application Framework. This class extends the Test Base class to inherit the properties of Tests Based on Test Util.
To be continue related Properties File - This file stores the information that remains static throughout the framework such as Browser-specific information, Application URL and Screenshots path etc. All the details which change as per the Environment and Authorization such as your Login credentials are kept in config.property files keeping these details in a separate file makes easy to maintain.
-
Screenshots: will be captured and stored in a Separate Folder also the Screenshots of the Failed Test cases will be added in the Extent Reports.
-
Test Data, All the historical test data will be kept in the excel sheet by using this particular Excel Sheet we pass this data and handle Data-driven testing. We use Apache to point to handle Excel sheets
-
Test NG, we use Test NG annotations for Assertions, Grouping and parallel Execution.
-
Maven, we are using Maven for build execution and dependency purpose.
We integrate the Test NG dependency in POM.XML file and running this POM.XML file using Jenkins
Version Control Tool - In our project, we use GIT as a Repository to store our Test scripts.
By using Jenkins's continuous-integration tool, we execute Test cases daily basis also for nightly execution based on the scheduled. Test Result will send to the Peers using Jenkins.
Extent Reports, For the Reporting purpose, we are using Extent Reports it generates beautiful HTML reports. We use the Extent Reports for maintaining logs also to include the screenshots of Failed Test cases in the External reports.
You have to explain all these when you are asked to Explain the Test Automation Framework in the interview.
How To Create A Test Automation Framework Architecture With Selenium
Source: https://www.nexsoftsys.com/articles/software-testing-interview-tips-tricks-question-answer.html
Posted by: mayerwhishis1967.blogspot.com
0 Response to "How To Create A Test Automation Framework Architecture With Selenium"
Post a Comment