Application testing method and device based on call dependency

By using call trace to determine the call dependencies of the changed nodes in application testing, and determining the test focus and scope based on the call popularity, the problem of low testing efficiency under the microservice architecture is solved, and more efficient application testing is achieved.

CN112380130BActive Publication Date: 2024-11-01KANG JIAN INFORMATION TECH (SHENZHEN) CO LTD

Patent Information

Application Number
CN202011301046.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-19
Publication Date
2024-11-01
Estimated Expiration
2040-11-19

AI Technical Summary

Technical Problem

Under the microservice architecture, the test efficiency is inefficient due to the complex mesh dependencies in application testing, especially when the refactoring class and tripartite library upgrade, the test scope is wide, making it difficult to complete quickly and efficiently, resulting in unavailability of the service.

Method used

By obtaining the application test request, finding the historical code of the application code to be tested, determining the modified node, and determining the call dependency node of the modified node through the call trace, determining the test focus and scope based on the call heat, and then conducting tests.

Benefits of technology

It effectively improves the efficiency of application testing, can more accurately locate the affected modification methods in software version updates, and improves the efficiency of functional verification and problem checking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112380130B_ABST
    Figure CN112380130B_ABST
Patent Text Reader

Abstract

The present application relates to the field of test process improvement in R&D management, and specifically to an application testing method and device based on call dependency relationships, which obtains an application test request to find the application code to be tested; finds the historical application code corresponding to the application code to be tested, compares the application code to be tested and the historical application code to be tested, and determines the modified node; determines the call dependency node corresponding to the modified node through call trace; then determines the call heat corresponding to the modified method, and determines the test focus and test scope; and tests the application code to be tested. Starting from the perspective of the application code to be tested, the present application analyzes the user's heat data through the modified nodes and call dependency nodes in the code, and can more effectively and accurately locate the modified methods affected in the software version update; thereby being able to more efficiently perform functional verification and effectively check problems for hot businesses in application testing, thereby improving the efficiency of application testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and specifically provides an application testing method, apparatus, computer device and storage medium based on call dependency. Background Art

[0002] With the development of computer technology and software technology, application testing technology is also constantly updated. Scope determination in the application testing process is an important part of the application testing field, and it is different for different project characteristics; for refactoring classes and third-party library upgrades, the test scope is very wide and almost requires full regression. This will bring huge testing costs.

[0003] In the testing process, fast and efficient agile iterations have replaced the traditional waterfall model. With the increasing popularity of microservice SOA (Service-Oriented Architecture), business modules have become atomic, and the release frequency has increased. The continuous integration of automated testing such as unit testing and interface testing is also developing rapidly. However, due to the complexity of the network dependencies of microservices, some key test scenarios are still difficult to consider, resulting in service unavailability, thereby reducing the efficiency of testing. Summary of the invention

[0004] Based on this, it is necessary to provide an application testing method, device, computer equipment and storage medium that can effectively improve testing efficiency in response to the above technical problems.

[0005] An application testing method based on call dependency, the method comprising:

[0006] Obtain an application test request, and search for the application code to be tested according to the application test request;

[0007] Searching for a historical application code corresponding to the application code to be tested, comparing the application code to be tested with the historical application code, and determining a modified node;

[0008] Determine the call dependency node corresponding to the modified node through call trace;

[0009] Determine the call heat corresponding to the modified method according to the call dependency node, determine the test focus and test scope according to the call heat, and the modified method is associated with the modified node;

[0010] The application code to be tested is tested according to the test focus and the test scope.

[0011] In one embodiment, searching for historical application codes corresponding to the application code to be tested, comparing the application code to be tested with the historical application codes, and determining the modified nodes includes:

[0012] Obtaining difference data between the application code to be tested and the historical application code through the git diff command;

[0013] The modified node is located according to the difference data.

[0014] In one embodiment, determining the call dependency node corresponding to the modified node through call trace includes:

[0015] Through call trace, according to the modified node, the top interface method in the dependency relationship corresponding to the modified node is reversely queried, and the call dependency relationship node between the top interface method and the modified node is determined.

[0016] In one embodiment, the reverse querying of the top interface method in the dependency relationship corresponding to the modified node through call trace according to the modified node, and determining the call dependency relationship node between the top interface method and the modified node includes:

[0017] Pack and compile the project corresponding to the application code to be tested to obtain a jar file;

