CN117453561A - Test script calling method, device, computer equipment and storage medium - Google Patents

Test script calling method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN117453561A
CN117453561A CN202311496140.8A CN202311496140A CN117453561A CN 117453561 A CN117453561 A CN 117453561A CN 202311496140 A CN202311496140 A CN 202311496140A CN 117453561 A CN117453561 A CN 117453561A
Authority
CN
China
Prior art keywords
test
script
target
event
target event
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.)
Pending
Application number
CN202311496140.8A
Other languages
Chinese (zh)
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.)
Southern Power Grid Digital Grid Research Institute Co Ltd
Original Assignee
Southern Power Grid Digital Grid Research Institute 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 Southern Power Grid Digital Grid Research Institute Co Ltd filed Critical Southern Power Grid Digital Grid Research Institute Co Ltd
Priority to CN202311496140.8A priority Critical patent/CN117453561A/en
Publication of CN117453561A publication Critical patent/CN117453561A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请涉及一种测试用例的测试方法、装置、计算机设备和存储介质。在存在测试请求时,响应于测试用例的测试请求,在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;并根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本;并运行目标测试脚本,以对测试用例进行测试。通过将对测试用例进行验证的验证规则编码成对应的事件脚本,并在对测试用例的验证规则发生变更的情况下,通过确定与新验证规则对应的事件脚本,并和通用测试脚本确定目标测试脚本,相比于现有技术中硬编码方式,在验证规则发生变更时,无需重复修改程序代码,进而提高了测试用例的测试效率。

The present application relates to a test method, device, computer equipment and storage medium for test cases. When a test request exists, in response to the test request of the test case, if it is determined that the verification rule of the test case has changed according to the test request, select a target event that matches the new verification rule after the change from the candidate event script script; and determine the target test script based on the general test script and target event script of the test case; and run the target test script to test the test case. By encoding the verification rules for verifying test cases into corresponding event scripts, and when the verification rules for test cases change, by determining the event script corresponding to the new verification rules, and determining the target test with the general test script Compared with the hard-coding method in the existing technology, the script does not need to repeatedly modify the program code when the verification rules are changed, thereby improving the testing efficiency of the test cases.

Description

测试脚本调用方法、装置、计算机设备和存储介质Test script calls methods, devices, computer equipment and storage media

技术领域Technical field

本申请涉及计算机技术领域,特别是涉及一种测试脚本调用方法、装置、计算机设备和存储介质。The present application relates to the field of computer technology, and in particular to a test script calling method, device, computer equipment and storage medium.

背景技术Background technique

测试用例是一种用于测试软件应用程序或系统功能的详细规范性文件。它包含了一组步骤、输入数据、预期结果以及可能的前提条件和后置条件,以验证特定功能是否按照要求正常运行。通常情况下,在设计了测试用例之后,由测试人员根据测试用例中描述的过程逐步执行测试,得到实际结果,并将实际结果与预期结果进行比较。为了提高测试效率,可以通过硬编码方式,实现不同测试用例自动测试。A test case is a detailed normative document used to test the functionality of a software application or system. It consists of a set of steps, input data, expected results, and possible pre- and post-conditions to verify that a specific functionality works as required. Normally, after a test case is designed, the tester performs the test step by step according to the process described in the test case, obtains the actual results, and compares the actual results with the expected results. In order to improve testing efficiency, automatic testing of different test cases can be implemented through hard coding.

然而,不同设备、不同测试用例的验证规则要求不一致,硬编码开发复杂,工作量大,当测试用例验证规则变更时,需重复修改程序代码,使得测试用例测试效率低下。However, the verification rule requirements for different devices and different test cases are inconsistent, hard-coded development is complex, and the workload is large. When the test case verification rules change, the program code needs to be modified repeatedly, making the test case testing inefficient.

发明内容Contents of the invention

基于此,有必要针对上述技术问题,提供一种测试用例的测试方法、装置、计算机设备和存储介质,能够提高测试用例的测试效率。Based on this, it is necessary to provide a test case testing method, device, computer equipment and storage medium to address the above technical problems, which can improve the testing efficiency of test cases.

第一方面,本申请提供了一种测试用例的测试方法,所述方法包括:In the first aspect, this application provides a test case testing method, which method includes:

响应于测试用例的测试请求,在根据所述测试请求,确定对所述测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;In response to the test request of the test case, if it is determined that the verification rule of the test case has been changed according to the test request, selecting a target event script that matches the changed new verification rule from the candidate event scripts;

根据所述测试用例的通用测试脚本和所述目标事件脚本,确定目标测试脚本;Determine a target test script according to the general test script of the test case and the target event script;

运行所述目标测试脚本,以对所述测试用例进行测试。Run the target test script to test the test case.

在其中一个实施例中,所述根据所述测试请求,确定对所述测试用例的验证规则发生变更,包括:In one embodiment, determining that the verification rules of the test case have changed based on the test request includes:

从所述测试请求中提取目标测试需求;Extract target test requirements from the test request;

若所述目标测试需求,与所述测试用例的原始测试需求不一致,则确定对所述测试用例的验证规则发生变更。If the target test requirement is inconsistent with the original test requirement of the test case, it is determined that the verification rule for the test case has been changed.

在其中一个实施例中,所述从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本,包括:In one embodiment, selecting a target event script that matches the changed new verification rule from the candidate event scripts includes:

根据所述目标测试需求,构建目标事件;其中,所述目标事件包括目标事件标识和变更后的新验证规则;Construct a target event according to the target test requirements; wherein the target event includes a target event identifier and a changed new verification rule;

基于候选事件标识与候选事件脚本之间的对应关系,根据所述目标事件标识,确定所述候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。Based on the correspondence between the candidate event identifier and the candidate event script, a target event script in the candidate event script that matches the changed new verification rule is determined according to the target event identifier.

在其中一个实施例中,所述从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本,包括:In one embodiment, selecting a target event script that matches the changed new verification rule from the candidate event scripts includes:

若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则向测试需求端展示脚本生成界面;If there is no target event script matching the changed new verification rules among the candidate event scripts, the script generation interface will be displayed to the test demand side;

根据所述测试需求端作用于所述脚本生成界面上的输入操作,生成与所述新验证规则相匹配的目标事件脚本。Generate a target event script matching the new verification rule according to the input operation performed by the test demand side on the script generation interface.

在其中一个实施例中,所述从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本,包括:In one embodiment, selecting a target event script that matches the changed new verification rule from the candidate event scripts includes:

