WO2020233089A1 - 测试用例生成方法、装置、终端及计算机可读存储介质 - Google Patents

测试用例生成方法、装置、终端及计算机可读存储介质 Download PDF

Info

Publication number
WO2020233089A1
WO2020233089A1 PCT/CN2019/122781 CN2019122781W WO2020233089A1 WO 2020233089 A1 WO2020233089 A1 WO 2020233089A1 CN 2019122781 W CN2019122781 W CN 2019122781W WO 2020233089 A1 WO2020233089 A1 WO 2020233089A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
preset
scene
nodes
backbone
Prior art date
Application number
PCT/CN2019/122781
Other languages
English (en)
French (fr)
Inventor
张娟
Original Assignee
深圳壹账通智能科技有限公司
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 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2020233089A1 publication Critical patent/WO2020233089A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Definitions

  • This application relates to the technical field of program testing, and in particular to a method, device, terminal, and computer-readable storage medium for generating test cases.
  • Test case Case is a set of test inputs, execution conditions, and expected results prepared for a particular goal in order to test a program path or verify whether a particular requirement is met.
  • designers write test requirements documents, and testers manually write test cases according to the requirements documents. If there are many process steps or branch processes in the requirements document, there will be many test scenarios. Manually writing test scenarios for all processes will be time-consuming and work-intensive.
  • the main purpose of this application is to provide a test case generation method, device, terminal, and computer-readable storage medium, aiming to solve the technical problems of long time-consuming and heavy workload caused by manually writing test cases, which has become a technical problem that needs to be solved urgently.
  • test case generation method includes:
  • the preset test scenarios corresponding to each of the nodes are associated according to the connection relationship between the nodes, and the test codes corresponding to each of the associated preset test scenarios are combined to form a test case.
  • test case generation device includes:
  • An analysis module which is used to receive a demand document, analyze the demand document, and generate a number of nodes corresponding to the demand document, a scene description corresponding to the node, and the connection relationship between each node ;
  • a query module where the query module is used for the scene description of each node to query the preset test scene corresponding to each node from the preset address;
  • An export module which is configured to associate preset test scenarios corresponding to each of the nodes according to the connection relationship between each node, and combine the test codes corresponding to each of the associated preset test scenarios to form a test case .
  • This application provides a terminal, including a processor, a memory, a communicator, and computer-readable instructions stored on the memory that can be executed by the processor, wherein the computer-readable instructions are executed by the processor When executed, the steps of the aforementioned test case generation method are implemented.
  • This application provides a computer-readable storage medium having computer-readable instructions stored on the computer-readable storage medium, wherein, when the computer-readable instructions are executed by a processor, the test case generation method described above is implemented step.
  • the connection relationship between each node is determined according to the scene description of each node.
  • the preset test scenarios corresponding to the nodes are combined according to the connection relationship, thereby realizing automatic generation of test cases, eliminating the need for staff to manually edit test cases based on demand documents, improving work efficiency and reducing workload.
  • the test cases are automatically generated according to the connection relationship, which effectively avoids the situation that the logic relationship between adjacent nodes is prone to errors in the process of writing test cases due to the complex logic relationship, which leads to inconsistency with the requirements document.
  • FIG. 1 is a schematic diagram of the hardware structure of a terminal involved in a solution of an embodiment of the application
  • FIG. 2 is a schematic flowchart of the first embodiment of the test case generation method of this application.
  • FIG. 3 is a schematic flowchart of a second embodiment of the test case generation method of this application.
  • FIG. 4 is a schematic flowchart of a third embodiment of a test case generation method according to this application.
  • FIG. 5 is a schematic flowchart of a fourth embodiment of a test case generation method according to this application.
  • FIG. 6 is a schematic flowchart of a seventh embodiment of a test case generation method of this application.
  • FIG. 7 is a schematic diagram of modules of the test case generation device of this application.
  • the test case generation method involved in the embodiment of the present application is mainly applied to a terminal.
  • the terminal is a device with processing functions, and may be a portable computer or a server.
  • FIG. 1 is a schematic diagram of a terminal structure involved in a solution of an embodiment of this application.
  • the terminal may include a processor 1001 (for example, a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005.
  • the communication bus 1002 is used to realize the connection and communication between these components;
  • the user interface 1003 may include a display (Display), an input unit such as a keyboard (Keyboard);
  • the network interface 1004 may optionally include a standard wired interface, a wireless interface (Such as WI-FI interface);
  • the memory 1005 can be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory.
  • the memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.
  • the hardware structure shown in FIG. 1 does not constitute a limitation on the device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange different components.
  • the memory 1005 as a computer-readable storage medium in FIG. 1 may include an operating system, a network communication module, and computer-readable instructions.
  • the network communication module is mainly used to connect to the user terminal and perform data communication with the user terminal; and the processor 1001 can call the computer readable instructions stored in the memory 1005 and execute the steps of the test case generation method.
  • test case generation method includes the following steps:
  • Step S100 receiving a demand document, analyzing the demand document, and generating a number of nodes corresponding to the demand document, a scene description corresponding to the node, and the connection relationship between each of the nodes;
  • the requirement document is a pre-set outline set by the designer according to the functions to be tested by the program to be tested.
  • the staff sets up test cases according to the requirement document to test each function of the program to be tested.
  • the requirement document is a flowchart.
  • the requirement document can also be embodied in tabular form or plain text.
  • different analysis programs can be established to integrate the requirement documents. Dataization and standardization of the content in, obtain the nodes listed in the requirements document, the scene description of the corresponding nodes, and the connection relationship between each node.
  • the scene description is a detailed description of the functions and application scenarios of each node.
  • the connection relationship is the logical relationship and judgment rule between each node.
  • the demand document When the demand document is expressed in plain text, it is recognized through word segmentation, semantic recognition, keyword comparison, etc.
  • the demand document composed of plain text there are several nodes, the scene description of each node, and the connection between each node relationship. For example, if the requirement document records "the first test account is incorrectly entered in the login page, the test password is incorrectly entered, and the final test verification code is incorrectly entered", it can be known through word segmentation, semantic recognition, keyword comparison, etc., that there is a "verification account entry There are three nodes, "Error”, “Incorrect verification password”, and “Incorrect verification code”, among which the connection relationship is carried out in sequence.
  • Step S200 query the preset test scene corresponding to each node from the preset address according to the scene description of each node;
  • the preset address points to a storage space that stores preset test scenarios and test codes of preset test scenarios preset by those skilled in the art, and may specifically be a uniform resource locator (niform Resoure Locator, url).
  • the test code is test data prepared by those skilled in the art for each scenario in advance. For example: for the scenario where the login password is wrong and the wrong password prompt pops up, write the test data for logging in with the wrong password in advance. When it is necessary to verify the scenario where the login password is wrong, write the test data for logging in with the wrong password in advance.
  • Step S300 Associate preset test scenarios corresponding to each of the nodes according to the connection relationship between each of the nodes, and combine the test codes corresponding to each of the associated preset test scenarios to form a test case.
  • the test agent corresponding to the preset test scenario of each node is formed into a whole according to the connection relationship, and the whole is a test case that matches the requirement document .
  • This application analyzes the requirements document to obtain the required number of nodes in the requirement document, the scene description of the node, and the connection relationship between each node.
  • the preset corresponding to each node is determined according to the scene description of each node.
  • the test cases are automatically generated according to the connection relationship, which effectively avoids the situation that the logic relationship between adjacent nodes is prone to errors in the process of writing test cases due to the complex logic relationship, which leads to inconsistency with the requirements document.
  • step S100 includes:
  • Step S110 receiving the flowchart, comparing the flowchart with a preset graphic element template library, and identifying the positions of arrows and connecting lines in the flowchart;
  • arrows and connecting lines of various shapes and different manifestations are preset in the preset graphic element template library, so that the arrows and connecting lines in the process can be identified.
  • Step S120 Perform grayscale processing on the flowchart to generate a grayscale value matrix
  • the color parameters in the flowchart are discarded by gray-scale processing of the flowchart, which is helpful for identifying the node boxes in the flowchart.
  • Each element in the matrix represents the gray value of the corresponding pixel (the value is 0-255).
  • the background color in the flowchart is white (gray value 255)
  • the node frame is black (gray value less than 255).
  • Step S130 Identify the node frame in the grayscale matrix according to the gray value matrix in combination with the arrow and connecting line positions, and set one of the node frames as one of the nodes;
  • each node frame has a color difference with the background, through color difference analysis, the position coordinates of each node frame and each node frame are obtained.
  • Step S140 generating a connection relationship between each of the nodes according to the position of the arrow and the connecting line;
  • step S 110 Identify the arrows and connecting lines in the flowchart, and combine the gray value matrix to mark the start and end positions of each arrow and connecting line, and compare the marked results with the position coordinates of the node box, namely The connection relationship of the nodes corresponding to each node frame can be obtained.
  • Step S150 Recognize the text in each node frame through OCR text recognition technology, and generate a scene description corresponding to the node.
  • OCR optical character recognition
  • the nodes, scene descriptions, and connection relationships embodied in the flow chart in the form of pictures can be transformed into a computer-understandable data form.
  • the designer expresses the requirement document with a flowchart, which is convenient for the designer to design.
  • test scenario includes a preset backbone scenario and a preset branch scenario;
  • step S200 includes:
  • Step S210 Query the preset backbone scene corresponding to the current node from the preset address according to the scene description of the current node;
  • the scene description is not clear, it is possible that the corresponding preset backbone scene cannot be queried from the preset address according to the scene description of the node.
  • the node is marked and prompt information is generated. The user is prompted to manually edit the test code added to the node.
  • the preset main test scenario cannot be queried. At this time, you can set to skip the node or start from the preset branch test scenario corresponding to the previous node of the current node Inquire.
  • the node in the first order must be the default backbone scene
  • the node in the second-Nth order may be the default backbone scene or the preset branch scene.
  • the preset test scenario corresponding to the first node is queried from the preset address from the first node, that is, the current node in step S210 must be available from the preset address.
  • the preset backbone scene corresponding to the current node is queried in the address.
  • Step S220 if the preset backbone scene corresponding to the current node is queried from the preset address, determine the connection relationship between the current node and the previous node as the backbone process;
  • the previous node is the node performed before the current node.
  • the connection relationship not only indicates the direct connection or indirect connection between the nodes, but also indicates whether the relationship between the nodes is the main process or the branch process.
  • Step S230 If the preset backbone scene corresponding to the current node cannot be found from the preset address, determine that the connection relationship between the current node and the previous node is a branch process;
  • the preset address stores a preset backbone scene, and when the corresponding preset backbone scene cannot be queried for the scene description of the node, the node may be a preset branch scene.
  • Step S240 sequentially determining subsequent nodes connected to the current node according to the arrow and the position of the connecting line, and querying the preset backbone corresponding to the subsequent node from the preset address according to the scene description of the subsequent node Scenes;
  • multiple subsequent nodes N+1, N+2, N+n... can also be directly or indirectly connected, and it is determined in turn whether the preset address can be queried with each subsequent node.
  • Step S250 Confirm the connection relationship between each node according to the query result.
  • step S220 There may be two query results. One is similar to step S220, and the corresponding preset backbone scene is queried, then the connection relationship between nodes is confirmed as the backbone process; the other is similar to step S230, and the corresponding preset backbone scene cannot be queried. , Then confirm that the connection relationship between nodes is a branch process. Determine the connection relationship between each node until the last node is determined.
  • the connection relationship between the nodes corresponding to the preset trunk scene is listed as the trunk process, so that each node in the trunk process can be further corresponding to the preset trunk
  • the test code combination of the scenario forms a test case.
  • FIG. 5 is a schematic flowchart of the fourth embodiment of the test case generation method of this application. Based on the third embodiment, after step S230, it includes:
  • Step S260 Query at least one of the preset branch scenarios corresponding to the previous node from the preset address;
  • One or more preset branch scenes are preset in the preset address to correspond to one preset trunk scene.
  • one preset branch scene may also correspond to multiple preset trunk scenes.
  • the default backbone scene corresponding to node N-1 is the login page scene, you can set the verification verification code input error scene, the verification account input error scene, and the verification password input error scene.
  • the preset branch scene corresponds to the login page scene, the current node N corresponds to one of the scenario where the verification code is entered incorrectly, the verification account is entered incorrectly, and the verification password is entered incorrectly.
  • Step S270 According to the scene description of the current node, a preset branch scene corresponding to the current node is obtained by comparing from the preset branch scene corresponding to the previous node.
  • preset branch scenes are preset for the preset trunk scenes, so that the nodes after the nodes corresponding to the preset trunk scenes can be selected from the preset branch scenes , To reduce the amount of calculation in the comparison process.
  • step S270 the method includes:
  • the required scene is a preset branch scene that must be performed after a preset main scene.
  • the number of necessary scenes corresponding to the preset main scene is less than or equal to the preset branch scenes corresponding to the preset main scene.
  • step S300 includes:
  • connection relationship with each node in the backbone node chain is the node of the branch process, and the test code of the preset branch scene corresponding to the node of the branch process is filled in the test code according to the connection relationship.
  • a test case is formed.
  • each backbone node chain can be parallel, that is, the nodes in each backbone node chain are evenly distributed; it can also be crossed, that is, the same points are both It belongs to the backbone node chain A, and belongs to the backbone node chain B.
  • the user makes node chain selection operations by clicking, sliding, etc., one backbone node chain can be selected at a time, or multiple backbone node chains can be selected.
  • test cases are dynamically generated, which is convenient for users to change dynamic use cases according to actual conditions.
  • step S210 includes:
  • Step S211 Obtain a first keyword corresponding to the preset backbone scene, and determine whether the first keyword exists in the scene description of the node;
  • the first keyword may specifically be composed of one vocabulary or multiple vocabulary, or may be composed of multiple vocabulary and logical words. Each node can be distinguished by the first keyword. For example, if the scenario description is "Test the account login function on the login page", the first keyword can be set to "Login page and account account”.
  • Step S212 If the first keyword exists in the scene description, set the node to correspond to the preset backbone scene corresponding to the first keyword.
  • the previous node connected to the node is determined according to the position of the arrow and the connecting line, in the preset branch scene corresponding to the previous node Select a preset branch scene to correspond to the node. If it fails to match a preset backbone scene corresponding to the node in the preset branch scene corresponding to the previous node, a prompt message is generated to prompt the user to edit manually.
  • the preset backbone scene corresponding to each node is determined by setting the first keyword, and then the preset branch scene is determined by the scene description, so that the amount of setting of the first keyword is small and the comparison error is reduced.
  • test case generation device which includes:
  • the analysis module 10 is used to receive a demand document, analyze the demand document, and generate a number of nodes corresponding to the demand document, a scene description corresponding to the node, and the relationship between each node Connection relationship
  • Query module 20 which is used for the scene description of each node to query the preset test scene corresponding to each node from the preset address;
  • An export module 30 which is configured to associate preset test scenarios corresponding to each of the nodes according to the connection relationship between each node, and combine the test codes corresponding to each of the associated preset test scenarios to form Test case.
  • the requirement document is a flowchart;
  • the analysis module 10 includes: a first recognition unit, the first recognition unit is configured to receive the flowchart, and compare the flowchart with a preset graphic element template library Yes, identify the positions of the arrows and connecting lines in the flowchart; the gray-scale processing unit, perform gray-scale processing on the flowchart to generate a gray-scale value matrix; the second identification unit, the second identification unit is used According to the gray value matrix and the position of the arrow and the connecting line, the node frame in the gray value matrix is identified, and one of the node frames is set as one of the nodes; the first identification unit is also used for The connection relationship between the nodes is generated according to the position of the arrow and the connecting line; the third recognition unit, the third recognition unit is used to recognize the text in each of the node frames through OCR text recognition technology, and generate the corresponding The scene description of the node.
  • the query module 20 includes: a query unit configured to query the preset backbone scene corresponding to the current node from the preset address according to the scene description of the current node; a determination unit, the The determining unit is configured to determine that the connection relationship between the current node and the previous node is the backbone process if the preset backbone scene corresponding to the current node is queried from the preset address; If the preset backbone scene corresponding to the current node cannot be queried in the preset address, it is determined that the connection relationship between the current node and the previous node is a branch process; the query unit is further configured to The subsequent nodes connected to the current node are sequentially determined according to the position of the arrow and the connecting line, and the preset backbone scene corresponding to the subsequent node is queried from the preset address according to the scene description of the subsequent node; The determining unit is also used for confirming the connection relationship between the various nodes according to the query result.
  • the query unit is further configured to query at least one of the preset branch scenes corresponding to the previous node from the preset address; according to the scene description of the current node, from the previous node The comparison among the corresponding preset branch scenes obtains a preset branch scene corresponding to the current node.
  • the query module 20 further includes: an acquiring unit configured to acquire the necessary scene corresponding to the previous node, and determine whether the preset branch scene of each node connected to the previous node is Contains all the necessary scenes; a prompt unit configured to generate prompt information if the preset branch scenes of each node connected to the previous node do not contain all the necessary scenes.
  • the export module 30 includes: an associating unit, the associating unit is used to associate the connection relationship between the nodes of the backbone process to form at least one backbone node chain; a receiving unit, the receiving unit is used to receive users The node chain selection operation made according to the backbone node chain; the association unit is further configured to associate preset backbone scenarios corresponding to each node in at least one of the backbone node chains according to the node chain selection operation, and The associated test codes corresponding to each of the preset backbone scenarios are combined to form a backbone use case; it is determined that the connection relationship with each node in the backbone node chain is the node of the branch process, which will correspond to the node of the branch process The test code of the preset branch scenario is filled into the main use case according to the connection relationship to form a test case.
  • the query unit is also used to obtain the first keyword corresponding to the preset backbone scene, and determine whether the first keyword exists in the scene description of the node; if all the first keywords exist in the scene description If the first keyword is mentioned, the node is set to correspond to the preset backbone scene corresponding to the first keyword.
  • the present application also provides a computer-readable storage medium on which computer-readable instructions are stored.
  • the steps of the above-mentioned interface update method are implemented.
  • the storage medium is specifically a non-volatile computer-readable storage medium.

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)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

