Automatic interface testing method and device based on knowledge graph, electronic equipment, storage medium and program product
Through the knowledge graph-based interface automation testing method, the problem of lack of targeted interface information change dependence on manual maintenance and test cases in the existing technology is solved, and efficient and accurate interface automation testing is achieved, and testing can be initiated from any interface and generated specific tests are generated. Functional test case.
Patent Information
- Application Number
- CN202411278583.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-02-11
AI Technical Summary
The existing interface automation testing technology has problems such as manual maintenance reliance on interface information changes, low interface recognition accuracy, lack of targeted test cases, and inability to perform automated testing due to the front interface.
Using the knowledge graph-based interface automation testing method, the interface knowledge graph is dynamically updated, and multiple categories of test data and targeted test cases are generated to realize the interface Automated testing.
It improves the degree of automation of interface testing, reduces the dependence of manual maintenance, improves the accuracy and efficiency of testing, can initiate automated testing from any target interface, and generates test cases that meet specific testing needs for the specific functions of the application.
Smart Images

Figure CN119415416A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of big data and artificial intelligence technology, specifically to the field of interface testing technology, and more specifically to a knowledge graph-based interface automation testing method and device, electronic device, storage medium, and program product. Background Art
[0002] Interface testing is a test of the interface between system or application components. It is mainly used to detect the interaction points between external systems and internal subsystems. The focus of this test is to check the data exchange, transmission and control management process, as well as the mutual logical dependencies between systems.
[0003] As the number of functions integrated into a system or application increases, the complexity of the system or application increases, making the efficiency and accuracy of the traditional manual interface testing method lower and lower. In order to solve the technical problems of the traditional manual interface testing method, technical personnel in this field have proposed a technical solution for interface automation testing to improve the degree of automation in the interface testing process of complex systems or applications. Although the existing technical solution for interface automation testing has improved the test efficiency and test accuracy compared to the traditional manual interface testing method, there are still problems such as the reliance on manual maintenance for interface information changes, low interface recognition accuracy, lack of pertinence in test cases, and inability to perform automated testing due to the dependence on the front-end interface. Summary of the invention
[0004] In view of the above problems, the present disclosure provides a knowledge graph-based interface automation testing method and device, electronic device, storage medium and program product to improve the degree of interface testing automation.
[0005] According to a first aspect of the present disclosure, a knowledge graph-based interface automation testing method is provided, the method comprising:
[0006] Configure and manage the address information of applications distributed on different hosts, and obtain the target interface for testing in the application;
[0007] Construct an interface knowledge graph based on the attribute information of the target interface and the association relationship between the target interfaces, and manage the target interfaces;
[0008] Based on the interface change information, the interface knowledge graph is used to automatically change the attribute information and association relationship of the selected target interface, and the interface knowledge graph is dynamically updated;
[0009] Generate multi-category test data based on the updated interface knowledge graph, and generate test cases for testing the target interface by combining the test data;
[0010] Select test cases for specific functions of the application and use the selected test cases to perform automated testing on the target interface.
[0011] According to an embodiment of the present disclosure, the configuration management of address information of application programs distributed on different hosts includes:
[0012] Get the IP information or domain name information of all hosts, and get the port information of applications distributed on different hosts;
[0013] Configure and manage address information based on IP information, domain name information, and port information.
[0014] According to an embodiment of the present disclosure, the above-mentioned construction of an interface knowledge graph based on the attribute information of the target interface and the association relationship between the target interfaces, and management of the target interfaces includes:
[0015] Determine triple information of the target interface based on the attribute information of the target interface and the association relationship between the target interface and other target interfaces, wherein the triple information includes an entity, an attribute, and a relationship;
[0016] An interface knowledge graph is constructed based on the triple information of the target interface, and the interface knowledge graph is manually and / or automatically managed based on a preset maintenance mode.
[0017] According to an embodiment of the present disclosure, the attribute information of the target interface includes the name of the interface, the address information of the interface, the port information of the interface, the path information of the interface, the request protocol of the interface, the request header of the interface, the request content of the interface, the response header of the interface, the response content of the interface, the status code of the interface, the preceding target interface of the interface, and the following target interface of the interface;
[0018] The preset maintenance modes include adding a new interface, deleting an interface, modifying the attribute information of an interface, modifying the association relationship of an interface, adding the attribute information of a new interface, adding the association relationship of a new interface, deleting the attribute information of an interface, and deleting the association relationship of an interface.
[0019] According to an embodiment of the present disclosure, based on the interface change information, the interface knowledge graph is used to automatically change the attribute information and association relationship of the selected target interface, and the interface knowledge graph is dynamically updated, including:
[0020] Randomly select one or more target interfaces as the original node interfaces for comparison with the change operation, and use the interface knowledge graph to obtain the attribute information and association relationship of the original node interfaces;
[0021] Based on the interface change information, determine the target interface that needs to be changed as the change node interface, and obtain the attribute information and association relationship of the change node interface;
[0022] Based on the attribute information and association relationship of the original node interface and the attribute information and association relationship of the changed node interface, the original node interface and the changed node interface are automatically compared;
[0023] Based on the comparison results, the original node interface and the changed node interface are automatically changed, and the interface knowledge graph is dynamically updated.
[0024] According to an embodiment of the present disclosure, the above-mentioned determining the target interface that needs to be changed as the change node interface based on the interface change information, and obtaining the attribute information and association relationship of the change node interface includes:
[0025] Based on the interface change information, the association relationship of the changed node interface is obtained by using the interface knowledge graph, and the target interface that has an association relationship with the changed node interface in the interface knowledge graph is used as the comparison target; or
[0026] Based on the interface change information, the association relationship of the changed node interface is obtained by scanning the program package uploaded by the user, and the interface knowledge graph is dynamically updated based on the obtained association relationship.
[0027] According to an embodiment of the present disclosure, the automatic change of the original node interface and the changed node interface based on the comparison result includes:
[0028] Sorting the original node interface and the changed node interface, and comparing the original node interface and the changed node interface in sequence according to the sorting result to obtain a comparison result;
[0029] If the comparison result shows that the name and attribute information of the changed node interface are the same as those of the original node interface, the changed node interface and the original node interface are marked as the same interface, and the changed node interface and the sub-node interfaces of the original node interface are further compared.
[0030] According to an embodiment of the present disclosure, the automatic change of the original node interface and the changed node interface based on the comparison result further includes:
[0031] If the comparison result shows that the name of the original node interface is the same as the name of the changed node interface, but the attribute information of the original node is different from the attribute information of the changed node interface, the original node interface is marked as the changed node interface, and the child node interfaces of the marked original node interface and the changed node interface are continued to be compared.
[0032] According to an embodiment of the present disclosure, the automatic change of the original node interface and the changed node interface based on the comparison result further includes:
[0033] When the name and attribute information of the original node interface are different from the name and attribute information of the changed node interface, the original node interface and the child node interface of the original node interface are set as the deleted node interface, and the neighbor node interface of the original node interface is selected to continue to be compared with the changed node interface.
[0034] According to an embodiment of the present disclosure, the automatic change of the original node interface and the changed node interface based on the comparison result further includes:
[0035] After all original node interfaces have been compared, if there is an unmarked changed node interface, the unmarked changed node interface and its child node interfaces are marked as newly added interfaces, and the comparison process ends.
[0036] According to an embodiment of the present disclosure, the above-mentioned generation of multiple categories of test data based on the updated interface knowledge graph, and the generation of test cases for testing the target interface by combining the test data include:
[0037] Obtain the association relationship of the target interface based on the updated interface knowledge graph, and generate multi-category test data with a preset format based on the association relationship of the target interface or the interface dependency relationship specified by the user;
[0038] For a specific test function, a multi-category target interface that needs to be tested is determined, and based on the multi-category target results, a test case for the specific test function is generated by combining the multi-category test data.
[0039] According to an embodiment of the present disclosure, the above-mentioned selecting test cases for specific functions of the application program and using the selected test cases to perform automated testing on the target interface includes:
[0040] Determine the entry point of automated testing from the target interface based on the test scope specified by the user, and use the updated interface knowledge graph to automatically obtain the attribute information and association relationships of the target interface that depends on the entry point.
[0041] Test cases are selected for specific functions of the application, and based on the attribute information and association relationship of the target interfaces that depend on the entry and the entry, the test cases are used to perform automated testing on the entry and the target interfaces that depend on the entry and the entry.
[0042] According to a second aspect of the present disclosure, a knowledge graph-based interface automation testing device is provided, the device comprising:
[0043] The configuration management module is used to configure and manage the address information of applications distributed on different hosts and obtain the target interface for testing in the application;
[0044] The node management module is used to build an interface knowledge graph based on the attribute information of the target interface and the association relationship between the target interfaces, and manage the target interfaces;
[0045] A change comparison module is used to automatically change the attribute information and association relationship of the selected target interface based on the interface change information using the interface knowledge graph, and dynamically update the interface knowledge graph;
[0046] A case management module, used to generate multi-category test data based on the updated interface knowledge graph, and to generate test cases for testing the target interface by combining the test data;
[0047] The result management module is used to select test cases for specific functions of the application and use the selected test cases to perform automated testing on the target interface.
[0048] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0049] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.
[0050] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.
[0051] The above-mentioned interface automation testing method based on knowledge graph provided by the present invention can automatically change the relevant information of the target interface; and can automatically update the interface knowledge graph according to the information after the target interface is changed; at the same time, the above-mentioned method provided by the present invention uses the interface knowledge graph to construct the association relationship between the target interfaces, so it can automatically obtain the information of the previous and next target interfaces that the target interface to be tested depends on, so that the automated test can be initiated from any target interface according to user needs. In addition, the method provided by the present invention can combine the generated test data in a targeted manner according to the specific functions of the application, and then obtain test cases that meet specific test requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0053] Figure 1The application scenario diagram of the interface automation testing method based on the knowledge graph according to the embodiment of the present disclosure is schematically shown;
[0054] Figure 2 The flowchart of the interface automation testing method based on the knowledge graph according to the embodiment of the present disclosure is schematically shown;
[0055] Figure 3 The structure diagram of the interface knowledge graph according to the embodiment of the present disclosure is schematically shown;
[0056] Figure 4 A flowchart schematically shows the automatic change of target interface related information according to an embodiment of the present disclosure;
[0057] Figure 5 Schematically shows a flow chart of automatic change comparison according to an embodiment of the present disclosure;
[0058] Figure 6 The structure diagram of the interface automation testing device based on the knowledge graph according to the embodiment of the present disclosure is schematically shown;
[0059] Figure 7 A block diagram of an electronic device suitable for implementing an interface automation testing method based on a knowledge graph according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0060] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0061] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0062] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0063] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0064] The existing interface automation testing methods generally obtain interface information first, including protocol, number of fields, field type, field attributes, etc.; then compile test cases, prepare corresponding test data and process results according to interface attributes; secondly, execute test cases, send requests in test cases to the interface and receive responses, and judge whether the interface works normally according to the preset conditions of the test cases; then verify the test results, verify the data returned by the interface, and check whether it meets expectations; finally, generate a test report including the execution status of the test cases for subsequent analysis.
[0065] Based on the above-mentioned interface automation testing method, technical personnel in this field have developed related interface automation testing tools. However, the above-mentioned interface automation testing tools still have many technical problems. For example, changes in interface information rely on manual maintenance, and it is impossible to quickly and accurately obtain change information; for example, when an interface change occurs, it is impossible to identify the affected interface range and implement targeted verification; for example, when an interface is selected for testing, if the interface has a pre-dependent interface, it is impossible to directly initiate a test request from the interface; for example, the test case functions need to be complexly associated, and the required functions cannot be quickly implemented through combination.
[0066] In order to solve at least one of the problems in the prior art, the present disclosure provides an interface automation testing method and device based on knowledge graph, an electronic device, a storage medium and a program product, which realizes interface automation testing by using knowledge graph technology. Among them, the knowledge graph is a graph-based data structure, which builds a network topology graph rich in semantic information by storing the relationships and attributes between entities. The knowledge graph abstracts the affairs and concepts of the real world into nodes (entities) and edges (relationships) on the way, providing machines or programs with the ability to understand and process complex relationships. The knowledge graph emphasizes the analysis of relationships, which provides a basis for automatic calls between interfaces during automated testing.
[0067] It should be noted that in the embodiments of the present disclosure, certain software, components, models and other existing solutions in the industry may be mentioned, which should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0068] Figure 1An application scenario diagram of the knowledge graph-based interface automation testing method according to an embodiment of the present disclosure is schematically shown.
[0069] like Figure 1 As shown, the application scenario 100 according to this embodiment may include the fields of big data and artificial intelligence technology. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0070] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0071] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0072] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0073] It should be noted that the interface automation testing method based on the knowledge graph provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the interface automation testing device based on the knowledge graph provided in the embodiment of the present disclosure can generally be set in the server 105. The interface automation testing method based on the knowledge graph provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the interface automation testing device based on the knowledge graph provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0074] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0075] The following will be based on Figure 1 The scene described by Figure 2~Figure 6 The knowledge graph-based interface automation testing method of the disclosed embodiment is described in detail.
[0076] It should be noted that in the embodiments of the present disclosure, certain software, components, models and other existing solutions in the industry may be mentioned, which should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0077] Figure 2 A flowchart of an interface automation testing method based on a knowledge graph according to an embodiment of the present disclosure is schematically shown.
[0078] like Figure 2 As shown, the knowledge graph-based interface automation testing method of this embodiment includes operations S210 to S250.
[0079] In operation S210, configuration management is performed on the address information of the application programs distributed on different hosts, and a target interface for testing in the application programs is obtained.
[0080] According to an embodiment of the present disclosure, the above-mentioned configuration management of address information of applications distributed on different hosts includes: obtaining IP information or domain name information of all hosts, and obtaining port information of applications distributed on different hosts; configuring and managing address information based on IP information or domain name information and port information.
[0081] Through configuration management, it is possible to achieve unified management of distributed hosts or distributed applications, avoiding address conflicts and other similar technical problems encountered during automated testing; it can also help technicians quickly locate problems encountered during automated testing.
[0082] The above operation S210 can be applied to different applications on the same host or different applications on different hosts, and can also obtain other application information other than address information for testing. Those skilled in the art can set it according to actual testing requirements.
[0083] In the process of obtaining the host address information and the application port information, the above operation S210 obtains the authorization of the host and the application owner, and processes the above host address information and the application port information with the permission of the host and the application owner. The relevant process complies with the provisions of laws and regulations, and strict confidentiality measures are taken.
[0084] At the same time, in the embodiments of the present disclosure, a corresponding operation entry can be provided for the user to choose to agree or refuse to collect the host address information and application port information. That is, when the user host address information and application port information are acquired, transmitted, processed and stored, the user's consent or refusal to perform the processing / decision-making instructions input through the corresponding operation entry can be obtained. If the user agrees to perform the processing / decision-making, the user information is acquired, transmitted, processed and stored, and step S210 is executed. If the user refuses to perform the processing / decision-making, the user's relevant information is not acquired, transmitted, processed and stored.
[0085] In operation S220, an interface knowledge graph is constructed based on the attribute information of the target interface and the association relationship between the target interfaces, and the target interfaces are managed.
[0086] The association relationship (or relationship) between target interfaces includes but is not limited to the relationship between front and back dependencies, the relationship between parent nodes and child nodes, the relationship between calling and being called, etc.
[0087] In the interface knowledge graph, the entity or node refers to the target interface, and the interface knowledge graph is composed of the target interface-attribute-relationship.
[0088] In the process of constructing the interface knowledge graph, interfaces (i.e., entities of the knowledge graph), attribute information of interfaces, and the relationships between interfaces can be extracted manually or through automated methods, such as artificial intelligence models.
[0089] For example, interface extraction and links between interfaces can be extracted using automated methods including rule engines, statistical models, and deep learning models.
[0090] In operation S230, based on the interface change information, the interface knowledge graph is used to automatically change the attribute information and association relationship of the selected target interface, and the interface knowledge graph is dynamically updated.
[0091] In operation S240 , multiple categories of test data are generated based on the updated interface knowledge graph, and test cases for testing the target interface are generated by combining the test data.
[0092] Those skilled in the art can set the format of the test data by themselves and generate the test data according to the preset format.
[0093] In operation S250, a test case is selected for a specific function of the application program, and the target interface is automatically tested using the selected test case.
[0094] Users or testers can view the execution status of previously executed historical cases in a visual way, and present the execution results in an intuitive and visual way. For example, the content that passed the execution is displayed in green, and the content that failed is displayed in red.
[0095] The predecessor interfaces or interfaces with other dependencies that the target interface to be tested depends on can be automatically obtained based on the interface knowledge graph, thereby ensuring the degree of automation of interface testing without the need to manually set the dependencies of the target interface to be tested.
[0096] The above-mentioned interface automation testing method based on knowledge graph provided by the present invention can automatically change the relevant information of the target interface, for example, by scanning the program package, the latest interface information can be obtained, and the changed content of the interface can be automatically identified by comparing the new and old interfaces; and the interface knowledge graph can be automatically updated according to the information after the target interface is changed, for example, based on the interface knowledge graph, by comparing the selected new and old nodes, the difference between the two can be identified, and then the affected interface range can be automatically identified, and then the affected interface can be quickly identified; at the same time, the above-mentioned method provided by the present invention uses the interface knowledge graph to construct the association relationship between the target interfaces, so that the information of the front and back target interfaces that the target interface to be tested depends on can be automatically obtained, so that the automated test can be initiated from any target interface according to user needs, for example, the test can be initiated from any set position. Since the interfaces have been associated through the front and back relationships, if the current node is not a root node (there is no dependent front interface), it is necessary to find one or more root nodes corresponding to it before the interface call can be executed. In this way, it is possible to initiate a test request from any interface, and the entire call can be initiated from the initial root node. In addition, the method provided by the present invention can combine the generated test data in a targeted manner according to the specific functions of the application program, thereby obtaining a test case that meets the specific test requirements. For example, the required function can be achieved by combining test cases. Since the data of the test case is generated based on the interface, and there is an association relationship between the test interfaces, when the test cases of related functions are combined together, a test case set that meets the specific occasion is achieved.
[0097] According to an embodiment of the present disclosure, the above-mentioned construction of an interface knowledge graph based on the attribute information of the target interface and the association relationship between the target interfaces, and the management of the target interface includes: determining the triple information of the target interface based on the attribute information of the target interface and the association relationship between the target interface and other target interfaces, wherein the triple information includes entities, attributes and relationships; constructing an interface knowledge graph based on the triple information of the target interface, and manually and / or automatically managing the interface knowledge graph based on a preset maintenance mode.
[0098] The above-mentioned interface knowledge graph takes interface as entity, attribute information of interface as attribute of interface knowledge graph, and association relationship between interfaces as relationship of interface knowledge graph, that is, interface-attribute information-association relationship is used as triple information of interface knowledge graph, and triple information is used as basic unit to construct interface knowledge graph.
[0099] The above-mentioned attribute information of the interfaces and the association relationship between the interfaces are exemplary, and those skilled in the art may set other attribute information or association relationships according to actual test requirements.
[0100] According to an embodiment of the present disclosure, the attribute information of the above-mentioned target interface includes the name of the interface, the address information of the interface, the port information of the interface, the path information of the interface, the request protocol of the interface, the request header of the interface, the request content of the interface, the response header of the interface, the response content of the interface, the status code of the interface, the preceding target interface of the interface, and the following target interface of the interface; wherein, the preset maintenance mode includes adding a new interface, deleting an interface, modifying the attribute information of an interface, modifying the association relationship of an interface, adding the attribute information of a new interface, adding the association relationship of an interface, deleting the attribute information of an interface, and deleting the association relationship of an interface.
[0101] According to the above embodiment, similar triplet information can be obtained, such as {target interface: (name, interface address information, interface port information, interface path information, interface request protocol, interface request header, interface request content, interface response header, interface response content, interface status code, preceding target interface, succeeding target interface): (parent-child interface relationship, preceding interface relationship, succeeding interface relationship)}.
[0102] The above maintenance modes for interface attribute information and association relationships are exemplary, and those skilled in the art may adopt other maintenance modes according to actual test requirements.
[0103] The following is a further detailed description of the construction process of the interface knowledge graph and the management operation of the target interface involved in the present disclosure through specific embodiments and in combination with the accompanying drawings.
[0104] Figure 3The structural diagram of the interface knowledge graph according to the embodiment of the present disclosure is schematically shown.
[0105] The association of the target interface mainly involves the maintenance of information, and can support the addition, modification, and deletion of the target interface (represented as a node in the interface knowledge graph), relationships, and attributes. For example, you can add a new node A, add a relationship between node A and the existing node B, and then add a new attribute to node A. The default attributes of the node include: interface name, address (IP or domain name and other information), port, path, request protocol, request header, request content, response header, response content, status code, front interface, back interface, etc. Supports manual or automatic addition, modification, and deletion of node information. The structure diagram of the interface knowledge graph is as follows: Figure 3 As shown in the figure, the interface or node represents the entity of the knowledge graph, and the attribute information of the node is Figure 3 It is only an example, and those skilled in the art can set it according to the test requirements. Figure 3 The interface knowledge graph shown can realize the visual presentation of interface attribute information and the relationship between interfaces.
[0106] Figure 4 The flowchart of automatically changing the target interface related information according to the embodiment of the present disclosure is schematically shown.
[0107] like Figure 4 As shown, based on the interface change information, the interface knowledge graph is used to automatically change the attribute information and association relationship of the selected target interface, and the interface knowledge graph is dynamically updated, including operations S410 to S440.
[0108] In operation S410, one or more target interfaces are randomly selected as original node interfaces for comparison targets of the change operation, and the interface knowledge graph is used to obtain attribute information and association relationships of the original node interfaces.
[0109] The above operation S410 is used to select an original node (ie, original node interface, the same below) as a comparison target, which may be one or more original nodes, or a root node or a child node (child node interface, the same below).
[0110] In operation S420, a target interface that needs to be changed is determined as a change node interface based on the interface change information, and attribute information and association relationship of the change node interface are obtained.
[0111] The interface change information may be information specified by the user or information automatically generated according to the test requirements. Those skilled in the art may determine the change information according to the actual test requirements.
[0112] In operation S430, the original node interface and the changed node interface are automatically compared based on the attribute information and association relationship of the original node interface and the attribute information and association relationship of the changed node interface.
[0113] In the above operation S430, the original node and its related relationship are compared with the changed interface and its related relationship obtained in the second step. The selected original node and the changed node are arranged in ascending order according to the interface name. The changed node is compared with the original node in turn.
[0114] In operation S440, the original node interface and the changed node interface are automatically changed based on the comparison result, and the interface knowledge graph is dynamically updated.
[0115] After the interface information is automatically changed, the interface knowledge graph can be automatically updated based on the changed interface by using a predefined algorithm or tool to identify the interface entity.
[0116] The above-mentioned automatic change comparison process is further described in detail below through specific embodiments and in conjunction with the accompanying drawings.
[0117] Figure 5 The flowchart of automatic change comparison according to an embodiment of the present disclosure is schematically shown.
[0118] According to an embodiment of the present disclosure, the above-mentioned determination of the target interface that needs to be changed as the change node interface based on the interface change information, and obtaining the attribute information and association relationship of the change node interface includes: based on the interface change information, using the interface knowledge graph to obtain the association relationship of the change node interface, and using the target interface in the interface knowledge graph that has an association relationship with the change node interface as a comparison target; or based on the interface change information, obtaining the association relationship of the change node interface by scanning the program package uploaded by the user, and dynamically updating the interface knowledge graph based on the obtained association relationship.
[0119] like Figure 5 As shown in the figure, there are two ways to select a change node (i.e., change the node interface, the same below). The first way is to upload the program package, obtain the relationship between its interfaces by scanning the program package, and store it in the form of a knowledge graph node as a comparison node. The second way is to select an existing node in the knowledge graph, in which case the node (target interface, the same below) and all related node information and relationships under the node will be used as a comparison node.
[0120] According to an embodiment of the present disclosure, the above-mentioned automatic change of the original node interface and the change node interface based on the comparison result includes: sorting the original node interface and the change node interface, and comparing the original node interface and the change node interface in sequence according to the sorting result to obtain a comparison result; when the comparison result is that the name and attribute information of the change node interface are the same as the name and attribute information of the original node interface, the change node interface and the original node interface are marked as the same interface, and the change node interface and the original node interface sub-node interface are continued to be compared.
[0121] like Figure 5 As shown, when the name and attributes of the changed node are the same as those of the original node, the original node and the changed node are set to be the same node (the flag is 0), and then the child nodes of the two nodes are compared.
[0122] According to an embodiment of the present disclosure, the above-mentioned automatic change of the original node interface and the changed node interface based on the comparison result also includes: when the comparison result is that the name of the original node interface is the same as the name of the changed node interface, but the attribute information of the original node is different from the attribute information of the changed node interface, the original node interface is marked as the changed node interface, and the sub-node interfaces of the marked original node interface and the changed node interface are continued to be compared.
[0123] like Figure 5 As shown, when the original node and the changed node have the same name but different attributes, the node is marked as changed (the flag is 1), and then the child nodes of the two nodes are compared.
[0124] According to an embodiment of the present disclosure, the above-mentioned automatic change of the original node interface and the changed node interface based on the comparison result also includes: when the name and attribute information of the original node interface are different from the name and attribute information of the changed node interface, the original node interface and the child node interface of the original node interface are set to the deleted node interface, and the neighbor node interface of the original node interface is selected to continue to be compared with the changed node interface.
[0125] like Figure 5 As shown, when all the changed nodes are different from the original node, the original node and its child nodes are set to be deleted nodes (the flag is -1), and then the neighbor nodes of the original node are selected to continue comparing with the unmarked (flag is empty) changed nodes.
[0126] According to an embodiment of the present disclosure, the above-mentioned automatic change of the original node interface and the change node interface based on the comparison results also includes: after the original node interfaces have been compared, when there are unmarked change node interfaces, the unmarked change node interface and the sub-node interfaces of the unmarked change node interface are marked as newly added interfaces, and the comparison process is terminated.
[0127] like Figure 5 As shown, when all the original nodes are compared (the flag is not empty), if there are still unmarked changed nodes, the changed node and its child nodes are set to be newly added (the flag is 2), and the comparison process ends.
[0128] The comparison process of the child node interface is similar to that of the parent node interface or the root node interface, and the comparison of all child node interfaces is achieved through a recursive loop.
[0129] Based on the above-mentioned process of automatic interface change comparison, the interface knowledge graph can be automatically updated. For example, the difference between the original node and the comparison node is displayed on the graph. If there is no difference (the mark is 0), the original node and edge are displayed normally. If there is a difference (the mark is not 0), the corresponding original node and edge are set to different colors to distinguish them. Deleted nodes (marked with -1) and edges are circled with red dotted lines, changed nodes (marked with 1) and edges are circled with blue solid lines, and newly added nodes (marked with 2) and edges are circled with green. The change comparison results can be merged into the main graph.
[0130] According to an embodiment of the present disclosure, the above-mentioned generation of multi-category test data based on the updated interface knowledge graph, and generation of test cases for testing the target interface by combining the test data include: obtaining the association relationship of the target interface based on the updated interface knowledge graph, and generating multi-category test data with a preset format based on the association relationship of the target interface or the interface dependency relationship specified by the user; determining the multi-category target interfaces that need to be tested for a specific test function, and generating test cases for the specific test function by combining the multi-category test data based on the multi-category target results.
[0131] In the above embodiment, since the interface knowledge graph constructed in advance includes different categories of interface knowledge graphs of different applications, multiple categories of test data can be generated based on the interface attribute information and the relationship between interfaces in the interface knowledge graph; technical personnel in this field can update the generated multiple categories of test data or combine them to generate case combinations for specific test functions according to test needs.
[0132] According to an embodiment of the present disclosure, the above-mentioned selection of test cases for specific functions of the application and the use of the selected test cases to perform automated testing on the target interface include: determining the entry for automated testing from the target interface based on the test scope specified by the user, and using the updated interface knowledge graph to automatically obtain the attribute information and association relationships of the target interfaces that are dependent before and after the entry; selecting test cases for specific functions of the application, and based on the attribute information and association relationships of the target interfaces that are dependent before and after the entry, using the test cases to perform automated testing on the entry and the target interfaces that are dependent before and after the entry.
[0133] The process of performing automated testing on the target interface using the selected test cases is further described in detail below through a specific embodiment.
[0134] Test data is created based on test interfaces (i.e. nodes), and references or dependencies between test data can be specified. The before and after execution relationships between cases can also be added to form a set of test cases that can complete specific functions.
[0135] The test case is associated with the interface, and its data is directly referenced by the subsequent interface. The reference method is interface name + attribute name + numerical path name under the attribute. For example, if "Interface 2" references the start date in the payload under "Root Node 1", it can be obtained using $root node 1.payload.query.startDate. If "Interface 2" references the total number of responses under "Root Node 1", it can be obtained using $root node 1.response.totalCount.
[0136] You can implement a specific function by combining different test cases together. For example, for the "Change Password" function, you can connect the test cases of the three interfaces "User Login", "Authentication", and "Change and Save Password" in sequence.
[0137] Based on the above-mentioned interface automation testing method based on knowledge graph, the present disclosure also provides an interface automation testing device based on knowledge graph. Figure 6 The device is described in detail.
[0138] Figure 6 The structural diagram of the interface automation testing device based on the knowledge graph according to the embodiment of the present disclosure is schematically shown.
[0139] like Figure 6 As shown, the above-mentioned knowledge graph-based interface automation testing device 600 includes a configuration management module 610, a node management module 620, a change comparison module 630, a case management module 640 and a result management module 650.
[0140] The configuration management module 610 is used to perform configuration management on the address information of the applications distributed on different hosts and obtain the target interface for testing in the applications. In one embodiment, the configuration management module 610 can be used to perform the operation S210 described above, which will not be described in detail here.
[0141] At the same time, in the configuration management module 610, a corresponding operation entry can be provided for the user to choose to agree or refuse to collect the host address information and application port information of the user, that is, when the user host address information and application port information are acquired, transmitted, processed and stored, etc., the user's instruction to agree or refuse to perform the processing / decision input through the corresponding operation entry can be obtained. If the user agrees to perform the processing / decision, the user information is acquired, transmitted, processed and stored, etc., that is, step S210 is executed. If the user refuses to perform the processing / decision, the user's relevant information is not acquired, transmitted, processed and stored, etc.
[0142] The node management module 620 is used to construct an interface knowledge graph based on the attribute information of the target interface and the association relationship between the target interfaces, and manage the target interfaces. In one embodiment, the node management module 620 can be used to perform the operation S220 described above, which will not be repeated here.
[0143] The change comparison module 630 is used to automatically change the attribute information and association relationship of the selected target interface based on the interface change information using the interface knowledge graph, and dynamically update the interface knowledge graph. In one embodiment, the change comparison module 630 can be used to perform the operation S230 described above, which will not be repeated here.
[0144] The case management module 640 is used to generate multiple categories of test data based on the updated interface knowledge graph, and to generate test cases for testing the target interface by combining the test data. In one embodiment, the case management module 640 can be used to perform the operation S240 described above, which will not be described in detail here.
[0145] The result management module 650 is used to select test cases for specific functions of the application program and use the selected test cases to perform automated testing on the target interface. In one embodiment, the result management module 650 can be used to perform the operation S250 described above, which will not be described in detail here.
[0146] According to an embodiment of the present disclosure, any multiple modules of the configuration management module 610, the node management module 620, the change comparison module 630, the case management module 640, and the result management module 650 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the configuration management module 610, the node management module 620, the change comparison module 630, the case management module 640, and the result management module 650 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the configuration management module 610 , the node management module 620 , the change comparison module 630 , the case management module 640 , and the result management module 650 may be at least partially implemented as a computer program module, which may perform corresponding functions when executed.
[0147] According to an embodiment of the present disclosure, the configuration management module 610 includes an information acquisition submodule and a configuration management submodule.
[0148] The information acquisition submodule is used to obtain the IP information or domain name information of all hosts and the port information of applications distributed on different hosts.
[0149] The configuration management submodule is used to configure and manage address information based on IP information or domain name information and port information.
[0150] According to an embodiment of the present disclosure, the above-mentioned node management module 620 includes a triple acquisition submodule and a knowledge graph construction and management submodule.
[0151] The triplet acquisition submodule is used to determine the triplet information of the target interface based on the attribute information of the target interface and the association relationship between the target interface and other target interfaces, wherein the triplet information includes entities, attributes and relationships.
[0152] The knowledge graph construction and management submodule is used to construct an interface knowledge graph based on the triple information of the target interface, and to manually and / or automatically manage the interface knowledge graph based on a preset maintenance mode.
[0153] According to an embodiment of the present disclosure, the above-mentioned change comparison module 630 includes an original node selection submodule, a change node acquisition submodule, a comparison submodule and a change submodule.
[0154] The original node selection submodule is used to randomly select one or more target interfaces as the original node interfaces for comparison targets for change operations, and use the interface knowledge graph to obtain the attribute information and association relationships of the original node interfaces.
[0155] The change node acquisition submodule is used to determine the target interface that needs to be changed as the change node interface based on the interface change information, and to obtain the attribute information and association relationship of the change node interface.
[0156] The comparison submodule is used to automatically compare the original node interface and the changed node interface based on the attribute information and association relationship of the original node interface and the attribute information and association relationship of the changed node interface.
[0157] The change submodule is used to automatically change the original node interface and the changed node interface based on the comparison results, and dynamically update the interface knowledge graph.
[0158] According to an embodiment of the present disclosure, the above-mentioned change node acquisition submodule includes a first acquisition unit and / or a second acquisition unit.
[0159] The first acquisition unit is used to acquire the association relationship of the changed node interface by using the interface knowledge graph based on the interface change information, and take the target interface that has an association relationship with the changed node interface in the interface knowledge graph as a comparison target.
[0160] The second acquisition unit is used to obtain the association relationship of the changed node interface by scanning the program package uploaded by the user based on the interface change information, and dynamically update the interface knowledge graph based on the obtained association relationship.
[0161] According to an embodiment of the present disclosure, the change submodule includes a sorting unit, a first determination and processing unit, a second determination and processing unit, a third determination and processing unit, and a fourth determination and processing unit.
[0162] The sorting unit is used to sort the original node interface and the changed node interface, and compare the original node interface and the changed node interface in sequence according to the sorting result to obtain a comparison result.
[0163] The first judgment and processing unit is used to mark the changed node interface and the original node interface as the same interface when the comparison result shows that the name and attribute information of the changed node interface are the same as the name and attribute information of the original node interface, and continue to compare the changed node interface with the sub-node interfaces of the original node interface.
[0164] The second judgment and processing unit is used to mark the original node interface as a changed node interface when the comparison result is that the name of the original node interface is the same as the name of the changed node interface, but the attribute information of the original node is different from the attribute information of the changed node interface, and continue to compare the child node interfaces of the marked original node interface and the changed node interface.
[0165] The third judgment and processing unit is used to set the original node interface and the child node interface of the original node interface as the deleted node interface when the name and attribute information of the original node interface are different from the name and attribute information of the changed node interface, and select the neighbor node interface of the original node interface to continue comparing with the changed node interface.
[0166] The fourth determination and processing unit is used to mark the unmarked change node interface and its child node interface as newly added interfaces after all original node interfaces have been compared, and end the comparison process if there is an unmarked change node interface.
[0167] According to an embodiment of the present disclosure, the case management module 640 includes a test data generation submodule and a test case combination generation submodule.
[0168] The test data generation submodule is used to obtain the association relationship of the target interface based on the updated interface knowledge graph, and generate multi-category test data with a preset format based on the association relationship of the target interface or the interface dependency relationship specified by the user.
[0169] The test case combination generation submodule is used to determine the multi-category target interfaces that need to be tested for a specific test function, and based on the multi-category target results, generate test cases for the specific test function by combining the multi-category test data.
[0170] According to an embodiment of the present disclosure, the above-mentioned result management module 650 includes a test entry determination submodule and an automated test submodule.
[0171] The test entry determination submodule is used to determine the entry of the automated test from the target interface based on the test scope specified by the user, and use the updated interface knowledge graph to automatically obtain the attribute information and association relationships of the target interface that depends before and after the entry.
[0172] The automated testing submodule is used to select test cases for specific functions of the application, and based on the attribute information and association relationship of the target interfaces that depend on the entry before and after the entry, use the test cases to perform automated testing on the entry and the target interfaces that depend on the entry before and after the entry.
[0173] Figure 7A block diagram of an electronic device suitable for implementing an interface automation testing method based on a knowledge graph according to an embodiment of the present disclosure is schematically shown.
[0174] like Figure 7 As shown, the electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 708 to a random access memory (RAM) 703. The processor 701 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 701 may also include an onboard memory for caching purposes. The processor 701 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0175] In RAM 703, various programs and data required for the operation of electronic device 700 are stored. Processor 701, ROM 702 and RAM 703 are connected to each other via bus 704. Processor 701 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 702 and / or RAM 703. It should be noted that the program can also be stored in one or more memories other than ROM 702 and RAM 703. Processor 701 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0176] According to an embodiment of the present disclosure, the electronic device 700 may further include an input / output (I / O) interface 705, which is also connected to the bus 704. The electronic device 700 may further include one or more of the following components connected to the input / output (I / O) interface 705: an input portion 706 including a keyboard, a mouse, etc.; an output portion 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 708 including a hard disk, etc.; and a communication portion 709 including a network interface card such as a LAN card, a modem, etc. The communication portion 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output (I / O) interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage portion 708 as needed.
[0177] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0178] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 702 and / or RAM 703 described above and / or one or more memories other than ROM 702 and RAM 703.
[0179] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the interface automation testing method based on the knowledge graph provided in the embodiment of the present disclosure.
[0180] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 701. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0181] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 709, and / or installed from the removable medium 711. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0182] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0183] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0184] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0185] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0186] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. An interface automation testing method based on knowledge graph, characterized in that: The method comprises: Perform configuration management on the address information of applications distributed on different hosts, and obtain the target interface to be tested in the application; Building an interface knowledge graph based on the attribute information of the target interface and the association relationship between the target interfaces, and managing the target interfaces; Based on the interface change information, the interface knowledge graph is used to automatically change the attribute information and association relationship of the selected target interface, and the interface knowledge graph is dynamically updated; Generate multiple categories of test data based on the updated interface knowledge graph, and generate test cases for testing the target interface by combining the test data; The test case is selected for the specific function of the application program, and the target interface is automatically tested using the selected test case.
2. The method according to claim 1, characterized in that Configuration management of address information of applications distributed on different hosts includes: Get the IP information or domain name information of all hosts, and get the port information of applications distributed on different hosts; The address information is configured and managed based on the IP information or the domain name information and the port information.
3. The method according to claim 1, characterized in that Constructing an interface knowledge graph based on the attribute information of the target interface and the association relationship between the target interfaces, and managing the target interfaces includes: Determine the triplet information of the target interface based on the attribute information of the target interface and the association relationship between the target interface and other target interfaces, wherein the triplet information includes an entity, an attribute, and a relationship; The interface knowledge graph is constructed based on the triple information of the target interface, and the interface knowledge graph is manually and / or automatically managed based on a preset maintenance mode.
4. The method according to claim 3, characterized in that The attribute information of the target interface includes the name of the interface, the address information of the interface, the port information of the interface, the path information of the interface, the request protocol of the interface, the request header of the interface, the request content of the interface, the response header of the interface, the response content of the interface, the status code of the interface, the front target interface of the interface and the rear target interface of the interface; Among them, the preset maintenance mode includes adding a new interface, deleting an interface, modifying the attribute information of an interface, modifying the association relationship of an interface, adding the attribute information of a new interface, adding the association relationship of a new interface, deleting the attribute information of an interface and deleting the association relationship of an interface.
5. The method according to claim 1, characterized in that: Based on the interface change information, automatically changing the attribute information and association relationship of the selected target interface using the interface knowledge graph, and dynamically updating the interface knowledge graph includes: Randomly select one or more of the target interfaces as original node interfaces for comparison targets of the change operation, and use the interface knowledge graph to obtain attribute information and association relationships of the original node interfaces; Determine the target interface that needs to be changed as the change node interface based on the interface change information, and obtain the attribute information and association relationship of the change node interface; Automatically comparing the original node interface and the changed node interface based on the attribute information and association relationship of the original node interface and the attribute information and association relationship of the changed node interface; Based on the comparison result, the original node interface and the changed node interface are automatically changed, and the interface knowledge graph is dynamically updated.
6. The method according to claim 5, characterized in that Determining a target interface that needs to be changed based on the interface change information as a change node interface, and acquiring attribute information and association relationship of the change node interface includes: Based on the interface change information, the association relationship of the change node interface is obtained by using the interface knowledge graph, and the target interface in the interface knowledge graph that has an association relationship with the change node interface is used as a comparison target; or Based on the interface change information, the association relationship of the changed node interface is obtained by scanning the program package uploaded by the user, and the interface knowledge graph is dynamically updated based on the obtained association relationship.
7. The method according to claim 5, characterized in that Automatically changing the original node interface and the changed node interface based on the comparison result includes: Sorting the original node interface and the changed node interface, and comparing the original node interface and the changed node interface in sequence according to the sorting result to obtain the comparison result; When the comparison result shows that the name and attribute information of the changed node interface are the same as the name and attribute information of the original node interface, the changed node interface and the original node interface are marked as the same interface, and the changed node interface and the sub-node interface of the original node interface are continued to be compared.
8. The method according to claim 7, characterized in that Also includes: If the comparison result is that the name of the original node interface is the same as the name of the change node interface, but the attribute information of the original node is different from the attribute information of the change node interface, the original node interface is marked as a change node interface, and the child node interfaces of the marked original node interface and the change node interface are continued to be compared.
9. The method according to claim 7, characterized in that: Also includes: When the name and attribute information of the original node interface are different from the name and attribute information of the changed node interface, the original node interface and the child node interface of the original node interface are set as deleted node interfaces, and the neighbor node interface of the original node interface is selected to continue to be compared with the changed node interface.
10. The method according to claim 7, characterized in that Also includes: After all the original node interfaces have been compared, if there is an unmarked changed node interface, the unmarked changed node interface and its child node interface are marked as newly added interfaces, and the comparison process ends.
11. The method according to claim 1, characterized in that Generating multiple categories of test data based on the updated interface knowledge graph, and generating test cases for testing the target interface by combining the test data include: Acquire the association relationship of the target interface based on the updated interface knowledge graph, and generate multi-category test data with a preset format based on the association relationship of the target interface or the interface dependency relationship specified by the user; For a specific test function, multiple categories of target interfaces that need to be tested are determined, and based on the multiple categories of target results, a test case for the specific test function is generated by combining the multiple categories of test data.
12. The method according to claim 1, characterized in that Selecting the test case for the specific function of the application program and using the selected test case to perform automated testing on the target interface includes: Determine the entry of the automated test from the target interface based on the test scope specified by the user, and automatically obtain the attribute information and association relationship of the target interface that the entry depends on before and after using the updated interface knowledge graph; The test case is selected for the specific function of the application, and based on the attribute information and association relationship of the target interface that the entry depends on before and after, the test case is used to perform automated testing on the entry and the target interface that the entry depends on before and after.
13. An interface automation testing device based on knowledge graph, characterized in that: The device comprises: A configuration management module, used to perform configuration management on the address information of applications distributed on different hosts, and obtain the target interface to be tested in the application; A node management module, used to construct an interface knowledge graph based on the attribute information of the target interface and the association relationship between the target interfaces, and manage the target interfaces; A change comparison module, used to automatically change the attribute information and association relationship of the selected target interface based on the interface change information using the interface knowledge graph, and dynamically update the interface knowledge graph; A case management module, used to generate multiple categories of test data based on the updated interface knowledge graph, and generate test cases for testing the target interface by combining the test data; The result management module is used to select the test cases for the specific functions of the application program and use the selected test cases to perform automated testing on the target interface.
14. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 12.
15. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
16. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Cited By
Dependence graph generation method, risk assessment method, device, equipment and medium
CN120315725A
User demand determination method and device in multi-power system cooperation scene
CN120996856A
Train control system test scene and test case management method based on knowledge graph
CN121635277A