Keyword Driven Framework Getting Started Tutorial-1-Introduction

        In the group before, I saw a lot of people talking about keyword-driven frameworks. I have used keyword-driven frameworks written by others before. In fact, I don't like this framework, it is more or less as a development or Test developer, a framework or tool developed to allow black-box testers who do not understand code to quickly write test scripts. It happened that I saw this keyword-driven tutorial on toolsqa.com, so here I translate it and add some of my own understanding. I hope you can also pass this tutorial to know what a keyword-driven framework is and how to design a simple keyword-driven automated testing framework.


What is a keyword-driven framework?

       Keyword Driven Framework is a kind of functional automation testing framework, sometimes called Table-Driver or Action Word based. The automated testing framework of Selenium based on the POM idea that I introduced in the blog, the idea of ​​the keyword-driven framework in this series is keyword-driven, and the basic implementation principle is: in the keyword-driven framework, the test cases are divided into 4 parts : Test steps, test objects, actions, test data.

 

In the above 4 parts, we can use excel to organize and manage.

Test Step : is a description of a small test step, such as clicking a button.

Test object : Generally, the elements on the page on the web system, such as the user name input box and the login button.

Actions : e.g. click, type, open browser

Test data : Data used to assign values ​​to test objects, such as mobile phone number and email fields.

 

       The idea behind keyword-driven is to split a code-written automated test case scenario into multiple small test steps, especially to provide a way for manual testers who do not understand code or are not familiar with writing automated tests , to implement automated testing. Manual testers do not need to pay attention to how the internal code is implemented. They only need to fill in the test data according to the rules in the data table, such as execel, to realize the automation of the test scenario.

 

       Let's take an example to introduce this idea. The following is an example of logging in to the server. The following test steps, whether automated or manual, are basically divided in this way.

1. Open your browser

2. Enter the test server address

3. Click the login link

4. Enter username

5. Enter password

6. Click the Login button

7. Click the logout link

8. Close the browser and exit the test

 

The above steps, implemented with keyword-driven thinking, are done like this:

1. Excel table: This table mainly writes the test case name, test steps, test objects (elements) and operation methods.

2. Object warehouse: mainly the positioning methods and expressions of page elements. For example, we are used to using xpath to locate page elements. The concept of warehouse is mentioned here. Think about it this way. I use an xml file, an excel file, or a text format file, in which all the expressions of the element objects that need to be used on the page of a software project are written in the same file. A file, this method is called an object repository.

3. Keyword method library: It is to define or encapsulate some operation methods for other places to call. These methods try to use some simple vocabulary to describe the operation actions, such as click and input.

4. Data sheet: It can be an excel sheet, used to store some test data, such as user information: nickname, mobile phone number, password, etc.

5. Execution engine: After writing the test script, we need to run the script. How to organize and schedule the execution of scripts is implemented in the execution engine. For example, how to get test data in excel, how to read test case information in excel sheet, etc.

 

The whole process can be represented by the following picture, or the principle of the keyword-driven framework is as follows.

 

Advantages of keyword-driven frameworks:

1. Low technical threshold: Once the developer has designed the framework, manual testers or those with no relevant scripting experience can write automated test scripts according to the template.

2. 容易理解:基本上都是在维护excel表,没有在写代码,所以测试脚本容易读和理解。而且看到那些关键字方法,就很容易想起手动测试场景。

3. 容易上手:和前面两个优点差不多意思,主要是不需要代码知识也能写测试脚本

4. 组件重用:支持模块化复用,具有一定的扩展性。

5. 代码复用:其实调用关键字方法就是在复用代码。包括执行引擎一个用例一个用例执行下去也是在复用代码。

 

       其实,我们大概了解了关键字框架的优点,我们也适当了解一下它的缺点。当然,作为本系列的开篇,我不会立马给出关键字驱动框架的缺点。等我们慢慢设计出来框架,然后使用它,自己去找出它的限制和缺点。可以肯定的是,它没有用代码写自动化测试用例要效率高和方便和高复用性。下面我们就开始来学习关键字框架的设计过程,我这里选择Java+Selenium3.0来展开。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324636951&siteId=291194637