一种测试用例生成方法、装置、终端及计算机可读存储介质,该方法包括:接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、所述节点的场景描述和各个所述节点之间的连接关系(S100);根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景(S200);根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例(S300)。

Description

测试用例生成方法、装置、终端及计算机可读存储介质
本申请要求于2019年05月21日提交中国专利局、申请号为201910433511.5、发明名称为“测试用例生成方法、装置、终端及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及程序测试技术领域,尤其涉及一种测试用例生成方法、装置、终端及计算机可读存储介质。
背景技术
测试用例(Test Case)是为某个特殊目标而编制的一组测试输入、执行条件以及预期结果,以便测试某个程序路径或核实是否满足某个特定需求。现有的测试流程中,由设计人员书写测试需求文档,测试人员根据需求文档手工编写测试用例。如果需求文档中的流程步骤较多或者分支流程较多,测试场景就会很多,用手工编写的方式去穷举所有流程的测试场景,耗时长、工作量大。
因此,如何解决现有手动编写测试用例造成耗时长、工作量大技术问题,成为了目前亟待解决的技术问题。
发明内容
本申请的主要目的在于提供一种测试用例生成方法、装置、终端及计算机可读存储介质,旨在解决手动编写测试用例造成耗时长、工作量大技术问题,成为了目前亟待解决的技术问题。
为实现上述目的,本申请提出一种测试用例生成方法,所述测试用例生成方法包括:
接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;
根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景;
根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。
本申请提供了一种测试用例生成装置,所述测试用例生成装置包括:
分析模块,所述分析模块用于接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;
查询模块,所述查询模块用于各所述节点的场景描述从所述预设地址中查询与各所述节点对应的预设测试场景;
导出模块,所述导出模块用于根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。
本申请提供了一种终端,包括处理器、存储器、通信器以及存储在所述存储器上的可被所述处理器执行的计算机可读指令,其中,所述计算机可读指令被所述处理器执行时,实现如前述的测试用例生成方法的步骤。
本申请提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机可读指令,其中,所述计算机可读指令被处理器执行时,实现如前述的测试用例生成方法的步骤。
本申请技术方案中,通过分析需求文档,从而可获得需求文档中所需要的节点数目、节点的场景描述和各个节点之间的连接关系,在此基础上,根据各个节点的场景描述确定与各节点对应的预设测试场景,再将预设测试场景按照连接关系进行组合,从而实现自动生成测试用例,省去了工作人员根据需求文档手动编辑测试用例,提高了工作效率、降低了工作量。同时由于测试用例根据连接关系自动生成,从而有效避免了测试用例编写过程中,由于逻辑关系复杂,相邻节点之间逻辑关系容易错误,导致与需求文档不符合的情况。
附图说明
图1为本申请实施例方案中涉及的终端的硬件结构示意图;
图2为本申请测试用例生成方法第一实施例的流程示意图;
图3为本申请测试用例生成方法第二实施例的流程示意图;
图4为本申请测试用例生成方法第三实施例的流程示意图;
图5为本申请测试用例生成方法第四实施例的流程示意图;
图6为本申请测试用例生成方法第七实施例的流程示意图;
图7为本申请测试用例生成装置的模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请实施例涉及的测试用例生成方法主要应用于终端,该终端是具有处理功能的设备,可以是便携计算机,也可以服务器。参照图1,图1为本申请实施例方案中涉及的终端结构示意图。本申请实施例中,终端可以包括处理器1001(例如CPU),通信总线1002,用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信;用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard);网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口);存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器,存储器1005可选的还可以是独立于前述处理器1001的存储装置。本领域技术人员可以理解,图1中示出的硬件结构并不构成对设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
继续参照图1,图1中作为一种计算机可读存储介质的存储器1005可以包括操作***、网络通信模块以及计算机可读指令。在图1中,网络通信模块主要用于连接用户终端,与用户终端进行数据通信;而处理器1001可以调用存储器1005中存储的计算机可读指令,并执行测试用例生成方法的步骤。
基于上述终端的硬件结构,提出本申请测试用例生成方法的各个实施例。本申请提供一种测试用例生成方法。请参阅图2,在本申请第一实施例中,测试用例生成方法包括以下步骤:
步骤S100,接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;
需求文档为设计人员根据待测试程序所需要测试的功能,预先设置的大纲,工作人员根据需求文档设置测试用例,以测试待测试程序的各个功能。在本实施例中,需求文档为流程图,在其它实施例中,需求文档也可以以表格形式、纯文字形式体现,针对不同表现形式的需求文档,可建立不同的分析程序,以将需求文档中的内容数据化、标准化,获得需求文档中所列明的节点、对应节点的场景描述和各个节点之间的连接关系。场景描述为对各个节点的功能、应用场景的详细描述。连接关系为各个节点之间的逻辑关系、判断规则。
当需求文档为纯文字形式表现,则通过分词、语义识别、关键字比对等方式,识别由纯文字构成的需求文档中,存在几个节点、各个节点的场景描述和各个节点之间的连接关系。例如:需求文档记载“登录页面内先测试账户填写错误、再测试密码填写错误、最后测试验证码填写错误”,则通过分词、语义识别、关键字比对等方式可知晓,存在“验证账户填写错误”、“验证密码填写错误”、“验证验证码填写错误”三个节点,其中连接关系为依次进行。
步骤S200,根据各所述节点的场景描述从所述预设地址中查询与各所述节点对应的预设测试场景;
所述预设地址指向本领域技术人员预先设置的存储有预设测试场景和预设测试场景的测试代码的存储空间,具体可以为统一资源定位符(niform Resoure Locator,url)。测试代码为本领域技术人员预先针对各个场景编写的测试数据。例如:针对登录密码错误,弹出密码错误提示的场景,预先编写采用错误密码登录的测试数据。当需要验证登录密码错误的场景时,预先编写采用错误密码登录的测试数据。
步骤S300,根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。
由于一个需求文档往往包含多个节点,并且各个节点之间存在复杂的逻辑关系,将各个节点的预设测试场景对应的测试代理按照连接关系形成一个整体,该整体为与需求文档匹配的测试用例。
本申请通过分析需求文档,从而可获得需求文档中所需要的节点数目、节点的场景描述和各个节点之间的连接关系,在此基础上,根据各个节点的场景描述确定与各节点对应的预设测试场景,再将预设测试场景按照连接关系进行组合,从而实现自动生成测试用例,省去了工作人员根据需求文档手动编辑测试用例,提高了工作效率、降低了工作量。同时由于测试用例根据连接关系自动生成,从而有效避免了测试用例编写过程中,由于逻辑关系复杂,相邻节点之间逻辑关系容易错误,导致与需求文档不符合的情况。
进一步地,请参照图3,图3为本申请测试用例生成方法第二实施例的流程示意图,基于第一实施例,所述需求文档为流程图;步骤S100包括:
步骤S110,接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;
具体地,预设图元模板库中预先设置了多种形状、不同表现形式的箭头和连接线,从而可识别流程中的箭头和连接线。
步骤S120,对所述流程图进行灰度处理,生成灰度值矩阵;
由于流程图通常带有颜色,通过将流程图进行灰度处理,从而舍弃流程图中的颜色参数,有利于识别流程图中的节点框。首先对流程图做灰度处理,获得并存储流程图中每个像素点对应的灰度值,组成灰度值矩阵,其中,矩阵行数是流程图的高度值,矩阵的列数是流程图的宽度值,矩阵中每一个元素表示相应像素点的灰度值(取值为0-255)。例如:流程图中背景颜色为白色(灰度值255),节点框为黑色(灰度值小于255)。
步骤S130,根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;
由于各个节点框与背景具有色差,通过色差分析,获得各个节点框及各个节点框的位置坐标。
步骤S140,根据所述箭头及连接线位置生成各所述节点之间的连接关系;
通过步骤S 110,识别出流程图中的箭头和连接线,再结合灰度值矩阵,对各个箭头和连接线的起始位置和终末位置进行标注,将标注的结果与节点框的位置坐标对比,即可获得各个节点框所对应的节点的连接关系。
步骤S150,通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。
OCR(optical character recognition)文字识别技术将图片形式的字符形状翻译成计算机文字的过程。通过OCR文字识别技术可将节点框内的文字转换成计算机文字形式的节点的场景描述。
通过上述步骤,可将图片形式的流程图中体现的节点、场景描述和连接关系转化成计算机可理解的数据形式。设计人员将需求文档用流程图表示,方便设计人员设计。
进一步地,请参照图4,图4为本申请测试用例生成方法第三实施例的流程示意图,基于第一实施例,所述测试场景包括预设主干场景和预设分支场景;步骤S200包括:
步骤S210,根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;
具体地,当场景描述不清楚时,有可能根据所述节点的场景描述从所述预设地址中查询不到对应的预设主干场景,此时,对该节点进行标注,并生成提示信息,提示用户手动编辑加入该节点的测试代码。当该节点对应的是预设分支测试场景时,也查询不到预设主干测试场景,此时可设置跳过该节点,或从该当前节点的上一节点对应的预设分支测试场景中开始查询。
一般情况下,次序排在第一位的节点一定是预设主干场景,次序排在第二位-第N位的节点可能是预设主干场景,也可能是预设分支场景。可选地,步骤S200,从第一位节点开始从所述预设地址中查询与第一位节点对应的预设测试场景,也就是说,步骤S210中的当前节点一定是可以从所述预设地址中查询到与当前节点对应的预设主干场景。
步骤S220,若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;
上一节点为在当前节点之前进行的节点。当当前节点为第一位节点时,即不存在上一节点,也就不存在判定所述当前节点与上一节点之间的连接关系的步骤。连接关系不仅仅只表示各个节点之间直接连接或间接连接,还表示各个节点之间的关系是主干流程还是分支流程。
步骤S230,若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;
所述预设地址中存储有预设主干场景,当该节点的场景描述查询不到对应的预设主干场景,则该节点有可能是预设分支场景。
根据箭头及连接线位置确定与该上一节点N-1相连接的当前节点N,通过当前节点的场景描述,判断是否能从所述预设地址中查询到与当前节点N对应的预设主干场景;若查询到与当前节点N对应的预设主干场景,则判定上一节点N-1与当前节点N之间的连接关系为主干流程;若当前节点N查询不到与之对应的预设主干场景,则判定上一节点N-1与当前节点N之间的连接关系为分支流程。上一节点N-1和当前节点N之间,一定是先有上一节点N-1,再有当前节点N。上一节点N-1之后可以有多个当前节点N。
步骤S240,根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;
在当前节点N之后,还可以直接或间接连接多个后续节点N+1、N+2、N+n......,依次确定在所述预设地址中是否能查询到与各个后续节点对应的预设主干场景。
步骤S250,根据查询结果确认各个节点之间的连接关系。
查询结果可能有两种,一种类似步骤S220,查询到对应的预设主干场景,则确认节点之间的连接关系为主干流程;另一种类似步骤S230,查询不到对应的预设主干场景,则确认节点之间的连接关系为分支流程。确定各个节点之间的连接关系,直至确定到最后一个节点为止。
通过将预设测试场景区分为预设主干场景和预设分支场景,将预设主干场景对应的节点之间的连接关系列为主干流程,从而可进一步将主干流程中的各个节点对应预设主干场景的测试代码组合,形成测试用例。
进一步地,请参照图5,图5为本申请测试用例生成方法第四实施例的流程示意图,基于第三实施例,步骤S230之后包括:
步骤S260,从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;
在所述预设地址中预先设置一个或多个预设分支场景对应一个预设主干场景,当然一个预设分支场景也可以对应多个预设主干场景。例如:节点N-1对应的预设主干场景为登录页面场景,可以设置验证验证码输入错误场景、验证账户输入错误场景、验证密码输入错误场景的预设分支场景与登录页面场景对应,当前节点N对应验证验证码输入错误场景、验证账户输入错误场景、验证密码输入错误场景中的一个。
步骤S270,根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。
通过将预设测试场景区分为预设主干场景和预设分支场景,针对预设主干场景预先设置预设分支场景,从而与预设主干场景对应的节点之后的节点可从预设分支场景中选择,减小比对过程的计算量。
进一步地,步骤S270之后包括:
获取所述上一节点对应的必须场景,判断与所述上一节点连接的各节点对应的所述预设分支场景是否包含全部所述必须场景;
若与所述上一节点连接的各节点的所述预设分支场景未包含全部所述必须场景,则生成提示信息。
若与所述上一节点连接的各节点对应的所述预设分支场景包含全部所述必须场景,则不做处理。必选场景为一个预设主干场景之后必须要进行的预设分支场景。预设主干场景对应的必须场景的数目小于或等于预设主干场景对应的预设分支场景。通过判断当前节点对应的预设分支场景是否包含必须场景,从而可发现需求文档中设置遗漏节点的情况。
进一步地,基于第四实施例,步骤S300包括:
将所述连接关系为主干流程的节点相关联,形成至少一个主干节点链;
接收用户根据所述主干节点链做出的节点链选择操作,将至少一个所述主干节点链中各所述节点对应的所述预设主干场景相关联,将关联的各所述预设主干场景所对应的测试代码组合形成主干用例;
确定与所述主干节点链中各节点的连接关系为所述分支流程的节点,将为所述分支流程的节点所对应的所述预设分支场景的测试代码根据所述连接关系填充至所述主干用例中,形成测试用例。
由于节点之间的连接关系复杂,通常一个需求文档中会产生多个主干节点链,各个主干节点链可以平行,即各个主干节点链中的节点均布相同;也可以交叉,即同一几点既属于主干节点链A,又属于主干节点链B。用户通过点击、滑动等做出节点链选择操作,一次可选择一个主干节点链,也可以选择多个主干节点链。根据用户当前的实际需求,动态的生成测试用例,方便用户根据实际情况,对动态用例进行变更。
进一步地,请参照图6,图6为本申请测试用例生成方法第六实施例的流程示意图,基于第三实施例,步骤S210包括:
步骤S211,获取与所述预设主干场景对应的第一关键词,判断所述节点的场景描述中是否存在所述第一关键词;
第一关键词具体可以是一个词汇或多个词汇构成,还可以是多个词汇和逻辑词构成。通过第一关键词可区分各个节点。例如场景描述中为“对登录页面进行账户登录功能测试”,那第一关键词可以设置为“登录页面 and 账户账户”。
步骤S212,若所述场景描述中存在所述第一关键词,则设置所述节点对应于该第一关键词对应的预设主干场景。
若所述场景描述中不存在所述第一关键词,则根据所述箭头及连接线位置确定与该所述节点相连接的上一个节点,在所述上一个节点对应的预设分支场景中选择一个预设分支场景与所述节点对应。若在所述上一个节点对应的预设分支场景中未能匹配一个预设主干场景与所述节点对应,则生成提示信息,提示用户手动编辑。
本申请中通过设置第一关键词来判断各个节点对应的预设主干场景,再通过场景描述来判断预设分支场景,从而使得第一关键词的设置量小,减少比对错误。
此外,本申请还提供一种测试用例生成装置,所述测试用例生成装置包括:
分析模块10,所述分析模块10用于接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;
查询模块20,所述查询模块20用于各所述节点的场景描述从所述预设地址中查询与各所述节点对应的预设测试场景;
导出模块30,所述导出模块30用于根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。
进一步地,所述需求文档为流程图;所述分析模块10包括:第一识别单元,所述第一识别单元用于接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;灰度处理单元,对所述流程图进行灰度处理,生成灰度值矩阵;第二识别单元,所述第二识别单元用于根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;所述第一识别单元还用于根据所述箭头及连接线位置生成各所述节点之间的连接关系;第三识别单元,所述第三识别单元用于通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。
进一步地,所述查询模块20包括:查询单元,所述查询单元用于根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;判定单元,所述判定单元用于若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;所述查询单元还用于根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;所述判定单元还用于根据查询结果确认各个节点之间的连接关系。
进一步地,所述查询单元还用于从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。
进一步地,所述查询模块20还包括:获取单元,所述获取单元用于获取所述上一节点对应的必须场景,判断与所述上一节点连接的各节点的所述预设分支场景是否包含全部所述必须场景;提示单元,所述提示单元用于若与所述上一节点连接的各节点的所述预设分支场景未包含全部所述必须场景,则生成提示信息。
进一步地,所述导出模块30包括:关联单元,所述关联单元用于将所述连接关系为主干流程的节点相关联,形成至少一个主干节点链;接收单元,所述接收单元用于接收用户根据所述主干节点链做出的节点链选择操作;所述关联单元还用于根据所述节点链选择操作,将至少一个所述主干节点链中各节点对应的预设主干场景相关联,将关联的各所述预设主干场景所对应的测试代码组合形成主干用例;确定与所述主干节点链中各节点的连接关系为所述分支流程的节点,将为所述分支流程的节点所对应的所述预设分支场景的测试代码根据所述连接关系填充至所述主干用例中,形成测试用例。
进一步地,所述查询单元还用于获取与所述预设主干场景对应的第一关键词,判断所述节点的场景描述中是否存在所述第一关键词;若所述场景描述中存在所述第一关键词,则设置所述节点对应于该第一关键词对应的预设主干场景。
此外,本申请还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机可读指令,其中,计算机可读指令被处理器执行时,实现如上述的界面的更新方法的步骤。其中计算机可读指令被执行时所实现的方法可参照本申请界面的更新方法的各个实施例,此处不再赘述。在本申请中存储介质具体为非易失性计算机可读存储介质。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者***不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者***所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者***中还存在另外的相同要素。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种测试用例生成方法,其中,所述测试用例生成方法包括:
    接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;
    根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景;
    根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。
  2. 如权利要求1所述的测试用例生成方法,其中,所述需求文档为流程图;所述接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系的步骤,包括:
    接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;
    对所述流程图进行灰度处理,生成灰度值矩阵;
    根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;
    根据所述箭头及连接线位置生成各所述节点之间的连接关系;
    通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。
  3. 如权利要求2所述的测试用例生成方法,其中,所述测试场景包括预设主干场景和预设分支场景;所述根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景的步骤包括:
    根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;
    若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;
    若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;
    根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;
    根据查询结果确认各个所述节点之间的连接关系。
  4. 如权利要求3所述的测试用例生成方法,其中,所述若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程的步骤之后,还包括:
    从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;
    根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。
  5. 如权利要求4所述的测试用例生成方法,其中,所述根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景的步骤之后包括:
    获取所述上一节点对应的必须场景,判断与所述上一节点连接的各节点的所述预设分支场景是否包含全部所述必须场景;
    若与所述上一节点连接的各节点的所述预设分支场景未包含全部所述必须场景,则生成提示信息。
  6. 如权利要求4所述的测试用例生成方法,其中,所述根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例的步骤包括:
    将所述连接关系为主干流程的节点相关联,形成至少一个主干节点链;
    接收用户根据所述主干节点链做出的节点链选择操作;
    根据所述节点链选择操作,将至少一个所述主干节点链中各所述节点对应的所述预设主干场景相关联,将关联的各所述预设主干场景所对应的测试代码组合形成主干用例;
    确定与所述主干节点链中各节点的连接关系为所述分支流程的节点,将为所述分支流程的节点所对应的所述预设分支场景的测试代码根据所述连接关系填充至所述主干用例中,形成测试用例。
  7. 如权利要求3所述的测试用例生成方法,其中,所述根据所述节点的场景描述从所述预设地址中查询与所述节点对应的预设主干场景的步骤,包括:
    获取与所述预设主干场景对应的第一关键词,判断所述节点的场景描述中是否存在所述第一关键词;
    若所述场景描述中存在所述第一关键词,则设置所述节点对应于该第一关键词对应的预设主干场景。
  8. 一种测试用例生成装置,其中,所述测试用例生成装置包括:
    分析模块,所述分析模块用于接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;
    查询模块,所述查询模块用于各所述节点的场景描述从所述预设地址中查询与各所述节点对应的预设测试场景;
    导出模块,所述导出模块用于根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。
  9. 如权利要求8所述的测试用例生成装置,其中,所述需求文档为流程图;所述分析模块包括:
    第一识别单元,所述第一识别单元用于接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;
    灰度处理单元,对所述流程图进行灰度处理,生成灰度值矩阵;
    第二识别单元,所述第二识别单元用于根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;
    所述第一识别单元还用于根据所述箭头及连接线位置生成各所述节点之间的连接关系;
    第三识别单元,所述第三识别单元用于通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。
  10. 如权利要求9所述的测试用例生成装置,其中,所述测试场景包括预设主干场景和预设分支场景;所述查询模块包括:
    查询单元,所述查询单元用于根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;
    判定单元,所述判定单元用于若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;
    若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;
    所述查询单元还用于根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;
    所述判定单元还用于根据查询结果确认各个节点之间的连接关系。
  11. 如权利要求10所述的测试用例生成装置,其中,所述查询单元还用于从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;
    根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。
  12. 一种终端,其中,包括处理器、存储器、通信器以及存储在所述存储器上的可被所述处理器执行的计算机可读指令,其中,所述计算机可读指令被所述处理器执行时,实现如下步骤:
    接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;
    根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景;
    根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。
  13. 如权利要求12所述的终端,其中,所述需求文档为流程图;所述接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系的步骤,包括:
    接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;
    对所述流程图进行灰度处理,生成灰度值矩阵;
    根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;
    根据所述箭头及连接线位置生成各所述节点之间的连接关系;
    通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。
  14. 如权利要求13所述的终端,其中,所述测试场景包括预设主干场景和预设分支场景;所述根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景的步骤包括:
    根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;
    若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;
    若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;
    根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;
    根据查询结果确认各个所述节点之间的连接关系。
  15. 如权利要求14所述的终端,其中,所述若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程的步骤之后,还包括:
    从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;
    根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有计算机可读指令,其中,所述计算机可读指令被处理器执行时,实现如下步骤:
    接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;
    根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景;
    根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。
  17. 如权利要求16所述的计算机可读存储介质,其中,所述需求文档为流程图;所述接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系的步骤,包括:
    接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;
    对所述流程图进行灰度处理,生成灰度值矩阵;
    根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;
    根据所述箭头及连接线位置生成各所述节点之间的连接关系;
    通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。
  18. 如权利要求17所述的计算机可读存储介质,其中,所述测试场景包括预设主干场景和预设分支场景;所述根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景的步骤包括:
    根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;
    若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;
    若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;
    根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;
    根据查询结果确认各个所述节点之间的连接关系。
  19. 如权利要求18所述的计算机可读存储介质,其中,所述若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程的步骤之后,还包括:
    从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;
    根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。
  20. 如权利要求19所述的计算机可读存储介质,其中,所述根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景的步骤之后包括:
    获取所述上一节点对应的必须场景,判断与所述上一节点连接的各节点的所述预设分支场景是否包含全部所述必须场景;
    若与所述上一节点连接的各节点的所述预设分支场景未包含全部所述必须场景,则生成提示信息。