[0018] Find the class method in the application code to be tested by parsing the jar file;

[0019] Determine the modification method corresponding to the modification node according to the class method;

[0020] The call dependency node corresponding to the modified method is determined through a recursive algorithm.

[0021] In one embodiment, determining the call heat corresponding to the modified method according to the call dependency node includes:

[0022] Determine the call volume, call ratio and average call time of the modified method under the top interface method according to the call data of the top interface method;

[0023] The call heat corresponding to the modified method is determined according to the call volume, call proportion and average call duration of the modified method.

[0024] In one embodiment, after testing the application code to be tested according to the test focus and the test scope, the method further includes:

[0025] Get the call relationship tree and historical test case data corresponding to the call trace;

[0026] Determine the node branch process corresponding to the tree node in the call relationship tree;

[0027] A supplementary test case is generated according to the node branch process and the historical test case data.

[0028] An application testing device based on call dependency, the device comprising:

[0029] A request receiving module, used to obtain an application test request and search for the application code to be tested according to the application test request;

[0030] A modified node search module, used to search for the historical application code corresponding to the application code to be tested, compare the application code to be tested with the historical application code, and determine the modified node;

[0031] A dependency node search module, used to determine the call dependency node corresponding to the modified node through call trace;

[0032] A heat query module, used to determine the call heat corresponding to the modified method according to the call dependency node, determine the test focus and test scope according to the call heat, and the modified method is associated with the modified node;

[0033] The application testing module is used to test the application code to be tested according to the test focus and the test scope.

[0034] In one of the embodiments, the modified node search module is used to: obtain the difference data between the application code to be tested and the historical application code through a git diff command; and locate the modified node according to the difference data.

[0035] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0036] Obtain an application test request, and search for the application code to be tested according to the application test request;

[0037] Searching for a historical application code corresponding to the application code to be tested, comparing the application code to be tested with the historical application code, and determining a modified node;

[0038] Determine the call dependency node corresponding to the modified node through call trace;

[0039] Determine the call heat corresponding to the modified method according to the call dependency node, determine the test focus and test scope according to the call heat, and the modified method is associated with the modified node;

[0040] The application code to be tested is tested according to the test focus and the test scope.

[0041] A computer storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0042] Obtain an application test request, and search for the application code to be tested according to the application test request;

[0043] Searching for a historical application code corresponding to the application code to be tested, comparing the application code to be tested with the historical application code, and determining a modified node;

[0044] Determine the call dependency node corresponding to the modified node through call trace;

[0045] Determine the call heat corresponding to the modified method according to the call dependency node, determine the test focus and test scope according to the call heat, and the modified method is associated with the modified node;

[0046] The application code to be tested is tested according to the test focus and the test scope.

[0047] The above-mentioned application testing method, device, computer equipment, and storage medium based on call dependency relationships obtain an application test request, and search for the application code to be tested according to the application test request; search for the historical application code corresponding to the application code to be tested, compare the application code to be tested and the historical application code, and determine the modified node; determine the call dependency node corresponding to the modified node through call trace; determine the call heat corresponding to the modified method according to the call dependency node, and determine the test focus and test scope according to the call heat; test the application code to be tested according to the test focus and test scope. This application starts from the perspective of the application code to be tested, and analyzes the user's heat data through the modified nodes and call dependency nodes in the code, which can more effectively and accurately locate the modified methods affected in the software version update; thereby being able to more efficiently perform functional verification and effectively check problems for hot services in application testing, thereby improving the efficiency of application testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 An application scenario diagram of an application testing method based on call dependency in one embodiment;

[0049] Figure 2A flowchart of an application testing method based on call dependency in one embodiment;

[0050] Figure 3 A schematic diagram of a flow chart of a step of locating a modified node in an embodiment;

[0051] Figure 4 A schematic diagram of a process for searching for a call dependency node step in an embodiment;

[0052] Figure 5 A schematic diagram of a flow chart of a step of determining call heat in one embodiment;

[0053] Figure 6 A flowchart of steps for generating supplementary test cases in an embodiment;

[0054] Figure 7 A structural block diagram of an application testing device based on call dependency in one embodiment;

