CN100357910C - Keyword driving havigation method - Google Patents
Keyword driving havigation method Download PDFInfo
- Publication number
- CN100357910C CN100357910C CNB2005100371854A CN200510037185A CN100357910C CN 100357910 C CN100357910 C CN 100357910C CN B2005100371854 A CNB2005100371854 A CN B2005100371854A CN 200510037185 A CN200510037185 A CN 200510037185A CN 100357910 C CN100357910 C CN 100357910C
- Authority
- CN
- China
- Prior art keywords
- keyword
- script
- navigation
- keywords
- dynamic
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
- Stored Programmes (AREA)
Abstract
本发明涉及自动化测试技术,为达到新增AW(关键字)时不必修改导航脚本的目的,本发明提供一种关键字驱动的导航方法,其中采用由静态脚本和动态脚本组成的导航脚本,并在中心数据库内存储关键字、导航关键字、及关键字实现函数之间的相互关系,然后,可由静态脚本完成中心数据库的加载,并根据所需的关键字来创建相应的动态脚本;再由所述动态脚本根据所述关键字和导航关键字,通过查找所述中心数据库来获取对应的关键字实现函数;同时,所述动态脚本将测试逻辑中的关键字的参数传给所述关键字实现函数;通过执行所述关键字实现函数,即可完成相应的测试功能,并将结果返回给测试逻辑。本发明中的方法可提高开发效率,降低导航脚本的维护成本。
The present invention relates to automated test technology, in order to achieve the purpose of not needing to revise the navigation script when adding AW (keyword), the present invention provides a kind of keyword-driven navigation method, wherein adopts the navigation script that is made up of static script and dynamic script, and Store keywords, navigation keywords, and keyword realization functions in the central database. Then, the loading of the central database can be completed by static scripts, and corresponding dynamic scripts can be created according to the required keywords; and then by According to the keyword and the navigation keyword, the dynamic script obtains the corresponding keyword implementation function by searching the central database; at the same time, the dynamic script passes the parameter of the keyword in the test logic to the keyword Realize the function; by executing the keyword to realize the function, the corresponding test function can be completed, and the result will be returned to the test logic. The method in the invention can improve the development efficiency and reduce the maintenance cost of the navigation script.
Description
技术领域technical field
本发明涉及自动化测试技术,更具体地说,涉及一种关键字驱动的导航方法。The invention relates to automated testing technology, and more specifically, relates to a keyword-driven navigation method.
背景技术Background technique
在对电信设备或软件进行测试的过程中,通常是使用Key-Word Driven(关键字驱动)技术,它是基于Rational公司的Robot工具平台而实现的,通常应用于GUI(图形用户界面)的自动化测试中。In the process of testing telecommunication equipment or software, Key-Word Driven (Keyword Driven) technology is usually used, which is implemented based on Rational's Robot tool platform, and is usually applied to the automation of GUI (Graphical User Interface) testing.
在关键字驱动技术中,测试人员会使用类似Excel工作表的表格,以输入关键字(Key-Word)的方式来建立测试用例。这个方法的整个过程(包含功能)都是由关键字驱动的,关键字控制了整个测试过程。In keyword-driven technology, testers will use a form similar to an Excel worksheet to create test cases by entering keywords (Key-Word). The entire process (including functions) of this method is driven by keywords, and keywords control the entire testing process.
表一所示是一个示例性的测试用例。Table 1 shows an exemplary test case.
表一Table I
其中,第一列是关键字,用于说明要执行的动作;第二到第四列,是执行第一列的动作所必需的参数;第五列用于表示该步骤是否通过。Among them, the first column is a keyword, which is used to describe the action to be executed; the second to fourth columns are the parameters necessary to execute the action in the first column; the fifth column is used to indicate whether the step is passed.
如图1所示,关键字驱动技术的运作机制如下:As shown in Figure 1, the operating mechanism of keyword-driven technology is as follows:
(1)测试人员以Excel建立如表一所示的测试用例文件,例如可命名为KeyWords_Web.xls;测试用例文件由关键字(如Enter、Action、Verify等)及其参数组成。(1) Testers use Excel to create a test case file as shown in Table 1, for example, it can be named as KeyWords_Web.xls; the test case file consists of keywords (such as Enter, Action, Verify, etc.) and their parameters.
(2)测试用例运行时,驱动脚本(Drive TSL script)会运行初始化脚本(LogonTSL script),为整个测试作初始化工作,并载入控制文件(Run.txt),以获取当前要运行的测试用例(*.xls,例如KeyWords_Web.xls)。(2) When the test case is running, the drive script (Drive TSL script) will run the initialization script (LogonTSL script) to initialize the entire test, and load the control file (Run.txt) to obtain the current test case to be run ( * .xls, eg KeyWords_Web.xls).
(3)驱动脚本(Drive TSL script)在初始化工作完成后,启动控制脚本(Controller TSL script),由控制脚本来负责解析整个测试用例文件的关键字,例如Enter、Action、Verify等,并根据这些关键字来调用与之对应的实现脚本(User Defined TSL script)。(3) After the initialization work is completed, the drive script (Drive TSL script) starts the control script (Controller TSL script), and the control script is responsible for parsing the keywords of the entire test case file, such as Enter, Action, Verify, etc., and according to these keyword to call the corresponding implementation script (User Defined TSL script).
(4)Utility脚本(即实现TSL脚本)实际执行每个测试动作,并且使用其它列作为参数,执行完后将结果回传给控制脚本。当控制脚本执行到最后一行,整个测试用例就结束执行。(4) The Utility script (i.e. implements the TSL script) actually executes each test action, and uses other columns as parameters, and returns the result to the control script after execution. When the control script executes to the last line, the execution of the entire test case ends.
(5)当控制文件(Run.txt)中的所有用例文件(*.xls)都已运行完毕,则本次测试过程结束。(5) When all the use case files ( * .xls) in the control file (Run.txt) have been run, the test process ends.
由上述可知,在对电信设备或软件进行测试的过程中,关键字驱动技术有以下缺点:It can be seen from the above that in the process of testing telecommunication equipment or software, keyword-driven technology has the following disadvantages:
(1)主要应用于GUI自动化测试,并基于Rational公司的Robot工具平台而实现,(a)它的跨平台(特指操作系统)移植性比较弱,(b)跨工具平台移植性也比较弱,(c)而且不适合应用于通信设备类产品的自动化测试。(1) Mainly used in GUI automated testing, and implemented based on Rational's Robot tool platform, (a) its cross-platform (specifically operating system) portability is relatively weak, (b) cross-tool platform portability is relatively weak , (c) and it is not suitable for automated testing of communication equipment products.
(2)缺少中心数据库(CDB),AW(关键字)本身就是NKey(导航关键字),关键字的导航直接在驱动模块中实现,通常是通过编程语言提供的case语句或if语句来实现的,如图2所示,因此,如果新增一个关键字,则必须修改驱动模块;其结果将导致:(a)自动化测试过程中开发成本增加,(b)关键字将会有大量的冗余,(c)需同时维护多个版本的驱动模块。(2) Lack of central database (CDB), AW (Keyword) itself is NKey (Navigation Keyword), keyword navigation is directly implemented in the driver module, usually through the case statement or if statement provided by the programming language , as shown in Figure 2, therefore, if a new keyword is added, the driver module must be modified; the result will be: (a) the development cost increases during the automated testing process, (b) the keyword will have a lot of redundancy , (c) Driver modules of multiple versions need to be maintained at the same time.
(3)无法实现不同产品/版本间测试用例的移植。(3) The transplantation of test cases between different products/versions cannot be realized.
(4)关键字的实现方式只能通过脚本来实现,无法通过其它编程语言如C、Pascal等来实现。(4) The implementation of keywords can only be realized through scripts, and cannot be realized through other programming languages such as C and Pascal.
发明内容Contents of the invention
针对现有技术的上述缺陷,本发明要解决的技术问题在于如何改进关键字的导航技术,使得新增关键字时不必修改导航脚本。In view of the above-mentioned defects in the prior art, the technical problem to be solved by the present invention is how to improve the keyword navigation technology, so that it is not necessary to modify the navigation script when adding keywords.
为解决上述技术问题,本发明的方案是提供一种关键字驱动的导航方法,采用静态脚本和动态脚本组成导航脚本,包括以下步骤:In order to solve the above technical problems, the solution of the present invention is to provide a keyword-driven navigation method, using static scripts and dynamic scripts to form a navigation script, including the following steps:
(S1)由所述静态脚本完成中心数据库的加载,并创建相应的动态脚本;(S1) Complete the loading of the central database by the static script, and create a corresponding dynamic script;
(S2)所述动态脚本根据所述关键字和与之对应的导航关键字,获取对应的关键字实现函数。(S2) The dynamic script acquires the corresponding keyword implementation function according to the keyword and the corresponding navigation keyword.
为了实现测试的目的,本发明中还包括:In order to realize the purpose of testing, the present invention also includes:
(S3)所述动态脚本将测试逻辑中的关键字的参数传给所述关键字实现函数;(S3) The dynamic script passes the parameters of the keywords in the test logic to the keyword implementation function;
(S4)执行所述关键字实现函数,以完成相应的测试功能。(S4) Execute the keyword implementation function to complete the corresponding test function.
本发明中,在所述中心数据库内存储有关于关键字、导航关键字以及关键字实现函数之间相互关系的信息;在所述步骤(S1)中,所述静态脚本完成中心数据库的加载后,根据所需的关键字来创建相应的动态脚本;在所述步骤(S2)中,所述动态脚本根据所述关键字和与之对应的导航关键字,通过查找所述中心数据库来获取对应的关键字实现函数。In the present invention, information about the relationship between keywords, navigation keywords and keyword realization functions is stored in the central database; in the step (S1), after the static script completes the loading of the central database , create a corresponding dynamic script according to the required keyword; in the step (S2), the dynamic script obtains the corresponding dynamic script by searching the central database according to the keyword and the corresponding navigation keyword. The keyword implements the function.
本发明中,所述导航脚本可通过脚本语言或编译语言实现。所述静态脚本为初始化脚本;在所述步骤(S1)中,所述静态脚本可通过脚本语言动态创建命令的特性来创建所述动态脚本。所述脚本语言可为工具命令语言(TCL)。In the present invention, the navigation script can be realized by scripting language or compiled language. The static script is an initialization script; in the step (S1), the static script can create the dynamic script through the feature of a script language dynamic creation command. The scripting language may be Tool Command Language (TCL).
采用本发明的方案之后,通过中心数据库,在维护关键字及其与导航关键字、关键字实现函数之间的对应关系时,只需修改中心数据库即可,而不必再修改导航脚本,从而提高了关键字数据驱动自动化测试的开发效率,并且降低了关键字驱动自动化测试的后续维护成本,同时可避免关键字的冗余,避免维护多个版本的导航脚本;另外,具有相同功能的测试工具或测试仪器的配置和控制也可定义一套相同的关键字来实现。After adopting the scheme of the present invention, through the central database, when maintaining the corresponding relationship between keywords and navigation keywords and keyword realization functions, it is only necessary to modify the central database without revising the navigation script, thereby improving It improves the development efficiency of keyword data-driven automated testing, and reduces the follow-up maintenance cost of keyword-driven automated testing. At the same time, it can avoid keyword redundancy and avoid maintaining multiple versions of navigation scripts; in addition, testing tools with the same function Or the configuration and control of test instruments can also be implemented by defining a set of the same keywords.
而且,由采取了上述技术方案,通过导航关键字就可将关键字导航到不同测试工具或测试仪器的关键字实现函数,也可将关键字导航到不同产品或同一产品的不同版本的关键字实现函数,从而为测试脚本在不同产品或同一产品不版本间的移植奠定了基础。Moreover, by adopting the above technical solution, keywords can be navigated to keywords of different test tools or test instruments to realize functions by navigating keywords, and keywords can also be navigated to keywords of different products or different versions of the same product Realize the function, thus laying the foundation for the transplantation of test scripts between different products or different versions of the same product.
另外,由于在本发明中的导航脚本是通过脚本语言(如TCL脚本语言、Python语言)来实现的,而脚本语言具备跨平台(特指操作系统)及跨工具平台的特性,因此,本发明的方案能提高跨平台移植性和跨工具平台移植性,从而更适合应用于通信设备类产品的自动化测试。In addition, because the navigation script in the present invention is realized by a scripting language (such as TCL scripting language, Python language), and the scripting language possesses the characteristics of cross-platform (specifically referring to the operating system) and cross-tool platform, therefore, the present invention The solution can improve cross-platform portability and cross-tool platform portability, so it is more suitable for automated testing of communication equipment products.
附图说明Description of drawings
下面将结合附图及实施例对本发明作进一步说明,附图中:The present invention will be further described below in conjunction with accompanying drawing and embodiment, in the accompanying drawing:
图1是现有技术中关键字驱动技术的的动作机制示意图;FIG. 1 is a schematic diagram of the action mechanism of the keyword-driven technology in the prior art;
图2是现有技术中新增关键字时的流程示意图;Fig. 2 is a schematic flow chart when new keywords are added in the prior art;
图3是本发明中的导航脚本的结构示意图;Fig. 3 is a schematic structural diagram of a navigation script in the present invention;
图4是本发明中导航脚本的初始化流程图;Fig. 4 is the initialization flowchart of navigation script among the present invention;
图5是本发明中测试逻辑的执行过程示意图。Fig. 5 is a schematic diagram of the execution process of the test logic in the present invention.
具体实施方式Detailed ways
本发明的实现,是基于现有技术的各项发展,例如,脚本语言(如TCL、PYTHON等)的特性,如解释执行、可嵌入、可扩展等特性,为自动化测试技术奠定了基础;同时,各种产品(如电信设备或软件)不仅提供图形界面,同时也提供命令行接口或人机接口,也为产品的自动化测试技术奠定了基础;此外,申请人经过多年的自动化测试实践,总结了一整套自动化测试脚本设计模式,包括线性测试脚本设计模式、结构化测试脚本设计模式、共享测试脚本设计模式、数据驱动测试脚本设计模式、关键字驱动测试脚本设计模式等。The realization of the present invention is based on various developments of the prior art, for example, the characteristics of scripting languages (such as TCL, PYTHON, etc.), such as interpretation and execution, embeddable, expandable and other characteristics, have laid the foundation for automated testing technology; , various products (such as telecommunication equipment or software) not only provide a graphical interface, but also provide a command line interface or a human-machine interface, which also lays the foundation for the automated testing technology of the product; in addition, after years of automated testing practice, the applicant concluded that A set of automated test script design patterns, including linear test script design patterns, structured test script design patterns, shared test script design patterns, data-driven test script design patterns, keyword-driven test script design patterns, etc.
为便于对本发明的理解,下面对本文中使用的一些术语作一个简单的介绍,具体如表二所示:For the convenience of understanding the present invention, some terms used in this paper are briefly introduced below, specifically as shown in Table 2:
表二Table II
由前述内容可知,本发明的目的是要改进关键字的导航方案,使得新增关键字时不必修改导航脚本。It can be seen from the foregoing that the purpose of the present invention is to improve the keyword navigation scheme, so that it is not necessary to modify the navigation script when adding keywords.
如图3所示,本发明中,导航脚本由两部分组成:(1)一部分为静态脚本,即初始化脚本,主要用于完成中心数据库的加载,并通过脚本语言(如TCL)动态创建命令的特性,来创建导航脚本的动态脚本;(2)另一部分为动态脚本,即关键字函数,它根据导航关键字(NKey)来完成关键字的导航,执行关键字实现函数,并将结果返回给测试逻辑。具体实施时,导航脚本可以通过脚本语言(如Python)或编译语言(如C)来实现。As shown in Fig. 3, in the present invention, navigation script is made up of two parts: (1) a part is static script, i.e. initialization script, is mainly used in finishing the loading of central database, and by scripting language (as TCL) dynamic creation order characteristics, to create dynamic scripts for navigation scripts; (2) the other part is dynamic scripts, namely keyword functions, which complete keyword navigation based on navigation keywords (NKey), execute keyword implementation functions, and return the results to Test logic. During specific implementation, the navigation script can be implemented by a scripting language (such as Python) or a compiled language (such as C).
如图4所示,导航脚本在初始化阶段加载中心数据库,并且根据中心数据库中定义的关键字以及关键字与导航关键字、关键字实现函数之间的对应关系,利用脚本语言(如TCL)的可以动态生成命令的特性,生成关键字函数,即动态脚本;然后以关键字函数作为导航脚本的一部分,完成关键字到关键字实现函数的导航的功能。As shown in Figure 4, the navigation script loads the central database during the initialization phase, and according to the keywords defined in the central database and the corresponding relationship between keywords and navigation keywords and keyword implementation functions, the scripting language (such as TCL) is used to The characteristics of the command can be dynamically generated, and the keyword function can be generated, that is, the dynamic script; then the keyword function can be used as a part of the navigation script to complete the function of navigating from keyword to keyword to realize the function.
如图5所示,测试逻辑在执行过程中:As shown in Figure 5, during the execution of the test logic:
(1)关键字将触发关键字函数,转而执行关键字函数,即执行导航脚本中的动态脚本;(1) The keyword will trigger the keyword function, and then execute the keyword function, that is, execute the dynamic script in the navigation script;
(2)关键字函数根据关键字及与之对应的导航关键字,查找中心数据库,以获取与关键字对应的关键字实现函数;本文中的加载是指把中心数据库所有内容加载到计算机内存中或连接到数据库;查找是指在中心数据库中查找某条记录;(2) Keyword function Search the central database according to the keyword and the corresponding navigation keyword to obtain the keyword corresponding to the keyword to realize the function; the loading in this article refers to loading all the contents of the central database into the computer memory or connect to a database; lookup refers to looking for a record in the central database;
(3)导航脚本中的动态脚本将测试逻辑中的关键字的参数也同时传给关键字实现函数,然后执行关键字实现函数,以完成相应的测试功能;(3) The dynamic script in the navigation script also passes the parameter of the keyword in the test logic to the keyword implementation function at the same time, and then executes the keyword implementation function to complete the corresponding test function;
(4)将结果返回给测试逻辑,并确定测试逻辑是否继续执行下一个关键字,如果为否则结束整个流程。(4) Return the result to the test logic, and determine whether the test logic continues to execute the next keyword, if not, end the whole process.
可见,本发明中,由于新增加的关键字与导航关键字、关键字实现函数的对应关系,只需要修改中心数据库,不必修改导航脚本,所以提高了开发效率,降低了导航脚本的维护成本。其中的导航脚本可以通过脚本语言(如Python)或编译语言(如C)来实现。It can be seen that in the present invention, due to the correspondence between newly added keywords, navigation keywords, and keyword implementation functions, only the central database needs to be modified, and the navigation script does not need to be modified, so the development efficiency is improved and the maintenance cost of the navigation script is reduced. The navigation script therein can be implemented by a scripting language (such as Python) or a compiled language (such as C).
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005100371854A CN100357910C (en) | 2005-09-08 | 2005-09-08 | Keyword driving havigation method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CNB2005100371854A CN100357910C (en) | 2005-09-08 | 2005-09-08 | Keyword driving havigation method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1851664A CN1851664A (en) | 2006-10-25 |
CN100357910C true CN100357910C (en) | 2007-12-26 |
Family
ID=37133143
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB2005100371854A Expired - Fee Related CN100357910C (en) | 2005-09-08 | 2005-09-08 | Keyword driving havigation method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN100357910C (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7689665B2 (en) * | 2007-04-27 | 2010-03-30 | Microsoft Corporation | Dynamically loading scripts |
CN103019928B (en) * | 2011-09-27 | 2016-06-29 | 北京新媒传信科技有限公司 | A kind of automated testing method and system |
CN106294145A (en) * | 2016-08-05 | 2017-01-04 | 珠海市魅族科技有限公司 | A kind of method of software test and software testing device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020032538A1 (en) * | 2000-05-09 | 2002-03-14 | Lee Young-Seok | Software test system and method |
US6502102B1 (en) * | 2000-03-27 | 2002-12-31 | Accenture Llp | System, method and article of manufacture for a table-driven automated scripting architecture |
US20030084429A1 (en) * | 2001-10-26 | 2003-05-01 | Schaefer James S. | Systems and methods for table driven automation testing of software programs |
CN1503168A (en) * | 2002-11-22 | 2004-06-09 | 深圳市中兴通讯股份有限公司 | Automatic test method for system products |
-
2005
- 2005-09-08 CN CNB2005100371854A patent/CN100357910C/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6502102B1 (en) * | 2000-03-27 | 2002-12-31 | Accenture Llp | System, method and article of manufacture for a table-driven automated scripting architecture |
US20020032538A1 (en) * | 2000-05-09 | 2002-03-14 | Lee Young-Seok | Software test system and method |
US20030084429A1 (en) * | 2001-10-26 | 2003-05-01 | Schaefer James S. | Systems and methods for table driven automation testing of software programs |
CN1503168A (en) * | 2002-11-22 | 2004-06-09 | 深圳市中兴通讯股份有限公司 | Automatic test method for system products |
Non-Patent Citations (2)
Title |
---|
关键字驱动自动化测试的原理和实现 冯玉才,唐艳,周淳.计算机应用,第24卷第8期 2004 * |
实时嵌入式软件测试研究 于以序,何艳敏,左雪梅,王陈.中国测试技术,第30卷第5期 2004 * |
Also Published As
Publication number | Publication date |
---|---|
CN1851664A (en) | 2006-10-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11789715B2 (en) | Systems and methods for transformation of reporting schema | |
US20160299745A1 (en) | Development method for web development system, and web development system | |
CN103019928B (en) | A kind of automated testing method and system | |
US8037450B2 (en) | System and methods for tracing code generation in template engines | |
CN111324609B (en) | Knowledge graph construction method and device, electronic equipment and storage medium | |
US8635593B2 (en) | Dynamic autocompletion tool | |
CN100377109C (en) | A method for completing product automation testing by using a test suite | |
CN104133772A (en) | Automatic test data generation method | |
CN117033249B (en) | Test case generation method and device, computer equipment and storage medium | |
CN111026670B (en) | Test case generation method, test case generation device and storage medium | |
US20130042221A1 (en) | System and method for automatic impact variable analysis and field expansion in mainframe systems | |
US20160275126A1 (en) | Accessing and editing virtually-indexed message flows using structured query langauge (sql) | |
CN100517222C (en) | Model Transformation Device and Method Supporting Separation of Transformation Engine and Mapping Rules | |
CN114371841A (en) | Front-end project code generation method and device, computer equipment and storage medium | |
Feuerstack et al. | Automated usability evaluation during model-based interactive system development | |
US20200097260A1 (en) | Software application developer tools platform | |
CN100595756C (en) | A method for keyword-driven navigation | |
CN100357910C (en) | Keyword driving havigation method | |
Schramm et al. | Rapid UI development for enterprise applications: Combining manual and model-driven techniques | |
CN110764746B (en) | Script generation method and device and computer readable storage medium | |
KR20230082020A (en) | Test methods, systems and equipment based on Excel file loading | |
US11467752B2 (en) | Data migration system and data migration method | |
CN111324332A (en) | Big data task processing method and system, electronic device and storage medium | |
US20210263756A1 (en) | System and method for proprietary source code interpretation | |
CN115587036A (en) | Test system and test case generation method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20071226 Termination date: 20170908 |