若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则根据所述测试请求中的目标测试需求,对通用事件脚本进行更新,得到与所述新验证规则相匹配的目标事件脚本。If there is no target event script in the candidate event script that matches the new verification rule after the change, the general event script is updated according to the target test requirements in the test request to obtain the event script that matches the new verification rule. Target event script.

在其中一个实施例中,在所述新验证规则的数量为至少两个的情况下,所述方法还包括:In one embodiment, when the number of new verification rules is at least two, the method further includes:

根据各新验证规则对应的目标事件脚本之间的执行顺序,对所述测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果。According to the execution sequence between the target event scripts corresponding to each new verification rule, the test results of the test cases are summarized, and the summarized test results are displayed to the test demand side.

第二方面,本申请还提供了一种测试用例的测试装置,所述装置包括:In a second aspect, this application also provides a test device for test cases, and the device includes:

选择模块,用于响应于测试用例的测试请求,在根据所述测试请求,确定对所述测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;a selection module, configured to respond to a test request of the test case, and select a new verification rule from the candidate event script that matches the changed new verification rule when it is determined according to the test request that the verification rule of the test case has changed. target event script;

确定模块,用于根据所述测试用例的通用测试脚本和所述目标事件脚本,确定目标测试脚本;A determination module, configured to determine a target test script based on the general test script of the test case and the target event script;

运行模块,用于运行所述目标测试脚本,以对所述测试用例进行测试。A running module is used to run the target test script to test the test case.

第三方面,本申请还提供了一种计算机设备,所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:In a third aspect, this application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, it implements the following steps:

响应于测试用例的测试请求,在根据所述测试请求,确定对所述测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;In response to the test request of the test case, if it is determined that the verification rule of the test case has been changed according to the test request, selecting a target event script that matches the changed new verification rule from the candidate event scripts;

根据所述测试用例的通用测试脚本和所述目标事件脚本,确定目标测试脚本;Determine a target test script according to the general test script of the test case and the target event script;

运行所述目标测试脚本,以对所述测试用例进行测试。Run the target test script to test the test case.

第四方面,本申请还提供了一种计算机可读存储介质,所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium has a computer program stored thereon. When the computer program is executed by a processor, the following steps are implemented:

响应于测试用例的测试请求,在根据所述测试请求,确定对所述测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;In response to the test request of the test case, if it is determined that the verification rule of the test case has been changed according to the test request, selecting a target event script that matches the changed new verification rule from the candidate event scripts;

根据所述测试用例的通用测试脚本和所述目标事件脚本,确定目标测试脚本;Determine a target test script according to the general test script of the test case and the target event script;

运行所述目标测试脚本,以对所述测试用例进行测试。Run the target test script to test the test case.

第五方面,本申请还提供了一种计算机程序产品,所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:In a fifth aspect, this application also provides a computer program product. The computer program product includes a computer program. When the computer program is executed by a processor, the following steps are implemented:

响应于测试用例的测试请求,在根据所述测试请求,确定对所述测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;In response to the test request of the test case, if it is determined that the verification rule of the test case has been changed according to the test request, selecting a target event script that matches the changed new verification rule from the candidate event scripts;

根据所述测试用例的通用测试脚本和所述目标事件脚本,确定目标测试脚本;Determine a target test script according to the general test script of the test case and the target event script;

运行所述目标测试脚本,以对所述测试用例进行测试。Run the target test script to test the test case.

上述测试用例的测试方法、装置、计算机设备和存储介质,在存在测试请求时,响应于测试用例的测试请求,在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;并根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本;进而运行目标测试脚本,以对测试用例进行测试。通过将对测试用例进行验证的验证规则编码成对应的事件脚本,并在对测试用例的验证规则发生变更的情况下,通过确定与新验证规则对应的事件脚本,并和通用测试脚本确定目标测试脚本,相比于现有技术中硬编码方式,在验证规则发生变更时,无需重复修改程序代码,进而提高了测试用例的测试效率。The test method, device, computer equipment and storage medium of the above-mentioned test case, when there is a test request, respond to the test request of the test case, and when it is determined that the verification rules of the test case are changed according to the test request, from the candidate event Select the target event script in the script that matches the changed new verification rule; determine the target test script based on the general test script and target event script of the test case; and then run the target test script to test the test case. By encoding the verification rules for verifying test cases into corresponding event scripts, and when the verification rules for test cases change, by determining the event script corresponding to the new verification rules, and determining the target test with the general test script Compared with the hard-coding method in the existing technology, the script does not need to repeatedly modify the program code when the verification rules are changed, thereby improving the testing efficiency of the test cases.

附图说明Description of the drawings

图1为一个实施例中测试用例的测试方法的应用环境图;Figure 1 is an application environment diagram of the test method of the test case in an embodiment;

图2为一个实施例中测试用例的测试方法的流程示意图;Figure 2 is a schematic flow chart of a test method for test cases in an embodiment;

图3为一个实施例中确定与新验证规则相匹配的目标事件脚本的方法流程示意图;Figure 3 is a schematic flowchart of a method for determining a target event script that matches a new verification rule in one embodiment;

图4为一个实施例中生成目标事件脚本的方法流程示意图;Figure 4 is a schematic flowchart of a method for generating a target event script in one embodiment;

图5为另一个实施例中测试用例的测试方法的流程示意图;Figure 5 is a schematic flow chart of a test method for test cases in another embodiment;

图6为一个实施例中测试用例的测试装置的结构框图;Figure 6 is a structural block diagram of a test device for a test case in an embodiment;

图7为另一个实施例中测试用例的测试装置的结构框图;Figure 7 is a structural block diagram of a test device for a test case in another embodiment;

图8为一个实施例中计算机设备的内部结构图。Figure 8 is an internal structure diagram of a computer device in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.

本申请实施例提供的测试用例的测试方法,可以适用于对测试用例进行测试的场景。例如,图1是本申请实施例中提供的一种测试用例的测试方法的应用环境图。其中,终端102通过网络与服务器104进行通信。例如,终端102向服务器104发送测试用例的测试请求,服务器104响应于测试用例的测试请求,生成目标测试脚本,并对测试用例进行测试,并向终端102返回测试结果。数据存储系统可以存储服务器104需要处理的数据。数据存储系统可以集成在服务器104上,也可以放在云上或其他网络服务器上。The test case testing method provided by the embodiment of this application can be applied to the scenario of testing the test case. For example, FIG. 1 is an application environment diagram of a test method for test cases provided in the embodiment of the present application. Among them, the terminal 102 communicates with the server 104 through the network. For example, the terminal 102 sends a test request of a test case to the server 104. The server 104 responds to the test request of the test case, generates a target test script, tests the test case, and returns the test results to the terminal 102. The data storage system may store data that server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers.