[0055] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0057] The application testing method based on call dependency provided in this application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the application testing server 104 through the network, the test environment is specifically Linux, and the application to be tested corresponding to the application code to be tested is specifically a Java application. When the application tester needs to perform application testing on the code of a specific software, the corresponding application testing request can be submitted to the application testing server 104 through the terminal 102 to perform application testing. Specifically, the application tester can send an application testing request to the application testing server 104 through the terminal 102. The application testing server 104 obtains the application testing request, searches for the application code to be tested according to the application testing request; searches for the historical application code corresponding to the application code to be tested, compares the application code to be tested with the historical application code, and determines the modified node; determines the call dependency node corresponding to the modified node through call trace; determines the call heat corresponding to the modified method according to the call dependency node, determines the test focus and test scope according to the call heat, and the modified method is associated with the modified node; tests the application code to be tested according to the test focus and test scope. The terminal 102 may be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0058] In one embodiment, Figure 2 As shown, an application testing method based on call dependency is provided, and the method is applied to Figure 1 The application test server 104 in the example is used as an example to illustrate, including the following steps:

[0059] Step 201: Obtain an application test request, and search for the application code to be tested according to the application test request.

[0060] Among them, the application test request refers to a task request submitted by the tester to the application test server 104 through the terminal, which is used to specify the application code to be tested and request the application test server 104 to start a test process. When the application test server 104 receives the application test request, it will find the corresponding application code to be tested to start a test process. The application code to be tested is the completed application code, which contains multiple historical versions, and the application test request refers to testing the latest application code. And focus on testing methods that have been modified in version updates and hot methods.

[0061] Specifically, when conducting an application test, the test staff needs to first initiate a corresponding application test request to the application test server 104 through the terminal 102. The application test request carries characteristic information of the application code to be tested, such as the address or project name, etc. After receiving the test request, the application test server 104 will search for the application code to be tested according to the characteristic information contained in the request, and obtain this part of the application code to be tested for subsequent software application testing.

[0062] Step 203: search for the historical application code corresponding to the application code to be tested, compare the application code to be tested with the historical application code, and determine the modified node.

[0063] Among them, the historical application code refers to the code of the previous version of the application code to be tested, specifically, it can be the code of the previous version of the application code to be tested. By comparing the two versions of the code, it can be determined which codes have been modified, so as to more effectively determine which content in the application code to be tested has been modified. In the version iteration test, it is precisely this part of the content that needs to be tested, that is, the change node.

[0064] Specifically, after the application code to be tested is determined, the historical application code corresponding to the application code to be tested can be searched based on the feature information corresponding to the application code to be tested, and then the application code to be tested and the historical application code can be compared to determine the modified node. For applications without historical application code, all codes can be used as modified nodes to perform full application testing.

[0065] Step 205: determine the call dependency node corresponding to the modified node through call trace.

[0066] Among them, call trace is used to determine the calling relationship of methods. In the application code, there is a call chain relationship between each method. Through call trace, all call dependencies corresponding to each modified node can be determined. The call dependency relationship includes the direct call relationship between the method of the modified node and the indirect call relationship. By clarifying all the call dependency nodes, the corresponding call relationship tree can be established. The call dependency node refers to the node that has a call dependency relationship with the modified node.

[0067] Specifically, after determining the modified node in the application code to be tested, the call dependency node corresponding to the modified node can be determined through call trace. Specifically, call trace can print out the function call stack of the current modified node, thereby clarifying the corresponding call dependency node.

[0068] Step 207, determining the call heat corresponding to the modified method according to the call dependency node, determining the test focus and test scope according to the call heat, and the modified method is associated with the modified node.

[0069] Step 209: Test the application code to be tested according to the test focus and test scope.

[0070] Among them, the modified node refers to the modified code method, and the modified method includes not only the modified node, but also other code methods that have a calling and called relationship with the modified node. The call heat can be determined by the number of times the method is called, how many ports call the method, the call ratio, and the average call time. The heat can be used to determine which methods need to be tested, so as to determine the focus and scope of the test. Then, the test can be carried out according to the test focus and test scope determined by the heat information, thereby improving the efficiency of application testing.

[0071] Specifically, after determining the modified node and the call dependency node, the call heat of the modified method corresponding to the modified node can be determined based on the call dependency node. Specifically, the top interface in the call dependency node of the call chain corresponding to the modified method can be called externally, and the call heat corresponding to the modified method can be determined based on the heat of the top interface being called externally. Then, by comparing the call heats between different modified methods, it is determined which modified methods are frequently called methods. These methods can be identified as test focuses, and the test scope is divided accordingly, and then application testing is performed.

