WO2020233089A1 - Test case generating method and apparatus, terminal, and computer readable storage medium - Google Patents

Test case generating method and apparatus, terminal, and computer readable storage medium 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
French (fr)
Chinese (zh)
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/en

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.

Abstract

A test case generating method and apparatus, a terminal, and a computer readable storage medium, the method comprising: receiving a requirements document and analysing the requirements document to generate a number of nodes corresponding to the requirements document, a scenario descriptions of the nodes, and the connecting relationship between each of the nodes (S100); on the basis of the scenario description of the nodes, querying from a preset address a preset test scenario corresponding to each node (S200); on the basis of the connecting relationship between each of the nodes, associating the preset test scenario corresponding to each node, and combining the test codes corresponding to each of the associated preset test scenarios to form a test case (S300).

Description

测试用例生成方法、装置、终端及计算机可读存储介质 Test case generation method, device, terminal and computer readable storage medium To
本申请要求于2019年05月21日提交中国专利局、申请号为201910433511.5、发明名称为“测试用例生成方法、装置、终端及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on May 21, 2019, the application number is 201910433511.5, and the invention title is "Test Case Generation Method, Device, Terminal, and Computer-readable Storage Medium", and its entire content Incorporated in the application by reference.
技术领域Technical field
本申请涉及程序测试技术领域,尤其涉及一种测试用例生成方法、装置、终端及计算机可读存储介质。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.
背景技术Background technique
测试用例(Test Case)是为某个特殊目标而编制的一组测试输入、执行条件以及预期结果,以便测试某个程序路径或核实是否满足某个特定需求。现有的测试流程中,由设计人员书写测试需求文档,测试人员根据需求文档手工编写测试用例。如果需求文档中的流程步骤较多或者分支流程较多,测试场景就会很多,用手工编写的方式去穷举所有流程的测试场景,耗时长、工作量大。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. In the existing test process, 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.
因此,如何解决现有手动编写测试用例造成耗时长、工作量大技术问题,成为了目前亟待解决的技术问题。Therefore, how to solve the technical problems of long time-consuming and heavy workload caused by the existing manual writing of test cases has become a technical problem to be solved urgently.
发明内容Summary of the invention
本申请的主要目的在于提供一种测试用例生成方法、装置、终端及计算机可读存储介质,旨在解决手动编写测试用例造成耗时长、工作量大技术问题,成为了目前亟待解决的技术问题。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.
为实现上述目的,本申请提出一种测试用例生成方法,所述测试用例生成方法包括:In order to achieve the above objective, this application proposes a test case generation method, and the test case generation method includes:
接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;Receiving a requirement document and analyzing the requirement document to generate a number of nodes corresponding to the requirement document, a scene description corresponding to the node, and the connection relationship between each of the nodes;
根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景;Query the preset test scene corresponding to each node from the preset address according to the scene description of each node;
根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。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.
本申请提供了一种测试用例生成装置,所述测试用例生成装置包括:This application provides a test case generation device, the 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.
本申请技术方案中,通过分析需求文档,从而可获得需求文档中所需要的节点数目、节点的场景描述和各个节点之间的连接关系,在此基础上,根据各个节点的场景描述确定与各节点对应的预设测试场景,再将预设测试场景按照连接关系进行组合,从而实现自动生成测试用例,省去了工作人员根据需求文档手动编辑测试用例,提高了工作效率、降低了工作量。同时由于测试用例根据连接关系自动生成,从而有效避免了测试用例编写过程中,由于逻辑关系复杂,相邻节点之间逻辑关系容易错误,导致与需求文档不符合的情况。In the technical solution of this application, by analyzing the requirement document, the number of nodes required in the requirement document, the scene description of the node, and the connection relationship between each node can be obtained. On this basis, 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. At the same time, 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.
附图说明Description of the drawings
图1为本申请实施例方案中涉及的终端的硬件结构示意图;FIG. 1 is a schematic diagram of the hardware structure of a terminal involved in a solution of an embodiment of the application;
图2为本申请测试用例生成方法第一实施例的流程示意图;FIG. 2 is a schematic flowchart of the first embodiment of the test case generation method of this application;
图3为本申请测试用例生成方法第二实施例的流程示意图;FIG. 3 is a schematic flowchart of a second embodiment of the test case generation method of this application;
图4为本申请测试用例生成方法第三实施例的流程示意图;FIG. 4 is a schematic flowchart of a third embodiment of a test case generation method according to this application;
图5为本申请测试用例生成方法第四实施例的流程示意图;FIG. 5 is a schematic flowchart of a fourth embodiment of a test case generation method according to this application;
图6为本申请测试用例生成方法第七实施例的流程示意图;FIG. 6 is a schematic flowchart of a seventh embodiment of a test case generation method of this application;
图7为本申请测试用例生成装置的模块示意图。FIG. 7 is a schematic diagram of modules of the test case generation device of this application.
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the application, and are not used to limit the application.
本申请实施例涉及的测试用例生成方法主要应用于终端,该终端是具有处理功能的设备,可以是便携计算机,也可以服务器。参照图1,图1为本申请实施例方案中涉及的终端结构示意图。本申请实施例中,终端可以包括处理器1001(例如CPU),通信总线1002,用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信;用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard);网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口);存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器,存储器1005可选的还可以是独立于前述处理器1001的存储装置。本领域技术人员可以理解,图1中示出的硬件结构并不构成对设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。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. Referring to FIG. 1, FIG. 1 is a schematic diagram of a terminal structure involved in a solution of an embodiment of this application. In the embodiment of the present 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. Among them, 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. Those skilled in the art can understand that 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.
继续参照图1,图1中作为一种计算机可读存储介质的存储器1005可以包括操作系统、网络通信模块以及计算机可读指令。在图1中,网络通信模块主要用于连接用户终端,与用户终端进行数据通信;而处理器1001可以调用存储器1005中存储的计算机可读指令,并执行测试用例生成方法的步骤。Continuing to refer to FIG. 1, 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. In FIG. 1, 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.
基于上述终端的硬件结构,提出本申请测试用例生成方法的各个实施例。本申请提供一种测试用例生成方法。请参阅图2,在本申请第一实施例中,测试用例生成方法包括以下步骤:Based on the hardware structure of the above terminal, various embodiments of the test case generation method of the present application are proposed. This application provides a method for generating test cases. Please refer to Figure 2. In the first embodiment of the present application, the test case generation method includes the following steps:
步骤S100,接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;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. In this embodiment, the requirement document is a flowchart. In other embodiments, the requirement document can also be embodied in tabular form or plain text. For requirement documents in different manifestations, 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.
当需求文档为纯文字形式表现,则通过分词、语义识别、关键字比对等方式,识别由纯文字构成的需求文档中,存在几个节点、各个节点的场景描述和各个节点之间的连接关系。例如:需求文档记载“登录页面内先测试账户填写错误、再测试密码填写错误、最后测试验证码填写错误”,则通过分词、语义识别、关键字比对等方式可知晓,存在“验证账户填写错误”、“验证密码填写错误”、“验证验证码填写错误”三个节点,其中连接关系为依次进行。When the demand document is expressed in plain text, it is recognized through word segmentation, semantic recognition, keyword comparison, etc. In 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.
步骤S200,根据各所述节点的场景描述从所述预设地址中查询与各所述节点对应的预设测试场景;Step S200: query the preset test scene corresponding to each node from the preset address according to the scene description of each node;
所述预设地址指向本领域技术人员预先设置的存储有预设测试场景和预设测试场景的测试代码的存储空间,具体可以为统一资源定位符(niform Resoure Locator,url)。测试代码为本领域技术人员预先针对各个场景编写的测试数据。例如:针对登录密码错误,弹出密码错误提示的场景,预先编写采用错误密码登录的测试数据。当需要验证登录密码错误的场景时,预先编写采用错误密码登录的测试数据。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.
步骤S300,根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。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.
由于一个需求文档往往包含多个节点,并且各个节点之间存在复杂的逻辑关系,将各个节点的预设测试场景对应的测试代理按照连接关系形成一个整体,该整体为与需求文档匹配的测试用例。Since a requirement document often contains multiple nodes, and there are complex logical relationships between each node, 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. On this basis, the preset corresponding to each node is determined according to the scene description of each node. Set up test scenarios, and then combine the preset test scenarios 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. At the same time, 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. To
进一步地,请参照图3,图3为本申请测试用例生成方法第二实施例的流程示意图,基于第一实施例,所述需求文档为流程图;步骤S100包括:Further, please refer to FIG. 3, which is a schematic flowchart of the second embodiment of the test case generation method of this application. Based on the first embodiment, the requirement document is a flowchart; step S100 includes:
步骤S110,接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;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;
具体地,预设图元模板库中预先设置了多种形状、不同表现形式的箭头和连接线,从而可识别流程中的箭头和连接线。Specifically, 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.
步骤S120,对所述流程图进行灰度处理,生成灰度值矩阵;Step S120: Perform grayscale processing on the flowchart to generate a grayscale value matrix;
由于流程图通常带有颜色,通过将流程图进行灰度处理,从而舍弃流程图中的颜色参数,有利于识别流程图中的节点框。首先对流程图做灰度处理,获得并存储流程图中每个像素点对应的灰度值,组成灰度值矩阵,其中,矩阵行数是流程图的高度值,矩阵的列数是流程图的宽度值,矩阵中每一个元素表示相应像素点的灰度值(取值为0-255)。例如:流程图中背景颜色为白色(灰度值255),节点框为黑色(灰度值小于255)。Since the flowchart is usually colored, 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. First, perform grayscale processing on the flowchart, obtain and store the gray value corresponding to each pixel in the flowchart, and form a gray value matrix, where the number of rows in the matrix is the height of the flowchart, and the number of columns in the matrix is the flowchart Each element in the matrix represents the gray value of the corresponding pixel (the value is 0-255). For example: the background color in the flowchart is white (gray value 255), and the node frame is black (gray value less than 255).
步骤S130,根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;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;
由于各个节点框与背景具有色差,通过色差分析,获得各个节点框及各个节点框的位置坐标。Since 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.
步骤S140,根据所述箭头及连接线位置生成各所述节点之间的连接关系;Step S140, generating a connection relationship between each of the nodes according to the position of the arrow and the connecting line;
通过步骤S 110,识别出流程图中的箭头和连接线,再结合灰度值矩阵,对各个箭头和连接线的起始位置和终末位置进行标注,将标注的结果与节点框的位置坐标对比,即可获得各个节点框所对应的节点的连接关系。Go through 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.
步骤S150,通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。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)文字识别技术将图片形式的字符形状翻译成计算机文字的过程。通过OCR文字识别技术可将节点框内的文字转换成计算机文字形式的节点的场景描述。OCR (optical character recognition) The process by which text recognition technology translates character shapes in the form of pictures into computer text. Through the OCR text recognition technology, the text in the node box can be converted into the scene description of the node in the form of computer text.
通过上述步骤,可将图片形式的流程图中体现的节点、场景描述和连接关系转化成计算机可理解的数据形式。设计人员将需求文档用流程图表示,方便设计人员设计。Through the above steps, 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.
进一步地,请参照图4,图4为本申请测试用例生成方法第三实施例的流程示意图,基于第一实施例,所述测试场景包括预设主干场景和预设分支场景;步骤S200包括:Further, please refer to FIG. 4, which is a schematic flow chart of the third embodiment of the test case generation method of this application. Based on the first embodiment, the test scenario includes a preset backbone scenario and a preset branch scenario; step S200 includes:
步骤S210,根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;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;
具体地,当场景描述不清楚时,有可能根据所述节点的场景描述从所述预设地址中查询不到对应的预设主干场景,此时,对该节点进行标注,并生成提示信息,提示用户手动编辑加入该节点的测试代码。当该节点对应的是预设分支测试场景时,也查询不到预设主干测试场景,此时可设置跳过该节点,或从该当前节点的上一节点对应的预设分支测试场景中开始查询。Specifically, when 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. At this time, the node is marked and prompt information is generated. The user is prompted to manually edit the test code added to the node. When the node corresponds to the preset branch test scenario, 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.
一般情况下,次序排在第一位的节点一定是预设主干场景,次序排在第二位-第N位的节点可能是预设主干场景,也可能是预设分支场景。可选地,步骤S200,从第一位节点开始从所述预设地址中查询与第一位节点对应的预设测试场景,也就是说,步骤S210中的当前节点一定是可以从所述预设地址中查询到与当前节点对应的预设主干场景。In general, the node in the first order must be the default backbone scene, and the node in the second-Nth order may be the default backbone scene or the preset branch scene. Optionally, in step S200, 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. Suppose that the preset backbone scene corresponding to the current node is queried in the address.
步骤S220,若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;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. When the current node is the first node, that is, there is no previous node, and there is no step of determining the connection relationship between the current node and the previous 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.
步骤S230,若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;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.
根据箭头及连接线位置确定与该上一节点N-1相连接的当前节点N,通过当前节点的场景描述,判断是否能从所述预设地址中查询到与当前节点N对应的预设主干场景;若查询到与当前节点N对应的预设主干场景,则判定上一节点N-1与当前节点N之间的连接关系为主干流程;若当前节点N查询不到与之对应的预设主干场景,则判定上一节点N-1与当前节点N之间的连接关系为分支流程。上一节点N-1和当前节点N之间,一定是先有上一节点N-1,再有当前节点N。上一节点N-1之后可以有多个当前节点N。Determine the current node N connected to the previous node N-1 according to the position of the arrow and the connecting line, and determine whether the preset backbone corresponding to the current node N can be queried from the preset address based on the scene description of the current node Scene; if the preset backbone scene corresponding to the current node N is queried, the connection relationship between the previous node N-1 and the current node N is determined as the backbone process; if the current node N cannot find the corresponding preset In the backbone scenario, it is determined that the connection relationship between the previous node N-1 and the current node N is a branch process. Between the previous node N-1 and the current node N, there must be the previous node N-1 first, and then the current node N. There can be multiple current nodes N after the previous node N-1.
步骤S240,根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;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;
在当前节点N之后,还可以直接或间接连接多个后续节点N+1、N+2、N+n......,依次确定在所述预设地址中是否能查询到与各个后续节点对应的预设主干场景。After the current node N, 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. The default backbone scene corresponding to the node.
步骤S250,根据查询结果确认各个节点之间的连接关系。Step S250: Confirm the connection relationship between each node according to the query result.
查询结果可能有两种,一种类似步骤S220,查询到对应的预设主干场景,则确认节点之间的连接关系为主干流程;另一种类似步骤S230,查询不到对应的预设主干场景,则确认节点之间的连接关系为分支流程。确定各个节点之间的连接关系,直至确定到最后一个节点为止。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.
通过将预设测试场景区分为预设主干场景和预设分支场景,将预设主干场景对应的节点之间的连接关系列为主干流程,从而可进一步将主干流程中的各个节点对应预设主干场景的测试代码组合,形成测试用例。By dividing the preset test scenes into the preset trunk scene and the preset branch scene, 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.
进一步地,请参照图5,图5为本申请测试用例生成方法第四实施例的流程示意图,基于第三实施例,步骤S230之后包括:Further, please refer to FIG. 5. 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:
步骤S260,从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;Step S260: Query at least one of the preset branch scenarios corresponding to the previous node from the preset address;
在所述预设地址中预先设置一个或多个预设分支场景对应一个预设主干场景,当然一个预设分支场景也可以对应多个预设主干场景。例如:节点N-1对应的预设主干场景为登录页面场景,可以设置验证验证码输入错误场景、验证账户输入错误场景、验证密码输入错误场景的预设分支场景与登录页面场景对应,当前节点N对应验证验证码输入错误场景、验证账户输入错误场景、验证密码输入错误场景中的一个。One or more preset branch scenes are preset in the preset address to correspond to one preset trunk scene. Of course, one preset branch scene may also correspond to multiple preset trunk scenes. For example: 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.
步骤S270,根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。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.
通过将预设测试场景区分为预设主干场景和预设分支场景,针对预设主干场景预先设置预设分支场景,从而与预设主干场景对应的节点之后的节点可从预设分支场景中选择,减小比对过程的计算量。By dividing the preset test scenes into preset trunk scenes and preset branch scenes, 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.
进一步地,步骤S270之后包括:Further, after step S270, the method includes:
获取所述上一节点对应的必须场景,判断与所述上一节点连接的各节点对应的所述预设分支场景是否包含全部所述必须场景;Acquiring the necessary scene corresponding to the previous node, and determining whether the preset branch scene corresponding to each node connected to the previous node includes all the necessary scenes;
若与所述上一节点连接的各节点的所述预设分支场景未包含全部所述必须场景,则生成提示信息。If the preset branch scenes of the nodes connected to the previous node do not include all the necessary scenes, prompt information is generated.
若与所述上一节点连接的各节点对应的所述预设分支场景包含全部所述必须场景,则不做处理。必选场景为一个预设主干场景之后必须要进行的预设分支场景。预设主干场景对应的必须场景的数目小于或等于预设主干场景对应的预设分支场景。通过判断当前节点对应的预设分支场景是否包含必须场景,从而可发现需求文档中设置遗漏节点的情况。If the preset branch scenes corresponding to the nodes connected to the previous node include all the necessary scenes, no processing is performed. 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. By judging whether the preset branch scene corresponding to the current node contains the necessary scene, it is possible to find the missing node in the requirement document.
进一步地,基于第四实施例,步骤S300包括:Further, based on the fourth embodiment, step S300 includes:
将所述连接关系为主干流程的节点相关联,形成至少一个主干节点链;Associating the connection relationship with the nodes of the backbone process to form at least one backbone node chain;
接收用户根据所述主干节点链做出的节点链选择操作,将至少一个所述主干节点链中各所述节点对应的所述预设主干场景相关联,将关联的各所述预设主干场景所对应的测试代码组合形成主干用例;Receive the node chain selection operation made by the user according to the backbone node chain, associate the preset backbone scenes corresponding to each of the nodes in at least one of the backbone node chains, and associate each of the associated preset backbone scenes The corresponding test code combination forms the main use case;
确定与所述主干节点链中各节点的连接关系为所述分支流程的节点,将为所述分支流程的节点所对应的所述预设分支场景的测试代码根据所述连接关系填充至所述主干用例中,形成测试用例。It is determined that the 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. In the main use case, a test case is formed.
由于节点之间的连接关系复杂,通常一个需求文档中会产生多个主干节点链,各个主干节点链可以平行,即各个主干节点链中的节点均布相同;也可以交叉,即同一几点既属于主干节点链A,又属于主干节点链B。用户通过点击、滑动等做出节点链选择操作,一次可选择一个主干节点链,也可以选择多个主干节点链。根据用户当前的实际需求,动态的生成测试用例,方便用户根据实际情况,对动态用例进行变更。Due to the complex connection relationship between nodes, usually multiple backbone node chains are generated in a requirement document, and 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. According to the current actual needs of users, test cases are dynamically generated, which is convenient for users to change dynamic use cases according to actual conditions.
进一步地,请参照图6,图6为本申请测试用例生成方法第六实施例的流程示意图,基于第三实施例,步骤S210包括:Further, please refer to FIG. 6, which is a schematic flowchart of the sixth embodiment of the test case generation method of this application. Based on the third embodiment, step S210 includes:
步骤S211,获取与所述预设主干场景对应的第一关键词,判断所述节点的场景描述中是否存在所述第一关键词;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;
第一关键词具体可以是一个词汇或多个词汇构成,还可以是多个词汇和逻辑词构成。通过第一关键词可区分各个节点。例如场景描述中为“对登录页面进行账户登录功能测试”,那第一关键词可以设置为“登录页面 and 账户账户”。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".
步骤S212,若所述场景描述中存在所述第一关键词,则设置所述节点对应于该第一关键词对应的预设主干场景。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.
若所述场景描述中不存在所述第一关键词,则根据所述箭头及连接线位置确定与该所述节点相连接的上一个节点,在所述上一个节点对应的预设分支场景中选择一个预设分支场景与所述节点对应。若在所述上一个节点对应的预设分支场景中未能匹配一个预设主干场景与所述节点对应,则生成提示信息,提示用户手动编辑。If the first keyword does not exist in the scene description, 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.
本申请中通过设置第一关键词来判断各个节点对应的预设主干场景,再通过场景描述来判断预设分支场景,从而使得第一关键词的设置量小,减少比对错误。In this application, 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.
此外,本申请还提供一种测试用例生成装置,所述测试用例生成装置包括:In addition, the present application also provides a test case generation device, which includes:
分析模块10,所述分析模块10用于接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;Analysis module 10, 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
查询模块20,所述查询模块20用于各所述节点的场景描述从所述预设地址中查询与各所述节点对应的预设测试场景;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;
导出模块30,所述导出模块30用于根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。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.
进一步地,所述需求文档为流程图;所述分析模块10包括:第一识别单元,所述第一识别单元用于接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;灰度处理单元,对所述流程图进行灰度处理,生成灰度值矩阵;第二识别单元,所述第二识别单元用于根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;所述第一识别单元还用于根据所述箭头及连接线位置生成各所述节点之间的连接关系;第三识别单元,所述第三识别单元用于通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。Further, 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.
进一步地,所述查询模块20包括:查询单元,所述查询单元用于根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;判定单元,所述判定单元用于若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;所述查询单元还用于根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;所述判定单元还用于根据查询结果确认各个节点之间的连接关系。Further, 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.
进一步地,所述查询单元还用于从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。Further, 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.
进一步地,所述查询模块20还包括:获取单元,所述获取单元用于获取所述上一节点对应的必须场景,判断与所述上一节点连接的各节点的所述预设分支场景是否包含全部所述必须场景;提示单元,所述提示单元用于若与所述上一节点连接的各节点的所述预设分支场景未包含全部所述必须场景,则生成提示信息。Further, 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.
进一步地,所述导出模块30包括:关联单元,所述关联单元用于将所述连接关系为主干流程的节点相关联,形成至少一个主干节点链;接收单元,所述接收单元用于接收用户根据所述主干节点链做出的节点链选择操作;所述关联单元还用于根据所述节点链选择操作,将至少一个所述主干节点链中各节点对应的预设主干场景相关联,将关联的各所述预设主干场景所对应的测试代码组合形成主干用例;确定与所述主干节点链中各节点的连接关系为所述分支流程的节点,将为所述分支流程的节点所对应的所述预设分支场景的测试代码根据所述连接关系填充至所述主干用例中,形成测试用例。Further, 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.
进一步地,所述查询单元还用于获取与所述预设主干场景对应的第一关键词,判断所述节点的场景描述中是否存在所述第一关键词;若所述场景描述中存在所述第一关键词,则设置所述节点对应于该第一关键词对应的预设主干场景。Further, 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.
此外,本申请还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机可读指令,其中,计算机可读指令被处理器执行时,实现如上述的界面的更新方法的步骤。其中计算机可读指令被执行时所实现的方法可参照本申请界面的更新方法的各个实施例,此处不再赘述。在本申请中存储介质具体为非易失性计算机可读存储介质。In addition, the present application also provides a computer-readable storage medium on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor, the steps of the above-mentioned interface update method are implemented. For the method implemented when the computer-readable instruction is executed, please refer to the various embodiments of the interface update method of this application, which will not be repeated here. In this application, the storage medium is specifically a non-volatile computer-readable storage medium.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。 It should be noted that in this article, the terms "include", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, It also includes other elements not explicitly listed, or elements inherent to the process, method, article, or system. If there are no more restrictions, the element defined by the sentence "including a..." does not exclude the existence of other identical elements in the process, method, article or system that includes the element. The serial numbers of the foregoing embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments. Through the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above. , Magnetic disk, optical disk), including several instructions to make a terminal device (can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method described in each embodiment of the present application. The above are only preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

  1. 一种测试用例生成方法,其中,所述测试用例生成方法包括: A method for generating test cases, wherein the method for generating test cases includes:
    接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;Receiving a requirement document and analyzing the requirement document to generate a number of nodes corresponding to the requirement document, a scene description corresponding to the node, and the connection relationship between each of the nodes;
    根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景;Query the preset test scene corresponding to each node from the preset address according to the scene description of each node;
    根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。 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. To
  2. 如权利要求1所述的测试用例生成方法,其中,所述需求文档为流程图;所述接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系的步骤,包括:The test case generation method according to claim 1, wherein the requirement document is a flowchart; the receiving requirement document and analyzing the requirement document generate a number of nodes corresponding to the requirement document and corresponding The step of describing the scene description of the node and the connection relationship between each of the nodes includes:
    接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;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;
    对所述流程图进行灰度处理,生成灰度值矩阵;Perform grayscale processing on the flowchart to generate a grayscale value matrix;
    根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;Identify the node frame in the gray scale matrix according to the gray value matrix in combination with the arrow and the position of the connecting line, and set one of the node frames as one of the nodes;
    根据所述箭头及连接线位置生成各所述节点之间的连接关系;Generating the connection relationship between the nodes according to the arrow and the position of the connecting line;
    通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。The OCR text recognition technology is used to recognize the text in each of the node frames, and generate a scene description corresponding to the node.
  3. 如权利要求2所述的测试用例生成方法,其中,所述测试场景包括预设主干场景和预设分支场景;所述根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景的步骤包括:The test case generation method according to claim 2, wherein the test scenario includes a preset backbone scenario and a preset branch scenario; and the query is related to each node from a preset address according to the scenario description of each node. The steps of the corresponding preset test scenario include:
    根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;Querying the preset backbone scene corresponding to the current node from the preset address according to the scene description of the current node;
    若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;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;
    若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;If the preset backbone scene corresponding to the current node cannot be found from the preset address, determining that the connection relationship between the current node and the previous node is a branch process;
    根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;Sequentially determine the subsequent nodes connected to the current node according to the arrow and the position of the connecting line, and query the preset backbone scene corresponding to the subsequent node from the preset address according to the scene description of the subsequent node;
    根据查询结果确认各个所述节点之间的连接关系。Confirm the connection relationship between each of the nodes according to the query result.
  4. 如权利要求3所述的测试用例生成方法,其中,所述若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程的步骤之后,还包括:The test case generation method according to claim 3, wherein, if the preset backbone scene corresponding to the current node cannot be queried from the preset address, it is determined that the current node and the After the connection relationship between the previous nodes is the step of the branch process, it also includes:
    从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;Querying at least one of the preset branch scenarios corresponding to the previous node from the preset address;
    根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。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.
  5. 如权利要求4所述的测试用例生成方法,其中,所述根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景的步骤之后包括:The method for generating a test case according to claim 4, wherein, according to the scene description of the current node, a preset branch scene corresponding to the previous node is compared to obtain a preset branch scene corresponding to the current node. After the steps of setting up a branch scenario, include:
    获取所述上一节点对应的必须场景,判断与所述上一节点连接的各节点的所述预设分支场景是否包含全部所述必须场景;Acquiring the necessary scene corresponding to the previous node, and judging whether the preset branch scenes of each node connected to the previous node include all the necessary scenes;
    若与所述上一节点连接的各节点的所述预设分支场景未包含全部所述必须场景,则生成提示信息。If the preset branch scenes of the nodes connected to the previous node do not include all the necessary scenes, prompt information is generated.
  6. 如权利要求4所述的测试用例生成方法,其中,所述根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例的步骤包括:The method for generating test cases according to claim 4, wherein the preset test scenarios corresponding to each of the nodes are associated according to the connection relationship between the nodes, and each of the associated preset test scenarios corresponds to The steps of combining the test code to form a test case include:
    将所述连接关系为主干流程的节点相关联,形成至少一个主干节点链;Associating the connection relationship with the nodes of the backbone process to form at least one backbone node chain;
    接收用户根据所述主干节点链做出的节点链选择操作;Receiving a node chain selection operation made by a user according to the backbone node chain;
    根据所述节点链选择操作,将至少一个所述主干节点链中各所述节点对应的所述预设主干场景相关联,将关联的各所述预设主干场景所对应的测试代码组合形成主干用例;According to the node chain selection operation, the preset backbone scenes corresponding to each of the nodes in at least one backbone node chain are associated, and the test codes corresponding to each of the associated preset backbone scenes are combined to form the backbone Example;
    确定与所述主干节点链中各节点的连接关系为所述分支流程的节点,将为所述分支流程的节点所对应的所述预设分支场景的测试代码根据所述连接关系填充至所述主干用例中,形成测试用例。It is determined that the 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. In the main use case, a test case is formed.
  7. 如权利要求3所述的测试用例生成方法,其中,所述根据所述节点的场景描述从所述预设地址中查询与所述节点对应的预设主干场景的步骤,包括:The test case generation method according to claim 3, wherein the step of querying the preset backbone scene corresponding to the node from the preset address according to the scene description of the node comprises:
    获取与所述预设主干场景对应的第一关键词,判断所述节点的场景描述中是否存在所述第一关键词;Acquiring a first keyword corresponding to the preset backbone scene, and determining whether the first keyword exists in the scene description of the node;
    若所述场景描述中存在所述第一关键词,则设置所述节点对应于该第一关键词对应的预设主干场景。If the first keyword exists in the scene description, the node is set to correspond to the preset backbone scene corresponding to the first keyword.
  8. 一种测试用例生成装置,其中,所述测试用例生成装置包括:A test case generation device, wherein the 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 .
  9. 如权利要求8所述的测试用例生成装置,其中,所述需求文档为流程图;所述分析模块包括:8. The test case generation device according to claim 8, wherein the requirement document is a flowchart; the analysis module includes:
    第一识别单元,所述第一识别单元用于接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;A first recognition unit, the first recognition unit is configured to receive the flowchart, compare the flowchart with a preset graphic element template library, and recognize the positions of arrows and connecting lines in the flowchart;
    灰度处理单元,对所述流程图进行灰度处理,生成灰度值矩阵;A gray-scale processing unit, which performs gray-scale processing on the flowchart to generate a gray-scale value matrix;
    第二识别单元,所述第二识别单元用于根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;The second identification unit is configured to identify the node frame in the grayscale matrix in combination with the arrow and the position of the connecting line according to the grayscale value matrix, and set one of the node frames to one The node;
    所述第一识别单元还用于根据所述箭头及连接线位置生成各所述节点之间的连接关系;The first identification unit is further configured to generate the connection relationship between the nodes according to the position of the arrow and the connecting line;
    第三识别单元,所述第三识别单元用于通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。A third recognition unit, the third recognition unit is configured to recognize the text in each of the node frames through OCR text recognition technology, and generate a scene description corresponding to the node.
  10. 如权利要求9所述的测试用例生成装置,其中,所述测试场景包括预设主干场景和预设分支场景;所述查询模块包括:9. The test case generation device according to claim 9, wherein the test scenario includes a preset trunk scenario and a preset branch scenario; the query module includes:
    查询单元,所述查询单元用于根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;A query unit, the query unit is 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 determining unit, the determining unit is configured to determine that the connection relationship between the current node and the previous node is the backbone if the preset backbone scene corresponding to the current node is queried from the preset address Process;
    若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;If the preset backbone scene corresponding to the current node cannot be found from the preset address, determining that the connection relationship between the current node and the previous node is a branch process;
    所述查询单元还用于根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;The query unit is further configured to sequentially determine subsequent nodes connected to the current node according to the position of the arrow and the connecting line, and query the preset address corresponding to the subsequent node according to the scene description of the subsequent node The default backbone scene;
    所述判定单元还用于根据查询结果确认各个节点之间的连接关系。The determining unit is also used to confirm the connection relationship between the various nodes according to the query result.
  11. 如权利要求10所述的测试用例生成装置,其中,所述查询单元还用于从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;10. The test case generation device according to claim 10, wherein the query unit is further configured to query at least one of the preset branch scenarios corresponding to the previous node from the preset address;
    根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。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.
  12. 一种终端,其中,包括处理器、存储器、通信器以及存储在所述存储器上的可被所述处理器执行的计算机可读指令,其中,所述计算机可读指令被所述处理器执行时,实现如下步骤: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 , To achieve the following steps:
    接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;Receiving a requirement document and analyzing the requirement document to generate a number of nodes corresponding to the requirement document, a scene description corresponding to the node, and the connection relationship between each of the nodes;
    根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景;Query the preset test scene corresponding to each node from the preset address according to the scene description of each node;
    根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。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.
  13. 如权利要求12所述的终端,其中,所述需求文档为流程图;所述接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系的步骤,包括:The terminal according to claim 12, wherein the demand document is a flowchart; the receiving demand document, and analyzing the demand document, generate a number of nodes corresponding to the demand document, and the corresponding node The steps of the scene description and the connection relationship between each of the nodes include:
    接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;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;
    对所述流程图进行灰度处理,生成灰度值矩阵;Perform grayscale processing on the flowchart to generate a grayscale value matrix;
    根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;Identify the node frame in the gray scale matrix according to the gray value matrix in combination with the arrow and the position of the connecting line, and set one of the node frames as one of the nodes;
    根据所述箭头及连接线位置生成各所述节点之间的连接关系;Generating the connection relationship between the nodes according to the arrow and the position of the connecting line;
    通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。The OCR text recognition technology is used to recognize the text in each of the node frames, and generate a scene description corresponding to the node.
  14. 如权利要求13所述的终端,其中,所述测试场景包括预设主干场景和预设分支场景;所述根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景的步骤包括:The terminal according to claim 13, wherein the test scene includes a preset backbone scene and a preset branch scene; and the preset address is queried for the preset address corresponding to each node according to the scene description of each node. The steps to set up a test scenario include:
    根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;Querying the preset backbone scene corresponding to the current node from the preset address according to the scene description of the current node;
    若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;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;
    若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;If the preset backbone scene corresponding to the current node cannot be found from the preset address, determining that the connection relationship between the current node and the previous node is a branch process;
    根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;Sequentially determine the subsequent nodes connected to the current node according to the arrow and the position of the connecting line, and query the preset backbone scene corresponding to the subsequent node from the preset address according to the scene description of the subsequent node;
    根据查询结果确认各个所述节点之间的连接关系。Confirm the connection relationship between each of the nodes according to the query result.
  15. 如权利要求14所述的终端,其中,所述若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程的步骤之后,还包括:The terminal according to claim 14, wherein, if the preset backbone scene corresponding to the current node cannot be queried from the preset address, it is determined that the current node and the previous node After the connection relationship between the steps of the branch process, it also includes:
    从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;Querying at least one of the preset branch scenarios corresponding to the previous node from the preset address;
    根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。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.
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有计算机可读指令,其中,所述计算机可读指令被处理器执行时,实现如下步骤:A computer-readable storage medium, wherein computer-readable instructions are stored on the computer-readable storage medium, and when the computer-readable instructions are executed by a processor, the following steps are implemented:
    接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系;Receiving a requirement document and analyzing the requirement document to generate a number of nodes corresponding to the requirement document, a scene description corresponding to the node, and the connection relationship between each of the nodes;
    根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景;Query the preset test scene corresponding to each node from the preset address according to the scene description of each node;
    根据各个所述节点之间的连接关系关联各所述节点对应的预设测试场景,将关联的各所述预设测试场景所对应的测试代码组合形成测试用例。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.
  17. 如权利要求16所述的计算机可读存储介质,其中,所述需求文档为流程图;所述接收需求文档,并对所述需求文档进行分析,生成与所述需求文档对应数目的节点、对应所述节点的场景描述和各个所述节点之间的连接关系的步骤,包括:The computer-readable storage medium according to claim 16, wherein the requirement document is a flowchart; the receiving requirement document and analyzing the requirement document generate a number of nodes corresponding to the requirement document and corresponding The steps of the scene description of the node and the connection relationship between each of the nodes include:
    接收所述流程图,将所述流程图与预设图元模板库比对,识别出所述流程图中箭头及连接线的位置;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;
    对所述流程图进行灰度处理,生成灰度值矩阵;Perform grayscale processing on the flowchart to generate a grayscale value matrix;
    根据所述灰度值矩阵结合所述箭头及连接线位置,识别出所述灰度矩阵中的节点框,将一个所述节点框设置为一个所述节点;Identify the node frame in the gray scale matrix according to the gray value matrix in combination with the arrow and the position of the connecting line, and set one of the node frames as one of the nodes;
    根据所述箭头及连接线位置生成各所述节点之间的连接关系;Generating the connection relationship between the nodes according to the arrow and the position of the connecting line;
    通过OCR文字识别技术识别各所述节点框内的文字,生成对应所述节点的场景描述。The OCR text recognition technology is used to recognize the text in each of the node frames, and generate a scene description corresponding to the node.
  18. 如权利要求17所述的计算机可读存储介质,其中,所述测试场景包括预设主干场景和预设分支场景;所述根据各所述节点的场景描述从预设地址中查询与各所述节点对应的预设测试场景的步骤包括:17. The computer-readable storage medium according to claim 17, wherein the test scenario includes a preset backbone scenario and a preset branch scenario; and the query is made from a preset address according to the scenario description of each of the nodes. The steps of the preset test scenario corresponding to the node include:
    根据当前节点的场景描述从所述预设地址中查询与所述当前节点对应的预设主干场景;Querying the preset backbone scene corresponding to the current node from the preset address according to the scene description of the current node;
    若从所述预设地址中查询到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与上一节点之间的连接关系为主干流程;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;
    若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程;If the preset backbone scene corresponding to the current node cannot be found from the preset address, determining that the connection relationship between the current node and the previous node is a branch process;
    根据所述箭头及连接线位置依次确定与所述当前节点相连接的后续节点,根据所述后续节点的场景描述从所述预设地址中查询与所述后续节点对应的预设主干场景;Sequentially determine the subsequent nodes connected to the current node according to the arrow and the position of the connecting line, and query the preset backbone scene corresponding to the subsequent node from the preset address according to the scene description of the subsequent node;
    根据查询结果确认各个所述节点之间的连接关系。Confirm the connection relationship between each of the nodes according to the query result.
  19. 如权利要求18所述的计算机可读存储介质,其中,所述若从所述预设地址中查询不到与所述当前节点对应的所述预设主干场景,则判定所述当前节点与所述上一节点之间的连接关系为分支流程的步骤之后,还包括:The computer-readable storage medium according to claim 18, wherein if the preset backbone scene corresponding to the current node cannot be queried from the preset address, it is determined that the current node is After the above connection relationship between the nodes is the step of the branch process, it also includes:
    从所述预设地址中查询与所述上一节点对应的至少一个所述预设分支场景;Querying at least one of the preset branch scenarios corresponding to the previous node from the preset address;
    根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景。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.
  20. 如权利要求19所述的计算机可读存储介质,其中,所述根据所述当前节点的场景描述从与所述上一节点对应的预设分支场景中比对得到一个与所述当前节点对应的预设分支场景的步骤之后包括:The computer-readable storage medium according to claim 19, wherein the scene description of the current node compares the preset branch scenes corresponding to the previous node to obtain one corresponding to the current node After the steps of presetting the branch scene, include:
    获取所述上一节点对应的必须场景,判断与所述上一节点连接的各节点的所述预设分支场景是否包含全部所述必须场景;Acquiring the necessary scene corresponding to the previous node, and judging whether the preset branch scenes of each node connected to the previous node include all the necessary scenes;
    若与所述上一节点连接的各节点的所述预设分支场景未包含全部所述必须场景,则生成提示信息。 If the preset branch scenes of the nodes connected to the previous node do not include all the necessary scenes, prompt information is generated.
PCT/CN2019/122781 2019-05-21 2019-12-03 Test case generating method and apparatus, terminal, and computer readable storage medium WO2020233089A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910433511.5 2019-05-21
CN201910433511.5A CN110287104A (en) 2019-05-21 2019-05-21 Method for generating test case, device, terminal and computer readable storage medium

Publications (1)

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

Family

ID=68002437

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/122781 WO2020233089A1 (en) 2019-05-21 2019-12-03 Test case generating method and apparatus, terminal, and computer readable storage medium

Country Status (2)

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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597034A (en) * 2020-12-25 2021-04-02 深圳证券交易所 Test case generation method and device and computer readable storage medium
CN113590453A (en) * 2021-01-28 2021-11-02 腾讯科技(深圳)有限公司 Test case generation method and device and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110287104A (en) * 2019-05-21 2019-09-27 深圳壹账通智能科技有限公司 Method for generating test case, device, terminal and computer readable storage medium
CN114077534A (en) * 2020-08-11 2022-02-22 腾讯科技(深圳)有限公司 Test case generation method and device and computer readable storage medium
CN113377653B (en) * 2021-06-10 2023-09-26 北京京东振世信息技术有限公司 Method and device for generating test cases

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 (en) * 2017-12-05 2018-03-23 郑州云海信息技术有限公司 A kind of system detection method, device and medium
CN108595338A (en) * 2018-05-08 2018-09-28 平安普惠企业管理有限公司 Test case write method, device, computer equipment and storage medium
CN109710508A (en) * 2018-08-20 2019-05-03 平安普惠企业管理有限公司 Test method, test device, test equipment and computer readable storage medium
CN110287104A (en) * 2019-05-21 2019-09-27 深圳壹账通智能科技有限公司 Method for generating test case, device, terminal and computer readable storage medium

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 (en) * 2017-12-05 2018-03-23 郑州云海信息技术有限公司 A kind of system detection method, device and medium
CN108595338A (en) * 2018-05-08 2018-09-28 平安普惠企业管理有限公司 Test case write method, device, computer equipment and storage medium
CN109710508A (en) * 2018-08-20 2019-05-03 平安普惠企业管理有限公司 Test method, test device, test equipment and computer readable storage medium
CN110287104A (en) * 2019-05-21 2019-09-27 深圳壹账通智能科技有限公司 Method for generating test case, device, terminal and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112597034A (en) * 2020-12-25 2021-04-02 深圳证券交易所 Test case generation method and device and computer readable storage medium
CN113590453A (en) * 2021-01-28 2021-11-02 腾讯科技(深圳)有限公司 Test case generation method and device and storage medium

Also Published As

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

Similar Documents

Publication Publication Date Title
WO2020233089A1 (en) Test case generating method and apparatus, terminal, and computer readable storage medium
WO2020015067A1 (en) Data acquisition method, device, equipment and storage medium
WO2020082562A1 (en) Symbol identification method, apparatus, device, and storage medium
WO2016112558A1 (en) Question matching method and system in intelligent interaction system
WO2020119115A1 (en) Data verification method, device, apparatus, and storage medium
WO2020107761A1 (en) Advertising copy processing method, apparatus and device, and computer-readable storage medium
WO2020015064A1 (en) System fault processing method, apparatus, device and storage medium
WO2020119069A1 (en) Text generation method and device based on self-coding neural network, and terminal and medium
WO2020087978A1 (en) Risk control audit model generation method, apparatus and device and storage medium
WO2020233090A1 (en) Application configuration method, apparatus and device based on h5 page, and storage medium
WO2020000632A1 (en) Invoice issuing method, apparatus and device, and computer-readable storage medium
WO2020258657A1 (en) Abnormality detection method and apparatus, computer device and storage medium
WO2020119369A1 (en) Intelligent it operation and maintenance fault positioning method, apparatus and device, and readable storage medium
WO2020107591A1 (en) Double insurance limiting method, apparatus, device, and readable storage medium
WO2010123168A1 (en) Database management method and system
WO2020062661A1 (en) Method, device and apparatus for verifying consistency of contract data and storage medium
WO2019024485A1 (en) Data sharing method and device and computer readable storage medium
WO2021051558A1 (en) Knowledge graph-based question and answer method and apparatus, and storage medium
WO2020224251A1 (en) Block chain transaction processing method, device, apparatus and storage medium
WO2020062640A1 (en) Method, server and storage medium for switching dynamic copywriting language of terminal application
WO2015050321A1 (en) Apparatus for generating self-learning alignment-based alignment corpus, method therefor, apparatus for analyzing destructive expression morpheme by using alignment corpus, and morpheme analysis method therefor
WO2021215620A1 (en) Device and method for automatically generating domain-specific image caption by using semantic ontology
WO2020098078A1 (en) Method and apparatus for generating ocr training sample, device and readable storage medium
WO2020073494A1 (en) Webpage backdoor detecting method, device, storage medium and apparatus
WO2021027143A1 (en) Information pushing method, apparatus and device, and computer-readable storage medium

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