其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能音箱、智能电视、智能空调、智能车载设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。服务器104可以包括测试系统功能模块和脚本测试功能模块,测试系统功能模块用于管理通用测试平台,例如用于测试用例加量控制(测试用例数据的改变),用户管理(测试人员的登录验证)、测试用例管理(增加测试用例或者修改测试用例等)、测试用例编辑、测试结果传送至终端102等;脚本测试功能模块用于调用相应的测试脚本,并对测试用例进行测试,并将测试结果传送至测试系统。Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. . Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented as an independent server or a server cluster composed of multiple servers. The server 104 may include a test system function module and a script test function module. The test system function module is used to manage a general test platform, for example, for test case addition control (change of test case data), user management (tester login verification) , test case management (adding test cases or modifying test cases, etc.), test case editing, transmitting test results to the terminal 102, etc.; the script test function module is used to call the corresponding test script, test the test cases, and send the test results Sent to test system.

在一个实施例中,如图2所示,提供了一种测试用例的测试方法,以该方法应用于图1中的服务器104为例进行说明,包括以下步骤:In one embodiment, as shown in Figure 2, a test case testing method is provided. This method is explained by taking the method applied to the server 104 in Figure 1 as an example, and includes the following steps:

S201,响应于测试用例的测试请求,在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本。S201. In response to the test request of the test case, if it is determined that the verification rule of the test case has changed according to the test request, select a target event script that matches the new verification rule after the change from the candidate event scripts.

可选的,测试用例可以为用于测试软件应用程序或系统功能的详细规范性文件,其包含了一组步骤、输入数据、预期结果以及可能的前提条件和后置条件,以验证特定功能是否按照要求正常运行。当测试需求端有测试需求时,会发起一个测试用例测试请求。验证规则可以理解为对测试用例涉及的数据的验证规则,以判断测试用例涉及的数据时候满足要求。例如,测试用例为测试数据采集通道1的数据采集精度,验证规则可以为验证数据通道1采集的数据与预期数据的差值是否在预设范围内。目标事件脚本可以理解为与新验证规则对应的脚本文件。Optionally, a test case can be a detailed normative document used to test a software application or system function, which contains a set of steps, input data, expected results, and possible preconditions and postconditions to verify whether a specific function Operate normally as required. When there is a test requirement on the test demand side, a test case test request will be initiated. Verification rules can be understood as verification rules for the data involved in the test case to determine when the data involved in the test case meets the requirements. For example, the test case is to test the data collection accuracy of data collection channel 1, and the verification rule can be to verify whether the difference between the data collected by data collection channel 1 and the expected data is within the preset range. The target event script can be understood as the script file corresponding to the new validation rule.

服务器104接收测试请求,并响应于测试用例的测试请求,可以首先根据测试请求判断对测试用例的验证规则是否发生变化。在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本。应理解,可以将各个验证规则对应的事件脚本提前编辑完成,并将各个事件脚本与各个验证规则建立一一对应关系,并生成候选事件脚本。这样,就可以在对测试用例的验证规则发生变更的情况下,根据测试规则与事件脚本的对应关系,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本。The server 104 receives the test request, and in response to the test request of the test case, may first determine whether the verification rules for the test case have changed according to the test request. When it is determined that the verification rules of the test case are changed according to the test request, a target event script that matches the new verification rule after the change is selected from the candidate event scripts. It should be understood that the event script corresponding to each verification rule can be edited in advance, a one-to-one correspondence between each event script and each verification rule can be established, and a candidate event script can be generated. In this way, when the verification rules of the test case are changed, the target event script that matches the changed new verification rules can be selected from the candidate event scripts based on the correspondence between the test rules and the event scripts.

可选的,根据所述测试请求,确定对测试用例的验证规则是否发生变更,具体可通过以下方式实现:Optionally, according to the test request, determine whether the verification rules of the test case have changed. This can be achieved in the following ways:

首先从测试请求中提取目标测试需求;其中,目标测试需求可以包括对测试测试用例进行测试的测试数据、获取测试数据的方式和验证测试数据的规则等信息。然后判断目标测试需求与测试用例的原始测试需求是否一致。若目标测试需求,与测试用例的原始测试需求不一致,则确定对测试用例的验证规则发生变更。First, target test requirements are extracted from the test request; among them, the target test requirements can include information such as test data for testing test cases, methods of obtaining test data, and rules for verifying test data. Then determine whether the target test requirements are consistent with the original test requirements of the test case. If the target test requirements are inconsistent with the original test requirements of the test case, it is determined that the verification rules of the test case have been changed.

S202,根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本。S202: Determine the target test script according to the general test script and the target event script of the test case.

可选的,通用测试脚本可以理解为进行测试用例测试的通用脚本文件,即测试各个测试用例都需要用到的测试脚本。目标事件脚本即为与新验证规则对应的脚本文件。目标测试脚本可以理解为用于测试测试用例的脚本文件。可以调用测试用例的通用测试脚本和目标事件脚本,以确定出目标测试脚本。Optionally, a universal test script can be understood as a universal script file for testing test cases, that is, a test script that is needed to test each test case. The target event script is the script file corresponding to the new validation rule. The target test script can be understood as a script file used to test test cases. The test case's general test script and target event script can be called to determine the target test script.

S203,运行目标测试脚本,以对测试用例进行测试。S203: Run the target test script to test the test case.

当确定了用于测试测试脚本的目标测试脚本后,运行目标测试脚本,以完成对测试用例的测试,例如输出最终的测试结果。After determining the target test script for testing the test script, run the target test script to complete the test of the test case, such as outputting the final test results.

上述测试用例的测试方法,在存在测试请求时,响应于测试用例的测试请求,在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;并根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本;进而运行目标测试脚本,以对测试用例进行测试。通过将对测试用例进行验证的验证规则编码成对应的事件脚本,并在对测试用例的验证规则发生变更的情况下,通过确定与新验证规则对应的事件脚本,并和通用测试脚本确定目标测试脚本,相比于现有技术中硬编码方式,在验证规则发生变更时,无需重复修改程序代码,进而提高了测试用例的测试效率。The test method of the above test case, when there is a test request, responds to the test request of the test case, and when it is determined that the verification rules of the test case have been changed according to the test request, select a new one after the change from the candidate event script. Verify the target event script that matches the rule; determine the target test script based on the general test script and the target event script of the test case; and then run the target test script to test the test case. By encoding the verification rules for verifying test cases into corresponding event scripts, and when the verification rules for test cases change, by determining the event script corresponding to the new verification rules, and determining the target test with the general test script Compared with the hard-coding method in the existing technology, the script does not need to repeatedly modify the program code when the verification rules are changed, thereby improving the testing efficiency of the test cases.