[0072] The above-mentioned application testing method based on call dependency obtains an application testing request, searches for the application code to be tested according to the application testing request; searches for the historical application code corresponding to the application code to be tested, compares the application code to be tested and the historical application code to be tested, and determines the modified node; determines the call dependency node corresponding to the modified node through call trace; determines the call heat corresponding to the modified method according to the call dependency node, and determines the test focus and test scope according to the call heat; tests the application code to be tested according to the test focus and test scope. This application starts from the perspective of the application code to be tested, and analyzes the user's heat data through the modified nodes and call dependency nodes in the code, which can more effectively and accurately locate the modified methods affected in the software version update; thereby being able to more efficiently perform functional verification and effectively check problems for hot services in application testing, thereby improving the efficiency of application testing.

[0073] In one embodiment, if Figure 3 As shown, step 203 includes:

[0074] Step 302: Obtain the difference data between the application code to be tested and the historical application code through the git diff command.

[0075] Step 304: locate the modified node according to the difference data.

[0076] Among them, git is an open source distributed version control system that can effectively and quickly handle the version management of projects from very small to very large. In the solution of this application, multiple versions of application code can be managed through git, and then when testing is required, the difference data between the application code to be tested and the historical application code can be obtained through git's git diff command, and the changed nodes can be located based on the difference data. The changed node specifically refers to the method that contains the changed code line.

[0077] Specifically, the application testing server 104 can obtain the difference data of the code between the two versions through the git diff command. This part of the difference data specifically includes the modified line number and file list of the new and old versions of the code. At the same time, when cloning two different version files, the file source code is obtained. In one embodiment, the offset of the modified line of the new and old versions in the diff file can be parsed, and the plus and minus signs are used to represent the added and deleted code lines. The code lines with incremental changes are displayed more intuitively, and the complete change points are located. The modified node specifically refers to the method containing the modified code line. Specifically, in the process of comparing the version differences, the code line number where the change is located can be determined, and the starting line and ending line of the method containing the modified line can be further determined. In this embodiment, the difference data between the application code to be tested and the historical application code is obtained through the git diff command, and then the modified nodes are located, which can effectively improve the efficiency of locating the modified nodes, thereby improving the efficiency of application testing.

[0078] In one embodiment, step 205 specifically includes: by call trace, according to the modified node, reversely querying the top interface method in the dependency relationship corresponding to the modified node, and determining the call dependency relationship node between the top interface method and the modified node.

[0079] The top interface method refers to the interface method used by the application to interact with external data. Because the internal methods of the program cannot show specific popularity, the top interface method in the dependency relationship is reversely searched, and the popularity of other methods is inferred through the top interface method and the calling conditions between methods.

[0080] Specifically, the top interface method in the dependency relationship can be found in reverse based on the code change node. Then, the RPC (Remote Procedure Call) call status between microservices is calculated online and offline, including the total call volume, call ratio, and average time consumption. For example, in one of the embodiments, the call status of the changed method related to the changed node in the past week can be found based on the top interface method, and then the popularity status can be determined based on the call status. Then determine the test focus and test scope. Specifically, in this embodiment, by reversely querying the top interface method in the dependency relationship corresponding to the changed node, the call dependency node can be found more effectively, thereby improving the efficiency of application testing.

[0081] In one embodiment, if Figure 4 As shown, step 205 specifically includes:

[0082] Step 401 , packaging and compiling the project corresponding to the application code to be tested to obtain a jar file.

[0083] Step 403: Find the class method in the application code to be tested by parsing the jar file.

[0084] Step 405: Determine the modification method corresponding to the modified node according to the class method.

[0085] Step 407: Determine the call dependency node corresponding to the modified method through a recursive algorithm.

[0086] Among them, jar file (Java Archive, English: Java Archive) is a software package file format, which is usually used to aggregate a large number of Java class files, related metadata and resource (text, pictures, etc.) files into one file to develop Java platform application software or libraries.

[0087] Specifically, in one of the embodiments, the application testing method of the present application is specifically used to test Java type applications. When determining the call dependency node, the project corresponding to the application code to be tested can be packaged and compiled first, and then the class method in the source code is found by parsing the jar binary file, and the modified method is determined. Finally, according to the modification method, the call dependency node corresponding to the method of modifying the node in the project is analyzed by a recursive algorithm. In one of the embodiments, it is also possible to check whether the methods of the source code and the class binary file are the same to exclude the overloading situation. In this embodiment, by packaging and compiling the jar file, and then parsing the jar file to determine the call dependency node corresponding to the modified method, the efficiency of determining the call dependency node can be effectively improved, thereby improving the efficiency of application testing.

[0088] In one embodiment, if Figure 5 As shown, step 207 includes:

[0089] Step 502, determining the call volume, call ratio, and average call duration of the modified method under the top interface method according to the call data of the top interface method.

[0090] Step 504: Determine the call heat corresponding to the modified method according to the call volume, call ratio, and average call duration of the modified method.

[0091] Specifically, when it is necessary to determine the call heat of the modified method, it can be determined by the call data of the top interface method corresponding to the modified method, because the method inside the program cannot show the specific heat, so by reversely finding the top interface method in the dependency, through the top interface method, combined with the call situation between methods, the heat corresponding to other methods can be inferred. In one embodiment, corresponding heat weights can also be assigned to the call volume, call proportion and average call time, so that in the process of determining the call heat, the call heat can be calculated based on the specific values ​​corresponding to the call volume, call proportion and average call time, combined with the call weight. Improve the rationality of the call heat calculation, in another embodiment, after obtaining the top interface method, the modified method under the top interface method, and the call volume, call proportion and average call time corresponding to each modified method, a corresponding hot spot distribution table can be established based on these data, and the top level of the hot spot distribution table is the interface method, and the next level is the modified node under the interface method. The call volume, call proportion and average call time are the corresponding data of each modified node. At the same time, the modified methods can be ranked in the hotspot distribution table according to the call volume, call proportion, average call time and other data, and the ranking can reflect the heat corresponding to each modified method. This improves the visibility of the heat data. In this embodiment, the call data of the modified method is determined by the call data of the top interface method, and then the call heat corresponding to the modified method is determined.

[0092] In one embodiment, if Figure 6 As shown, after step 209, the following steps are also included:

[0093] Step 601, obtain the call relationship tree and historical test case data corresponding to the call trace.

[0094] Step 603: determine the node branch process corresponding to the tree node in the call relationship tree.

[0095] Step 605: Generate supplementary test cases according to the node branch process and historical test case data.

[0096] Specifically, after determining the test focus and test scope, and generating test cases to test the application, it also includes the use case tracking part, which can be implemented through the call relationship tree obtained by call trace. Specifically, after obtaining the tree relationship of call trace, the modified method can be used as a tree node to analyze the node branch process, and the corresponding label serial number can be added, combined with the historical test case data that has been used in the test process, and then the uncovered business use case points can be supplemented. In this embodiment, the test coverage of the test process can be effectively improved through manual use cases.

[0097] In one of the embodiments, the present application also includes a process of automatically generating test cases. Specifically, the call route of the call relationship is first obtained, and the method input parameters of the interface are analyzed to complete the different combinations of parameters; then the relationship between the tested code and the tested code is established. Therefore, the next time the code line is changed, the automated regression and result feedback to the test can be triggered directly based on the call link and the interface automation relationship. The efficiency of generating test cases can be effectively improved through automated use cases.

[0098] It should be understood that although Figure 2-6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-6 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0099] In one embodiment, Figure 7 As shown, an application testing device based on call dependency is provided, comprising:

[0100] The request receiving module 702 is used to obtain an application test request and search for the application code to be tested according to the application test request.

[0101] The modified node search module 704 is used to search for the historical application code corresponding to the application code to be tested, compare the application code to be tested with the historical application code, and determine the modified node.

[0102] The dependency node search module 706 is used to determine the call dependency node corresponding to the modified node through call trace.

[0103] The heat query module 708 is used to determine the call heat corresponding to the modified method according to the call dependency node, determine the test focus and test scope according to the call heat, and the modified method is associated with the modified node.

[0104] The application testing module 710 is used to test the application code to be tested according to the test focus and test scope.

[0105] In one embodiment, the modified node search module 704 is specifically used to: obtain the difference data between the application code to be tested and the historical application code through the git diff command; and locate the modified node according to the difference data.