PCT/CN2019/122781 2019-05-21 2019-12-03 测试用例生成方法、装置、终端及计算机可读存储介质 WO2020233089A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910433511.5 2019-05-21
CN201910433511.5A CN110287104A (zh) 2019-05-21 2019-05-21 测试用例生成方法、装置、终端及计算机可读存储介质

Publications (1)

Publication Number Publication Date
WO2020233089A1 true WO2020233089A1 (zh) 2020-11-26

Family

ID=68002437

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122781 WO2020233089A1 (zh) 2019-05-21 2019-12-03 测试用例生成方法、装置、终端及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN110287104A (zh)
WO (1) WO2020233089A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597034A (zh) * 2020-12-25 2021-04-02 深圳证券交易所 测试用例的生成方法、装置及计算机可读存储介质
CN113590453A (zh) * 2021-01-28 2021-11-02 腾讯科技(深圳)有限公司 测试用例的生成方法、装置与存储介质
CN114338472A (zh) * 2021-12-31 2022-04-12 北京百度网讯科技有限公司 地图服务器的容量测试方法、装置、设备、介质及产品

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287104A (zh) * 2019-05-21 2019-09-27 深圳壹账通智能科技有限公司 测试用例生成方法、装置、终端及计算机可读存储介质
CN114077534B (zh) * 2020-08-11 2024-05-31 腾讯科技(深圳)有限公司 测试用例生成方法、装置和计算机可读存储介质
CN113377653B (zh) * 2021-06-10 2023-09-26 北京京东振世信息技术有限公司 生成测试用例的方法和装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150026664A1 (en) * 2013-07-17 2015-01-22 International Business Machines Corporation Method and system for automated test case selection
CN107832231A (zh) * 2017-12-05 2018-03-23 郑州云海信息技术有限公司 一种***测试方法、装置及介质
CN108595338A (zh) * 2018-05-08 2018-09-28 平安普惠企业管理有限公司 测试用例编写方法、装置、计算机设备及存储介质
CN109710508A (zh) * 2018-08-20 2019-05-03 平安普惠企业管理有限公司 测试方法、测试装置、测试设备及计算机可读存储介质
CN110287104A (zh) * 2019-05-21 2019-09-27 深圳壹账通智能科技有限公司 测试用例生成方法、装置、终端及计算机可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150026664A1 (en) * 2013-07-17 2015-01-22 International Business Machines Corporation Method and system for automated test case selection
CN107832231A (zh) * 2017-12-05 2018-03-23 郑州云海信息技术有限公司 一种***测试方法、装置及介质
CN108595338A (zh) * 2018-05-08 2018-09-28 平安普惠企业管理有限公司 测试用例编写方法、装置、计算机设备及存储介质
CN109710508A (zh) * 2018-08-20 2019-05-03 平安普惠企业管理有限公司 测试方法、测试装置、测试设备及计算机可读存储介质
CN110287104A (zh) * 2019-05-21 2019-09-27 深圳壹账通智能科技有限公司 测试用例生成方法、装置、终端及计算机可读存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597034A (zh) * 2020-12-25 2021-04-02 深圳证券交易所 测试用例的生成方法、装置及计算机可读存储介质
CN113590453A (zh) * 2021-01-28 2021-11-02 腾讯科技(深圳)有限公司 测试用例的生成方法、装置与存储介质
CN114338472A (zh) * 2021-12-31 2022-04-12 北京百度网讯科技有限公司 地图服务器的容量测试方法、装置、设备、介质及产品
CN114338472B (zh) * 2021-12-31 2024-05-07 北京百度网讯科技有限公司 地图服务器的容量测试方法、装置、设备、介质及产品