在一个实施例中,参见图3,图3提供了一种确定与新验证规则相匹配的目标事件脚本的方法流程示意图,具体包括以下步骤:In one embodiment, see Figure 3, which provides a schematic flowchart of a method for determining a target event script that matches a new verification rule, which specifically includes the following steps:

S301,根据目标测试需求,构建目标事件。S301: Construct a target event according to the target test requirements.

可选的,当存在目标测试需求时,可以根据目标测试需求构建目标事件,其中,目标事件包括目标事件标识和变更后的新验证规则。例如目标事件为测试数据采集通道1的采集数据的精确度。目标事件标识可以为事件名称和事件创建事件;变更后的新验证规则可以为验证数据采集通道1的采集数据与预期数据的相对差值是否在10%以内。Optionally, when there is a target test requirement, a target event can be constructed according to the target test requirement, where the target event includes the target event identifier and the changed new verification rule. For example, the target event is to test the accuracy of the collected data of data collection channel 1. The target event identifier can create an event for the event name and event; the new verification rule after the change can be used to verify whether the relative difference between the collected data of data collection channel 1 and the expected data is within 10%.

S302,基于候选事件标识与候选事件脚本之间的对应关系,根据目标事件标识,确定候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。S302: Based on the correspondence between the candidate event identifier and the candidate event script, determine the target event script in the candidate event script that matches the changed new verification rule according to the target event identifier.

可选的,可以根据目标事件预先生成对应的目标事件脚本,并根据目标事件标识与目标事件建立对应关系,然后与其他事件脚本一同放入候选事件脚本中。这样,就可以基于候选事件标识与候选事件脚本之间的对应关系,根据目标事件标识,确定候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。Optionally, a corresponding target event script can be generated in advance according to the target event, and a corresponding relationship is established with the target event according to the target event identifier, and then placed into the candidate event script together with other event scripts. In this way, based on the corresponding relationship between the candidate event identifier and the candidate event script, the target event script in the candidate event script that matches the changed new verification rule can be determined according to the target event identifier.

本申请实施例中,通过目标事件标识,能够快速地确定出候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本,以实现提高测试用例的测试效率。In the embodiment of the present application, through the target event identifier, the target event script in the candidate event script that matches the changed new verification rule can be quickly determined, so as to improve the testing efficiency of the test case.

可选地,候选事件脚本中可能不存在与变更后的新验证规则相匹配的目标事件脚本,此时可以生成目标事件脚本,以对测试用例进行测试。在一个实施例中,参见图4,图4提供了一种生成目标事件脚本的方法流程示意图。具体包括以下步骤:Optionally, the target event script that matches the changed new verification rule may not exist in the candidate event scripts. In this case, the target event script can be generated to test the test case. In one embodiment, see Figure 4, which provides a schematic flowchart of a method for generating a target event script. Specifically, it includes the following steps:

S401,若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则向测试需求端展示脚本生成界面。S401. If there is no target event script matching the changed new verification rule in the candidate event script, display the script generation interface to the test demand side.

可选的,若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则向测试需求端展示脚本生成界面。其中,脚本生成界面中可以包括与目标事件脚本相类似的事件脚本,以供用户通过测试需求端对事件脚本进行修改,以生成目标事件脚本。Optionally, if there is no target event script matching the new verification rule after the change among the candidate event scripts, the script generation interface is displayed to the test demand side. The script generation interface may include an event script similar to the target event script, so that the user can modify the event script through the test demand side to generate the target event script.

S402,根据测试需求端作用于脚本生成界面上的输入操作,生成与新验证规则相匹配的目标事件脚本。S402: Generate a target event script that matches the new verification rule according to the input operation on the script generation interface performed by the test demand side.

用户可以通过测试需求端对脚本生成界面进行操作,例如,对脚本生成界面中的相类似的脚本文件进行修改操作,服务器104可以根据测试需求端作用于脚本生成界面上的输入操作,生成与新验证规则相匹配的目标事件脚本。The user can operate the script generation interface through the test demand side, for example, modify a similar script file in the script generation interface. The server 104 can generate a new script based on the input operation on the script generation interface by the test demand side. Validation rules match the target event script.

本申请实施例中,在候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本的情况下,向测试需求端展示脚本生成界面,以供测试需求端对应的用户对脚本生成界面进行操作,以生成目标事件脚本。无需大量修改脚本文件,提高了生成目标事件脚本的效率。In the embodiment of this application, when there is no target event script matching the changed new verification rule in the candidate event script, the script generation interface is displayed to the test demand side so that the corresponding user of the test demand side can generate the script. interface to generate target event scripts. There is no need to modify a large number of script files, which improves the efficiency of generating target event scripts.

进一步地,在候选事件脚本中可能不存在与变更后的新验证规则相匹配的目标事件脚本的情况下,还可以自动生成目标事件脚本,以对测试用例进行测试。可选的,若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则可以根据测试请求中的目标测试需求,对通用事件脚本进行更新,得到与新验证规则相匹配的目标事件脚本。其中,通用事件脚本本质是一种事件脚本模板。Furthermore, in the case that the target event script that matches the changed new verification rule may not exist in the candidate event script, the target event script can also be automatically generated to test the test case. Optionally, if there is no target event script in the candidate event script that matches the new verification rule after the change, the general event script can be updated according to the target test requirements in the test request to obtain a script that matches the new verification rule. target event script. Among them, the universal event script is essentially an event script template.

例如,可以提取目标测试需求中的关键字段,并将关键字段填入通用事件脚本的对应位置,以得到与新验证规则相匹配的目标事件脚本。For example, you can extract key fields in the target test requirements and fill in the key fields into the corresponding positions of the universal event script to obtain a target event script that matches the new validation rules.

本申请实施例中,通过根据测试请求中的目标测试需求,对通用事件脚本进行更新,可以自动生成与新验证规则相匹配的目标事件脚本,进而提高了生成目标事件脚本的效率。In the embodiment of this application, by updating the general event script according to the target test requirements in the test request, the target event script that matches the new verification rule can be automatically generated, thereby improving the efficiency of generating the target event script.

