[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN103984626B - A kind of method and device for generating test case script - Google Patents

A kind of method and device for generating test case script Download PDF

Info

Publication number
CN103984626B
CN103984626B CN201410201488.4A CN201410201488A CN103984626B CN 103984626 B CN103984626 B CN 103984626B CN 201410201488 A CN201410201488 A CN 201410201488A CN 103984626 B CN103984626 B CN 103984626B
Authority
CN
China
Prior art keywords
script
unit function
user
function script
unit
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.)
Active
Application number
CN201410201488.4A
Other languages
Chinese (zh)
Other versions
CN103984626A (en
Inventor
孟斌
武锐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201410201488.4A priority Critical patent/CN103984626B/en
Publication of CN103984626A publication Critical patent/CN103984626A/en
Application granted granted Critical
Publication of CN103984626B publication Critical patent/CN103984626B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

This application provides a kind of method and device for generating test case script.Methods described includes:Obtain the Elementary Function script call operation of user's input;The corresponding Elementary Function script of the Elementary Function script call operation is assembled into test case script;Wherein, the Elementary Function script includes sequence of operation data and the Elementary Function scripted code for calling the sequence of operation data cell function script, and the sequence of operation data are that the corresponding peration data of the continuous operating procedure in part in all operationss step performed when being tested by user application program to be measured is constituted;Application program to be measured is tested using the test case script.Using the present processes or device, it can make that there is the relatively low degree of coupling between test case script and program to be tested, if program to be tested changes, it is only necessary to test case script is carried out simply to change, the human cost of modification process consuming is reduced.

Description

一种生成测试用例脚本的方法及装置A method and device for generating test case scripts

技术领域technical field

本申请涉及程序测试领域,特别是涉及一种生成测试用例脚本的方法及装置。This application relates to the field of program testing, in particular to a method and device for generating test case scripts.

背景技术Background technique

在程序开发过程中,当一个新的程序设计完毕后,通常需要对该程序进行测试。现有技术中,对于程序的测试方法主要是程序开发人员手动使用该程序,操作该程序执行预先设计的功能,判断该程序是否能够正确稳定的执行上述功能。During program development, when a new program is designed, it is usually necessary to test the program. In the prior art, the testing method for the program is mainly that the program developer manually uses the program, operates the program to perform pre-designed functions, and judges whether the program can perform the above functions correctly and stably.

随着程序开发需求的增加,需要进行测试的程序也越来越多。手动测试的方法将占用测试人员很多的时间和精力。因此,现有技术中,开始采用自动化的方式进行程序测试。With the increase of program development requirements, more and more programs need to be tested. The method of manual testing will take up a lot of time and energy of the testers. Therefore, in the prior art, an automated method is used for program testing.

自动化的方式进行程序测试,是指对于待测试的程序,生成一个对应的测试用例脚本。执行该测试用例脚本,就可以对待测试的程序进行自动测试。现有技术中,生成测试用例脚本的方法主要是根据程序测试过程中,测试人员需要输入的操作指令,生成对应的脚本;然后控制计算机自动执行该脚本,就可以自动对程序进行测试。Program testing in an automated manner refers to generating a corresponding test case script for the program to be tested. By executing the test case script, the program to be tested can be automatically tested. In the prior art, the method of generating test case scripts is mainly to generate corresponding scripts according to the operation instructions that testers need to input during the program testing process; and then control the computer to automatically execute the scripts to automatically test the program.

但是,现有技术中生成测试用例脚本的方法,脚本与待测试程序的耦合度过高,一旦待测试程序由于版本升级等情况发生变更,则需要对测试用例脚本进行大量修改,甚至需要重新编写测试用例脚本。However, in the method for generating test case scripts in the prior art, the coupling between the script and the program to be tested is too high. Once the program to be tested changes due to version upgrades, etc., the test case script needs to be modified a lot, or even rewritten. Test case script.

发明内容Contents of the invention

本申请的目的是提供一种生成测试用例脚本的方法及装置,能够使测试程序的脚本与待测试程序之间具有较低的耦合度,如果待测试程序发生变动,只需要对测试程序进行简单修改即可,降低修改过程耗费的人力成本。The purpose of this application is to provide a method and device for generating test case scripts, which can make the script of the test program and the program to be tested have a low degree of coupling. It only needs to be modified, reducing the labor cost of the modification process.

为实现上述目的,本申请提供了如下方案:In order to achieve the above object, the application provides the following scheme:

根据本申请的第一方面的第一种可能的实现方式,本申请提供一种生成测试用例脚本的方法,包括:According to a first possible implementation of the first aspect of the present application, the present application provides a method for generating test case scripts, including:

获取用户输入的单元功能脚本调用操作;Obtain the unit function script call operation input by the user;

将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本包括操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码,所述操作序列数据是由用户对待测应用程序进行测试时所执行的全部操作步骤中的部分连续的操作步骤对应的操作数据构成的,且所述操作序列数据以及单元功能脚本代码分别保存;The unit function script corresponding to the unit function script call operation is assembled into a test case script; wherein, the unit function script includes operation sequence data and unit function script code for calling the operation sequence data unit function script, the The operation sequence data is composed of operation data corresponding to some continuous operation steps in all operation steps performed by the user when testing the application program to be tested, and the operation sequence data and unit function script codes are stored separately;

采用所述测试用例脚本对所述待测应用程序进行测试;Using the test case script to test the application program to be tested;

其中,所述获取用户输入的单元功能脚本调用操作之前,还包括:Wherein, before the unit function script calling operation for obtaining user input, it also includes:

获取用户输入的单元功能脚本录制起始操作;Obtain the unit function script recording start operation input by the user;

录制用户对所述待测应用程序进行测试时所执行的操作步骤;recording the operation steps performed by the user when testing the application program to be tested;

获取用户输入的单元功能脚本录制结束操作;Obtain the unit function script recording end operation input by the user;

得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本;obtaining the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation;

则所述录制用户对所述待测应用程序进行测试时所执行的操作步骤,具体包括:Then the operation steps performed by the recording user when testing the application program to be tested include:

确定所述操作步骤对应的操作对象的特征图像;determining the characteristic image of the operation object corresponding to the operation step;

将所述特征图像的特征图像名和特征图像路径添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,根据所述特征图像名和特征图像路径获取所述特征图像,并基于所述特征图像通过图像识别的方式判断操作体当前所处的图像环境是否与所述特征图像表示的图像环境相匹配。Add the feature image name and feature image path of the feature image to the operation sequence data, so that when the test case script is used to test the application program to be tested, the feature image name and feature image path can be obtained according to the feature image name and feature image path The characteristic image, and judge whether the image environment where the operating body is currently located matches the image environment represented by the characteristic image by means of image recognition based on the characteristic image.

结合第一方面的第二种可能的实现方式的第一种具体实现方式的一种具体实现方式,所述确定所述操作步骤对应的操作对象的特征图像,具体包括:With reference to a specific implementation manner of the first specific implementation manner of the second possible implementation manner of the first aspect, the determining the characteristic image of the operation object corresponding to the operation step specifically includes:

获取用户在所述操作对象上截取的图形信息;Acquiring graphic information intercepted by the user on the operation object;

将所述图形信息确定为所述操作步骤对应的操作对象的特征图像。The graphic information is determined as a characteristic image of the operation object corresponding to the operation step.

结合第一方面的第二种可能的实现方式的第二种具体实现方式,所述录制用户对所述待测应用程序进行测试时所执行的操作步骤,具体包括:With reference to the second specific implementation manner of the second possible implementation manner of the first aspect, the recording of the operation steps performed by the user when testing the application program under test specifically includes:

获取用户在执行所述操作步骤时输入的文本信息和/或键盘操作信息;Obtain text information and/or keyboard operation information input by the user when performing the operation steps;

将所述文本信息和/或键盘操作信息添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,自动输入所述文本信息和/或键盘操作信息。adding the text information and/or keyboard operation information to the operation sequence data, so that when the test case script is used to test the application program to be tested, the text information and/or keyboard operation information is automatically input information.

结合第一方面的第二种可能的实现方式的第三种具体实现方式,所述录制用户对所述待测应用程序进行测试时所执行的操作步骤,具体包括:In combination with the third specific implementation manner of the second possible implementation manner of the first aspect, the recording of the operation steps performed by the user when testing the application program under test specifically includes:

获取执行所述操作步骤时置前的窗体的窗体名;Obtain the form name of the form that is brought forward when performing the operation steps;

将所述窗体名添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,基于所述窗体名置前所述窗体。The form name is added to the operation sequence data, so that when the test case script is used to test the application program to be tested, the form is placed in front based on the form name.

结合第一方面的第三种可能的实现方式,所述获取用户输入的单元功能脚本调用操作之后,还包括:With reference to the third possible implementation manner of the first aspect, after the unit function script invoking operation for acquiring user input, further includes:

获取用户基于预设的单元功能脚本列表选择的预设的单元功能脚本;Obtaining a preset unit function script selected by the user based on the list of preset unit function scripts;

添加所述预设的单元功能脚本至所述测试用例脚本中,以实现将所述预设的单元功能脚本拼装成所述测试用例脚本;Adding the preset unit function script to the test case script, so as to assemble the preset unit function script into the test case script;

其中,所述预设的单元功能脚本包括:Wherein, the preset unit function script includes:

用于控制网络管理程序的单元功能脚本;Unit function scripts for controlling network management programs;

和/或,用于控制外部设备的单元功能脚本。And/or, unit function scripts for controlling external devices.

结合第一方面的第二种可能的实现方式的第四种具体实现方式,所述得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本之后,还包括:With reference to the fourth specific implementation manner of the second possible implementation manner of the first aspect, the obtaining the unit function corresponding to the operation steps performed by the user between the recording start operation and the recording end operation After the script, also include:

显示所述单元功能脚本中的参数修改接口;Displaying the parameter modification interface in the unit function script;

接收用户通过所述参数修改接口输入的参数修改操作;receiving a parameter modification operation input by the user through the parameter modification interface;

基于所述参数修改操作,修改所述单元功能脚本中的参数。Based on the parameter modification operation, the parameters in the unit function script are modified.

根据本申请的第二方面的第一种可能的实现方式,本申请提供一种生成测试用例脚本的装置,包括:According to the first possible implementation of the second aspect of the present application, the present application provides an apparatus for generating test case scripts, including:

调用操作获取单元,用于获取用户输入的单元功能脚本调用操作;The call operation obtaining unit is used to obtain the call operation of the unit function script input by the user;

测试用例脚本拼装单元,用于将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本包括操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码,所述操作序列数据是由用户对待测应用程序进行测试时所执行的全部操作步骤中的部分连续的操作步骤对应的操作数据构成的,且所述操作序列数据以及单元功能脚本代码分别保存;A test case script assembling unit is used to assemble the unit function script corresponding to the unit function script call operation into a test case script; wherein, the unit function script includes operation sequence data and is used to call the operation sequence data unit function script The unit function script code, the operation sequence data is composed of the operation data corresponding to some continuous operation steps in all the operation steps performed by the user when testing the application program to be tested, and the operation sequence data and the unit function Script codes are saved separately;

测试单元,用于采用所述测试用例脚本对所述待测应用程序进行测试;a test unit, configured to test the application program under test by using the test case script;

所述装置,还包括:The device also includes:

录制起始操作获取单元,用于在获取用户输入的单元功能脚本调用操作之前,获取用户输入的单元功能脚本录制起始操作;The recording start operation acquisition unit is used to obtain the unit function script recording start operation input by the user before obtaining the unit function script call operation input by the user;

操作步骤录制单元,用于录制用户对所述待测应用程序进行测试时所执行的操作步骤;An operation step recording unit, configured to record the operation steps performed by the user when testing the application program to be tested;

录制结束操作获取单元,用于获取用户输入的单元功能脚本录制结束操作;The recording end operation acquisition unit is used to obtain the unit function script recording end operation input by the user;

单元功能脚本获得单元,用于得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本;A unit function script obtaining unit, configured to obtain the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation;

其中,所述操作步骤录制单元,具体用于确定所述操作步骤对应的操作对象的特征图像;Wherein, the operation step recording unit is specifically configured to determine the characteristic image of the operation object corresponding to the operation step;

以及用于将所述特征图像的特征图像名和特征图像路径添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,根据所述特征图像名和特征图像路径获取所述特征图像,并基于所述特征图像通过图像识别的方式判断操作体当前所处的图像环境是否与所述特征图像表示的图像环境相匹配。and adding the feature image name and feature image path of the feature image to the operation sequence data, so that when the test case script is used to test the application program to be tested, according to the feature image name and feature The image path acquires the feature image, and judges whether the current image environment of the operator matches the image environment represented by the feature image through image recognition based on the feature image.

结合第二方面的第二种可能的实现方式的第一种具体的实现方式的一种更具体的实现方式,所述操作步骤录制单元确定所述操作步骤对应的操作对象的特征图像,具体包括获取用户在所述操作对象上截取的图形信息;With reference to a more specific implementation manner of the first specific implementation manner of the second possible implementation manner of the second aspect, the operation step recording unit determines the characteristic image of the operation object corresponding to the operation step, specifically including Acquiring graphic information intercepted by the user on the operation object;

并将所述图形信息确定为所述操作步骤对应的操作对象的特征图像。And the graphic information is determined as the characteristic image of the operation object corresponding to the operation step.

结合第二方面的第二种可能的实现方式的第二种具体的实现方式,所述操作步骤录制单元,具体用于获取用户在执行所述操作步骤时输入的文本信息和/或键盘操作信息;With reference to the second specific implementation of the second possible implementation of the second aspect, the operation step recording unit is specifically configured to acquire text information and/or keyboard operation information input by the user when performing the operation steps ;

以及用于将所述文本信息和/或键盘操作信息添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,自动输入所述文本信息和/或键盘操作信息。and adding the text information and/or keyboard operation information to the operation sequence data, so that when the test case script is used to test the application program to be tested, the text information and/or keyboard operation information are automatically input or keystroke information.

结合第二方面的第二种可能的实现方式的第三种具体的实现方式,所述操作步骤录制单元,具体用于获取执行所述操作步骤时置前的窗体的窗体名;With reference to a third specific implementation of the second possible implementation of the second aspect, the operation step recording unit is specifically configured to acquire the window name of the front window when performing the operation step;

以及用于将所述窗体名添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,基于所述窗体名置前所述窗体。and adding the form name to the operation sequence data, so that when the test case script is used to test the application program to be tested, the form is placed in front of the form based on the form name.

结合第二方面的第三种可能的实现方式,还包括:In combination with the third possible implementation of the second aspect, it also includes:

预设单元功能脚本获取单元,用于在获取用户输入的单元功能脚本调用操作之后,获取用户基于预设的单元功能脚本列表选择的预设的单元功能脚本;The preset unit function script obtaining unit is used to obtain the preset unit function script selected by the user based on the preset unit function script list after obtaining the unit function script call operation input by the user;

预设单元功能脚本添加单元,用于添加所述预设的单元功能脚本至所述测试用例脚本中,以实现将所述预设的单元功能脚本拼装成所述测试用例脚本;A preset unit function script adding unit, configured to add the preset unit function script to the test case script, so as to assemble the preset unit function script into the test case script;

其中,所述预设的单元功能脚本包括:Wherein, the preset unit function script includes:

用于控制网络管理程序的单元功能脚本;Unit function scripts for controlling network management programs;

和/或,用于控制外部设备的单元功能脚本。And/or, unit function scripts for controlling external devices.

结合第二方面的第二种可能的实现方式的第四种具体的实现方式,还包括:A fourth specific implementation manner combined with the second possible implementation manner of the second aspect further includes:

参数修改接口显示单元,用于在得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本之后,显示所述单元功能脚本中的参数修改接口;A parameter modification interface display unit, configured to display the parameter modification in the unit function script after obtaining the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation interface;

参数修改操作接收单元,用于接收用户通过所述参数修改接口输入的参数修改操作;A parameter modification operation receiving unit, configured to receive a parameter modification operation input by a user through the parameter modification interface;

参数修改单元,用于基于所述参数修改操作,修改所述单元功能脚本中的参数。A parameter modification unit, configured to modify parameters in the unit function script based on the parameter modification operation.

根据本申请提供的具体实施例,本申请公开了以下技术效果:According to the specific embodiments provided by the application, the application discloses the following technical effects:

本申请公开的生成测试程序的方法或装置,通过获取用户输入的单元功能脚本调用操作;将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本中包含用户对程序进行测试时所执行的多个连续的操作步骤,所述单元功能脚本包括由各个所述操作步骤对应的操作数据构成的操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码;由于测试步骤分成单元功能脚本代码和操作序列数据分别进行保存,由用户对于每个单元功能脚本分别进行调用从而生成完整的测试用例脚本,所以当待测程序发生变动时,只需要修改发生变动的步骤中对应的操作序列数据即可。因此,可以使测试用例脚本与待测试程序之间具有较低的耦合度,如果待测试程序发生变动,只需要对测试用例脚本进行简单修改即可,降低了修改过程耗费的人力成本。The method or device for generating a test program disclosed in the present application obtains the unit function script call operation input by the user; assembles the unit function script corresponding to the unit function script call operation into a test case script; wherein, in the unit function script Contains a plurality of continuous operation steps performed by the user when testing the program, the unit function script includes operation sequence data composed of operation data corresponding to each operation step and a unit function script for calling the operation sequence data The unit function script code; since the test steps are divided into unit function script code and operation sequence data to be stored separately, and the user calls each unit function script separately to generate a complete test case script, so when the program to be tested changes, It is only necessary to modify the corresponding operation sequence data in the changed steps. Therefore, the coupling degree between the test case script and the program to be tested can be lowered. If the program to be tested changes, only a simple modification of the test case script is required, which reduces the labor cost of the modification process.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required in the embodiments. Obviously, the accompanying drawings in the following description are only some of the present application. Embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without paying creative labor.

图1为本申请的生成测试用例脚本的方法的应用场景示意图;Fig. 1 is the application scenario schematic diagram of the method for generating test case script of the present application;

图2为本申请的生成测试用例脚本的方法实施例1的流程图;Fig. 2 is the flowchart of the method embodiment 1 of generating test case script of the present application;

图3为本申请的生成测试用例脚本的方法实施例2的流程图;Fig. 3 is the flow chart of the method embodiment 2 of the generation test case script of the present application;

图4为本申请的生成测试用例脚本的方法实施例3的流程图;Fig. 4 is the flowchart of the method embodiment 3 of the generation test case script of the present application;

图5为本申请的生成测试用例脚本的方法实施例4的流程图;Fig. 5 is the flowchart of the method embodiment 4 of the generation test case script of the present application;

图6为本申请的生成测试用例脚本的装置实施例的流程图;Fig. 6 is the flow chart of the device embodiment of the generation test case script of the present application;

图7为本申请的计算节点的结构图。FIG. 7 is a structural diagram of a computing node of the present application.

具体实施方式detailed description

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the application with reference to the drawings in the embodiments of the application. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

为使本申请的上述目的、特征和优点能够更加明显易懂,下面结合附图和具体实施方式对本申请作进一步详细的说明。In order to make the above objects, features and advantages of the present application more obvious and comprehensible, the present application will be further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

图1为本申请的生成测试用例脚本的方法的应用场景示意图。如图1所示,计算机10与设备20之间可以进行通信。计算机10可以运行各种程序,其中包括设备控制程序以及测试用例脚本。所述设备控制程序是用于控制设备20执行设定操作的程序。所述测试用例脚本是用于测试所述设备控制程序是否可以正常运行的程序。FIG. 1 is a schematic diagram of an application scenario of the method for generating test case scripts of the present application. As shown in FIG. 1 , a computer 10 and a device 20 may communicate. Computer 10 can run various programs, including device control programs and test case scripts. The device control program is a program for controlling the device 20 to perform setting operations. The test case script is a program for testing whether the device control program can run normally.

当所述计算机10运行所述测试用例脚本时,可以通过运行所述设备控制程序对设备20下发控制指令,控制设备20完成设定的操作。设备20可以向计算机10反馈与该操作相关的状态信息,从而使计算机10获知设备20是否完成了该操作。When the computer 10 runs the test case script, it can issue a control command to the device 20 by running the device control program, and control the device 20 to complete the set operation. The device 20 may feed back status information related to the operation to the computer 10, so that the computer 10 knows whether the device 20 has completed the operation.

图2为本申请的生成测试用例脚本的方法实施例1的流程图。如图2所示,该方法可以包括:FIG. 2 is a flow chart of Embodiment 1 of the method for generating test case scripts of the present application. As shown in Figure 2, the method may include:

步骤201:获取用户输入的单元功能脚本调用操作;Step 201: Obtain the unit function script call operation input by the user;

所述单元功能脚本可以是在用户手动执行对待测应用程序进行测试的过程中,由计算机等设备录制下来的相关操作所生成的脚本。其中,所述待测应用程序可以是包括设备控制程序在内的应用程序。The unit function script may be a script generated by related operations recorded by devices such as a computer during the process of manually executing the test application program by the user. Wherein, the application program to be tested may be an application program including a device control program.

本实施例中,可以先由用户手动对所述待测应用程序进行操作。即,用户可以通过手动方式输入对待测应用程序的操作。这些操作可以实现对所述待测应用程序的一次测试。In this embodiment, the user may first manually operate the application program to be tested. That is, the user can manually input the operation of the application program to be tested. These operations can implement a test of the application program to be tested.

步骤202:将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本包括操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码,所述操作序列数据是由用户对待测应用程序进行测试时所执行的全部操作步骤中的部分连续的操作步骤对应的操作数据构成的;Step 202: Assemble the unit function script corresponding to the unit function script call operation into a test case script; wherein, the unit function script includes operation sequence data and unit function script code for calling the operation sequence data unit function script , the operation sequence data is composed of operation data corresponding to some continuous operation steps in all operation steps performed by the user when testing the application program to be tested;

用户对程序进行测试时所执行的操作,可以按照不同的操作目的划分为多个单元功能脚本。每个单元功能脚本中可以包含用户对程序进行测试时所执行的多个连续的操作步骤。所述多个连续的操作步骤可以是所述用户对所述待测应用程序进行测试时所执行的全部操作步骤中的一部分。The operations performed by the user when testing the program can be divided into multiple unit function scripts according to different operation purposes. Each unit function script may contain a plurality of continuous operation steps performed by the user when testing the program. The plurality of continuous operation steps may be a part of all operation steps performed by the user when testing the application program to be tested.

所述步骤可以包括输入字符串、激活/关闭窗体、限时等待一个窗体激活、限时等待一个窗体关闭/消失、重置窗体大小、查找/定位到特征图、等待一个特征图出现/消失、清空剪切板、剪切板转换等等。The steps may include inputting a character string, activating/closing a window, waiting for a window to activate within a time limit, waiting for a window to close/disappear within a time limit, resetting the size of the window, finding/locating a feature map, waiting for a feature map to appear/ Disappear, empty clipboard, clipboard transition, etc.

所述单元功能脚本中包含有由各个所述操作步骤对应的操作数据构成的操作序列数据。The unit function script includes operation sequence data composed of operation data corresponding to each of the operation steps.

操作序列数据的一种具体实现方式可以如下所示:A specific implementation of manipulating sequence data can be as follows:

"Step:=","Win:=","Img_find:=","TimeOut:=","Img_find_nocare:=","Mouse:=","Key:=","Delay:="。"Step:=","Win:=","Img_find:=","TimeOut:=","Img_find_nocare:=","Mouse:=","Key:=","Delay:=".

其中,"Step:="中等号后面的值,可以表示该行操作序列数据对应的操作步骤的操作目的;"Win:="中等号后面的值,可以表示当前激活的窗口;"Img_find:="中等号后面的值,可以表示当前操作状态下的特征图的存储路径和特征图的名称(特征图的概念后续会进行说明),"TimeOut:="中等号后面的值,可以表示多种含义,例如可以表示限时等待查找一个特征图,或者可以表示限时等待一个特征图消失;"Img_find_nocare:="中等号后面的值,可以表示如果查找不到特征图,是否进行报错提示;"Mouse:="中等号后面的值,可以表示鼠标执行的操作;"Key:="中等号后面的值,可以表示键盘的按键操作或输入的一串文本;"Delay:="中等号后面的值,可以表示本次操作步骤执行后的延时等待时间,单位可以是秒。Among them, the value behind the equal sign in "Step:=" can indicate the operation purpose of the operation step corresponding to the row of operation sequence data; the value behind the equal sign in "Win:=" can indicate the currently activated window; "Img_find: = The value after the "medium sign" can represent the storage path of the feature map and the name of the feature map in the current operating state (the concept of the feature map will be explained later), and the value after the "TimeOut:=" medium sign can represent a variety of Meaning, for example, it can mean waiting for a time limit to find a feature map, or it can mean waiting a time limit for a feature map to disappear; "Img_find_nocare:="The value after the equal sign can indicate whether to report an error if the feature map cannot be found; "Mouse: ="The value behind the equal sign can represent the operation performed by the mouse; the value behind "Key:=" can represent the key operation of the keyboard or a string of text input; the value behind the "Delay:=" It can indicate the delay waiting time after the execution of this operation step, and the unit can be seconds.

上面的例子中,根据实际操作,等号后面均是可以附有具体数值或标识的。例如,当"Key:="中等号后面的值为“v”时,即“Key:=v”可以表示该步骤中需要执行按下键盘上V键的操作。"Delay:="中等号后面的值为1时,即"Delay:=1"可以表示该步骤执行后可以有1秒的延时时限。实际应用中,所述操作序列数据还可以根据需求具有各种实现方式,此处不再一一列举。In the above example, according to the actual operation, the equal sign can be followed by a specific value or logo. For example, when the value behind the equal sign in "Key:=" is "v", that is, "Key:=v" may indicate that the operation of pressing the V key on the keyboard needs to be performed in this step. When the value behind the equal sign in "Delay:=" is 1, that is, "Delay:=1" can indicate that there can be a delay time limit of 1 second after the execution of this step. In practical applications, the operation sequence data may also have various implementation methods according to requirements, which will not be listed here.

所述单元功能脚本中还包含有单元功能脚本代码。所述单元功能脚本代码可以对所述操作序列数据进行调用。所述单元功能脚本中还可以包含有目的描述代码,所述目的描述代码可以描述所述单元功能脚本的操作目的,以便开发人员在调用或者修改所述单元功能脚本时,快速地了解所述单元功能脚本对应的步骤的操作目的。The unit function script also includes the unit function script code. The unit function script code can call the operation sequence data. The unit function script may also contain a purpose description code, and the purpose description code may describe the operation purpose of the unit function script, so that developers can quickly understand the unit function when calling or modifying the unit function script. The operation purpose of the step corresponding to the function script.

实际应用中,在获取用户输入的单元功能脚本调用操作之前,还可以包括以下步骤:In practical application, before obtaining the unit function script call operation input by the user, the following steps may also be included:

获取用户输入的单元功能脚本录制起始操作;Obtain the unit function script recording start operation input by the user;

录制用户对所述待测应用程序进行测试时所执行的操作步骤;recording the operation steps performed by the user when testing the application program to be tested;

获取用户输入的单元功能脚本录制结束操作;Obtain the unit function script recording end operation input by the user;

得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本。A unit function script corresponding to an operation step performed by the user between the recording start operation and the recording end operation is obtained.

当用户完成对程序进行的测试操作后,可以将用户在执行所述操作步骤时录制的单元功能脚本进行保存。After the user completes the test operation on the program, the unit function script recorded by the user when performing the operation steps can be saved.

用户可以对保存的单元功能脚本进行调用。通过用户的调用,多个单元功能脚本就可以整体组成一个测试用例脚本。The user can call the saved unit function script. Through calling by the user, multiple unit function scripts can form a test case script as a whole.

录制完成的单元功能脚本可以显示在用户可以观察到的窗口中。用户可以通过点击窗口中显示的单元功能脚本,来对单元功能脚本进行调用。当用户对某一个单元功能脚本进行调用后,在测试用例脚本中就会添加该单元功能脚本对应的名称及参数;当用户通过点击对多个单元功能脚本进行调用以后,就可以在测试用例脚本中添加所述多个单元功能脚本对应的名称及参数,从而实现单元功能脚本的拼装。The recorded unit function script can be displayed in a window that the user can observe. The user can call the unit function script by clicking the unit function script displayed in the window. When the user calls a certain unit function script, the name and parameters corresponding to the unit function script will be added in the test case script; when the user clicks to call multiple unit function scripts, the test case script can The names and parameters corresponding to the plurality of unit function scripts are added in , so as to realize the assembly of the unit function scripts.

步骤203:采用所述测试用例脚本对待测应用程序进行测试;Step 203: Using the test case script to test the application program to be tested;

采用所述测试用例脚本对待测应用程序进行测试时,通过所述单元功能脚本中的单元功能脚本代码,可以实现对操作序列数据的调用。在调用所述操作序列数据的过程中,可以根据所述操作序列数据,解析得到相应的操作步骤代码,由计算机等设备自动执行所述操作步骤代码,实现对于待测应用程序的测试。When using the test case script to test the application program to be tested, the operation sequence data can be called through the unit function script code in the unit function script. In the process of invoking the operation sequence data, the corresponding operation step code can be obtained by analyzing the operation sequence data, and the computer and other equipment can automatically execute the operation step code to realize the test of the application program to be tested.

还需要说明的是,本发明实施例中的方法,对于待测应用程序中的图形用户界面部分,可以自动录制用户输入的操作,生成测试图形用户界面部分的单元功能脚本;对于网络管理程序或者外部设备,则可以将用于控制网络管理程序或者外部设备的单元功能脚本,预先编写并存储在预设单元功能脚本列表中,以便用户可以直接调用用于控制网络管理程序或者外部设备的单元功能脚本。It should also be noted that, the method in the embodiment of the present invention, for the GUI part in the application program to be tested, can automatically record the operation input by the user, and generate a unit function script for testing the GUI part; for the network management program or For external devices, the unit function scripts used to control the network management program or external devices can be pre-written and stored in the preset unit function script list, so that users can directly call the unit functions used to control the network management program or external devices script.

具体的,可以在获取用户输入的单元功能脚本调用操作之后:Specifically, after the unit function script call operation that obtains user input:

获取用户基于的预设单元功能脚本列表选择的预设的单元功能脚本;Obtaining a preset unit function script selected by the user based on the list of preset unit function scripts;

添加所述预设的单元功能脚本至所述测试用例脚本中,以实现将所述预设的单元功能脚本拼装成所述测试用例脚本;Adding the preset unit function script to the test case script, so as to assemble the preset unit function script into the test case script;

其中,所述预设的单元功能脚本包括:Wherein, the preset unit function script includes:

用于控制网络管理程序的单元功能脚本;Unit function scripts for controlling network management programs;

和/或,用于控制外部设备的单元功能脚本。And/or, unit function scripts for controlling external devices.

通过获取用户选择的预设单元功能脚本;将所述预设单元功能脚本添加至所述测试用例脚本中,可以进一步完善测试用例脚本的功能,实现不同的软件工具以及不同的外部设备之间的相互调用。By obtaining the preset unit function script selected by the user; adding the preset unit function script to the test case script can further improve the function of the test case script, and realize the interaction between different software tools and different external devices call each other.

综上所述,本实施例中,通过获取用户输入的单元功能脚本调用操作;将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本中包含用户对程序进行测试时所执行的多个连续的操作步骤,所述单元功能脚本包括由各个所述操作步骤对应的操作数据构成的操作序列数据以及用于调用所述操作序列数据的单元功能脚本代码;由于测试步骤分成单元功能脚本代码和操作序列数据分别进行保存,由用户对于每个单元功能脚本分别进行调用从而生成完整的测试用例脚本,所以当待测试程序发生变动时,只需要修改发生变动的步骤中对应的操作序列数据即可。因此,可以使测试用例脚本与待测试程序之间具有较低的耦合度,如果待测试程序发生变动,只需要对测试用例脚本进行简单修改即可,降低了修改过程耗费的人力成本。In summary, in this embodiment, the unit function script call operation input by the user is acquired; the unit function script corresponding to the unit function script call operation is assembled into a test case script; wherein, the unit function script includes the user A plurality of continuous operation steps executed when the program is tested, the unit function script includes operation sequence data composed of operation data corresponding to each operation step and unit function script code for invoking the operation sequence data ;Because the test steps are divided into unit function script code and operation sequence data to be stored separately, and the user calls each unit function script separately to generate a complete test case script, so when the program to be tested changes, only the modification is required The corresponding operation sequence data in the steps is enough. Therefore, the coupling degree between the test case script and the program to be tested can be lowered. If the program to be tested changes, only a simple modification of the test case script is required, which reduces the labor cost of the modification process.

图3为本申请的生成测试用例脚本的方法实施例2的流程图。如图3所示,该方法可以包括:FIG. 3 is a flow chart of Embodiment 2 of the method for generating test case scripts of the present application. As shown in Figure 3, the method may include:

步骤301:获取用户输入的单元功能脚本录制起始操作;Step 301: Obtain the unit function script recording start operation input by the user;

步骤302:在录制过程中,确定操作步骤对应的操作对象的特征图像;Step 302: During the recording process, determine the characteristic image of the operation object corresponding to the operation step;

所述特征图像用于表示操作步骤对应的操作对象。例如,某个操作步骤是针对窗体A执行的,那么就可以截取窗体A的整体或部分区域作为窗体A的特征图像。在后续采用测试用例脚本自动执行对待测应用程序的测试操作时,可以根据所述特征图像,判断当前所处的操作环境中是否存在特定的操作对象。The characteristic image is used to represent the operation object corresponding to the operation step. For example, if a certain operation step is performed on form A, then the entire or partial area of form A may be intercepted as the feature image of form A. When using the test case script to automatically execute the test operation of the application program under test, it can be determined whether there is a specific operation object in the current operating environment according to the characteristic image.

由于用户在手动输入测试操作时,同一个步骤所针对的操作对象有可能是不同的。因此,需要明确每个步骤所对应的操作对象。Since the user manually inputs the test operation, the operation objects targeted at the same step may be different. Therefore, it is necessary to clarify the operation object corresponding to each step.

例如,以鼠标点击为例,假设显示界面上同时显示有A图标和B图标,则用户执行的鼠标点击操作,有可能是针对A图标的,也有可能是针对B图标的。为了确定用户点击的操作对象是哪个,可以将所述操作对象的图像信息作为参考依据。For example, taking mouse click as an example, assuming that icon A and icon B are displayed on the display interface at the same time, the mouse click operation performed by the user may be aimed at icon A or icon B. In order to determine which operation object the user clicks, the image information of the operation object may be used as a reference.

所述确定所述操作步骤对应的操作对象的特征图像,具体可以包括:The determining the characteristic image of the operation object corresponding to the operation step may specifically include:

获取用户在所述操作对象上截取的图形信息;Acquiring graphic information intercepted by the user on the operation object;

将所述图形信息确定为所述操作步骤对应的操作对象的特征图像。The graphic information is determined as a characteristic image of the operation object corresponding to the operation step.

步骤303:将表示所述操作对象的特征图像名和特征图像路径添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,根据所述特征图像名和特征图像路径获取所述特征图像,基于所述特征图像通过图像识别的方式判断操作体当前所处的图像环境是否与所述特征图像表示的图像环境相匹配。Step 303: Add the feature image name and feature image path representing the operation object to the operation sequence data, so that when using the test case script to test the application program under test, according to the feature image name and feature image path The feature image path acquires the feature image, and judges whether the current image environment of the operator matches the image environment represented by the feature image through image recognition based on the feature image.

其中,所述操作体可以是进行鼠标操作时在电子设备的屏幕上显示的指针,也可以是进行文字录入操作时在电子设备的屏幕上显示的光标。Wherein, the operating body may be a pointer displayed on the screen of the electronic device when a mouse operation is performed, or a cursor displayed on the screen of the electronic device when a character input operation is performed.

本实施例中,可以对所述操作对象的部分区域的图像进行截取,将截取得到的图像信息进行命名。命名的名称可以作为所述操作对象的图像信息的标识。将所述标识添加在所述操作数据中后,还可以将所述标识对应的截取得到的图像进行保存。In this embodiment, the image of the partial area of the operation object may be intercepted, and the image information obtained by the interception may be named. The named name may serve as an identifier of the image information of the operation object. After the identifier is added to the operation data, the intercepted image corresponding to the identifier can also be saved.

当所述测试程序对程序进行自动测试时,就可以根据所述标识查找到所述截取得到的图像,并与当前自动执行的步骤所针对的操作对象的图像进行比对。进而可以通过图像识别等技术,判断出当前自动执行的步骤所针对的操作对象是否是正确的操作对象。其中,图像识别就可以是指,将根据所述标识查找到所述截取得到的图像,与当前自动执行的步骤所针对的操作对象的图像进行比对,识别两个图像是否相同。When the test program automatically tests the program, the intercepted image can be found according to the identification, and compared with the image of the operation object targeted by the currently automatically executed step. Furthermore, it may be determined whether the operation object targeted by the currently automatically executed step is a correct operation object through technologies such as image recognition. Wherein, the image recognition may refer to comparing the intercepted image found according to the identification with the image of the operation object targeted by the currently automatically executed step, and identifying whether the two images are the same.

步骤304:获取用户输入的单元功能脚本录制结束操作;Step 304: Obtain the unit function script recording end operation input by the user;

步骤305:得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本;Step 305: Obtain the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation;

步骤306:获取用户输入的单元功能脚本调用操作;Step 306: Obtain the unit function script call operation input by the user;

步骤307:将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本中包含用户对程序进行测试时所执行的多个连续的操作步骤,所述单元功能脚本包括由各个所述操作步骤对应的操作数据构成的操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码;Step 307: Assemble the unit function script corresponding to the unit function script call operation into a test case script; wherein, the unit function script includes a plurality of continuous operation steps performed by the user when testing the program, and the unit The function script includes operation sequence data composed of operation data corresponding to each of the operation steps and a unit function script code for calling the unit function script of the operation sequence data;

步骤308:采用所述测试用例脚本对待测应用程序进行测试。Step 308: Test the application program to be tested by using the test case script.

本实施例中,通过确定所述操作步骤对应的操作对象的特征图像;将表示所述操作对象的特征图像名和特征图像路径添加在所述操作数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,根据所述特征图像名和特征图像路径获取所述特征图像,基于所述特征图像通过图像识别的方式判断操作体当前所处的图像环境是否与所述特征图像表示的图像环境相匹配;可以在后续的自动测试过程中通过图像识别等技术,判断出当前自动执行的步骤所针对的操作对象是否是正确的操作对象,提高自动测试过程的精确性。In this embodiment, by determining the characteristic image of the operation object corresponding to the operation step; adding the characteristic image name and characteristic image path representing the operation object to the operation data, so that when using the test case script to When the application program to be tested is tested, the feature image is obtained according to the feature image name and feature image path, and based on the feature image, it is judged whether the image environment where the operator is currently in is consistent with the feature image representation In the subsequent automatic test process, image recognition and other technologies can be used to judge whether the operation object targeted by the current automatically executed steps is the correct operation object, so as to improve the accuracy of the automatic test process.

图4为本申请的生成测试用例脚本的方法实施例3的流程图。如图4所示,该方法可以包括:FIG. 4 is a flow chart of Embodiment 3 of the method for generating test case scripts of the present application. As shown in Figure 4, the method may include:

步骤401:获取用户输入的单元功能脚本录制起始操作;Step 401: Obtain the unit function script recording start operation input by the user;

步骤402:录制用户对所述待测应用程序进行测试时所执行的操作步骤;Step 402: recording the operation steps performed by the user when testing the application program to be tested;

所述录制用户对程序进行测试时所执行的操作步骤,具体可以包括:The recording of the operation steps performed by the user when testing the program may specifically include:

获取用户在执行所述操作步骤时输入的文本信息和/或键盘操作信息;Obtain text information and/or keyboard operation information input by the user when performing the operation steps;

将所述文本信息和/或键盘操作信息添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,自动输入所述文本信息和/或键盘操作信息。adding the text information and/or keyboard operation information to the operation sequence data, so that when the test case script is used to test the application program to be tested, the text information and/or keyboard operation information is automatically input information.

所述录制用户对程序进行测试时所执行的操作步骤,具体还可以包括:The recording of the operation steps performed by the user when testing the program may specifically include:

获取执行所述操作步骤时置前的窗体的窗体名;其中,所述置前的窗体,是指当前处于激活状态,并且在大多数情况下以高亮方式所显示的窗体。Acquire the window name of the front window when the operation steps are executed; wherein, the front window refers to the window that is currently activated and displayed in a highlighted manner in most cases.

将所述窗体名添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,基于所述窗体名置前所述窗体。The form name is added to the operation sequence data, so that when the test case script is used to test the application program to be tested, the form is placed in front based on the form name.

步骤403:获取用户输入的单元功能脚本录制结束操作;Step 403: Obtain the unit function script recording end operation input by the user;

步骤404:得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本。Step 404: Obtain the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation.

步骤405:获取用户输入的单元功能脚本调用操作;Step 405: Obtain the unit function script call operation input by the user;

步骤406:将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本中包含用户对程序进行测试时所执行的多个连续的操作步骤,所述单元功能脚本包括由各个所述操作步骤对应的操作数据构成的操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码;Step 406: Assemble the unit function script corresponding to the unit function script call operation into a test case script; wherein, the unit function script includes a plurality of continuous operation steps performed by the user when testing the program, and the unit The function script includes operation sequence data composed of operation data corresponding to each of the operation steps and a unit function script code for calling the unit function script of the operation sequence data;

步骤407:采用所述测试用例脚本对待测应用程序进行测试。Step 407: Test the application program to be tested by using the test case script.

本实施例中,通过录制用户对所述待测应用程序进行测试时所执行的操作步骤,可以对用户输入的文本信息以及其他键盘操作信息进行录制,还可以记录执行所述操作步骤时置前的窗体。In this embodiment, by recording the operation steps performed by the user when testing the application program to be tested, the text information entered by the user and other keyboard operation information can be recorded, and the preceding operation steps can also be recorded when the operation steps are executed. form.

图5为本申请的生成测试用例脚本的方法实施例4的流程图。如图5所示,该方法可以包括:FIG. 5 is a flow chart of Embodiment 4 of the method for generating test case scripts of the present application. As shown in Figure 5, the method may include:

步骤501:获取用户输入的单元功能脚本录制起始操作;Step 501: Obtain the unit function script recording start operation input by the user;

步骤502:录制用户对所述待测应用程序进行测试时所执行的操作步骤;Step 502: recording the operation steps performed by the user when testing the application program to be tested;

步骤503:获取用户输入的单元功能脚本录制结束操作;Step 503: Obtain the unit function script recording end operation input by the user;

步骤504:得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本。Step 504: Obtain the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation.

步骤505:显示所述单元功能脚本中的参数修改接口;Step 505: Display the parameter modification interface in the unit function script;

步骤506:接收用户通过所述参数修改接口输入的参数修改操作;Step 506: receiving a parameter modification operation input by the user through the parameter modification interface;

步骤507:基于所述参数修改操作,修改所述单元功能脚本中的参数。Step 507: Based on the parameter modification operation, modify the parameters in the unit function script.

其中,所述参数可以包括端口号等用于表示单元功能脚本的操作对象的参数,还可以包括业务认证方式和具体的认证码等等。Wherein, the parameters may include port numbers and other parameters used to represent the operation objects of the unit function scripts, and may also include service authentication methods and specific authentication codes.

步骤508:获取用户输入的单元功能脚本调用操作;Step 508: Obtain the unit function script call operation input by the user;

步骤509:将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本中包含用户对程序进行测试时所执行的多个连续的操作步骤,所述单元功能脚本包括由各个所述操作步骤对应的操作数据构成的操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码;Step 509: Assemble the unit function script corresponding to the unit function script call operation into a test case script; wherein, the unit function script includes a plurality of continuous operation steps performed by the user when testing the program, and the unit The function script includes operation sequence data composed of operation data corresponding to each of the operation steps and a unit function script code for calling the unit function script of the operation sequence data;

步骤510:采用所述测试用例脚本对待测应用程序进行测试。Step 510: Test the application program to be tested by using the test case script.

本实施例中,通过显示所述单元功能脚本中的参数修改接口;接收用户通过所述参数修改接口输入的参数修改操作;基于所述参数修改操作,修改所述单元功能脚本中的参数,可以提高用户对测试脚本的修改效率,降低修改测试程序的过程中所耗费的人力成本。In this embodiment, by displaying the parameter modification interface in the unit function script; receiving the parameter modification operation input by the user through the parameter modification interface; based on the parameter modification operation, modifying the parameters in the unit function script can be Improve the user's modification efficiency of the test script and reduce the labor cost in the process of modifying the test program.

本申请还提供了一种成测试用例脚本的装置。The application also provides a device for generating test case scripts.

图6为本申请的生成测试用例脚本的装置实施例的流程图。如图6所示,该装置可以包括:FIG. 6 is a flowchart of an embodiment of an apparatus for generating test case scripts of the present application. As shown in Figure 6, the device may include:

调用操作获取单元601,用于获取用户输入的单元功能脚本调用操作;Call operation acquisition unit 601, used to obtain the unit function script call operation input by the user;

所述单元功能脚本可以是在用户手动执行对待测应用程序进行测试的过程中,由计算机等设备录制下来的相关操作所生成的脚本。其中,所述待测应用程序可以是包括设备控制程序在内的应用程序。The unit function script may be a script generated by related operations recorded by devices such as a computer during the process of manually executing the test application program by the user. Wherein, the application program to be tested may be an application program including a device control program.

本实施例中,可以先由用户手动对所述待测应用程序进行操作。即,用户可以通过手动方式输入对待测应用程序的操作。这些操作可以实现对所述待测应用程序的一次测试。In this embodiment, the user may first manually operate the application program to be tested. That is, the user can manually input the operation of the application program to be tested. These operations can implement a test of the application program to be tested.

测试用例脚本拼装单元602,用于将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本包括操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码,所述操作序列数据是由用户对待测应用程序进行测试时所执行的全部操作步骤中的部分连续的操作步骤对应的操作数据构成的;The test case script assembling unit 602 is used to assemble the unit function script corresponding to the unit function script call operation into a test case script; wherein, the unit function script includes operation sequence data and is used to call the operation sequence data unit function The unit function script code of the script, the operation sequence data is composed of operation data corresponding to some continuous operation steps in all operation steps performed by the user when testing the application program to be tested;

用户对程序进行测试时所执行的操作,可以按照不同的操作目的划分为多个单元功能脚本。每个单元功能脚本中可以包含用户对程序进行测试时所执行的多个连续的操作步骤。The operations performed by the user when testing the program can be divided into multiple unit function scripts according to different operation purposes. Each unit function script may contain a plurality of continuous operation steps performed by the user when testing the program.

所述步骤可以包括输入字符串、激活/关闭窗体、限时等待一个窗体激活、限时等待一个窗体关闭/消失、重置窗体大小、查找/定位到特征图、等待一个特征图出现/消失、清空剪切板、剪切板转换等等。The steps may include inputting a character string, activating/closing a window, waiting for a window to activate within a time limit, waiting for a window to close/disappear within a time limit, resetting the size of the window, finding/locating a feature map, waiting for a feature map to appear/ Disappear, empty clipboard, clipboard transition, etc.

所述单元功能脚本中包含有由各个所述操作步骤对应的操作数据构成的操作序列数据。The unit function script includes operation sequence data composed of operation data corresponding to each of the operation steps.

操作序列数据的一种具体实现方式可以如下所示:A specific implementation of manipulating sequence data can be as follows:

"Step:=","Win:=","Img_find:=","TimeOut:=","Img_find_nocare:=","Mouse:=","Key:=","Delay:="。"Step:=","Win:=","Img_find:=","TimeOut:=","Img_find_nocare:=","Mouse:=","Key:=","Delay:=".

其中,"Step:="中等号后面的值,可以表示该行操作序列数据对应的操作步骤的操作目的,;"Win:="中等号后面的值,可以表示当前激活的窗口;"Img_find:="中等号后面的值,可以表示当前操作状态下的特征图的存储路径和特征图的名称(特征图的概念后续会进行说明),"TimeOut:="中等号后面的值,可以表示多种含义,例如可以表示限时等待查找一个特征图,或者可以表示限时等待一个特征图消失;"Img_find_nocare:="中等号后面的值,可以表示如果查找不到特征图,是否进行报错提示;"Mouse:="中等号后面的值,可以表示鼠标执行的操作;"Key:="中等号后面的值,可以表示键盘的按键操作或输入的一串文本;"Delay:="中等号后面的值,可以表示本次操作步骤执行后的延时等待时间,单位可以是秒。Among them, the value behind the equal sign in "Step:=" can indicate the operation purpose of the operation step corresponding to the row of operation sequence data; the value behind the equal sign in "Win:=" can indicate the currently activated window; "Img_find: ="The value after the equal sign can indicate the storage path and name of the feature map in the current operating state (the concept of the feature map will be explained later), the value after "TimeOut:=" can indicate multiple For example, it can mean waiting for a time limit to find a feature map, or it can mean waiting a time limit for a feature map to disappear; "Img_find_nocare:="The value after the equal sign can indicate whether to report an error if the feature map cannot be found; "Mouse :="The value behind the equal sign can represent the operation performed by the mouse; the value behind "Key:=" can represent the keyboard key operation or a string of text input; the value behind "Delay:=" the equal sign , which can indicate the delay waiting time after the execution of this operation step, and the unit can be seconds.

上面的例子中,根据实际操作,等号后面均是可以附有具体数值或标识的。例如,当"Key:="中等号后面的值为“v”时,即“Key:=v”可以表示该步骤中需要执行按下键盘上V键的操作。"Delay:="中等号后面的值为1时,即"Delay:=1"可以表示该步骤执行后可以有1秒的延时时限。实际应用中,所述操作序列数据还可以根据需求具有各种实现方式,此处不再一一列举。In the above example, according to the actual operation, the equal sign can be followed by a specific value or logo. For example, when the value behind the equal sign in "Key:=" is "v", that is, "Key:=v" may indicate that the operation of pressing the V key on the keyboard needs to be performed in this step. When the value behind the equal sign in "Delay:=" is 1, that is, "Delay:=1" can indicate that there can be a delay time limit of 1 second after the execution of this step. In practical applications, the operation sequence data may also have various implementation methods according to requirements, which will not be listed here.

所述单元功能脚本中还包含有单元功能脚本代码。所述单元功能脚本代码可以对所述操作序列数据进行调用。所述单元功能脚本中还可以包含有目的描述代码,所述目的描述代码可以描述所述单元功能脚本的操作目的,以便开发人员在调用或者修改所述单元功能脚本时,快速地了解所述单元功能脚本对应的步骤的操作目的。The unit function script also includes the unit function script code. The unit function script code can call the operation sequence data. The unit function script may also contain a purpose description code, and the purpose description code may describe the operation purpose of the unit function script, so that developers can quickly understand the unit function when calling or modifying the unit function script. The operation purpose of the step corresponding to the function script.

实际应用中,在获取用户输入的单元功能脚本调用操作之前,还可以包括以下步骤:In practical application, before obtaining the unit function script call operation input by the user, the following steps may also be included:

获取用户输入的单元功能脚本录制起始操作;Obtain the unit function script recording start operation input by the user;

录制用户对所述待测应用程序进行测试时所执行的操作步骤;recording the operation steps performed by the user when testing the application program to be tested;

获取用户输入的单元功能脚本录制结束操作;Obtain the unit function script recording end operation input by the user;

生成所述用户在所述起始操作与所述结束操作之间执行的操作步骤所对应的单元功能脚本。A unit function script corresponding to the operation steps performed by the user between the start operation and the end operation is generated.

当用户完成对程序进行的测试操作后,可以将用户在执行所述操作步骤时录制的单元功能脚本进行保存。After the user completes the test operation on the program, the unit function script recorded by the user when performing the operation steps can be saved.

用户可以对保存的单元功能脚本进行调用。通过用户的调用,多个单元功能脚本就可以整体组成一个测试用例脚本。The user can call the saved unit function script. Through calling by the user, multiple unit function scripts can form a test case script as a whole.

测试单元603,用于采用所述测试用例脚本对待测应用程序进行测试。The testing unit 603 is configured to use the test case script to test the application program to be tested.

采用所述测试用例脚本对待测应用程序进行测试时,通过所述单元功能脚本中的单元功能脚本代码,可以实现对操作序列数据的调用。在调用所述操作序列数据的过程中,可以根据所述操作序列数据,解析得到相应的操作步骤代码,由计算机等设备自动执行所述操作步骤代码,实现对于待测应用程序的测试。When using the test case script to test the application program to be tested, the operation sequence data can be called through the unit function script code in the unit function script. In the process of invoking the operation sequence data, the corresponding operation step code can be obtained by analyzing the operation sequence data, and the computer and other equipment can automatically execute the operation step code to realize the test of the application program to be tested.

综上所述,本实施例中,通过获取用户输入的单元功能脚本调用操作;将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本中包含用户对程序进行测试时所执行的多个连续的操作步骤,所述单元功能脚本包括由各个所述操作步骤对应的操作数据构成的操作序列数据以及用于调用所述操作序列数据的单元功能脚本代码;由于测试步骤分成单元功能脚本代码和操作序列数据分别进行保存,由用户对于每个单元功能脚本分别进行调用从而生成完整的测试用例脚本,所以当待测试程序发生变动时,只需要修改发生变动的步骤中对应的操作序列数据即可。因此,可以使测试用例脚本与待测试程序之间具有较低的耦合度,如果待测试程序发生变动,只需要对测试用例脚本进行简单修改即可,降低了修改过程耗费的人力成本。In summary, in this embodiment, the unit function script call operation input by the user is acquired; the unit function script corresponding to the unit function script call operation is assembled into a test case script; wherein, the unit function script includes the user A plurality of continuous operation steps executed when the program is tested, the unit function script includes operation sequence data composed of operation data corresponding to each operation step and unit function script code for invoking the operation sequence data ;Because the test steps are divided into unit function script code and operation sequence data to be stored separately, and the user calls each unit function script separately to generate a complete test case script, so when the program to be tested changes, only the modification is required The corresponding operation sequence data in the steps is enough. Therefore, the coupling degree between the test case script and the program to be tested can be lowered. If the program to be tested changes, only a simple modification of the test case script is required, which reduces the labor cost of the modification process.

实际应用中,所述装置还可以包括:In practical applications, the device may also include:

录制起始操作获取单元,用于获取用户输入的单元功能脚本调用操作之前,获取用户输入的单元功能脚本录制起始操作;The recording start operation acquisition unit is used to obtain the unit function script input by the user before the unit function script call operation, and obtain the recording start operation of the unit function script input by the user;

操作步骤录制单元,用于录制用户对所述待测应用程序进行测试时所执行的操作步骤;An operation step recording unit, configured to record the operation steps performed by the user when testing the application program to be tested;

录制结束操作获取单元,用于获取用户输入的单元功能脚本录制结束操作;The recording end operation acquisition unit is used to obtain the unit function script recording end operation input by the user;

单元功能脚本获得单元,用于得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本。The unit function script obtaining unit is configured to obtain the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation.

实际应用中,所述操作步骤录制单元,具体可以用于确定所述操作步骤对应的操作对象的特征图像;In practical applications, the operation step recording unit may specifically be used to determine the characteristic image of the operation object corresponding to the operation step;

以及用于将所述特征图像的特征图像名和特征图像路径添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,根据所述特征图像名和特征图像路径获取所述特征图像,并基于所述特征图像通过图像识别的方式判断操作体当前所处的图像环境是否与所述特征图像表示的图像环境相匹配。and adding the feature image name and feature image path of the feature image to the operation sequence data, so that when the test case script is used to test the application program to be tested, according to the feature image name and feature The image path acquires the feature image, and judges whether the current image environment of the operator matches the image environment represented by the feature image through image recognition based on the feature image.

实际应用中,所述操作步骤录制单元确定所述操作步骤对应的操作对象的特征图像,具体可以包括获取用户在所述操作对象上截取的图形信息;In practical applications, the operation step recording unit determines the characteristic image of the operation object corresponding to the operation step, which may specifically include acquiring graphic information intercepted by the user on the operation object;

并用于将所述图形信息确定为所述操作步骤对应的操作对象的特征图像。And it is used to determine the graphic information as the characteristic image of the operation object corresponding to the operation step.

实际应用中,所述操作步骤录制单元,具体可以用于获取用户在执行所述操作步骤时输入的文本信息和/或键盘操作信息;In practical applications, the operation step recording unit may specifically be used to acquire text information and/or keyboard operation information input by the user when performing the operation steps;

以及用于将所述文本信息和/或键盘操作信息添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,自动输入所述文本信息和/或键盘操作信息。and adding the text information and/or keyboard operation information to the operation sequence data, so that when the test case script is used to test the application program to be tested, the text information and/or keyboard operation information are automatically input or keystroke information.

实际应用中,所述操作步骤录制单元,具体可以用于获取执行所述操作步骤时置前的窗体的窗体名;In practical applications, the operation step recording unit may specifically be used to obtain the form name of the front form when performing the operation step;

以及用于将所述窗体名添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,基于所述窗体名置前所述窗体。and adding the form name to the operation sequence data, so that when the test case script is used to test the application program to be tested, the form is placed in front of the form based on the form name.

实际应用中,还可以包括:In practical applications, it can also include:

预设单元功能脚本获取单元,用于在获取用户输入的单元功能脚本调用操作之后,获取用户基于预设的单元功能脚本列表选择的预设的单元功能脚本;The preset unit function script obtaining unit is used to obtain the preset unit function script selected by the user based on the preset unit function script list after obtaining the unit function script call operation input by the user;

预设单元功能脚本添加单元,用于添加所述预设的单元功能脚本至所述测试用例脚本中,以实现测试用例脚本的拼装;The preset unit function script adding unit is used to add the preset unit function script to the test case script to realize the assembly of the test case script;

其中,所述预设的单元功能脚本包括:Wherein, the preset unit function script includes:

用于控制网络管理程序的单元功能脚本;Unit function scripts for controlling network management programs;

和/或,用于控制外部设备的单元功能脚本。And/or, unit function scripts for controlling external devices.

实际应用中,还可以包括:In practical applications, it can also include:

参数修改接口显示单元,用于在得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本之后,显示所述单元功能脚本中的参数修改接口;A parameter modification interface display unit, configured to display the parameter modification in the unit function script after obtaining the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation interface;

参数修改操作接收单元,用于接收用户通过所述参数修改接口输入的参数修改操作;A parameter modification operation receiving unit, configured to receive a parameter modification operation input by a user through the parameter modification interface;

参数修改单元,用于基于所述参数修改操作,修改所述单元功能脚本中的参数。A parameter modification unit, configured to modify parameters in the unit function script based on the parameter modification operation.

另外,本申请实施例还提供了一种计算节点,计算节点可能是包含计算能力的主机服务器,或者是个人计算机PC,或者是可携带的便携式计算机或终端等等,本申请具体实施例并不对计算节点的具体实现做限定。In addition, the embodiment of the present application also provides a computing node. The computing node may be a host server with computing capabilities, or a personal computer PC, or a portable portable computer or terminal, etc. The specific embodiments of the present application do not The specific implementation of computing nodes is limited.

图7为本申请的计算节点的结构图。如图7所示,计算节点700包括:FIG. 7 is a structural diagram of a computing node of the present application. As shown in FIG. 7, computing node 700 includes:

处理器(processor)710,通信接口(Communications Interface)720,存储器(memory)730,总线740。A processor (processor) 710 , a communication interface (Communications Interface) 720 , a memory (memory) 730 , and a bus 740 .

处理器710,通信接口720,存储器730通过总线740完成相互间的通信。The processor 710 , the communication interface 720 , and the memory 730 communicate with each other through the bus 740 .

处理器710,用于执行程序732。The processor 710 is configured to execute the program 732 .

具体地,程序732可以包括程序代码,所述程序代码包括计算机操作指令。Specifically, the program 732 may include program codes including computer operation instructions.

处理器710可能是一个中央处理器CPU,或者是特定集成电路ASIC(ApplicationSpecific Integrated Circuit),或者是被配置成实施本申请实施例的一个或多个集成电路。The processor 710 may be a central processing unit CPU, or an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application.

存储器730,用于存放程序732。存储器730可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 730 is used to store a program 732 . The memory 730 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory.

程序732中各模块的具体实现参见图6所示实施例中的相应模块或单元,在此不赘述。For the specific implementation of each module in the program 732, refer to the corresponding modules or units in the embodiment shown in FIG. 6 , which will not be repeated here.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本申请可借助软件加必需的硬件平台的方式来实现,当然也可以全部通过硬件来实施,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案对背景技术做出贡献的全部或者部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例或者实施例的某些部分所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary hardware platforms, and of course all can be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, all or part of the contribution made by the technical solution of the present application to the background technology can be embodied in the form of software products, and the computer software products can be stored in storage media, such as ROM/RAM, magnetic disks, optical disks, etc. , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute the methods described in various embodiments or some parts of the embodiments of the present application.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related part, please refer to the description of the method part.

本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处。综上所述,本说明书内容不应理解为对本申请的限制。In this paper, specific examples are used to illustrate the principles and implementation methods of the application. The descriptions of the above embodiments are only used to help understand the method and core idea of the application; meanwhile, for those of ordinary skill in the art, according to the application Thoughts, there will be changes in specific implementation methods and application ranges. To sum up, the contents of this specification should not be understood as limiting the application.

Claims (12)

1.一种生成测试用例脚本的方法,其特征在于,包括:1. A method for generating test case scripts, comprising: 获取用户输入的单元功能脚本调用操作;Obtain the unit function script call operation input by the user; 将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本包括操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码,所述操作序列数据是由用户对待测应用程序进行测试时所执行的全部操作步骤中的部分连续的操作步骤对应的操作数据构成的,且所述操作序列数据以及单元功能脚本代码分别保存;The unit function script corresponding to the unit function script call operation is assembled into a test case script; wherein, the unit function script includes operation sequence data and unit function script code for calling the operation sequence data unit function script, the The operation sequence data is composed of operation data corresponding to some continuous operation steps in all operation steps performed by the user when testing the application program to be tested, and the operation sequence data and unit function script codes are stored separately; 采用所述测试用例脚本对所述待测应用程序进行测试;Using the test case script to test the application program to be tested; 其中,所述获取用户输入的单元功能脚本调用操作之前,还包括:Wherein, before the unit function script calling operation for obtaining user input, it also includes: 获取用户输入的单元功能脚本录制起始操作;Obtain the unit function script recording start operation input by the user; 录制用户对所述待测应用程序进行测试时所执行的操作步骤;recording the operation steps performed by the user when testing the application program to be tested; 获取用户输入的单元功能脚本录制结束操作;Obtain the unit function script recording end operation input by the user; 得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本;obtaining the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation; 则所述录制用户对所述待测应用程序进行测试时所执行的操作步骤,具体包括:Then the operation steps performed by the recording user when testing the application program to be tested include: 确定所述操作步骤对应的操作对象的特征图像;determining the characteristic image of the operation object corresponding to the operation step; 将所述特征图像的特征图像名和特征图像路径添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,根据所述特征图像名和特征图像路径获取所述特征图像,并基于所述特征图像通过图像识别的方式判断操作体当前所处的图像环境是否与所述特征图像表示的图像环境相匹配。Add the feature image name and feature image path of the feature image to the operation sequence data, so that when the test case script is used to test the application program to be tested, the feature image name and feature image path can be obtained according to the feature image name and feature image path The characteristic image, and judge whether the image environment where the operating body is currently located matches the image environment represented by the characteristic image by means of image recognition based on the characteristic image. 2.根据权利要求1所述的方法,其特征在于,所述确定所述操作步骤对应的操作对象的特征图像,具体包括:2. The method according to claim 1, wherein the determining the characteristic image of the operation object corresponding to the operation step specifically comprises: 获取用户在所述操作对象上截取的图形信息;Acquiring graphic information intercepted by the user on the operation object; 将所述图形信息确定为所述操作步骤对应的操作对象的特征图像。The graphic information is determined as a characteristic image of the operation object corresponding to the operation step. 3.根据权利要求1所述的方法,其特征在于,所述录制用户对所述待测应用程序进行测试时所执行的操作步骤,具体包括:3. The method according to claim 1, wherein the recording of the operation steps performed by the user when testing the application program under test specifically comprises: 获取用户在执行所述操作步骤时输入的文本信息和/或键盘操作信息;Obtain text information and/or keyboard operation information input by the user when performing the operation steps; 将所述文本信息和/或键盘操作信息添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,自动输入所述文本信息和/或键盘操作信息。adding the text information and/or keyboard operation information to the operation sequence data, so that when the test case script is used to test the application program to be tested, the text information and/or keyboard operation information is automatically input information. 4.根据权利要求1所述的方法,其特征在于,所述录制用户对所述待测应用程序进行测试时所执行的操作步骤,具体包括:4. The method according to claim 1, wherein the recording the operation steps performed by the user when testing the application program under test specifically comprises: 获取执行所述操作步骤时置前的窗体的窗体名;Obtain the form name of the form that is brought forward when performing the operation steps; 将所述窗体名添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,基于所述窗体名置前所述窗体。The form name is added to the operation sequence data, so that when the test case script is used to test the application program to be tested, the form is placed in front based on the form name. 5.根据权利要求1所述的方法,其特征在于,所述获取用户输入的单元功能脚本调用操作之后,还包括:5. The method according to claim 1, further comprising: 获取用户基于预设的单元功能脚本列表选择的预设的单元功能脚本;Obtaining a preset unit function script selected by the user based on the list of preset unit function scripts; 添加所述预设的单元功能脚本至所述测试用例脚本中,以实现将所述预设的单元功能脚本拼装成所述测试用例脚本;Adding the preset unit function script to the test case script, so as to assemble the preset unit function script into the test case script; 其中,所述预设的单元功能脚本包括:Wherein, the preset unit function script includes: 用于控制网络管理程序的单元功能脚本;Unit function scripts for controlling network management programs; 和/或,用于控制外部设备的单元功能脚本。And/or, unit function scripts for controlling external devices. 6.根据权利要求1所述的方法,其特征在于,所述得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本之后,还包括:6. The method according to claim 1, wherein after obtaining the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation, further comprising: : 显示所述单元功能脚本中的参数修改接口;Displaying the parameter modification interface in the unit function script; 接收用户通过所述参数修改接口输入的参数修改操作;receiving a parameter modification operation input by the user through the parameter modification interface; 基于所述参数修改操作,修改所述单元功能脚本中的参数。Based on the parameter modification operation, the parameters in the unit function script are modified. 7.一种生成测试用例脚本的装置,其特征在于,包括:7. A device for generating test case scripts, comprising: 调用操作获取单元,用于获取用户输入的单元功能脚本调用操作;The call operation obtaining unit is used to obtain the call operation of the unit function script input by the user; 测试用例脚本拼装单元,用于将所述单元功能脚本调用操作对应的单元功能脚本拼装成测试用例脚本;其中,所述单元功能脚本包括操作序列数据以及用于调用所述操作序列数据单元功能脚本的单元功能脚本代码,所述操作序列数据是由用户对待测应用程序进行测试时所执行的全部操作步骤中的部分连续的操作步骤对应的操作数据构成的,且所述操作序列数据以及单元功能脚本代码分别保存;A test case script assembling unit is used to assemble the unit function script corresponding to the unit function script call operation into a test case script; wherein, the unit function script includes operation sequence data and is used to call the operation sequence data unit function script The unit function script code, the operation sequence data is composed of the operation data corresponding to some continuous operation steps in all the operation steps performed by the user when testing the application program to be tested, and the operation sequence data and the unit function Script codes are saved separately; 测试单元,用于采用所述测试用例脚本对所述待测应用程序进行测试;a test unit, configured to test the application program under test by using the test case script; 所述装置,还包括:The device also includes: 录制起始操作获取单元,用于在获取用户输入的单元功能脚本调用操作之前,获取用户输入的单元功能脚本录制起始操作;The recording start operation acquisition unit is used to obtain the unit function script recording start operation input by the user before obtaining the unit function script call operation input by the user; 操作步骤录制单元,用于录制用户对所述待测应用程序进行测试时所执行的操作步骤;An operation step recording unit, configured to record the operation steps performed by the user when testing the application program to be tested; 录制结束操作获取单元,用于获取用户输入的单元功能脚本录制结束操作;The recording end operation acquisition unit is used to obtain the unit function script recording end operation input by the user; 单元功能脚本获得单元,用于得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本;A unit function script obtaining unit, configured to obtain the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation; 其中,所述操作步骤录制单元,具体用于确定所述操作步骤对应的操作对象的特征图像;Wherein, the operation step recording unit is specifically configured to determine the characteristic image of the operation object corresponding to the operation step; 以及用于将所述特征图像的特征图像名和特征图像路径添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,根据所述特征图像名和特征图像路径获取所述特征图像,并基于所述特征图像通过图像识别的方式判断操作体当前所处的图像环境是否与所述特征图像表示的图像环境相匹配。and adding the feature image name and feature image path of the feature image to the operation sequence data, so that when the test case script is used to test the application program to be tested, according to the feature image name and feature The image path acquires the feature image, and judges whether the current image environment of the operator matches the image environment represented by the feature image through image recognition based on the feature image. 8.根据权利要求7所述的装置,其特征在于,所述操作步骤录制单元确定所述操作步骤对应的操作对象的特征图像,具体包括获取用户在所述操作对象上截取的图形信息;8. The device according to claim 7, wherein the operation step recording unit determines the characteristic image of the operation object corresponding to the operation step, which specifically includes obtaining graphic information intercepted by the user on the operation object; 并将所述图形信息确定为所述操作步骤对应的操作对象的特征图像。And the graphic information is determined as the characteristic image of the operation object corresponding to the operation step. 9.根据权利要求7所述的装置,其特征在于,所述操作步骤录制单元,具体用于获取用户在执行所述操作步骤时输入的文本信息和/或键盘操作信息;9. The device according to claim 7, wherein the operation step recording unit is specifically configured to acquire text information and/or keyboard operation information input by the user when performing the operation step; 以及用于将所述文本信息和/或键盘操作信息添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,自动输入所述文本信息和/或键盘操作信息。and adding the text information and/or keyboard operation information to the operation sequence data, so that when the test case script is used to test the application program to be tested, the text information and/or keyboard operation information are automatically input or keystroke information. 10.根据权利要求7所述的装置,其特征在于,所述操作步骤录制单元,具体用于获取执行所述操作步骤时置前的窗体的窗体名;10. The device according to claim 7, wherein the operation step recording unit is specifically configured to obtain the window name of the front window when performing the operation step; 以及用于将所述窗体名添加在所述操作序列数据中,以便在使用所述测试用例脚本对所述待测应用程序进行测试时,基于所述窗体名置前所述窗体。and adding the form name to the operation sequence data, so that when the test case script is used to test the application program to be tested, the form is placed in front of the form based on the form name. 11.根据权利要求7所述的装置,其特征在于,还包括:11. The device according to claim 7, further comprising: 预设单元功能脚本获取单元,用于在获取用户输入的单元功能脚本调用操作之后,获取用户基于预设的单元功能脚本列表选择的预设的单元功能脚本;The preset unit function script obtaining unit is used to obtain the preset unit function script selected by the user based on the preset unit function script list after obtaining the unit function script call operation input by the user; 预设单元功能脚本添加单元,用于添加所述预设的单元功能脚本至所述测试用例脚本中,以实现将所述预设的单元功能脚本拼装成所述测试用例脚本;A preset unit function script adding unit, configured to add the preset unit function script to the test case script, so as to assemble the preset unit function script into the test case script; 其中,所述预设的单元功能脚本包括:Wherein, the preset unit function script includes: 用于控制网络管理程序的单元功能脚本;Unit function scripts for controlling network management programs; 和/或,用于控制外部设备的单元功能脚本。And/or, unit function scripts for controlling external devices. 12.根据权利要求7所述的装置,其特征在于,还包括:12. The device according to claim 7, further comprising: 参数修改接口显示单元,用于在得到所述用户在所述录制起始操作与所述录制结束操作之间执行的操作步骤所对应的单元功能脚本之后,显示所述单元功能脚本中的参数修改接口;A parameter modification interface display unit, configured to display the parameter modification in the unit function script after obtaining the unit function script corresponding to the operation steps performed by the user between the recording start operation and the recording end operation interface; 参数修改操作接收单元,用于接收用户通过所述参数修改接口输入的参数修改操作;A parameter modification operation receiving unit, configured to receive a parameter modification operation input by a user through the parameter modification interface; 参数修改单元,用于基于所述参数修改操作,修改所述单元功能脚本中的参数。A parameter modification unit, configured to modify parameters in the unit function script based on the parameter modification operation.
CN201410201488.4A 2014-05-13 2014-05-13 A kind of method and device for generating test case script Active CN103984626B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410201488.4A CN103984626B (en) 2014-05-13 2014-05-13 A kind of method and device for generating test case script

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410201488.4A CN103984626B (en) 2014-05-13 2014-05-13 A kind of method and device for generating test case script

Publications (2)

Publication Number Publication Date
CN103984626A CN103984626A (en) 2014-08-13
CN103984626B true CN103984626B (en) 2017-07-28

Family

ID=51276616

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410201488.4A Active CN103984626B (en) 2014-05-13 2014-05-13 A kind of method and device for generating test case script

Country Status (1)

Country Link
CN (1) CN103984626B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106155886B (en) * 2015-03-31 2019-05-14 北京奇虎科技有限公司 A kind of method and apparatus of key mouse script processing
CN106354482A (en) * 2015-07-13 2017-01-25 西安中兴新软件有限责任公司 Method and device for acquiring automated scripts and application method and device of automated scripts
CN106814629B (en) * 2015-11-27 2021-03-12 大唐移动通信设备有限公司 Method and device for controlling smart home
CN105893243A (en) * 2015-12-14 2016-08-24 乐视网信息技术(北京)股份有限公司 Test frame used for test tool, and test tool
CN106201873A (en) * 2016-07-01 2016-12-07 网易(杭州)网络有限公司 The treating method and apparatus of test script
CN107766226B (en) * 2016-08-18 2021-04-09 北京金山云网络技术有限公司 A test method and device
CN106528420B (en) * 2016-11-07 2019-04-05 中国工商银行股份有限公司 A kind of automated testing method and device of software interface
CN108287788A (en) * 2017-12-26 2018-07-17 广东睿江云计算股份有限公司 A kind of use-case step matching method based on test case, system
CN109753437B (en) * 2019-01-11 2024-06-25 平安科技(深圳)有限公司 Test program generation method and device, storage medium and electronic equipment
CN110175112A (en) * 2019-04-17 2019-08-27 武汉思普崚技术有限公司 The method and apparatus of Kernel-based methods management raising version testing efficiency
CN111176994B (en) * 2019-12-24 2023-03-31 北京轩宇信息技术有限公司 Unit test case generation method and device for embedded software IO port
CN114900569B (en) * 2022-05-17 2024-05-03 中国银行股份有限公司 Test script acquisition method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101135989A (en) * 2006-08-31 2008-03-05 中国银联股份有限公司 Method and device for automated testing of a web application system
CN102279798A (en) * 2011-08-30 2011-12-14 中国工商银行股份有限公司 Software testing method and system based on point function driving
CN102355384A (en) * 2011-10-13 2012-02-15 纳龙(苏州)信息技术有限公司 Communication standard of automated testing for monitoring system
CN103713989A (en) * 2012-09-29 2014-04-09 百度在线网络技术(北京)有限公司 Test case generating method and test case generating device for user terminal

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101060372A (en) * 2007-06-26 2007-10-24 华为技术有限公司 A method and system for rapid creating the automation test script
CN101339534B (en) * 2008-06-17 2010-10-13 金蝶软件(中国)有限公司 Software test apparatus and test method
CN103365643B (en) * 2012-03-30 2017-07-21 Ge医疗系统环球技术有限公司 A kind of method and device for the test script for automatically generating graphic user interface

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101135989A (en) * 2006-08-31 2008-03-05 中国银联股份有限公司 Method and device for automated testing of a web application system
CN102279798A (en) * 2011-08-30 2011-12-14 中国工商银行股份有限公司 Software testing method and system based on point function driving
CN102355384A (en) * 2011-10-13 2012-02-15 纳龙(苏州)信息技术有限公司 Communication standard of automated testing for monitoring system
CN103713989A (en) * 2012-09-29 2014-04-09 百度在线网络技术(北京)有限公司 Test case generating method and test case generating device for user terminal

Also Published As

Publication number Publication date
CN103984626A (en) 2014-08-13

Similar Documents

Publication Publication Date Title
CN103984626B (en) A kind of method and device for generating test case script
US9959198B1 (en) Simulated testing of API
US11074162B2 (en) System and a method for automated script generation for application testing
US11714625B2 (en) Generating applications for versatile platform deployment
CN112463467A (en) Automated integrated test system and method thereof
CN108111364B (en) Service system testing method and device
CN111045653B (en) System generation method and device, computer readable medium and electronic equipment
CN112214405B (en) Software testing method and device, electronic equipment and readable storage medium
CN105630674A (en) Test method and device capable of aiming at interface
CN109992496A (en) A data processing method and device for automated testing
US8984487B2 (en) Resource tracker
WO2017020459A1 (en) Method and apparatus for configuring plugin package for host
US9965379B1 (en) Cross-platform API test flow synthesizer
CN111061522A (en) Method, device, equipment and storage medium for generating front-end card assembly based on back end
CN113986263A (en) Code automation testing method, device, electronic device, storage medium
Demmel et al. Data synthesis is going mobile—on community-driven dataset generation for android devices
CN109376085B (en) Test case generation method and device and computer readable storage medium
CN116955193A (en) Interface testing method, device, equipment and storage medium
CN115640220A (en) Test method, device, electronic device and computer-readable storage medium
CN114490330A (en) Method and device for generating test case
CN114860576B (en) A testing method, device, electronic equipment and storage medium
CN117130946B (en) A test scenario generation method, device, electronic device and readable storage medium
CN115328797B (en) Method, system, equipment, medium and software testing method for generating testing parameters
CN115994082A (en) Automatic testing method, device, equipment and medium for Flutter component
CN116643755A (en) Code generation method, code generation device, visualization platform and electronic equipment

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant