Functional automation testing frameworks come in various flavours, including Keyword Driven Framework, Table-Driven Framework, and Action Word-based Framework. The Keyword Driven Framework’s fundamental operation is the division of the Test Case into four distinct components. Test Step is the first, followed by Test Step’s Object, Test Step’s Action, Test Object’s Data, and Test Object’s Action. You can check out our Selenium course Online to learn more.
With the aid of an Excel spreadsheet, the aforementioned categorization can be completed and maintained:
- Test Action: It is a brief explanation of the test step or the action that will be performed on the test object.
- Test Object: It’s the name of the object or element on the web page, similar to username and password.
- Action: This is the name of the procedure that will be carried out on any object, such as a click, an open browser window, an input, etc.
- Test Data: Data can be any data that the Object requires to carry out any activity, such as the value of the Username field.
With the keyword-driven approach to automation, the coding is kept distinct from the test case and test phase. This makes it much easier for a non-technical individual to comprehend automation. A manual tester can create automation scripts using this. While a hard-core technical coder is required for every keyword-driven project to build up the framework and work on ongoing changes and upgrades to the background automation code, this does not imply that an automation tester is not required. However, as an illustration, an automation team could consist of an automation coder and two manual testers.
Take into account that you need to automate the following steps in a flow:
- Launch a browser
- Go to the URL
- and select the “My Account” link.
- Input the Username
- Specify Password
- Press the Login button.
- Activate the Logout button.
- Close the browser
The following is a list of typical elements you will need to complete the task:
- Excel Worksheet: The majority of the keyword-driven data, including Test cases, Test Steps, Test Objects, and Test Actions, are kept on this sheet.
- Repository for objects: Property file to contain the web application’s HTML elements’ properties; this property file will be associated with the test objects.
- Term Function Database: Function files are crucial in the keyword-driven framework since they contain the workings of the actions, allowing each action to be called from this file.
- Data Sheet: An Excel file that contains the data values that an object needs to conduct an action on it.
- Execution Engine: The sole test script in the Keyword Framework is called Test, and it includes all the code necessary to run the test using an Excel sheet, a Function Lib, and a Properties file.
A Keyword Driven Framework’s general flow looks something like this:
- Execution Engine launches the test, connects to the collection of test cases, and begins running each one one at a time.
After selecting a test case, connected test steps are carried out consecutively.
- Additionally linked to page objects, actions, and test data are test steps.
- The execution Engine connects to the application and completes the test phase once it has all the information needed.
Advantages
- Less Technical Expertise: Manual testers and non-technical testers can quickly build test scripts for automation after the Framework is set up.
- Easy to understand: The test scripts are simple to read and comprehend because they are kept in Excel sheets and contain no exposed coding. Because keywords and actions match manual test cases so closely, they are simpler to create and manage.
- Early Start: Since an Object Repository may be readily set up later on, you can begin creating keyword-driven test cases before the application is delivered. Keyword data tables can be made using details acquired from Requirements or other documents, and they can be made to correlate to equivalent manual test processes.
Reusability of component: Reusability can be improved by adding modularization in Keyword Driven.
Reusability of code: The Keyword Driven Framework encourages extremely high code reuse because there is only one Execution Engine.
Steps in Establishing a Keyword-Driven Framework
- Automate an End 2 End flow.
- Choose & Use Action Keywords
- Setup Data Engine – Excel Sheet
- Implement the Java Reflection class in step 4 to construct the Action Keywords run time.
- Setup of Java Constant Variables for Fixed Data
- Set up the object repository properties file
- Setup of Test Suite Execution Engine
- Set Up Framework Log4j Logging
- Configure the Framework’s Exception Handling
- Set up test result reporting
- Set up Data Driven Technique in Framework
- Establish a Structure for Manual Testers
Conclusion
To learn more about the Keyword Driven Framework in Selenium, check out the Selenium training online.