可选的,当测试需求端发起测试用例的不同测试请求时,可以从不同测试请求中提取不同的目标测试需求,并根据目标测试需求生成不同的目标事件。当目标事件为多个时,可以将目标事件放在事件队列中,根据事件队列中事件的排列顺序,依次根据目标事件标识,确定候选事件脚本中与目标事件中包括的验证规则相匹配的目标事件脚本,并运行通用测试脚本和目标事件脚本,直至事件队列中不存在未处理的目标事件,运行停止指令的脚本,即完成对测试用例的测试。Optionally, when the test demand side initiates different test requests for test cases, different target test requirements can be extracted from the different test requests, and different target events can be generated according to the target test requirements. When there are multiple target events, the target events can be placed in the event queue. According to the order of the events in the event queue, and based on the target event identification, the target in the candidate event script that matches the verification rule included in the target event is determined. event script, and run the general test script and the target event script until there are no unprocessed target events in the event queue, and run the script of the stop command to complete the test of the test case.

在一个实施例中,在新验证规则的数量为至少两个的情况下,还可以根据各新验证规则对应的目标事件的顺序,生成对应的测试结果,并进行展示。具体实现过程如下:In one embodiment, when the number of new verification rules is at least two, corresponding test results can also be generated and displayed according to the sequence of target events corresponding to each new verification rule. The specific implementation process is as follows:

可选的,根据各新验证规则对应的目标事件脚本之间的执行顺序,对测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果。其中,测试结果可以包括测试数据、验证规则和测试结果等。Optionally, summarize the test results of the test cases according to the execution order between the target event scripts corresponding to each new verification rule, and display the summarized test results to the test demand side. Among them, the test results can include test data, verification rules, test results, etc.

本申请实施例中,通过将测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果,方便测试需求端的用户进行查看。In the embodiment of this application, the test results of the test cases are summarized and the summarized test results are displayed to the test demand side to facilitate viewing by users of the test demand side.

在一个实施例中,参见图5,图5提供了另一种测试用例的测试方法的方法流程示意图,具体包括以下步骤:In one embodiment, referring to Figure 5, Figure 5 provides a schematic method flow diagram of another test case testing method, which specifically includes the following steps:

S501,响应于测试用例的测试请求,从测试请求中提取目标测试需求。S501: In response to the test request of the test case, extract the target test requirements from the test request.

可选的,服务器104接收测试请求,并响应于测试用例的测试请求,可以从测试请求中提取目标测试需求。其中,目标测试需求可以包括对测试测试用例进行测试的测试数据、获取测试数据的方式和验证测试数据的规则等信息。Optionally, the server 104 receives the test request, and in response to the test request of the test case, can extract the target test requirements from the test request. Among them, the target test requirements may include information such as test data for testing test cases, methods of obtaining test data, and rules for verifying test data.

S502,判断目标测试需求与测试用例的原始测试需求是否一致。若不一致则确定对测试用例的验证规则发生变更,此时执行步骤S503;若一致,则确定对测试用例的验证规则未发生变更,此时执行步骤S506。S502: Determine whether the target test requirements are consistent with the original test requirements of the test case. If they are inconsistent, it is determined that the verification rules for the test case have been changed, and step S503 is executed at this time; if they are consistent, it is determined that the verification rules for the test case have not been changed, and step S506 is executed at this time.

S503,根据目标测试需求,构建目标事件。S503: Construct the target event according to the target test requirements.

可选的,当存在目标测试需求时,可以根据目标测试需求构建目标事件,其中,目标事件包括目标事件标识和变更后的新验证规则。例如目标事件为测试数据采集通道1的采集数据的精确度。目标事件标识可以为事件名称和事件创建事件;变更后的新验证规则可以为验证数据采集通道1的采集数据与预期数据的相对差值是否在10%以内。Optionally, when there is a target test requirement, a target event can be constructed according to the target test requirement, where the target event includes the target event identifier and the changed new verification rule. For example, the target event is to test the accuracy of the collected data of data collection channel 1. The target event identifier can create an event for the event name and event; the new verification rule after the change can be used to verify whether the relative difference between the collected data of data collection channel 1 and the expected data is within 10%.

S504,基于候选事件标识与候选事件脚本之间的对应关系,根据目标事件标识,确定候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。S504: Based on the correspondence between the candidate event identifier and the candidate event script, determine the target event script in the candidate event script that matches the changed new verification rule according to the target event identifier.

可选的,可以根据目标事件预先生成对应的目标事件脚本,并根据目标事件标识与目标事件建立对应关系,然后与其他事件脚本一同放入候选事件脚本中。这样,就可以基于候选事件标识与候选事件脚本之间的对应关系,根据目标事件标识,确定候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。Optionally, a corresponding target event script can be generated in advance according to the target event, and a corresponding relationship is established with the target event according to the target event identifier, and then placed into the candidate event script together with other event scripts. In this way, based on the corresponding relationship between the candidate event identifier and the candidate event script, the target event script in the candidate event script that matches the changed new verification rule can be determined according to the target event identifier.

若候选事件脚本中可能不存在与变更后的新验证规则相匹配的目标事件脚本,此时可以生成目标事件脚本,以对测试用例进行测试。If the candidate event script may not contain a target event script that matches the new verification rule after the change, the target event script can be generated to test the test case.

具体的,若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则向测试需求端展示脚本生成界面。其中,脚本生成界面中可以包括与目标事件脚本相类似的事件脚本,以供用户通过测试需求端对事件脚本进行修改,以生成目标事件脚本。Specifically, if there is no target event script matching the new verification rule after the change among the candidate event scripts, the script generation interface is displayed to the test demand side. The script generation interface may include an event script similar to the target event script, so that the user can modify the event script through the test demand side to generate the target event script.

用户可以通过测试需求端对脚本生成界面进行操作,例如,对脚本生成界面中的相类似的脚本文件进行修改操作,服务器104可以根据测试需求端作用于脚本生成界面上的输入操作,生成与新验证规则相匹配的目标事件脚本。The user can operate the script generation interface through the test demand side, for example, modify a similar script file in the script generation interface. The server 104 can generate a new script based on the input operation on the script generation interface by the test demand side. Validation rules match the target event script.

进一步地,若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,还可以根据测试请求中的目标测试需求,对通用事件脚本进行更新,得到与新验证规则相匹配的目标事件脚本。例如,可以提取目标测试需求中的关键字段,并将关键字段填入通用事件脚本的对应位置,以得到与新验证规则相匹配的目标事件脚本。Furthermore, if there is no target event script matching the changed new verification rules in the candidate event scripts, the general event script can also be updated according to the target test requirements in the test request to obtain a target event script that matches the new verification rules. Target event script. For example, you can extract key fields in the target test requirements and fill in the key fields into the corresponding positions of the universal event script to obtain a target event script that matches the new validation rules.

