Executable test case generation method and device, equipment and storage medium
By obtaining the text test cases and interface transformation diagram of the object to be tested, the target scene nodes and action nodes are determined using semantic similarity calculations, and executable test cases are generated, which solves the problem of inefficient page interaction testing based on text test cases in the prior art, and realizes efficient automated testing.
Patent Information
- Application Number
- CN202411748736.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-21
AI Technical Summary
With the iterative update of application pages, the cost of page interaction testing based on text test cases gradually increases, resulting in inefficiency in testing.
By obtaining the text test cases and interface transformation diagram of the object to be tested, the target scene node and action node are determined using semantic similarity calculation to generate executable test cases.
The transformation of text test cases into executable test cases is implemented, which improves the automation efficiency of application page testing and reduces the cost of manual testing.
Smart Images

Figure CN119669077A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing, and in particular to a method, device, equipment and storage medium for generating executable test cases. Background Art
[0002] GUI (Graphical User Interface) is a way for users to interact with applications. To ensure the normal operation of pages in an application, testers need to perform page interaction testing based on test cases. However, with the iterative updates of pages in an application, the cost of manual testing based on text test cases by testers is becoming increasingly high.
[0003] Therefore, how to improve the page testing efficiency of application programs has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] In order to solve the above technical problem or at least partially solve the above technical problem, the present disclosure provides a method, apparatus, device and storage medium for generating an executable test case.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for generating an executable test case, the method comprising:
[0006] Obtain a text test case of the object to be tested, and an interface transition diagram of the object to be tested; wherein the text test case includes a plurality of test steps described in text, the test steps include description information of the page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on the page interaction data of the object to be tested, the interface transition diagram includes a plurality of scene nodes and an action node for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on the page information in the page interaction data, and the action nodes are annotated with action semantic information determined based on the interaction operation information in the page interaction data;
[0007] Based on the semantic similarity between the description information of the page to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition graph, determining the scene node corresponding to the description information of the page to be tested as the target scene node corresponding to the first test step;
[0008] Based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph, determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step;
[0009] Based on the target scene node and the target action node corresponding to the first test step, an executable test case corresponding to the text test case of the object to be tested is generated; wherein the executable test case includes the executable test code corresponding to the first test step.
[0010] In an optional implementation, the method of determining the scene node corresponding to the page description information to be tested as the target scene node corresponding to the first test step based on the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition graph includes:
[0011] Calculating the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of each scene node in the interface transition graph, and determining the scene nodes whose semantic similarity meets the preset similarity condition as candidate scene nodes corresponding to the page description information to be tested;
[0012] The target model is used to determine the scene node corresponding to the page description information to be tested from the candidate scene nodes corresponding to the page description information to be tested as the target scene node corresponding to the first test step.
[0013] In an optional implementation, before determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph, the method further includes:
[0014] Determine, from the action nodes in the interface transition graph, an action node that has a connection relationship with the target scene node as a first candidate action node corresponding to the page operation information to be tested;
[0015] Accordingly, the step of determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph includes:
[0016] Based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node, an action node corresponding to the page operation information to be tested is determined as a target action node corresponding to the first test step.
[0017] In an optional implementation, the step of determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node, includes:
[0018] Determining a second candidate action node corresponding to the page operation information to be tested based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node;
[0019] The target model is used to determine the action node corresponding to the page operation information to be tested from the second candidate action nodes corresponding to the page operation information to be tested as the target action node corresponding to the first test step.
[0020] In an optional implementation, before using the target model to determine the action node corresponding to the page operation information to be tested from the second candidate action nodes corresponding to the page operation information to be tested as the target action node corresponding to the first test step, the method further includes:
[0021] Determine a next-hop scene node of the second candidate action node from the interface transition graph, and obtain scene semantic information of the next-hop scene node;
[0022] Correspondingly, the step of using the target model to determine the action node corresponding to the page operation information to be tested from the second candidate action nodes corresponding to the page operation information to be tested as the target action node corresponding to the first test step includes:
[0023] The page operation information to be tested, the action semantic information corresponding to the second candidate action node, and the scene semantic information of the next-hop scene node of the second candidate action node are input into the target model. After being processed by the target model, the action node corresponding to the page operation information to be tested determined from the second candidate action node is output as the target action node corresponding to the first test step.
[0024] In an optional implementation manner, the method further includes:
[0025] If the target action node corresponding to the first test step is not successfully determined, continue to execute the step of determining the scene node corresponding to the page description information to be tested as the target scene node corresponding to the first test step based on the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition diagram, until the target action node corresponding to the first test step is determined.
[0026] In an optional implementation, after determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition diagram, the method further includes:
[0027] Determining the next hop scene node of the target action node from the interface transition graph based on semantic similarity;
[0028] Accordingly, the step of generating an executable test case corresponding to the text test case of the object to be tested based on the target scene node and the target action node corresponding to the first test step includes:
[0029] Based on the target scenario node, the target action node and the next-hop scenario node of the target action node corresponding to the first test step, construct a test link corresponding to the first test step;
[0030] An executable test case corresponding to the text test case of the object to be tested is generated based on the test link.
[0031] In an optional implementation manner, before obtaining the text test case of the object to be tested and the interface transition diagram of the object to be tested, the method further includes:
[0032] Obtaining page interaction data of the object to be tested by inserting a stub in the source code of the object to be tested; wherein the page interaction data includes page information and interaction operation information, the page information includes at least one of a page screenshot and page control attribute information, and the interaction operation information includes at least one of a page screenshot marked with an interaction position, page control information, and page control state information;
[0033] An interface transition diagram of the object to be tested is generated based on the page interaction data, and scene semantic information is annotated for scene nodes in the interface transition diagram based on the page information, and action semantic information is annotated for action nodes in the interface transition diagram based on the interactive operation information.
[0034] In a second aspect, the present disclosure provides a device for generating an executable test case, the device comprising:
[0035] A first acquisition module is used to acquire a text test case of an object to be tested, and an interface transition diagram of the object to be tested; wherein the text test case includes a plurality of test steps described in text, the test steps include description information of a page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on page interaction data of the object to be tested, the interface transition diagram includes a plurality of scene nodes and an action node for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on page information in the page interaction data, and the action nodes are annotated with action semantic information determined based on interaction operation information in the page interaction data;
[0036] A first determination module is used to determine, based on the semantic similarity between the description information of the page to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition diagram, the scene node corresponding to the description information of the page to be tested as the target scene node corresponding to the first test step;
[0037] A second determination module is used to determine, based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph, the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step;
[0038] A generation module is used to generate an executable test case corresponding to the text test case of the object to be tested based on the target scene node and target action node corresponding to the first test step; wherein the executable test case includes the executable test code corresponding to the first test step.
[0039] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement a method for generating executable test cases as provided in an embodiment of the present disclosure.
[0040] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the method for generating an executable test case as provided in an embodiment of the present disclosure.
[0041] In a fifth aspect, the present disclosure provides a computer program product, wherein the computer program product comprises a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.
[0042] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:
[0043] In the method for generating an executable test case provided by the embodiment of the present disclosure, first, a text test case of the object to be tested and an interface transition diagram of the object to be tested are obtained, wherein the text test case includes a plurality of test steps described in text, the test steps include description information of the page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on the page interaction data of the object to be tested, the interface transition diagram includes a plurality of scene nodes and an action node for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on the page information in the page interaction data, the action nodes are annotated with action semantic information determined based on the interaction operation information in the page interaction data, and then, based on the first test step in the text test case, Based on the semantic similarity between the description information of the page to be tested and the scene semantic information of the scene nodes in the interface transition diagram, the scene node corresponding to the description information of the page to be tested is determined as the target scene node corresponding to the first test step, and based on the semantic similarity between the operation information of the page to be tested in the first test step and the action semantic information of the action nodes in the interface transition diagram, the action node corresponding to the operation information of the page to be tested is determined as the target action node corresponding to the first test step, and then, based on the target scene node and the target action node corresponding to the first test step, an executable test case corresponding to the text test case of the object to be tested is generated, wherein the executable test case includes the executable test code corresponding to the first test step.
[0044] In the method for generating executable test cases provided by the embodiments of the present disclosure, by calculating semantic similarity based on an interface transition diagram annotated with semantic information and a text test case of the object to be tested, it is possible to convert the text test case into an executable test case, and subsequently use the executable test case to perform automated testing on the object to be tested. Compared with manual testing performed by testers based on text test cases, the embodiments of the present disclosure can improve the testing efficiency of the object to be tested as a whole. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0046] Figure 1 A flowchart of a method for generating an executable test case provided by an embodiment of the present disclosure;
[0047] Figure 2 A schematic diagram of an interface conversion diagram provided by an embodiment of the present disclosure;
[0048] Figure 3A process diagram of a method for generating an executable test case provided by an embodiment of the present disclosure;
[0049] Figure 4 A schematic diagram of a process for determining a target scene node provided by an embodiment of the present disclosure;
[0050] Figure 5 A schematic diagram of a process for determining a target action node provided by an embodiment of the present disclosure;
[0051] Figure 6 A schematic diagram of a process for determining a next-hop scene node of a target action node provided by an embodiment of the present disclosure;
[0052] Figure 7 A schematic diagram of the structure of a device for generating executable test cases provided in an embodiment of the present disclosure;
[0053] Figure 8 A schematic diagram of the structure of a device for generating executable test cases provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0054] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0055] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0056] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0057] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0058] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0059] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0060] GUI (Graphical User Interface) is a way for users to interact with applications. To ensure the normal operation of pages in an application, testers need to perform page interaction testing based on test cases. However, with the iterative updates of pages in an application, the cost of manual testing based on text test cases by testers is becoming increasingly high.
[0061] Therefore, how to improve the page testing efficiency of application programs has become a technical problem that needs to be solved urgently.
[0062] To this end, the embodiment of the present disclosure provides a method for generating an executable test case. Specifically, first, a text test case of an object to be tested and an interface transition diagram of the object to be tested are obtained, wherein the text test case includes a plurality of test steps described in text, the test steps include description information of a page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on page interaction data of the object to be tested, the interface transition diagram includes a plurality of scene nodes and action nodes for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on page information in the page interaction data, the action nodes are annotated with action semantic information determined based on interaction operation information in the page interaction data, and then, based on the first Based on the semantic similarity between the description information of the page to be tested in the test step and the scene semantic information of the scene node in the interface transition diagram, the scene node corresponding to the description information of the page to be tested is determined as the target scene node corresponding to the first test step, and based on the semantic similarity between the operation information of the page to be tested in the first test step and the action semantic information of the action node in the interface transition diagram, the action node corresponding to the operation information of the page to be tested is determined as the target action node corresponding to the first test step, and then, based on the target scene node and target action node corresponding to the first test step, an executable test case corresponding to the text test case of the object to be tested is generated, wherein the executable test case includes the executable test code corresponding to the first test step.
[0063] In the method for generating executable test cases provided by the embodiments of the present disclosure, by calculating semantic similarity based on an interface transition diagram annotated with semantic information and a text test case of the object to be tested, it is possible to convert the text test case into an executable test case, and subsequently use the executable test case to perform automated testing on the object to be tested. Compared with manual testing performed by testers based on text test cases, the embodiments of the present disclosure can improve the testing efficiency of the object to be tested as a whole.
[0064] Based on this, an embodiment of the present disclosure provides a method for generating an executable test case, which is introduced below in conjunction with a specific embodiment.
[0065] Figure 1 The present invention provides a flow chart of a method for generating an executable test case according to an embodiment of the present invention. The method can be performed by a device for generating an executable test case, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:
[0066] S101: Obtain a text test case of an object to be tested and an interface transition diagram of the object to be tested.
[0067] Among them, the text test case includes multiple test steps described in text, and the test steps include description information of the page to be tested and operation information of the page to be tested. The interface transition diagram is generated based on the page interaction data of the object to be tested. The interface transition diagram includes multiple scene nodes and action nodes for connecting two scene nodes. The scene nodes are annotated with scene semantic information determined based on the page information in the page interaction data, and the action nodes are annotated with action semantic information determined based on the interaction operation information in the page interaction data.
[0068] The method for generating executable test cases provided by the embodiments of the present disclosure is applied to a client. Specifically, the client can be deployed on terminals such as smart phones, tablet computers, and desktop computers.
[0069] The object to be tested may be an application or one or more functions on the application.
[0070] The text test case in the embodiment of the present disclosure may be a test case written in a natural language, and the text test case may be written by a developer.
[0071] Among them, the text test case contains test steps described in text form, and each test step contains description information of the page to be tested and operation information of the page to be tested, which are used to describe specific test scenarios and test requirements. In other words, the test steps in the text test case can characterize how to operate the object to be tested and how to judge whether the test results meet expectations.
[0072] The description information of the page to be tested is used to describe the page to be tested in the object to be tested, and the description information of the page to be tested may include information related to the page to be tested, such as testing a product details page displayed on an application, and the description information of the page to be tested may include "product details page"; the operation information of the page to be tested is used to describe the relevant interactive operations for the required test page in the object to be tested, that is, the operation information of the page to be tested indicates the specific interactive operations to be performed on the page to be tested. For example, in the product details page in the above example, the operation information for the product details page may include operations such as click to buy.
[0073] The interface transition diagram in the embodiment of the present disclosure is generated based on the page interaction data of the object to be tested, and the page interaction data may include page information and interaction operation information, that is, information generated during the interaction between the user and the object to be tested. For example, the page interaction data may be the order in which the user jumps between different pages, the type of interaction operation performed by the user on each page, etc.
[0074] The interface transition diagram is composed of scene nodes and action nodes, wherein the scene node is used to indicate the page scene in the page interaction data, for example, the page displayed when the application is opened can be a scene node; the action node is used to connect two scene nodes, and can represent the interactive operations required to be performed from one page scene to another page scene, for example, from the page displayed when the application is opened, click on the user avatar to enter the personal user homepage, wherein the operation of "clicking on the user avatar" can be represented by an action node.
[0075] Since the scene node is used to indicate the page scene in the page interaction data, and the action node can represent the interactive operation required to switch from one page scene to another, the disclosed embodiment annotates the scene semantic information on the scene nodes in the interface transition diagram, and annotates the action semantic information on the action nodes in the interface transition diagram, so that the user can understand the link flow in the interface transition diagram. Among them, the scene semantic information is determined based on the page information in the page interaction data, that is, by analyzing the data related to the page itself in the page interaction data, the annotated scene name and description are determined for each scene node, that is, for each scene node, an information that can describe the meaning of the scene is determined, for example, for the scene node "the page displayed after opening the application", the annotated scene semantic information can be "home page".
[0076] The action semantic information is determined based on the interactive operation information in the page interaction data, that is, according to the interactive operation (e.g., click, slide, input) performed by the user when switching between pages, each action node is labeled with an action name and an action description, that is, a piece of information that can explain the interactive operation. The action name can be composed of the action type and the operated control, and the action description can be used to describe the action content and the effect of the action. For example, the action semantic information can be "click the search control".
[0077] like Figure 2 , which is a schematic diagram of an interface transition diagram provided by an embodiment of the present disclosure. The scene nodes and action nodes in the interface transition diagram include a scene node 201 and the scene semantic information corresponding to the scene node 201, and an action node 202 and the action semantic information of the action node.
[0078] In an optional implementation, in order to generate an interface transition diagram for the object to be tested, the page interaction data of the object to be tested can be obtained by inserting a stub. Specifically, insert a stub in the source code of the object to be tested, collect page information and interactive operation information as page interaction data, wherein the page information may include at least one of a page screenshot and page control attribute information, and the page control attribute information includes the size, position, color, font, etc. of the control; the page interactive operation information may include at least one of a page screenshot marked with an interactive position, page control information, and page control status information. The page screenshot marked with an interactive position can represent the area where the page interactive operation occurs, and the page control information may include the name, ID, and other information of the control. The page control status information is used to represent the state change of the control during the interaction process.
[0079] After the page interaction data is obtained, an interface transition diagram of the object to be tested is generated based on the page interaction data, and scene semantic information is annotated for scene nodes in the interface transition diagram based on page information in the page interaction data, and action semantic information is annotated for action nodes in the interface transition diagram based on interactive operation information in the page interaction data. The action semantic information and scene semantic information can be annotated for action nodes and scene nodes in the interface transition diagram by manual annotation.
[0080] In an optional implementation, a method for generating an interface transition diagram of an object to be tested based on page interaction data may include: performing scene clustering and action clustering based on the page interaction data to form an interface transition diagram, wherein scene clustering may refer to aggregating the same or similar scenes in the page interaction data, and action clustering may refer to aggregating the same or similar actions in the interactive operations in the page interaction data. Scene clustering and action clustering may be specifically implemented based on scene clustering-related algorithms and action clustering-related algorithms. The present disclosure does not impose any restrictions on the method for generating an interface transition diagram based on page interaction data.
[0081] S102: Based on the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition diagram, determine the scene node corresponding to the page description information to be tested as the target scene node corresponding to the first test step.
[0082] The first test step may be any test step in a text test case.
[0083] In an optional implementation, a preset similarity condition may be set to determine the scene node corresponding to the page description information to be tested, and the preset similarity condition may be preset based on demand. The preset similarity condition may include a condition that the semantic similarity exceeds a similarity threshold, and the similarity threshold may be preset based on demand. Specifically, the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of each scene node in the interface transition diagram is calculated, and the scene node whose semantic similarity meets the preset similarity condition is determined as the candidate scene node corresponding to the page description information to be tested.
[0084] Among them, for calculating the semantic similarity between the page description information to be tested in the above-mentioned first test step and the scene semantic information of each scene node in the interface transition diagram, determining the candidate scene node corresponding to the page description information to be tested can include extracting a target scene vector from the page description information to be tested in the first test step, and extracting a semantic vector from the scene semantic information of each scene node, and then matching the target scene vector with the semantic vector of each scene node for semantic similarity, determining a semantic vector whose semantic similarity meets a preset similarity condition, and then determining the scene node corresponding to the semantic vector as the candidate scene node corresponding to the page description information to be tested in the first test step, and the number of candidate scene nodes can be one or more.
[0085] On the basis of the above embodiment, in order to ensure that the first test step can match the accurate target scene node, the target scene node corresponding to the first test step can also be determined from the candidate scene nodes using the target model based on the candidate scene nodes corresponding to the page description information to be tested.
[0086] In an optional implementation, based on determining the candidate scene nodes corresponding to the page description information to be tested, the scene semantic information of the candidate scene nodes and the page description information to be tested in the first test step are input into the target model. After being processed by the target model, the scene node corresponding to the page description information to be tested is determined from the candidate scene nodes corresponding to the page description information to be tested as the target scene node corresponding to the above-mentioned first test step.
[0087] S103: Based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition diagram, determine the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step.
[0088] After determining the target scene node corresponding to the first test step from the interface transition diagram, continue to determine the target action node corresponding to the first test step from the interface transition diagram. In actual applications, in order to improve the matching efficiency of the target action nodes, the number of candidate action nodes can be narrowed down based on the target scene node corresponding to the first test step.
[0089] In an optional implementation, based on determining the target scene node corresponding to the first test step from the interface transition diagram, an action node having a connection relationship with the target scene node is determined from the action nodes in the interface transition diagram as the first candidate action node corresponding to the page operation information to be tested in the first test step.
[0090] In an optional implementation, after obtaining the first candidate action node corresponding to the page operation information to be tested in the first test step, the target action node corresponding to the first test step can also be determined based on the semantic similarity. Specifically, based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node, the action node corresponding to the page operation information to be tested can be determined as the target action node corresponding to the first test step. In other words, the semantic similarity between the above-mentioned page operation information to be tested and the action semantic information of the first candidate action node is calculated, and the first candidate action node whose semantic similarity meets the preset similarity condition is determined as the target action node corresponding to the first test step.
[0091] Among them, for calculating the semantic similarity between the page operation information to be tested in the above-mentioned first test step and the action semantic information of the first candidate action node, determining the target action node corresponding to the first test step can include extracting the target action vector from the page operation information to be tested in the first test step, and extracting the semantic vector from the action semantic information of the first candidate action node, matching the target action vector with the semantic vectors of each first candidate action node for semantic similarity, determining the semantic vector whose semantic similarity meets the preset similarity condition, and then determining the first candidate action node corresponding to the semantic vector as the target action node corresponding to the first test step.
[0092] In another optional implementation, in order to ensure that the first test step can match the accurate target action node, the target action node corresponding to the first test step can also be determined from the first candidate target node based on the semantic similarity and the target model.
[0093] Specifically, based on the determination of the first candidate action node corresponding to the page operation information to be tested from the interface transition diagram, the second candidate action node corresponding to the page operation information to be tested is determined based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node. Then, the action semantic information of the second candidate action node and the page operation information to be tested are input into the target model, and after being processed by the target model, the action node corresponding to the page operation to be tested is determined from the second candidate action node as the target action node corresponding to the first test step.
[0094] Among them, based on the semantic similarity between the operation information of the page to be tested in the first test step and the action semantic information of the first candidate action node, determining the second candidate action node corresponding to the operation information of the page to be tested can include: extracting the target action vector from the operation information of the page to be tested in the first test step, and extracting the semantic vector from the action semantic information of the first candidate action node, matching the target action vector with the semantic vectors of each first candidate action node for semantic similarity, determining the semantic vector whose semantic similarity meets the preset similarity condition, and then determining the first candidate action node corresponding to the semantic vector as the second candidate action node corresponding to the operation information of the page to be tested.
[0095] In practical applications, in the process of matching the target node for the first test step, the embodiment of the present disclosure may also set a fault tolerance mechanism to ensure that the first test step can match the corresponding target node, thereby ensuring the normal operation of the method for generating executable test cases. The target node includes a target scene node and a target action node, and the fault tolerance mechanism may include a matching fallback method, that is, if the corresponding target node is not successfully matched for the first test step, then fall back to the previous target node and re-match the target node for the first test step.
[0096] In an optional implementation, taking the case where the target action node is matched with the first test step and the previous node of the target action node is the target scene node corresponding to the first test step as an example, in the process of determining the corresponding target action node for the first test step, if the target action node corresponding to the first test step is not successfully determined from the interface transition diagram, then the process goes back to the previous target scene node and re-executes the semantic similarity between the description information of the page to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition diagram to determine the candidate scene node, and uses the target model to re-determine the scene node corresponding to the description information of the page to be tested as the target scene node corresponding to the first test step, until the target action node corresponding to the first test step can be determined.
[0097] On the basis of the above embodiments, in order to reduce the probability of failing to successfully determine the target action node corresponding to the first test step from the interface transition diagram again, the disclosed embodiments can also filter out the target scene nodes determined last time using the target model from the target scene nodes re-determined this time using the target model, so as to reduce the probability of matching failure when determining the target action node corresponding to the first test step from the interface transition diagram based on the current target scene node.
[0098] S104: Based on the target scenario node and the target action node corresponding to the first test step, generate an executable test case corresponding to the text test case of the object to be tested.
[0099] Among them, the executable test case includes executable test code corresponding to the first test step.
[0100] That is to say, by determining the corresponding target scene node and target action node for the first test step from the interface conversion diagram, a test case in the form of executable code can be constructed to complete automated testing and improve the test efficiency of the object to be tested. Among them, based on determining the corresponding target scene node and target action node for the first test step from the interface conversion diagram, a method for constructing a test case in the form of executable code can include forming a test case in the form of executable code based on the code information identified by the target scene node and the target action node.
[0101] In an optional implementation, after determining the target scene node and target action node corresponding to the first test step, the next hop scene node of the target action node can also be determined from the interface transition diagram based on semantic similarity to build a complete test link. Specifically, based on the description information of the page to be tested in the first test step, semantic similarity matching is performed with the scene semantic information of the next hop scene node that has a connection relationship with the target action node in the interface transition diagram, and then the next hop scene node of the target action node is determined, and then, based on the target scene node, the target action node and the next hop scene node of the target action node, the test link corresponding to the first test step is constructed, and then based on the test link, an executable test case corresponding to the text test case of the object to be tested is generated.
[0102] Among them, based on the description information of the page to be tested in the first test step, semantic similarity matching is performed with the scene semantic information of the next hop scene node that has a connection relationship with the target action node in the interface transition diagram, and then the method of determining the next hop scene node of the target action node can include: extracting the target scene vector of the description information of the page to be tested from the first test step, and extracting the semantic vector from the scene semantic information of the next hop scene node that has a connection relationship with the target action node, performing semantic similarity matching between the target scene vector and the semantic vector of the next hop scene node, taking the next hop scene node corresponding to the semantic vector that meets the preset similarity condition as the candidate next hop scene node, and then using the target model, inputting the scene semantic information of the candidate next hop scene node and the page description information to be tested into the target model, and outputting the next hop scene node of the target action node after being processed by the target model.
[0103] The method of generating the executable test case corresponding to the text test case of the object to be tested based on the test link may include generating the executable test case corresponding to the text test case of the object to be tested based on the test link using other methods such as a code generation tool. This is not limited in the embodiments of the present disclosure.
[0104] The method for generating an executable test case provided by the embodiment of the present disclosure specifically comprises the following steps: first, obtaining a text test case of an object to be tested and an interface transition diagram of the object to be tested, wherein the text test case comprises a plurality of test steps described in text, the test steps comprise description information of a page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on page interaction data of the object to be tested, the interface transition diagram comprises a plurality of scene nodes and an action node for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on page information in the page interaction data, the action nodes are annotated with action semantic information determined based on interaction operation information in the page interaction data, and then, based on the first test step in the text test case, Based on the semantic similarity between the page description information to be tested in the step and the scene semantic information of the scene node in the interface transition diagram, the scene node corresponding to the page description information to be tested is determined as the target scene node corresponding to the first test step, and, based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition diagram, the action node corresponding to the page operation information to be tested is determined as the target action node corresponding to the first test step, and then, based on the target scene node and the target action node corresponding to the first test step, an executable test case corresponding to the text test case of the object to be tested is generated, wherein the executable test case includes the executable test code corresponding to the first test step.
[0105] In the method for generating executable test cases provided by the embodiments of the present disclosure, by calculating semantic similarity based on an interface transition diagram annotated with semantic information and a text test case of the object to be tested, it is possible to convert the text test case into an executable test case, and subsequently use the executable test case to perform automated testing on the object to be tested. Compared with manual testing performed by testers based on text test cases, the embodiments of the present disclosure can improve the testing efficiency of the object to be tested as a whole.
[0106] In another optional implementation, in order to effectively utilize the post-processing information to improve the efficiency of generating executable test cases, the target action node corresponding to the first test step can be determined based on the next hop scenario node of the second candidate action node on the basis of the second candidate action node corresponding to the operation information of the page to be tested determined above. The post-processing information may include relevant information of the post-processing node that has a connection relationship with the second candidate node after the second candidate action node is determined.
[0107] Specifically, first, based on the target scene node corresponding to the determined first test step, an action node having a connection relationship with the target scene node is determined from the action nodes in the interface transition graph as the first candidate action node corresponding to the operation information of the page to be tested, and based on the semantic similarity between the operation information of the page to be tested and the action semantic information of the first candidate action node, the second candidate action node corresponding to the operation information of the page to be tested is determined, and then, the next-hop scene node of the second candidate action node is determined from the interface transition graph, and the scene semantic information of the next-hop scene node is obtained.
[0108] Then, the operation information of the page to be tested, the action semantic information of the second candidate action node, and the scene semantic information of the next scene node of the second candidate action node are input into the target model. After being processed by the target model, the action node corresponding to the operation information of the page to be tested is output as the target action node corresponding to the first test step.
[0109] In order to facilitate understanding of the content of the above embodiment, the present disclosure also provides a flow chart of a method for generating an executable test case, referring to Figure 3 Take the case where test step A corresponds to three target nodes, including two target scene nodes and one target action node. Among them, one of the two target scene nodes can be a front scene node, and the other can be a back scene node.
[0110] In an optional implementation, a test step A and an interface transition diagram in a text test case of the object to be tested are obtained, and semantic similarity matching is performed based on the test page description information and the test page operation information of test step A and the scene semantic information of each scene node and the action semantic information of the action node in the interface transition diagram, and the scene nodes and action nodes whose semantic similarity meets a preset similarity condition are determined as the scene node A and action node B of test step A and scene node C (the next-hop scene node of the action node), and then a test link corresponding to test step A is generated based on scene node A, action node B and scene node C, and then an executable test case corresponding to the text test case of the object to be tested is generated based on the code information identified by each node in the test link.
[0111] Among them, for the process of determining the corresponding scene node A in test step A, refer to Figure 4 , is a schematic diagram of determining a target scene node provided by an embodiment of the present disclosure. Take the target scene node as scene node A as an example.
[0112] In an optional implementation, based on the page description information to be tested in test step A, a target scene vector is extracted from the page description information to be tested, and the semantic vectors of each scene node in the interface transition diagram are obtained from the target database, and semantic similarity matching is performed between the target scene node and the semantic vectors of each scene node in the interface transition diagram, and the scene node corresponding to the semantic vector whose semantic similarity meets a preset similarity condition is determined as the candidate scene node corresponding to the page description information to be tested, so as to reduce the number of candidate scene nodes.
[0113] Then, the scene semantic information of the candidate scene node and the description information of the page to be tested are input into the target model, and after being processed by the target model, the scene node A corresponding to the test step A is output. If the scene node A corresponding to the first test step is not successfully matched, the step of matching the semantic similarity between the target scene vector based on the description information of the page to be tested and the semantic vector of the scene node in the interface transition graph is re-executed until the scene node A corresponding to the first test step is matched.
[0114] Based on the matching of the corresponding scene node A for test step A, continue to determine the corresponding action node B for test step A. Figure 5 , which is a schematic diagram of determining a target action node provided in an embodiment of the present disclosure.
[0115] In an optional implementation, based on scene node A corresponding to test step A, an action node having a connection relationship with scene node A is determined from an interface transition diagram as the first candidate action node for the page operation information to be tested. Then, a target action vector is extracted from the page operation information to be tested in test step A, and a semantic vector of the first candidate action node is obtained from the interface transition diagram. Semantic similarity matching is performed between the target action vector and the semantic vector of the first candidate action node. The first candidate action node corresponding to the semantic vector whose semantic similarity meets a preset similarity condition is determined as the second candidate action node corresponding to the page description information to be tested, thereby reducing the number of candidate action nodes.
[0116] In an optional implementation, after determining the second candidate action node, in order to effectively utilize the post-process information to determine the accurate action node B for test step A, the next-hop scene node of the second candidate node can be determined from the interface transition diagram based on the second candidate action node, and the scene semantic information of the next-hop scene node can be obtained. The action semantic information of the second candidate action node, the scene semantic information of the next-hop scene node, and the page operation information to be tested are input into the target model. After processing by the target model, the action node corresponding to the page operation information to be tested is determined from the second candidate action node as the action node B corresponding to test step A.
[0117] If the action node B corresponding to test step A is not successfully matched, then fall back to the step of determining scene node A for test step A (refer to the above Figure 4 ) until the action node B corresponding to the first test step is matched.
[0118] In an optional implementation, after the corresponding action node B is matched for test step A, in order to form a complete test link, it is also necessary to determine the next hop scene node of action node B based on the description information of the page to be tested of test step A and the semantic similarity, that is, the post-scene node of test step A, that is, scene node C. Figure 6 , which is a schematic diagram of determining a next-hop scene node of a target action node provided by an embodiment of the present disclosure.
[0119] Specifically, a target scene vector is extracted from the description information of the page to be tested in test step A, and a next-hop scene node having a connection relationship with action node B is obtained from the interface transition graph, and a semantic vector of the next-hop scene node is obtained from the interface transition graph. The target scene vector and the semantic vector of the next-hop scene node are matched for semantic similarity, and the next-hop scene node corresponding to the semantic vector whose semantic similarity meets a preset similarity condition is used as a candidate next-hop scene node of action node B. Then, the scene semantic information of the candidate next-hop scene node of action node B and the description information of the page to be tested are input into the target model. After being processed by the target model, the next-hop scene node of action node B, i.e., scene node C, is output.
[0120] In order to implement the above embodiments, the present disclosure also proposes a device for generating executable test cases. Figure 7 This is a schematic diagram of the structure of a device for generating executable test cases provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 7 As shown, the device comprises:
[0121] The first acquisition module 701 is used to acquire a text test case of the object to be tested, and an interface transition diagram of the object to be tested; wherein the text test case includes a plurality of test steps described in text, the test steps include description information of the page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on the page interaction data of the object to be tested, the interface transition diagram includes a plurality of scene nodes and an action node for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on the page information in the page interaction data, and the action nodes are annotated with action semantic information determined based on the interaction operation information in the page interaction data;
[0122] A first determination module 702 is used to determine, based on the semantic similarity between the description information of the page to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition diagram, the scene node corresponding to the description information of the page to be tested as the target scene node corresponding to the first test step;
[0123] A second determination module 703 is used to determine the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition diagram;
[0124] The generation module 704 is used to generate an executable test case corresponding to the text test case of the object to be tested based on the target scene node and the target action node corresponding to the first test step; wherein the executable test case includes the executable test code corresponding to the first test step.
[0125] In an optional implementation manner, the first determining module includes:
[0126] A first determination submodule is used to calculate the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of each scene node in the interface transition diagram, and determine the scene nodes whose semantic similarity meets the preset similarity condition as candidate scene nodes corresponding to the page description information to be tested;
[0127] The second determination submodule is used to determine, by using a target model, a scene node corresponding to the page description information to be tested from candidate scene nodes corresponding to the page description information to be tested as a target scene node corresponding to the first test step.
[0128] In an optional implementation manner, the device further includes:
[0129] A third determination module is used to determine, from the action nodes in the interface transition graph, an action node having a connection relationship with the target scene node as a first candidate action node corresponding to the page operation information to be tested;
[0130] Accordingly, the second determining module is specifically configured to:
[0131] Based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node, an action node corresponding to the page operation information to be tested is determined as a target action node corresponding to the first test step.
[0132] In an optional implementation manner, the second determining module includes:
[0133] A third determination submodule, configured to determine a second candidate action node corresponding to the page operation information to be tested based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node;
[0134] The third determination submodule is used to determine, by using a target model, an action node corresponding to the page operation information to be tested from the second candidate action nodes corresponding to the page operation information to be tested as a target action node corresponding to the first test step.
[0135] In an optional implementation, the device further includes:
[0136] A first acquisition module, configured to determine a next-hop scene node of the second candidate action node from the interface transition graph, and acquire scene semantic information of the next-hop scene node;
[0137] Accordingly, the third determining submodule is specifically used for:
[0138] The page operation information to be tested, the action semantic information corresponding to the second candidate action node, and the scene semantic information of the next-hop scene node of the second candidate action node are input into the target model. After being processed by the target model, the action node corresponding to the page operation information to be tested determined from the second candidate action node is output as the target action node corresponding to the first test step.
[0139] In an optional implementation, the device further includes:
[0140] The third determination submodule is used to continue executing the step of determining the scene node corresponding to the page description information to be tested as the target scene node corresponding to the first test step if the target action node corresponding to the first test step is not successfully determined, based on the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition diagram, until the target action node corresponding to the first test step is determined.
[0141] In an optional implementation, the device further includes:
[0142] A fourth determination module, used to determine the next hop scene node of the target action node from the interface transition graph based on semantic similarity;
[0143] Accordingly, the generating module includes:
[0144] A construction module, used to construct a test link corresponding to the first test step based on a target scene node, a target action node and a next-hop scene node of the target action node corresponding to the first test step;
[0145] A generating submodule is used to generate an executable test case corresponding to the text test case of the object to be tested based on the test link.
[0146] In an optional implementation, the device further includes:
[0147] A second acquisition module is used to acquire page interaction data of the object to be tested by inserting a stub in the source code of the object to be tested; wherein the page interaction data includes page information and interaction operation information, the page information includes at least one of a page screenshot and page control attribute information, and the interaction operation information includes at least one of a page screenshot marked with an interaction position, page control information, and page control status information;
[0148] A labeling module is used to generate an interface transition diagram of the object to be tested based on the page interaction data, and to label scene semantic information for scene nodes in the interface transition diagram based on the page information, and to label action semantic information for action nodes in the interface transition diagram based on the interactive operation information.
[0149] In the device for generating executable test cases provided by the embodiment of the present disclosure, specifically, first, a text test case of the object to be tested and an interface transition diagram of the object to be tested are obtained, wherein the text test case includes a plurality of test steps described in text, the test steps include description information of the page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on the page interaction data of the object to be tested, the interface transition diagram includes a plurality of scene nodes and action nodes for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on the page information in the page interaction data, the action nodes are annotated with action semantic information determined based on the interaction operation information in the page interaction data, and then, based on the first test in the text test case, Based on the semantic similarity between the description information of the page to be tested in the step and the scene semantic information of the scene node in the interface transition diagram, the scene node corresponding to the description information of the page to be tested is determined as the target scene node corresponding to the first test step, and based on the semantic similarity between the operation information of the page to be tested in the first test step and the action semantic information of the action node in the interface transition diagram, the action node corresponding to the operation information of the page to be tested is determined as the target action node corresponding to the first test step, and then, based on the target scene node and target action node corresponding to the first test step, an executable test case corresponding to the text test case of the object to be tested is generated, wherein the executable test case includes the executable test code corresponding to the first test step.
[0150] In the method for generating executable test cases provided by the embodiments of the present disclosure, by calculating semantic similarity based on an interface transition diagram annotated with semantic information and a text test case of the object to be tested, it is possible to convert the text test case into an executable test case, and subsequently use the executable test case to perform automated testing on the object to be tested. Compared with manual testing performed by testers based on text test cases, the embodiments of the present disclosure can improve the testing efficiency of the object to be tested as a whole.
[0151] The device for generating executable test cases provided in the embodiments of the present disclosure can execute the method for generating executable test cases provided in any embodiment of the present disclosure, and has functional modules and beneficial effects corresponding to the execution method.
[0152] In order to implement the above embodiments, the present disclosure also proposes a computer program product, including a computer program / instruction, which implements the method for generating executable test cases in the above embodiments when executed by a processor.
[0153] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure also provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the method for generating executable test cases described in the embodiments of the present disclosure.
[0154] In addition, the present disclosure also provides a device for generating executable test cases, see Figure 8 As shown, it may include:
[0155] Processor 801, memory 802, input device 803 and output device 804. The number of processors 801 in the device for generating executable test cases can be one or more. Figure 8 In some embodiments of the present disclosure, the processor 801, the memory 802, the input device 803 and the output device 804 may be connected via a bus or other means, wherein: Figure 8 The example of connecting through bus is taken in the following.
[0156] The memory 802 can be used to store software programs and modules. The processor 801 executes various functional applications and data processing of the device for generating executable test cases by running the software programs and modules stored in the memory 802. The memory 802 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc. In addition, the memory 802 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The input device 803 can be used to receive input digital or character information, and generate signal input related to user settings and function control of the device for generating executable test cases.
[0157] Specifically in this embodiment, the processor 801 will load the executable files corresponding to the processes of one or more applications into the memory 802 according to the following instructions, and the processor 801 will run the applications stored in the memory 802, thereby realizing the various functions of the above-mentioned executable test case generation device.
[0158] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0159] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating an executable test case, characterized in that: include: Obtain a text test case of the object to be tested, and an interface transition diagram of the object to be tested; wherein the text test case includes a plurality of test steps described in text, the test steps include description information of the page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on the page interaction data of the object to be tested, the interface transition diagram includes a plurality of scene nodes and an action node for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on the page information in the page interaction data, and the action nodes are annotated with action semantic information determined based on the interaction operation information in the page interaction data; Based on the semantic similarity between the description information of the page to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition graph, determining the scene node corresponding to the description information of the page to be tested as the target scene node corresponding to the first test step; Based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph, determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step; Based on the target scene node and the target action node corresponding to the first test step, an executable test case corresponding to the text test case of the object to be tested is generated; wherein the executable test case includes the executable test code corresponding to the first test step.
2. The method according to claim 1, characterized in that The step of determining the scene node corresponding to the page description information to be tested as the target scene node corresponding to the first test step based on the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition graph includes: Calculating the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of each scene node in the interface transition graph, and determining the scene nodes whose semantic similarity meets the preset similarity condition as candidate scene nodes corresponding to the page description information to be tested; The target model is used to determine the scene node corresponding to the page description information to be tested from the candidate scene nodes corresponding to the page description information to be tested as the target scene node corresponding to the first test step.
3. The method according to claim 1, characterized in that Before determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph, the method further includes: Determine, from the action nodes in the interface transition graph, an action node that has a connection relationship with the target scene node as a first candidate action node corresponding to the page operation information to be tested; Accordingly, the step of determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph includes: Based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node, an action node corresponding to the page operation information to be tested is determined as a target action node corresponding to the first test step.
4. The method according to claim 3, characterized in that The step of determining, based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node, the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step includes: Determining a second candidate action node corresponding to the page operation information to be tested based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the first candidate action node; The target model is used to determine the action node corresponding to the page operation information to be tested from the second candidate action nodes corresponding to the page operation information to be tested as the target action node corresponding to the first test step.
5. The method according to claim 4, characterized in that Before determining the action node corresponding to the page operation information to be tested from the second candidate action nodes corresponding to the page operation information to be tested using the target model as the target action node corresponding to the first test step, the method further includes: Determine a next-hop scene node of the second candidate action node from the interface transition graph, and obtain scene semantic information of the next-hop scene node; Correspondingly, the step of using the target model to determine the action node corresponding to the page operation information to be tested from the second candidate action nodes corresponding to the page operation information to be tested as the target action node corresponding to the first test step includes: The page operation information to be tested, the action semantic information corresponding to the second candidate action node, and the scene semantic information of the next-hop scene node of the second candidate action node are input into the target model. After being processed by the target model, the action node corresponding to the page operation information to be tested determined from the second candidate action node is output as the target action node corresponding to the first test step.
6. The method according to claim 4, characterized in that The method further comprises: If the target action node corresponding to the first test step is not successfully determined, continue to execute the step of determining the scene node corresponding to the page description information to be tested as the target scene node corresponding to the first test step based on the semantic similarity between the page description information to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition diagram, until the target action node corresponding to the first test step is determined.
7. The method according to claim 1, characterized in that After determining the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph, the method further includes: Determining the next hop scene node of the target action node from the interface transition graph based on semantic similarity; Accordingly, the step of generating an executable test case corresponding to the text test case of the object to be tested based on the target scene node and the target action node corresponding to the first test step includes: Based on the target scenario node, the target action node and the next-hop scenario node of the target action node corresponding to the first test step, construct a test link corresponding to the first test step; An executable test case corresponding to the text test case of the object to be tested is generated based on the test link.
8. The method according to claim 1, characterized in that Before obtaining the text test case of the object to be tested and the interface conversion diagram of the object to be tested, the method further includes: Obtaining page interaction data of the object to be tested by inserting a stub in the source code of the object to be tested; wherein the page interaction data includes page information and interaction operation information, the page information includes at least one of a page screenshot and page control attribute information, and the interaction operation information includes at least one of a page screenshot marked with an interaction position, page control information, and page control state information; An interface transition diagram of the object to be tested is generated based on the page interaction data, and scene semantic information is annotated for scene nodes in the interface transition diagram based on the page information, and action semantic information is annotated for action nodes in the interface transition diagram based on the interactive operation information.
9. A device for generating executable test cases, characterized in that: The device comprises: A first acquisition module is used to acquire a text test case of an object to be tested, and an interface transition diagram of the object to be tested; wherein the text test case includes a plurality of test steps described in text, the test steps include description information of a page to be tested and operation information of the page to be tested, the interface transition diagram is generated based on page interaction data of the object to be tested, the interface transition diagram includes a plurality of scene nodes and an action node for connecting two scene nodes, the scene nodes are annotated with scene semantic information determined based on page information in the page interaction data, and the action nodes are annotated with action semantic information determined based on interaction operation information in the page interaction data; A first determination module is used to determine, based on the semantic similarity between the description information of the page to be tested in the first test step in the text test case and the scene semantic information of the scene node in the interface transition diagram, the scene node corresponding to the description information of the page to be tested as the target scene node corresponding to the first test step; A second determination module is used to determine, based on the semantic similarity between the page operation information to be tested in the first test step and the action semantic information of the action node in the interface transition graph, the action node corresponding to the page operation information to be tested as the target action node corresponding to the first test step; A generation module is used to generate an executable test case corresponding to the text test case of the object to be tested based on the target scene node and target action node corresponding to the first test step; wherein the executable test case includes the executable test code corresponding to the first test step.
10. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the method for generating executable test cases as described in any one of claims 1-8.
11. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to execute the method for generating an executable test case as described in any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 8 is implemented.