Also Published As

Publication number Publication date
CN110287104A (zh) 2019-09-27

Similar Documents

Publication Publication Date Title
WO2020233089A1 (zh) 测试用例生成方法、装置、终端及计算机可读存储介质
WO2020015067A1 (zh) 数据采集方法、装置、设备及存储介质
WO2016112558A1 (zh) 智能交互***中的问题匹配方法和***
WO2020143322A1 (zh) 用户请求的检测方法、装置、计算机设备及存储介质
WO2020107761A1 (zh) 广告文案处理方法、装置、设备及计算机可读存储介质
WO2020233090A1 (zh) 基于h5页面的应用配置方法、装置、设备及存储介质
WO2020087978A1 (zh) 风控审核模型的生成方法、装置、设备及存储介质
WO2020015064A1 (zh) ***故障处理方法、装置、设备及存储介质
WO2020119069A1 (zh) 基于自编码神经网络的文本生成方法、装置、终端及介质
WO2020258657A1 (zh) 异常检测方法、装置、计算机设备及存储介质
WO2020000632A1 (zh) ***开具方法、装置、设备及计算机可读存储介质
WO2020119369A1 (zh) 智能it运维故障定位方法、装置、设备及可读存储介质
WO2020107591A1 (zh) 重复投保限制方法、装置、设备及可读存储介质
WO2021051558A1 (zh) 基于知识图谱的问答方法、装置和存储介质
WO2020087981A1 (zh) 风控审核模型生成方法、装置、设备及可读存储介质
WO2020062661A1 (zh) 合同数据一致性的核实方法、装置、设备及存储介质
WO2021215620A1 (ko) 시맨틱 온톨로지를 이용한 도메인특화 이미지캡션 자동 생성 장치 및 방법
WO2019024485A1 (zh) 数据共享方法、装置及计算机可读存储介质
WO2020062658A1 (zh) 合同生成方法、装置、设备及存储介质
WO2017107367A1 (zh) 用户标识处理的方法、终端和非易失性计算可读存储介质
WO2020062640A1 (zh) 终端应用动态文案的语言切换方法、服务器及存储介质
WO2015050321A1 (ko) 자율학습 정렬 기반의 정렬 코퍼스 생성 장치 및 그 방법과, 정렬 코퍼스를 사용한 파괴 표현 형태소 분석 장치 및 그 형태소 분석 방법
WO2021027143A1 (zh) 信息推送方法、装置、设备及计算机可读存储介质
WO2020224251A1 (zh) 区块链事务的处理方法、装置、设备及存储介质
WO2020098078A1 (zh) Ocr训练样本的生成方法、装置、设备及可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19929439

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 04/03/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19929439

Country of ref document: EP

Kind code of ref document: A1