S505,根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本。S505: Determine the target test script according to the general test script and the target event script of the test case.

可选的,通用测试脚本可以理解为进行测试用例测试的通用脚本文件,即测试各个测试用例都需要用到的测试脚本。目标事件脚本即为与新验证规则对应的脚本文件。目标测试脚本可以理解为用于测试测试用例的脚本文件。可以调用测试用例的通用测试脚本和目标事件脚本,以确定出目标测试脚本。Optionally, a universal test script can be understood as a universal script file for testing test cases, that is, a test script that is needed to test each test case. The target event script is the script file corresponding to the new validation rule. The target test script can be understood as a script file used to test test cases. The test case's general test script and target event script can be called to determine the target test script.

S506,将原始测试需求对应的测试脚本,作为目标测试脚本。S506: Use the test script corresponding to the original test requirement as the target test script.

其中,原始测试需求对应的测试脚本包括测试用例的通用测试脚本和基于原始测试需求所确定的事件脚本。Among them, the test scripts corresponding to the original test requirements include general test scripts for test cases and event scripts determined based on the original test requirements.

S507,运行目标测试脚本,以对测试用例进行测试。S507: Run the target test script to test the test case.

当确定了用于测试测试脚本的目标测试脚本后,运行目标测试脚本,以完成对测试用例的测试,例如输出最终的测试结果。After determining the target test script for testing the test script, run the target test script to complete the test of the test case, such as outputting the final test results.

S508,对测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果。S508: Summarize the test results of the test cases and display the summarized test results to the test demand side.

可选的,根据各新验证规则对应的目标事件脚本之间的执行顺序,对测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果。其中,测试结果可以包括测试数据、验证规则和测试结果等。Optionally, summarize the test results of the test cases according to the execution order between the target event scripts corresponding to each new verification rule, and display the summarized test results to the test demand side. Among them, the test results can include test data, verification rules, test results, etc.

上述S501至S508的具体过程可以参见上述方法实施例的描述,其实现原理和技术效果类似,在此不再赘述。For the specific processes from S501 to S508, please refer to the description of the above method embodiment. The implementation principles and technical effects are similar and will not be described again here.

应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flowcharts involved in the above-mentioned embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flowcharts involved in the above embodiments may include multiple steps or stages. These steps or stages are not necessarily executed at the same time, but may be completed at different times. The execution order of these steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的测试用例的测试方法的测试用例的测试装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个测试用例的测试装置实施例中的具体限定可以参见上文中对于测试用例的测试方法的限定,在此不再赘述。Based on the same inventive concept, embodiments of the present application also provide a test case test device for implementing the above-mentioned test case test method. The solution to the problem provided by this device is similar to the solution recorded in the above method. Therefore, the specific limitations in the test device embodiments of one or more test cases provided below can be found in the above test case test. The limitations of the method will not be repeated here.

在一个实施例中,如图6所示,提供了一种测试用例的测试装置的结构框图,包括:In one embodiment, as shown in Figure 6, a structural block diagram of a test device for a test case is provided, including:

选择模块10,用于响应于测试用例的测试请求,在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;The selection module 10 is configured to respond to the test request of the test case and select a target event from the candidate event script that matches the changed new verification rule when it is determined that the verification rule of the test case has been changed according to the test request. script;

确定模块20,用于根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本;The determination module 20 is used to determine the target test script according to the general test script and the target event script of the test case;

运行模块30,用于运行目标测试脚本,以对测试用例进行测试。The running module 30 is used to run the target test script to test the test cases.

在一个实施例中,选择模块10可以包括:In one embodiment, the selection module 10 may include:

提取单元,用于从测试请求中提取目标测试需求;Extraction unit, used to extract target test requirements from test requests;

第一确定单元,用于若目标测试需求,与测试用例的原始测试需求不一致,则确定对测试用例的验证规则发生变更。The first determination unit is used to determine that the verification rules of the test case have been changed if the target test requirements are inconsistent with the original test requirements of the test case.

在一个实施例中,选择模块10还可以包括:In one embodiment, the selection module 10 may also include:

构建单元,用于根据目标测试需求,构建目标事件;其中,目标事件包括目标事件标识和变更后的新验证规则;The construction unit is used to build the target event according to the target test requirements; where the target event includes the target event identifier and the new verification rule after the change;

第二确定单元,用于基于候选事件标识与候选事件脚本之间的对应关系,根据目标事件标识,确定候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。The second determination unit is configured to determine, based on the corresponding relationship between the candidate event identifier and the candidate event script, the target event script in the candidate event script that matches the changed new verification rule according to the target event identifier.

在一个实施例中,选择模块10还可以包括:In one embodiment, the selection module 10 may also include:

展示单元,用于若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则向测试需求端展示脚本生成界面;The display unit is used to display the script generation interface to the test demand side if there is no target event script matching the new verification rule after the change in the candidate event script;

生成单元,用于根据测试需求端作用于脚本生成界面上的输入操作,生成与新验证规则相匹配的目标事件脚本。The generation unit is used to generate a target event script that matches the new verification rule based on the input operation on the script generation interface from the test demand side.

在一个实施例中,选择模块10还可以包括:In one embodiment, the selection module 10 may also include:

更新单元,用于若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则根据测试请求中的目标测试需求,对通用测试脚本进行更新,得到与新验证规则相匹配的目标事件脚本。The update unit is used to update the general test script according to the target test requirements in the test request to obtain a target event script that matches the new verification rule if there is no target event script in the candidate event script that matches the new verification rule. target event script.

在一个实施例中,参见图7,在图6的基础上,图7提供了另一种测试用例的测试装置的结构框图,该装置还包括:In one embodiment, see Figure 7. Based on Figure 6, Figure 7 provides a structural block diagram of a test device for another test case. The device also includes:

汇总模块40,用于根据各新验证规则对应的目标事件脚本之间的执行顺序,对测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果。The summary module 40 is used to summarize the test results of the test cases according to the execution order between the target event scripts corresponding to each new verification rule, and display the summarized test results to the test demand side.