[0106] In one embodiment, the dependency node search module 706 is specifically used to: through call trace, according to the modified node, reversely query the top interface method in the dependency relationship corresponding to the modified node, and determine the call dependency node between the top interface method and the modified node.

[0107] In one of the embodiments, the dependency node search module 706 is also used to: package and compile the project corresponding to the application code to be tested to obtain a jar file; search for class methods in the application code to be tested by parsing the jar file; determine the modified method corresponding to the modified node based on the class method; and determine the call dependency node corresponding to the modified method through a recursive algorithm.

[0108] In one of the embodiments, the heat query module 708 is specifically used to: determine the call volume, call proportion and average call time of the modified method under the top interface method based on the call data of the top interface method; determine the call heat corresponding to the modified method based on the call volume, call proportion and average call time of the modified method.

[0109] In one embodiment, the heat query module 708 is specifically used to: obtain the call relationship tree and historical test case data corresponding to the call trace; determine the node branch process corresponding to the tree node in the call relationship tree; and generate supplementary test cases according to the node branch process and historical test case data.

[0110] In one of the embodiments, it also includes a use case tracking module, which is used to: obtain the call relationship tree and historical test case data corresponding to the call trace; determine the node branch process corresponding to the tree node in the call relationship tree; and generate supplementary test cases based on the node branch process and historical test case data.

[0111] For the specific definition of the application testing device based on call dependency, please refer to the definition of the application testing method based on call dependency in the above text, which will not be repeated here. Each module in the above-mentioned application testing device based on call dependency can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0112] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store target detection model training data based on classification regression. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an application testing method based on call dependency is implemented.

[0113] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0114] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0115] Obtain an application test request, and search for the application code to be tested according to the application test request;

[0116] Find the historical application code corresponding to the application code to be tested, compare the application code to be tested with the historical application code, and determine the modified nodes;

[0117] Determine the call dependency node corresponding to the modified node through call trace;

[0118] Determine the call heat corresponding to the modified method according to the call dependency node, determine the test focus and test scope according to the call heat, and associate the modified method with the modified node;

[0119] Test the application code to be tested according to the test focus and test scope.

[0120] In one embodiment, when the processor executes the computer program, the following steps are further implemented: obtaining difference data between the application code to be tested and the historical application code through a git diff command; and locating the modified node according to the difference data.

[0121] In one embodiment, when the processor executes the computer program, the following steps are also implemented: through call trace, according to the modified node, reverse query the top interface method in the dependency relationship corresponding to the modified node, and determine the call dependency node between the top interface method and the modified node.

[0122] In one embodiment, when the processor executes the computer program, the following steps are also implemented: packaging and compiling the project corresponding to the application code to be tested to obtain a jar file; searching for class methods in the application code to be tested by parsing the jar file; determining the modified method corresponding to the modified node based on the class method; and determining the call dependency node corresponding to the modified method through a recursive algorithm.

[0123] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining the call volume, call proportion and average call time of the modified method under the top interface method based on the call data of the top interface method; determining the call heat corresponding to the modified method based on the call volume, call proportion and average call time of the modified method.

[0124] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining a call relationship tree and historical test case data corresponding to the call trace; determining a node branch process corresponding to a tree node in the call relationship tree; and generating a supplementary test case based on the node branch process and historical test case data.

[0125] In one embodiment, a computer storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0126] Obtain an application test request, and search for the application code to be tested according to the application test request;

[0127] Find the historical application code corresponding to the application code to be tested, compare the application code to be tested with the historical application code, and determine the modified nodes;

[0128] Determine the call dependency node corresponding to the modified node through call trace;

[0129] Determine the call heat corresponding to the modified method according to the call dependency node, determine the test focus and test scope according to the call heat, and associate the modified method with the modified node;

[0130] Test the application code to be tested according to the test focus and test scope.

[0131] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented: obtaining difference data between the application code to be tested and the historical application code through the git diff command; and locating the modified node according to the difference data.

[0132] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: through call trace, according to the modified node, reverse query the top interface method in the dependency relationship corresponding to the modified node, and determine the call dependency node between the top interface method and the modified node.

[0133] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the project corresponding to the application code to be tested is packaged and compiled to obtain a jar file; the class method in the application code to be tested is searched by parsing the jar file; the modified method corresponding to the modified node is determined according to the class method; and the call dependency node corresponding to the modified method is determined by a recursive algorithm.

