Selenium Automation Framework What is Test Automation Framework? ‘Framework’ is what drives almost everything – a basic outline or structure, a set of guidelines which when followed produce coherent & beneficial results. Be it manufacturing, politics or services. How do you think these different components interact to successfully test the application, automatically? How do you modularize application flows into different functions? How do you identify & organize application objects? Where is the Test data stored? How is it accessed? From where do you run the test scripts? Automation tool or Test Management tool? Which all screenshots & logs are captured? & in which format? How do you report the test execution results? Yeah! There has to be a set of guidelines driving these rules, right? That’s what we call it a Test Automation Framework! Why you should know how to explain Test Automation Framework You learn alphabets, i.e. A, B, C – what’s the use if you don’t know how to make words out of it? You know about gear, accelerator, brakes, and speed – what’s the use if you cannot ride a motorcycle? You learn Test case writing and execution – what’s the use if you have no idea about the Software Testing Life Cycle? Exactly! Test Automation Framework is the next step to script writing – a structure that binds together all the components of Test Automation. Without a structure, it is difficult to plan, learn and measure anything. That’s why this is one of the favorite interview question for automation interview – Could you please explain Test Automation framework that you are currently using in your project? Even if interviewer is not that experienced, the way you answer this can either make or break your opportunity. Understand the Components first Before you learn how to explain Test automation framework, you should know what it is built of? I.e. the components. It is not a rocket science – just put some brains and collect the components of Manual tests + add some automation-exclusive components. AUT: The application under test Test Automation tool such as HPE UFT or Selenium Test Management Tool where the test cases & screenshots are stored. In its absence a common shared drive can also be used. Test environment: A stable environment on which application is deployed for test purpose Application Objects: Different elements within application like textbox, checkbox, radio button, dropdown, etc. Application modules: Test Data: Specific functional flows that needs to be executed within different test cases. E.g. User login. Input values (valid or invalid) for the application fields such as Login credentials Functions: A set of reusable statements (for a particular functional flow) that needs to be executed within different scripts. E.g. User login. Test script: A standalone test case coded in a particular programming language using the test automation tool Results: This includes the error logs, execution status, screenshots, formal reports, etc. Now that you are aware of the test components, let’s see how to explain Test automation framework. Explain Test Automation Framework Note: With this question interviewer is not expecting you to give a definition or whether you know different types of test automation frameworks. The answer to this question depends upon your experience with Test automation. Testers currently working on automation might find it easy to explain test automation framework they are currently working on. On the other hand, it might be tough for someone who just started with test automation. Whatever be the case, it helps to prepare the answer for this peculiar question before facing an automation interview. Let’s look at the steps you need to explain test automation framework to the interviewer, Application-under-Test: What’s better than to start with the application under test? As a Software tester, you should already have a good idea about the functional flows. Just give an overview of the application and few major flows to-be-automated or already automated. The Automation tool & programming language: Let the interviewer know which automation tool you are using – whether it’s Selenium, HPE UFT, Test Complete, etc. Also the programming language that you use for automation scripts. It can be Java, Python, VBScript, Ruby, etc. The Type of Test Automation Framework: Now that interviewer has an idea about the application & the tool being used, the next logical step is to explain Test Automation framework, i.e. whether it’s a keyword-driven framework, data-driven or a hybrid framework. Recently Behavior-driven-development using Cucumber and continuous integration using Jenkins is also popular. You might need to explain the concept in short. The Structure: Quickly we come to the main part to explain test automation framework – the structure. The emphasis should be to explain the structure of different components of any automation framework and how do they interact for successful automation execution. Application Login: where or how do you maintain the environment variables and login credentials? How does the driver know on which environment to execute and using which credentials? E.g. generally we maintain a configuration file (properties file) to maintain all the static information with respect to browser, different environments, application URLs, screenshot path, etc. and pass the environment details before the script starts. Application Objects / Web Elements: One of the major aspect of automation is application objects or web elements and how they are maintained in the framework. E.g. different elements within application like textbox, checkbox, radio button, dropdown, etc. HPE UFT provides an inbuilt ‘Object Repository’ to maintain all the application objects whereas Selenium offers Page Object Model design pattern to maintain Web elements. Quickly just explain your way of maintaining the application objects or Web elements. You might maintain different project package for Page classes, Config files (src/main/java) and Test classes (src/test/java). Function Library: In most of the cases, a Test automation framework will have a function library wherein you maintain different functions, i.e. a set of reusable statements (for a specific functional flow) that needs to be repeatedly executed within different test scripts. E.g. User Login. Test Data: How can you neglect one of the most important concept of Software Testing – be it manual or automation testing. How the Test data is maintained, i.e. in database, excel files, XML, etc. & where it is saved – is mandatory to tell while you explain Test Automation framework. And you can surely expect a few counter questions on this – so be prepared. Test script: Once you are done with explaining Test data management, the next obvious step is to explain Test script management – how it is structured (Base class, Driver class, etc.) and where are the test scripts stored (local, Test management tool, shared repository, etc.). Test Base class (TestBase.java) deals with all the common functions used by all the pages. This class is responsible for loading the configurations from properties files, Initializing the WebDriver, Implicit Waits, Extent Reports and also to create the object of FileInputStream which is responsible for pointing towards the file from which the data should be read. Utility Class (TestUtil.java): There are certain actions which helps automation framework work (used across the entire framework) such as waits, actions, capturing screenshots, accessing excels, sending email etc. Generally there is a utility class to manage all these actions. The reason behind creating utility class is to achieve reusability. This class extends the Test Base class to inherit the properties of Test Base. Note: If you are mentioning about the utility classes, make sure you know about the libraries used. For E.g. You might use Apache POI library for excel read-write operations. Explain if the automation tool is integrated with any Test Management tool, like HPE UFT can be integrated with HPE ALM – where the test cases & screenshots are stored. In its absence a common shared drive can also be used. Test Execution: How do you configure Test execution? Sometimes we use excel files containing a list of all test scripts with Yes/No parameter to determine which all scripts to execute in this particular test run. Or you might use a Unit test framework as well, e.g. TestNG. Test Results: Yeah! Automation execution is finished. Now what? Automation team needs to send the Test Report, but how? And containing what details? Automation Test results include execution status, Pass/Fail, Error logs, Screenshots, Formal reports, etc. ‘Extent Reports’ is a widely used third party tool to generate HTML reports. Anything Particular? Every Test Automation framework is different. Some teams might use excel file for Test data management. Others might use XMLs. Some will follow Page Object Model, others might code at random for small requirements. Now that you are done with explaining the basics of your test automation framework, you might add a cherry on the cake by mentioning anything particular about your automation framework. TestNG: Using TestNG for Assertions, Grouping and Parallel execution. Integration with Defect management tool, automatic logging definitions with screenshots. Behavior Driven Development: Mention if you are using any tool like Cucumber for BDD approach. Maven/Ant: Using Maven or Ant for build, execution and dependency purpose. Integrating the TestNG dependency in POM.xml file and running this POM.xml file using Jenkins. Jenkins: By using Jenkins CI (Continuous Integration) Tool, we execute test cases on daily basis and also for nightly execution based on the schedule. Test Result will be sent to the peers using Jenkins. Version Control Tool: Which repository are you using as a version control tool? E.g. Git. Automated Defect logging: Prepare & Practice | How to explain Test Automation Framework Interview is the most important step in your Job search. When giving any answer, just keep in mind that it should be brief and to the point so that the interviewer should not lose interest. For a typical question like explain Test automation framework – frame your answer in your own words while explaining since interviewer is looking for your practical knowledge on automation frameworks. Mention the type of automation framework you work on – keyword-driven, data-driven, hybrid framework or is it based on a BDD Model. Just explain the structure of test automation framework that you use in the project. A visual representation (on paper or board) would help a lot to both, you & the interviewer. If everything goes well – this answer will definitely get you the job. The creation and maintenance of a Test Automation framework is key to the success of any test Automation project within an organization. Be happy that you are asked to explain Test automation framework because it is a vast subject and if explained well, your answer to this single question can convince the recruiter that you have enough skills for the job. Answering about your practical exposure to framework shows your level of experience in Test automation. Prepare from all the above aspects. Hope it helps. All the Best for your next interview.