上述测试用例的测试装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the test device of the above test case can be implemented in whole or in part by software, hardware and combinations thereof. Each of the above modules may be embedded in or independent of the processor of the computer device in the form of hardware, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图8所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储测试用例对应的脚本数据和测试数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种测试用例的测试方法。In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be shown in Figure 8 . The computer device includes a processor, memory, and network interfaces connected through a system bus. Wherein, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The non-volatile storage medium stores operating systems, computer programs and databases. This internal memory provides an environment for the execution of operating systems and computer programs in non-volatile storage media. The database of the computer device is used to store script data and test data corresponding to test cases. The network interface of the computer device is used to communicate with external terminals through a network connection. The computer program, when executed by the processor, implements a test case test method.

本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 8 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Specific computer equipment can May include more or fewer parts than shown, or combine certain parts, or have a different arrangement of parts.

在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现以下步骤:In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, it implements the following steps:

响应于测试用例的测试请求,在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;In response to the test request of the test case, if it is determined that the verification rule of the test case has been changed according to the test request, select a target event script that matches the changed new verification rule from the candidate event scripts;

根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本;Determine the target test script based on the general test script and target event script of the test case;

运行目标测试脚本,以对测试用例进行测试。Run the target test script to test the test cases.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor also implements the following steps when executing the computer program:

从测试请求中提取目标测试需求;若目标测试需求,与测试用例的原始测试需求不一致,则确定对测试用例的验证规则发生变更。Extract the target test requirements from the test request; if the target test requirements are inconsistent with the original test requirements of the test case, it is determined that the verification rules of the test case have changed.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor also implements the following steps when executing the computer program:

根据目标测试需求,构建目标事件;其中,目标事件包括目标事件标识和变更后的新验证规则;基于候选事件标识与候选事件脚本之间的对应关系,根据目标事件标识,确定候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。Construct the target event according to the target test requirements; wherein the target event includes the target event identifier and the new verification rule after the change; based on the correspondence between the candidate event identifier and the candidate event script, determine the candidate event script and the The target event script matches the new validation rule after the change.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor also implements the following steps when executing the computer program:

若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则向测试需求端展示脚本生成界面;根据测试需求端作用于脚本生成界面上的输入操作,生成与新验证规则相匹配的目标事件脚本。If there is no target event script matching the changed new verification rule in the candidate event script, the script generation interface is displayed to the test demand side; according to the input operation of the test demand side on the script generation interface, the new verification rule is generated Matches the target event script.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor also implements the following steps when executing the computer program:

若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则根据测试请求中的目标测试需求,对通用事件脚本进行更新,得到与新验证规则相匹配的目标事件脚本。If there is no target event script in the candidate event script that matches the new verification rule after the change, the general event script will be updated according to the target test requirements in the test request to obtain a target event script that matches the new verification rule.

在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, the processor also implements the following steps when executing the computer program:

根据各新验证规则对应的目标事件脚本之间的执行顺序,对测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果。According to the execution order between the target event scripts corresponding to each new verification rule, the test results of the test cases are summarized, and the summarized test results are displayed to the test demand side.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:In one embodiment, a computer-readable storage medium is provided with a computer program stored thereon. When the computer program is executed by a processor, the following steps are implemented:

响应于测试用例的测试请求,在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;In response to the test request of the test case, if it is determined that the verification rule of the test case has been changed according to the test request, select a target event script that matches the changed new verification rule from the candidate event scripts;

根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本;Determine the target test script based on the general test script and target event script of the test case;

运行目标测试脚本,以对测试用例进行测试。Run the target test script to test the test cases.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

从测试请求中提取目标测试需求;若目标测试需求,与测试用例的原始测试需求不一致,则确定对测试用例的验证规则发生变更。Extract the target test requirements from the test request; if the target test requirements are inconsistent with the original test requirements of the test case, it is determined that the verification rules of the test case have changed.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

根据目标测试需求,构建目标事件;其中,目标事件包括目标事件标识和变更后的新验证规则;基于候选事件标识与候选事件脚本之间的对应关系,根据目标事件标识,确定候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。Construct the target event according to the target test requirements; wherein the target event includes the target event identifier and the new verification rule after the change; based on the correspondence between the candidate event identifier and the candidate event script, determine the candidate event script and the The target event script matches the new validation rule after the change.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则向测试需求端展示脚本生成界面;根据测试需求端作用于脚本生成界面上的输入操作,生成与新验证规则相匹配的目标事件脚本。If there is no target event script matching the changed new verification rule in the candidate event script, the script generation interface is displayed to the test demand side; according to the input operation of the test demand side on the script generation interface, the new verification rule is generated Matches the target event script.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则根据测试请求中的目标测试需求,对通用事件脚本进行更新,得到与新验证规则相匹配的目标事件脚本。If there is no target event script in the candidate event script that matches the new verification rule after the change, the general event script will be updated according to the target test requirements in the test request to obtain a target event script that matches the new verification rule.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

根据各新验证规则对应的目标事件脚本之间的执行顺序,对测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果。According to the execution order between the target event scripts corresponding to each new verification rule, the test results of the test cases are summarized, and the summarized test results are displayed to the test demand side.

在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:In one embodiment, a computer program product is provided, comprising a computer program that when executed by a processor implements the following steps:

响应于测试用例的测试请求,在根据测试请求,确定对测试用例的验证规则发生变更的情况下,从候选事件脚本中选择与变更后的新验证规则相匹配的目标事件脚本;In response to the test request of the test case, if it is determined that the verification rule of the test case has been changed according to the test request, select a target event script that matches the changed new verification rule from the candidate event scripts;

根据测试用例的通用测试脚本和目标事件脚本,确定目标测试脚本;Determine the target test script based on the general test script and target event script of the test case;

运行目标测试脚本,以对测试用例进行测试。Run the target test script to test the test cases.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

从测试请求中提取目标测试需求;若目标测试需求,与测试用例的原始测试需求不一致,则确定对测试用例的验证规则发生变更。Extract the target test requirements from the test request; if the target test requirements are inconsistent with the original test requirements of the test case, it is determined that the verification rules of the test case have changed.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

根据目标测试需求,构建目标事件;其中,目标事件包括目标事件标识和变更后的新验证规则;基于候选事件标识与候选事件脚本之间的对应关系,根据目标事件标识,确定候选事件脚本中与变更后的新验证规则相匹配的目标事件脚本。Construct the target event according to the target test requirements; wherein the target event includes the target event identifier and the new verification rule after the change; based on the correspondence between the candidate event identifier and the candidate event script, determine the candidate event script and the The target event script matches the new validation rule after the change.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则向测试需求端展示脚本生成界面;根据测试需求端作用于脚本生成界面上的输入操作,生成与新验证规则相匹配的目标事件脚本。If there is no target event script matching the changed new verification rule in the candidate event script, the script generation interface is displayed to the test demand side; according to the input operation of the test demand side on the script generation interface, the new verification rule is generated Matches the target event script.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