[0134] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining the call volume, call proportion and average call time of the modified method under the top interface method based on the call data of the top interface method; determining the call heat corresponding to the modified method based on the call volume, call proportion and average call time of the modified method.

[0135] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining a call relationship tree and historical test case data corresponding to the call trace; determining a node branch process corresponding to a tree node in the call relationship tree; and generating a supplementary test case based on the node branch process and historical test case data.

[0136] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0137] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0138] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for testing an application based on calling dependencies, the method include: Obtain an application test request, and search for the application code to be tested according to the application test request; Searching for a historical application code corresponding to the application code to be tested, comparing the application code to be tested with the historical application code, and determining a modified node; Through call trace, according to the modified node, reversely query the top interface method in the dependency relationship corresponding to the modified node, and determine the call dependency relationship node between the top interface method and the modified node; Determine the call volume, call ratio and average call time of the modified method under the top interface method according to the call data of the top interface method; determine the call heat corresponding to the modified method according to the call volume, call ratio and average call time of the modified method, determine the test focus and test scope according to the call heat, and the modified method is associated with the modified node; The application code to be tested is tested according to the test focus and the test scope.

2. The method according to claim 1, It is characterized in that The searching for the historical application code corresponding to the application code to be tested, comparing the application code to be tested with the historical application code, and determining the modified node comprises: Obtaining difference data between the application code to be tested and the historical application code through the git diff command; The modified node is located according to the difference data.

3. The method according to claim 1, It is characterized in that The step of reversely querying the top interface method in the dependency relationship corresponding to the modified node through call trace according to the modified node, and determining the call dependency relationship node between the top interface method and the modified node includes: Pack and compile the project corresponding to the application code to be tested to obtain a jar file; Find the class method in the application code to be tested by parsing the jar file; Determine the modification method corresponding to the modification node according to the class method; The call dependency node corresponding to the modified method is determined through a recursive algorithm.

4. The method according to claim 1, It is characterized in that After testing the application code to be tested according to the test focus and the test scope, the method further includes: Get the call relationship tree and historical test case data corresponding to the call trace; Determine the node branch process corresponding to the tree node in the call relationship tree; A supplementary test case is generated according to the node branch process and the historical test case data.

5. An application testing device based on call dependency, It is characterized in that The device comprises: A request receiving module, used to obtain an application test request and search for the application code to be tested according to the application test request; A modified node search module, used to search for the historical application code corresponding to the application code to be tested, compare the application code to be tested with the historical application code, and determine the modified node; A dependency node search module, used to reversely query the top interface method in the dependency relationship corresponding to the modified node through call trace according to the modified node, and determine the call dependency relationship node between the top interface method and the modified node; A heat query module is used to determine the call volume, call proportion and average call time of the modified method under the top interface method according to the call data of the top interface method; determine the call heat corresponding to the modified method according to the call volume, call proportion and average call time of the modified method, determine the test focus and test scope according to the call heat, and the modified method is associated with the modified node; The application testing module is used to test the application code to be tested according to the test focus and the test scope.

6. The device according to claim 5, It is characterized in that The modified node search module is used to obtain the difference data between the application code to be tested and the historical application code through the git diff command; and locate the modified node according to the difference data.

7. The device according to claim 5, It is characterized in that The dependency node search module is also used to: package and compile the project corresponding to the application code to be tested to obtain a jar file; search for class methods in the application code to be tested by parsing the jar file; determine the modified method corresponding to the modified node based on the class method; and determine the call dependency node corresponding to the modified method through a recursive algorithm.

8. The method according to claim 5, It is characterized in that It also includes a use case tracking module for: obtaining a call relationship tree and historical test case data corresponding to the calltrace; determining a node branch process corresponding to a tree node in the call relationship tree; A supplementary test case is generated according to the node branch process and the historical test case data.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

10. A computer storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Code testing method and apparatus, terminal and storage medium

    CN107085555A

  • Method for performing permission early warning based on the importance degree of a code method

    CN109656615A

  • A program analysis method and terminal equipment

    CN109783353A

  • Proactive and selective regression testing based on historic test results

    US20170139815A1

Cited By

  • SAP closed-loop operation and maintenance method and system based on change influence atlas

    CN122633586A

  • Sap closed-loop operation and maintenance method and system based on change influence graph

    CN122633586B