若候选事件脚本中不存在与变更后的新验证规则相匹配的目标事件脚本,则根据测试请求中的目标测试需求,对通用事件脚本进行更新,得到与新验证规则相匹配的目标事件脚本。If there is no target event script in the candidate event script that matches the new verification rule after the change, the general event script will be updated according to the target test requirements in the test request to obtain a target event script that matches the new verification rule.

在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, the computer program, when executed by the processor, also implements the following steps:

根据各新验证规则对应的目标事件脚本之间的执行顺序,对测试用例的测试结果进行汇总,并向测试需求端展示汇总后的测试结果。According to the execution order between the target event scripts corresponding to each new verification rule, the test results of the test cases are summarized, and the summarized test results are displayed to the test demand side.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage. In the media, when executed, the computer program may include the processes of the above method embodiments. Any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetic variable memory (Magnetoresistive Random) Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene memory, etc. Volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration but not limitation, RAM can be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM). The databases involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include blockchain-based distributed databases, etc., but are not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to this.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined in any way. To simplify the description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, all possible combinations should be used. It is considered to be within the scope of this manual.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-described embodiments only express several implementation modes of the present application, and their descriptions are relatively specific and detailed, but should not be construed as limiting the patent scope of the present application. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all fall within the protection scope of the present application. Therefore, the scope of protection of this application should be determined by the appended claims.

Claims (10)

1. A method for testing a test case, the method comprising:
responding to a test request of a test case, and selecting a target event script matched with a new verification rule after modification from candidate event scripts under the condition that the verification rule of the test case is determined to be modified according to the test request;
determining a target test script according to the universal test script of the test case and the target event script;
And running the target test script to test the test case.
2. The method of claim 1, wherein determining that the validation rule for the test case has changed based on the test request comprises:
extracting a target test requirement from the test request;
and if the target test requirement is inconsistent with the original test requirement of the test case, determining that the verification rule of the test case is changed.
3. The method of claim 2, wherein selecting a target event script from the candidate event scripts that matches the changed new validation rule comprises:
constructing a target event according to the target test requirement; the target event comprises a target event identification and a changed new verification rule;
and determining a target event script matched with the changed new verification rule in the candidate event script according to the target event identifier based on the corresponding relation between the candidate event identifier and the candidate event script.
4. The method of claim 1, wherein selecting a target event script from the candidate event scripts that matches the changed new validation rule comprises:
If the candidate event script does not have the target event script matched with the changed new verification rule, a script generation interface is displayed to the test demand end;
and generating a target event script matched with the new verification rule according to the input operation of the test requirement end on the script generation interface.
5. The method of claim 1, wherein selecting a target event script from the candidate event scripts that matches the changed new validation rule comprises:
if the candidate event script does not have the target event script matched with the changed new verification rule, updating the universal event script according to the target test requirement in the test request to obtain the target event script matched with the new verification rule.
6. The method according to claim 1, wherein in case the number of new validation rules is at least two, the method further comprises:
summarizing the test results of the test cases according to the execution sequence among the target event scripts corresponding to the new verification rules, and displaying the summarized test results to the test requirement end.
7. A test apparatus for testing a case, the apparatus comprising:
the selection module is used for responding to the test request of the test case, and selecting a target event script matched with the new verification rule after the change from candidate event scripts under the condition that the verification rule of the test case is determined to be changed according to the test request;
the determining module is used for determining a target test script according to the universal test script of the test case and the target event script;
and the operation module is used for operating the target test script so as to test the test case.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311496140.8A 2023-11-09 2023-11-09 Test script calling method, device, computer equipment and storage medium Pending CN117453561A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311496140.8A CN117453561A (en) 2023-11-09 2023-11-09 Test script calling method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311496140.8A CN117453561A (en) 2023-11-09 2023-11-09 Test script calling method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117453561A true CN117453561A (en) 2024-01-26

Family

ID=89588953

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311496140.8A Pending CN117453561A (en) 2023-11-09 2023-11-09 Test script calling method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117453561A (en)

Similar Documents

Publication Publication Date Title
US11232017B2 (en) System for refreshing and sanitizing testing data in a low-level environment
TW201439792A (en) System and method for accessing database
CN106990974B (en) APP updating method and device and electronic equipment
CN118035095A (en) Method and device for testing business processing object, computer equipment and storage medium
CN117435651A (en) Test data processing method, device, computer equipment and storage medium
CN111552715A (en) User query method and device
CN117331956A (en) Task processing method, device, computer equipment and storage medium
CN117033172A (en) Test data processing method, apparatus, device, storage medium and program product
CN117453561A (en) Test script calling method, device, computer equipment and storage medium
CN115629958A (en) Universal field level automatic checking method and device for different service interfaces
CN116011380A (en) Cable connection diagram generation method, device, computer equipment and storage medium
CN114328635A (en) Data matching method, apparatus, computer equipment and storage medium
CN117435185A (en) Code generation method, device, computer equipment and storage medium
CN119376703A (en) Form generation method, device, equipment, readable storage medium and program product
CN118283099A (en) Micro-service verification method, apparatus, device, storage medium and program product
CN119739758A (en) Substation name processing method, device and storage medium computer program product
CN116541137A (en) Transaction processing method, apparatus, computer device, storage medium, and program product
CN119322743A (en) Consistency testing method and device, electronic equipment and storage medium
CN119166701A (en) Data integration method, device, equipment, and readable storage medium
CN118096171A (en) Data gray level verification method, device, computer equipment, medium and product
CN119201855A (en) Report file processing method, device, computer equipment, readable storage medium and program product
CN116884133A (en) Intelligent appointment number calling method, device, computer equipment and storage medium
CN119557225A (en) Method, device, equipment, storage medium and program product for generating test data
CN118964064A (en) Data access method, device, equipment, readable storage medium and program product
CN119149087A (en) Configuration item updating and querying method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: Room 86, room 406, No.1, Yichuang street, Zhongxin Guangzhou Knowledge City, Huangpu District, Guangzhou City, Guangdong Province

Applicant after: Southern Power Grid Digital Grid Research Institute Co.,Ltd.

Address before: Room 86, room 406, No.1, Yichuang street, Zhongxin Guangzhou Knowledge City, Huangpu District, Guangzhou City, Guangdong Province

Applicant before: Southern Power Grid Digital Grid Research Institute Co.,Ltd.

Country or region before: China