Test method and device for program analysis, equipment and storage medium
By constructing the link topology model of the target service system and comparing the expected and actual modification information, the problem of difficulty in ensuring the adaptability of the online service system function before modification is solved, and the compatibility pre-test of the new modified function and the original function is realized. , reducing conflicts and costs.
Patent Information
- Application Number
- CN202410783022.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-10-18
AI Technical Summary
It is difficult with the existing technology to ensure that the newly modified service functions are highly compatible with the original functions of the system before functional modifications are made to the online service system. This often leads to functional conflicts after online use and increases development and testing time and labor costs. .
By constructing a link topology model of the target service system, the expected modification information and actual modification information of the target service are obtained, and the two are compared to determine whether the actual modification information meets the modification requirements, and then pre-tested to ensure compatibility.
Conduct pre-testing before functional modifications to reduce the occurrence of functional conflicts, improve testing efficiency, and reduce the time and labor costs of subsequent testing and adjustments.
Smart Images

Figure CN118796685A_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of the present specification relate to the field of program testing technology, and more particularly, to a testing method, apparatus, device, and storage medium for program analysis. Background Art
[0002] For online service systems, with the continuous update of usage requirements and the service provider's own continuous pursuit of system quality, it is often necessary to modify the service functions. For the modified service functions, before they are put into online use, the modified corresponding program files need to be tested to ensure that the newly modified service functions will not affect other original service functions of the system while being used normally.
[0003] In traditional testing methods, modified program files are usually tested using static code scanning and dynamic analysis, and are put online for use after passing the test. For example, during testing, static code scanning can be used to check the syntax, data types, and other potential problems of program files, and dynamic analysis can be used to check the running program for abnormal problems such as null pointers. However, this method of testing modified program files separately is difficult to ensure a high degree of compatibility with the original service functions of the system. It is often the case that offline tests are normal, but after being put into online use, the newly modified service functions are exposed to conflict with the original service functions of the system.
[0004] Therefore, it is necessary to provide a method for testing updated functions in combination with the existing functions of the system, so as to improve the efficiency and accuracy of development and testing and reduce repeated rework. Summary of the invention
[0005] In order to improve the overall efficiency of program testing and reduce manpower and time costs, one or more embodiments of this specification provide a testing method, apparatus, device and storage medium for program analysis.
[0006] In a first aspect, one or more embodiments of the present specification provide a test method for program analysis, comprising: obtaining a link topology model of a target service system; the link topology model comprising multiple first link information, used to indicate the calling relationship between multiple services in the target service system; obtaining expected modification information and actual modification information corresponding to the target service; the target service is any one of the multiple services; the expected modification information and the actual modification information respectively include modification information of at least one of the request parameter type and return parameter type of the target service, and the parameter list and return value type of the method thereof; according to the link topology model, determining the second link information associated with the target service after the modification according to the expected modification information; according to the link topology model, determining the third link information associated with the target service after the modification according to the actual modification information; according to the second link information and the third link information, determining the test result of the actual modification information.
[0007] In an optional embodiment, obtaining a link topology model of a target service system includes: respectively obtaining first traffic data generated by multiple services in the target service system during execution; and constructing a link topology model of the target service system based on all the obtained first traffic data.
[0008] In an optional embodiment, first flow data generated during the execution of multiple services in the target service system are respectively obtained, including: collecting the first flow data during the execution of the multiple services from the target service system through a service plug-in.
[0009] In an optional embodiment, a link topology model of the target service system is constructed based on all the acquired first traffic data, including: identifying multiple tracking identifiers from all the acquired first traffic data; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; determining multiple fourth link information based on the first traffic data associated with the multiple tracking identifiers; deduplicating the multiple fourth link information to obtain multiple first link information; and constructing the link topology model of the target service system based on the multiple first link information.
[0010] In an optional embodiment, multiple fourth link information are determined based on the first traffic data associated with the multiple tracking identifiers, including: determining the service associated with each tracking identifier and at least one first method in each service based on the first traffic data associated with the multiple tracking identifiers; determining at least one first call link corresponding to each tracking identifier based on the calling relationship between the service associated with each tracking identifier and each first method; determining the request parameter type and return parameter type of the service associated with the corresponding first call link, as well as the parameter list and return value type of each associated first method based on the first traffic data flowing through each first call link; and determining the request parameter type and return parameter type of the service associated with each first call link, as well as the parameter list and return value type of the associated first method as one fourth link information.
[0011] In an optional embodiment, a link topology model of the target service system is constructed based on the multiple first link information, including: determining at least one mutually related fifth link information from the multiple first link information based on the calling relationship between the multiple services indicated by the multiple first link information; constructing a corresponding link topology sub-model based on each of the fifth link information; and constructing a link topology model of the target service system based on all link topology sub-models.
[0012] In an optional embodiment, a link topology model of the target service system is constructed based on all the acquired first traffic data, including: identifying multiple tracking identifiers from all the acquired first traffic data; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; based on the first traffic data associated with each tracking identifier, a first prefix tree corresponding to the corresponding tracking identifier is generated; the root node of the first prefix tree is the corresponding tracking identifier, and the path information from the root node to each leaf node is a first link information corresponding to the corresponding tracking identifier; based on the first prefix trees corresponding to the multiple tracking identifiers, a link topology model of the target service system is constructed.
[0013] In an optional embodiment, a link topology model of the target service system is constructed based on the first prefix trees corresponding to the multiple tracking identifiers, including: mining a corresponding frequent item set from the first prefix tree corresponding to each tracking identifier based on a preset frequent item support; generating a second prefix tree corresponding to the corresponding tracking identifier based on the frequent item set corresponding to each tracking identifier; and constructing the link topology model of the target service system based on the second prefix trees corresponding to the multiple tracking identifiers.
[0014] In an optional embodiment, the test result of the actual modification information is determined based on the second link information and the third link information, including: displaying the comparison result of the second link information and the third link information; if the comparison results are consistent, determining that the actual modification information meets the modification requirements; if the comparison results are inconsistent, outputting the comparison results for adjusting the actual modification information.
[0015] In an optional embodiment, it also includes: respectively acquiring second traffic data generated by multiple services in the target service system during execution; and updating at least one first link information in the link topology model according to the acquired second traffic data.
[0016] In a second aspect, one or more embodiments of the present specification also provide a test device for program analysis, comprising: a first acquisition module, used to acquire a link topology model of a target service system; the link topology model comprises multiple first link information, used to indicate the calling relationship between multiple services in the target service system; a second acquisition module, used to acquire expected modification information and actual modification information corresponding to the target service; the target service is any one of the multiple services; the expected modification information and the actual modification information respectively include modification information of the request parameter type, the return parameter type, and at least one of the parameter list and return value type of the method of the target service; a first determination module, used to determine, based on the link topology model, the second link information associated with the target service after the target service is modified according to the expected modification information; and, based on the link topology model, determine the third link information associated with the target service after the target service is modified according to the actual modification information; a second determination module, used to determine the test result of the actual modification information based on the second link information and the third link information.
[0017] In an optional embodiment, the first acquisition module acquires a link topology model of the target service system, and is used to: respectively acquire first traffic data generated by multiple services in the target service system during execution; and construct a link topology model of the target service system based on all acquired first traffic data.
[0018] In an optional embodiment, the first acquisition module respectively acquires the first flow data generated during the execution of multiple services in the target service system, and is used to: collect the first flow data during the execution of the multiple services from the target service system through a service plug-in.
[0019] In an optional embodiment, the first acquisition module constructs a link topology model of the target service system based on all the acquired first traffic data, and is used to: identify multiple tracking identifiers from all the acquired first traffic data; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; determine multiple fourth link information based on the first traffic data associated with the multiple tracking identifiers through the first determination module; deduplicate the multiple fourth link information to obtain multiple first link information; and construct the link topology model of the target service system based on the multiple first link information.
[0020] In an optional embodiment, the first determination module determines multiple fourth link information based on the first traffic data associated with the multiple tracking identifiers, and is used to: determine the service associated with each tracking identifier and at least one first method in each service based on the first traffic data associated with the multiple tracking identifiers; determine at least one first call link corresponding to each tracking identifier based on the calling relationship between the service associated with each tracking identifier and each first method; determine the request parameter type and return parameter type of the service associated with the corresponding first call link, as well as the parameter list and return value type of each associated first method based on the first traffic data flowing through each first call link; determine the request parameter type and return parameter type of the service associated with each first call link, as well as the parameter list and return value type of the associated first method as one fourth link information.
[0021] In an optional embodiment, the first acquisition module constructs a link topology model of the target service system based on the multiple first link information, and is used to: determine at least one mutually related fifth link information from the multiple first link information based on the calling relationship between the multiple services indicated by the multiple first link information; construct a corresponding link topology sub-model based on each of the fifth link information; and construct a link topology model of the target service system based on all link topology sub-models.
[0022] In an optional embodiment, the first acquisition module constructs a link topology model of the target service system based on all the acquired first traffic data, and is used to: identify multiple tracking identifiers from all the acquired first traffic data; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; based on the first traffic data associated with each tracking identifier, generate a first prefix tree corresponding to the corresponding tracking identifier; the root node of the first prefix tree is the corresponding tracking identifier, and the path information from the root node to each leaf node is a first link information corresponding to the corresponding tracking identifier; based on the first prefix trees corresponding to the multiple tracking identifiers, construct the link topology model of the target service system.
[0023] In an optional embodiment, the first acquisition module constructs a link topology model of the target service system according to the first prefix trees corresponding to the multiple tracking identifiers, and is used to: mine a corresponding frequent item set from the first prefix tree corresponding to each tracking identifier according to a preset frequent item support; generate a second prefix tree corresponding to the corresponding tracking identifier according to the frequent item set corresponding to each tracking identifier; and construct the link topology model of the target service system according to the second prefix trees corresponding to the multiple tracking identifiers.
[0024] In an optional embodiment, the second determination module determines the test result of the actual modification information based on the second link information and the third link information, and is used to: display the comparison result of the second link information and the third link information; if the comparison results are consistent, determine that the actual modification information meets the modification requirements; if the comparison results are inconsistent, output the comparison results for adjusting the actual modification information.
[0025] In an optional embodiment, the first acquisition module is further used to: respectively acquire second traffic data generated by multiple services in the target service system during execution; and update at least one first link information in the link topology model based on the acquired second traffic data.
[0026] In a third aspect, one or more embodiments of the present specification further provide an electronic device comprising a memory and a processor; the memory is used to store a computer program product; the processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, the method of the above-mentioned first aspect is implemented.
[0027] In a fourth aspect, one or more embodiments of the present specification further provide a computer-readable storage medium, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed, the method of the first aspect described above is implemented.
[0028] In one or more embodiments of the present specification, by collecting the traffic data generated by multiple services in the target service system during use and constructing a link topology model corresponding to the target service system, it is possible to visually display the calling relationship between multiple services in the target service system. Based on this, when it is necessary to modify any target service in the target service system, other services associated with the target service that need to be modified synchronously and the corresponding expected modification information can be determined in the constructed link topology model according to the modification requirements for the target service. Furthermore, by comparing the expected modification information and the actual modification information of the target service, it can be determined whether the actual modification information of the target service meets the modification requirements.
[0029] In summary, through the testing method provided in one or more embodiments of the present specification, it is possible to pre-test the compatibility of the modified function with the original service function of the target service system before performing functional testing on the modified target service, and in the event that the modified function of the target service is found to be incompatible with the original service function of the target service system, timely output corresponding test results, modification suggestions and other information, to help R&D personnel adjust the modification content in a timely manner, help reduce time and labor costs in subsequent functional testing, and improve overall testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of one or more embodiments of the present specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of one or more embodiments of the present specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0031] Figure 1 A flowchart of a testing method for program analysis provided for one or more embodiments of this specification;
[0032] Figure 2a A schematic diagram of the structure of a target service system including multiple services provided for one or more embodiments of this specification;
[0033] Figure 2b A schematic diagram of initiating a service request to multiple services in a target service system provided by one or more embodiments of this specification;
[0034] Figure 2c A schematic diagram of a calling relationship between multiple services in a target service system provided by one or more embodiments of this specification;
[0035] Figure 2d A schematic diagram of a link topology model of a target service system provided by one or more embodiments of this specification;
[0036] Figure 3 A structural block diagram of a test device for program analysis provided for one or more embodiments of this specification;
[0037] Figure 4 A structural block diagram of an electronic device provided for one or more embodiments of this specification. DETAILED DESCRIPTION
[0038] One or more embodiments of the present invention are further described in detail below through the accompanying drawings and examples. Through these descriptions, the features and advantages of one or more embodiments of the present invention will become clearer and more specific.
[0039] The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise noted.
[0040] In addition, the technical features involved in different implementations of one or more embodiments of this specification described below can be combined with each other as long as they do not conflict with each other.
[0041] To facilitate understanding, the application scenarios of the technical solutions provided by one or more embodiments of this specification are first described below.
[0042] During the online use of the service system, in order to adapt to user needs or the company's own adjustments to the service structure, it often involves the modification of service functions, which requires iterative updates to the program code of the corresponding functions to adapt to the latest usage needs of the service system. Usually, after the program code is modified, it needs to be tested offline and online, and only after the test is passed can it be put online for user use. In these testing processes, static code scanning and dynamic analysis are usually included. For example, static code scanning is used to check the syntax, data types and other potential problems of the program code, and dynamic analysis is used to check the execution of the program for abnormal problems such as null pointers during runtime.
[0043] However, although these testing methods can conduct targeted testing on the modified functions, it is difficult to intuitively perceive the degree of compatibility between the newly modified functions and the original functions of the service system. In most cases, the problem is discovered when the newly modified functions conflict with the original functions of the service system during the testing process or even during the use of online users. This requires rework and the above program modification and testing process to be performed again until it is determined that the functional conflict disappears. It can be seen that this process consumes a lot of manpower and time costs. If the newly modified functions can be pre-tested to see if there is a conflict with the original functions of the service system before the formal test, unnecessary repetitive work can be reduced during subsequent testing and use.
[0044] To this end, one or more embodiments of the present specification provide a testing method, apparatus, device and storage medium for program analysis, which are used to pre-test the compatibility of the modified program code with the original service function before formally testing the modified program code, so as to determine whether the modified function is compatible with the original function of the service system, so as to timely adjust the modified program file when it is determined that there is a functional conflict.
[0045] The following describes a test method for program analysis provided by one or more embodiments of this specification in conjunction with the accompanying drawings.
[0046] Figure 1 A flowchart of a test method for program analysis provided in one or more embodiments of this specification, such as Figure 1 As shown, the method includes:
[0047] S102, obtaining a link topology model of the target service system, wherein the link topology model includes multiple pieces of first link information, which are used to indicate a calling relationship between multiple services in the target service system;
[0048] S104, obtaining expected modification information and actual modification information corresponding to a target service, wherein the target service is any one of a plurality of services, and the expected modification information and the actual modification information respectively include modification information of at least one of a request parameter type, a return parameter type, and a parameter list and a return value type of a method of the target service;
[0049] S106. Determine, according to the link topology model, second link information associated with the target service after modification according to the expected modification information;
[0050] S108. Determine, according to the link topology model, third link information associated with the target service after modification according to the actual modification information;
[0051] S110: Determine a test result of actually modifying the information according to the second link information and the third link information.
[0052] It should be noted that, according to the method provided in this application, when any service of any service system is modified, the implementation method of the corresponding program test is the same. Therefore, the following description is given by taking any service of any service system as an example. In one or more embodiments of this specification, for the convenience of description, any of the aforementioned service systems is referred to as a target service system, wherein the target service system includes multiple services, and the target service is any one of these multiple services. Based on this, in order to indicate the calling relationship between multiple services in the target service system, one or more embodiments of this specification construct a corresponding link topology model for the target service system, wherein the link topology model includes multiple first link information, each first link information includes the request parameter type (or access parameter type) and return parameter type of each service associated with the corresponding call link, as well as the parameter list and return value type of each method executed by each service.
[0053] Based on the above, in order to pre-test the modification results of the target service, the expected modification information and the actual modification information of the target service can be obtained to determine whether the actual modification information of the target service meets the modification requirements based on the comparison results of the two. Among them, the expected modification information of the target service refers to the modification information determined based on the modification requirements of the target service and the link topology model, which includes not only the modification information of the target service, but also the modification information of other services that have a call relationship with the target service in the link topology model and need to be modified synchronously; accordingly, the actual modification information of the target service refers to the modification information of the target service by the R&D personnel according to the modification requirements, as well as the modification information of other services that have a call relationship with the target service determined based on the R&D experience.
[0054] In one or more embodiments of the present specification, the actual modification information of the target service meets the modification requirements, which means that after the target service is modified according to the actual modification information, the modified target service is applied to the target service system, and there will be no functional conflict with the original service in the target service system. That is to say, when modifying the target service, it is necessary not only to consider the modification of the target service itself, but also to consider the synchronous modification of other services that have an associated relationship with the target service. However, since the R&D personnel have limited understanding of the specific functions of the target service system, the other services that they determine to have a call relationship with the target service may be different from the other services that have a call relationship with the target service in the link topology model. After the target service is modified according to the actual modification information provided by the R&D personnel, it may be incompatible with the original service of the target service system when applied to the target service system. Therefore, it is necessary to test the actual modification information of the target service according to the expected modification information of the target service to determine whether the corresponding actual modification information meets the modification requirements.
[0055] In one or more embodiments of this specification, the specific content of the expected modification information and the actual modification information corresponding to the target service is not limited. Optionally, the expected modification information and the actual modification information of the target service at least include modification information of at least one of the request parameter type, the return parameter type, and the parameter list and return value type of each method executed by the target service. Based on this, after obtaining the expected modification information and the actual modification information of the target service, the second link information associated with the target service after the modification according to the expected modification information can be determined according to the link topology model, and the third link information associated with the target service after the modification according to the actual modification information can be determined according to the link topology model, and then, the test result of the actual modification information can be determined according to the second link information and the third link information.
[0056] The following is a description of the detailed information on the implementation process of each step in the above method.
[0057] In one or more embodiments of the present specification, the specific method for obtaining the link topology model of the target service system is not limited. Optionally, the link topology model can be constructed in advance, and when the actual modification information of the target service needs to be tested, the pre-constructed link topology model can be directly obtained; or, when the actual modification information of the target service needs to be tested, the link topology model of the target service system can be directly determined. The specific method can be determined according to actual needs. Regardless of the acquisition method, one or more embodiments of the present specification do not limit the method for constructing the link topology model. Optionally, when constructing the link topology model, the first traffic data generated by multiple services in the target service system during execution can be respectively obtained, and then, based on all the obtained first traffic data, the link topology model of the target service system can be constructed.
[0058] In one or more embodiments of the present specification, there is no limitation on the method of obtaining the first flow data generated during the online use of the target service system. Optionally, each service in the target service system can be directly monitored in real time, and when a service request is detected for any service in the target service system, the first flow data generated during the execution of the corresponding service can be obtained. Alternatively, the target service system can obtain the first flow data generated during the execution of each service in advance, and then obtain all the first flow data collected in advance from the target service system.
[0059] Further optionally, whether the first flow data generated during the execution of multiple services is directly obtained from the target service system, or the first flow data generated during the execution of multiple services is obtained in advance by the target service system, the first flow data generated during the execution of the aforementioned multiple services can be collected from the target service system through a service plug-in for collecting flow data. Among them, one or more embodiments of this specification do not limit the specific manner in which the service plug-in collects the first flow data. Optionally, when collecting the first flow data generated during the execution of each service, the service plug-in may not make any distinction. As long as a service request is generated in response, the first flow data generated during the execution of the requested service is collected. Alternatively, the service plug-in may also include a setting function, through which the service type that needs to be collected can be set. For example, a frequently used service type is set as a service that needs to collect flow data. Based on this, the service plug-in can collect the first flow data generated during the execution of the corresponding service in a targeted manner for the set service type.
[0060] In one or more embodiments of the present specification, there is no limitation on the specific content of the first flow data generated by each service during the execution process, and the content of the first flow data obtained can also be flexibly selected according to the actual test requirements. In practical applications, different users can initiate service requests for the same service respectively, and the same user can also initiate multiple service requests for the same service. Therefore, in order to distinguish the first flow data generated by each service executing the corresponding service according to different service requests, in one or more embodiments of the present specification, a corresponding trace ID (traceID) is assigned to each service request initiated by each service each time. Based on this, the first flow data generated by each service during the execution process includes the trace ID corresponding to the corresponding service request. In addition, it also includes the request parameters of the corresponding service request and its corresponding request parameter type, the return parameter and its corresponding return parameter type, and the parameters and return values of each method executed by each service for the corresponding service request, as well as the corresponding parameter list and return value type.
[0061] Based on this, when constructing a link topology model of the target service system based on all the acquired first traffic data, multiple tracking identifiers can be first identified from all the acquired first traffic data, that is, all tracking identifiers involved in all the first traffic data can be identified; then, based on the first traffic data associated with the identified multiple tracking identifiers, multiple fourth link information can be determined; then, the multiple fourth link information can be deduplicated to obtain multiple first link information, so as to construct a link topology model of the target service system based on the multiple first link information.
[0062] It should be noted that in one or more embodiments of the present specification, the specific manner of constructing the link topology model of the target service system is not limited, and two possible implementation manners are exemplified below.
[0063] In an optional manner, in order to determine multiple fourth link information from the first traffic data associated with multiple identified tracking identifiers, the service associated with each tracking identifier and at least one first method in each service can be determined based on the first traffic data associated with each tracking identifier, and at least one call link (hereinafter referred to as the first call link) corresponding to each tracking identifier can be determined based on the call relationship between the service associated with each tracking identifier and each first method. Further, based on the first traffic data flowing through each first call link, the request parameter type and return parameter type of the service associated with the corresponding first call link, as well as the parameter list and return value type of each associated first method can be determined. Further, the request parameter type and return parameter type of the service associated with each first call link, as well as the parameter list and return value type of each first method are determined as one fourth link information, and multiple fourth link information can be obtained.
[0064] Because, in actual applications, whether different users initiate the same type of service requests for the same service, or the same user initiates multiple service requests of the same type for the same service, during the execution of the corresponding service, the corresponding first call link is the same, and the only difference is that the request parameters and corresponding return parameters of each service request, as well as the parameters passed to each method and the corresponding return values may be different. Therefore, in the above embodiment, the multiple fourth link information determined according to multiple tracking identifiers may include some fourth link information that only has different data values but the same first call link. Based on this, before constructing the link topology model of the target service system, it is necessary to deduplicate the multiple fourth link information obtained in the above embodiment to obtain multiple different first link information.
[0065] Optionally, when deduplication is performed on multiple fourth link information, multiple services associated with each fourth link information and the request parameters of each service and their corresponding request parameter types, return parameters and their corresponding return parameter types, parameters of each method executed by multiple services and their corresponding parameter lists, return values and their corresponding return value types, and the calling relationships between multiple services and each method can be first identified. Based on this, for multiple services associated with each fourth link information and each method executed by each service, at least two fourth link information with the same request parameter type and return parameter type and the same parameter list and return value type in each method executed by these services, and the same calling relationship between the service and the method, are determined to correspond to the same first call link. Further, for each group of at least two fourth link information corresponding to the same first call link, only one fourth link information is retained as the first link information of the corresponding first call link to obtain multiple first link information that are different from each other.
[0066] Based on the above, after obtaining multiple different first link information, the link topology model of the target service system can be constructed according to the multiple first link information. However, since the target service system includes multiple services, there may be some services that have a calling relationship between the multiple services, and there may also be some services that do not have a calling relationship. Therefore, among the multiple different first link information obtained through the above embodiment, there may be some first link information that has an association relationship, and some first link information that does not have an association relationship. Based on this, when constructing the link topology model of the target service system, at least one fifth link information that is mutually related can be determined from the multiple first link information according to the calling relationship between the multiple services indicated by the multiple first link information. Furthermore, according to each fifth link information, the corresponding link topology sub-model is first constructed, and then, according to all the link topology sub-models, the link topology model of the target service system is constructed.
[0067] The process of constructing the link topology model of the target service system in the above embodiment is exemplarily described below with reference to the accompanying drawings.
[0068] Figure 2a FIG. 1 is a schematic diagram of the structure of the target service system, wherein each black dot represents a service in the target service system. It should be noted that, in order to simplify the structure of the attached figure, Figure 2a-2d The diagram only illustrates the calling relationship between multiple services as an example, and does not show the calling relationship between the various methods executed by each service.
[0069] Assume, in this example, that the service entry of the target service system is Figure 2a The services A, B, C and D in the dashed box have service exports respectively. Figure 2a Services H, L, O and S in the dotted box, when the user initiates a service request to the service in the service entrance, the requested service will pass and process parameters by calling other services, and finally return the return parameters corresponding to the processing results to the user through the service in the service exit. Of course, this method is only an exemplary description and is not limited to this in actual applications. Based on this, by collecting the first traffic data generated by each service in the target service system during execution, multiple services associated with each tracking identifier, as well as the request parameters and their corresponding request parameter types and return parameters and their corresponding return parameter types of each service, and the calling relationship between multiple services can be identified.
[0070] Assume that the service requests initiated for services A, B, C and D are as follows Figure 2b As shown, three service requests are initiated for service A, and the corresponding tracking identifiers are TraceID1, TraceID2 and TraceID3 respectively; one service request is initiated for service B, and the corresponding tracking identifier is TraceID4; two service requests are initiated for service C, and the corresponding tracking identifiers are TraceID5 and TraceID6 respectively; three service requests are initiated for service D, TraceID7, TraceID8 and TraceID9. Based on this, the first call link associated with each tracking identifier can be identified from the collected traffic data, as well as the multiple services associated with each first call link, the request parameter type and the return parameter type of each service, as the fourth link information corresponding to the corresponding tracking identifier.
[0071] Based on the above, it is assumed that the first call links consisting of multiple services associated with each tracking identifier are identified from the collected first traffic data, namely: the multiple first call links associated with TraceID1, TraceID2 and TraceID3 are 3 AEFH, 3 AEFGH, 3 AEFGL, 3 AIKL and 3 AIKO; the multiple first call links associated with TraceID4 are 1 BIKL, 1 BIKO and 1 BJO; the multiple first call links associated with TraceID5 and TraceID6 are 2 CMNQO and 2 CMNQS; the multiple first call links associated with TraceID7, TraceID8 and TraceID9 are 3 DPNQO, 3 DPNQS and 3 DPRS.
[0072] That is to say, through the collected first traffic data, it can be determined that multiple services of the target service system correspond to 31 pieces of fourth link information. Since some of the fourth link information corresponds to the same first call link, after deduplication processing, 13 different pieces of first link information can be obtained, namely AEFH, AEFGH, AEFGL, AIKL, AIKO, BIKL, BIKO, BJO, CMNQO, CMNQS, DPNQO, DPNQS and DPRS.
[0073] Further, according to the calling relationship between multiple services, the following can be determined from the above 13 pieces of first link information: Figure 2c According to the four fifth link information with associated relationships shown in FIG. 1 , a corresponding link topology sub-model can be constructed according to each fifth link information. Furthermore, according to all link topology sub-models, the following can be constructed: Figure 2d The link topology model corresponding to the target service system shown.
[0074] In the above embodiment, link information is directly identified from the collected first traffic data and a link topology model is constructed. In addition, a link topology model may be constructed by constructing a prefix tree (FP-Tree).
[0075] Optionally, after all the first traffic data are acquired, multiple tracking identifiers and the services associated with each tracking identifier and their corresponding request parameter types and return parameter types, parameter lists and return value types of each method executed by each service can be identified from all the acquired first traffic data. Further, based on the first traffic data associated with each tracking identifier, a first prefix tree corresponding to the corresponding tracking identifier is generated, wherein the root node of the first prefix tree is the corresponding tracking identifier, the path information from the root node to each leaf node is a first link information corresponding to the corresponding tracking identifier, and a node on each path corresponds to a service and its execution method. Based on this, a link topology model of the target service system can be constructed based on the first prefix trees corresponding to multiple tracking identifiers.
[0076] In this embodiment, the type of algorithm used to construct the prefix tree is not limited. Optionally, a frequent pattern tree algorithm (Parallel FP-Growth, PFP) can be used to perform the above process. Based on this, in order to construct a link topology model in a targeted manner, the corresponding frequent item support can also be set according to the characteristics of each service in the target service system to narrow the data processing scope and improve the processing efficiency. Among them, this embodiment does not limit the selection method of the frequent item support of each service. Optionally, the corresponding frequent item support can be determined according to the importance level, usage cycle or other dimensions that meet actual needs of the corresponding service.
[0077] Based on this, for each tracking identifier, the corresponding frequent item set can be mined from the first prefix tree corresponding to the corresponding tracking identifier according to the preset frequent item support of the service corresponding to the tracking identifier, and then, according to the frequent item set corresponding to each tracking identifier, a second prefix tree corresponding to the corresponding tracking identifier is generated. Furthermore, according to the second prefix trees corresponding to multiple tracking identifiers, a link topology model of the target service system can be constructed.
[0078] It should be noted that in the process of constructing the prefix tree, the specific construction method is not limited. Optionally, the first prefix trees corresponding to different tracking identifiers can be constructed in parallel through three Map-Reduce operations, wherein each constructed first prefix tree can be regarded as a process of constructing a link topology sub-model. Based on this, according to the frequent item support preset for each service, multiple first prefix trees are aggregated to construct a second prefix tree of global dimension as the link topology model of the target service system.
[0079] Further optionally, in each process of constructing the first prefix tree and the second prefix tree, the node positions in the corresponding first prefix tree and / or the second prefix tree can be flexibly adjusted according to the characteristics of different services. For example, for frequently accessed services, the nodes in the corresponding first prefix tree and / or the second prefix tree can be prioritized at the top layer. Of course, in practical applications, this is not limited to this, and the specific construction process can be determined according to actual needs, which will not be described in detail here.
[0080] In the above embodiment, the link topology model constructed by the collected first traffic data can logically reflect the calling relationship between multiple services in the target service system, and between each service and each executed method. Based on this, when it is necessary to modify any one of the multiple services, other services that have a calling relationship with the target service can be determined according to the calling relationship indicated by the link topology model of the target service system, and then the services that need to be modified synchronously can be determined. In other words, if the target service is modified, other services that have a calling relationship with it may also need to be modified synchronously. For example, the type of request parameter A that the target service originally needs to receive is a string type. According to the modification requirements, it is determined that the type of request parameter A needs to be modified to a numeric type. Then, among other services that have a calling relationship with the target service, the service that needs to synchronously process request parameter A also needs to modify the parameter type to a numeric type.
[0081] Since the services actually modified by the R&D personnel may be different from the services determined in the above embodiments, in order to distinguish from the actual modification information of the R&D personnel, one or more embodiments of this specification refer to the modification information of the target service and its services that need to be modified synchronously based on the link topology model as expected modification information. Based on this, according to the calling relationship between the target service and its services that need to be modified synchronously in the link topology model, the second link information associated with the target service after being modified according to the expected modification information can be determined; accordingly, according to the calling relationship between the services actually modified by the R&D personnel in the link topology model, the third link information associated with the target service after being modified according to the actual modification information can be determined. Furthermore, based on the comparison results of the second link information and the third link information, it can be determined whether the actual modification information of the target service meets the modification requirements.
[0082] Optionally, the comparison results of the second link information and the third link information can be displayed in a visual manner, wherein the specific content displayed is not limited. Optionally, in the case where there are differences between the second link information and the third link information, the comparison results of the entire links corresponding to the second link information and the third link information can be displayed, and the parts where there are differences between the two can be distinguished and marked in the comparison results of the entire links; or, instead of displaying the comparison results of the entire link, only the comparison results of the corresponding difference parts can be displayed. Further optionally, corresponding modification suggestion information can also be given for the difference parts. Accordingly, in the case where the second link information and the third link information are exactly the same, only the prompt information that the test results meet the modification requirements can also be displayed.
[0083] Further optionally, in addition to comparing the links corresponding to the second link information and the third link information, the comparison results of the second link information and the third link information may also include the comparison results of the request parameter type and the return parameter type corresponding to the same service in the second link information and the third link information, and the comparison results of the parameter list and the return value type corresponding to the same method in the second link information and the third link information, etc. It should be noted that the above content is only an exemplary description and is not limited to this in actual applications. The specific form can be determined according to actual needs.
[0084] Based on the above, if the comparison results of the second link information and the third link information are consistent, it is determined that the actual modification information meets the modification requirements. Correspondingly, if the comparison results of the second link information and the third link information are inconsistent, it is determined that the actual modification information does not meet the modification requirements. Based on this, the corresponding comparison results can be output for R&D personnel to adjust the actual modification information of the target service based on the comparison results.
[0085] It should be noted that, since the target service system will continue to iterate its functions in response to user needs and structural adjustments, the number of multiple services in the target service system may increase or decrease, and the calling relationships between each other and the corresponding link information may also change accordingly. Therefore, this specification implements the collection of traffic data of multiple services in the target service system during execution. In addition to constructing a link topology model of the target service system in the above manner and using it to test the modification information of the target service, it can also update the already constructed link topology model.
[0086] That is to say, the above principle of constructing a link topology model can also be applied to the update of the link topology model. Based on this, in an optional embodiment of the present specification, the second flow data generated by multiple services in the target service system during execution can be obtained respectively, so as to update at least one first link information in the link topology model according to the obtained second flow data. Among them, there is no limitation on the specific method of updating the link topology model according to the obtained second flow data. Optionally, a specified collection cycle can be set. After each second flow data is collected, the multiple services associated with the corresponding second flow data and the corresponding sixth link information can be determined by the method in the above embodiment. Further, by comparing with the first link information corresponding to the corresponding multiple services in the existing link topology model, if they are the same, no update is required. If they are different, the determined first link information is updated to the corresponding sixth link information.
[0087] In one or more embodiments of the present specification, by collecting the traffic data generated by multiple services in the target service system during use and constructing a link topology model corresponding to the target service system, it is possible to visually display the calling relationship between multiple services in the target service system. Based on this, when it is necessary to modify any target service in the target service system, other services associated with the target service that need to be modified synchronously and the corresponding expected modification information can be determined in the constructed link topology model according to the modification requirements for the target service. Furthermore, by comparing the expected modification information and the actual modification information of the target service, it can be determined whether the actual modification information of the target service meets the modification requirements.
[0088] Through the testing method provided in the embodiments of this specification, it is possible to pre-test the compatibility of the modified function with the original service function of the target service system before performing functional testing on the modified target service. In the event that the modified function of the target service is found to be incompatible with the original service function of the target service system, the corresponding test results, modification suggestions and other information can be output in a timely manner to help R&D personnel adjust the modification content in a timely manner, which helps to reduce time and labor costs in subsequent functional testing and improve overall testing efficiency.
[0089] It can be understood that the above embodiments are only examples and can be modified in actual implementation. Those skilled in the art can understand that the modification methods of the above embodiments without creative labor fall within the protection scope of one or more embodiments of this specification and will not be repeated in the embodiments.
[0090] Based on the same inventive concept, one or more embodiments of the present specification also provide a testing device for program analysis. Since the principles of the problems solved by the testing device for program analysis are similar to those of the aforementioned testing method for program analysis, the implementation of the testing device for program analysis can refer to the implementation of the aforementioned testing method for program analysis, and the repeated parts will not be repeated.
[0091] See also Figure 3 , Figure 3 A structural block diagram of a test device for program analysis provided in one or more embodiments of this specification. Figure 3 As shown, the test device 300 may include: a first acquisition module 301, a second acquisition module 302, a first determination module 303, and a second determination module 304.
[0092] The first acquisition module 301 is used to obtain the link topology model of the target service system; wherein the link topology model includes multiple first link information, which is used to indicate the calling relationship between multiple services in the target service system; the second acquisition module 302 is used to obtain the expected modification information and actual modification information corresponding to the target service; wherein the target service is any one of the multiple services; the expected modification information and the actual modification information respectively include the request parameter type, return parameter type, and modification information of at least one of the parameter list and return value type of the method of the target service; the first determination module 303 is used to determine, based on the link topology model, the second link information associated with the target service after the modification according to the expected modification information; and, based on the link topology model, determine the third link information associated with the target service after the modification according to the actual modification information; the second determination module 304 is used to determine the test result of the actual modification information based on the second link information and the third link information.
[0093] In an optional embodiment, the first acquisition module 301 acquires the link topology model of the target service system, and is used to: respectively acquire the first traffic data generated by multiple services in the target service system during execution; and construct the link topology model of the target service system based on all the acquired first traffic data.
[0094] In an optional embodiment, the first acquisition module 301 respectively acquires the first flow data generated during the execution of multiple services in the target service system, and is used to: collect the first flow data during the execution of the aforementioned multiple services from the target service system through a service plug-in.
[0095] In an optional embodiment, the first acquisition module 301 constructs a link topology model of the target service system based on all the first traffic data obtained, and is used to: identify multiple tracking identifiers from all the first traffic data obtained; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; determine multiple fourth link information based on the first traffic data associated with the multiple tracking identifiers through the first determination module 303; deduplicate the multiple fourth link information to obtain multiple first link information; and construct a link topology model of the target service system based on the multiple first link information.
[0096] In an optional embodiment, the first determination module 303 determines multiple fourth link information based on the first traffic data associated with multiple tracking identifiers, and is used to: determine the service associated with each tracking identifier and at least one first method in each service based on the first traffic data associated with the multiple tracking identifiers; determine at least one first call link corresponding to each tracking identifier based on the calling relationship between the service associated with each tracking identifier and each first method; determine the request parameter type and return parameter type of the service associated with the corresponding first call link, as well as the parameter list and return value type of each associated first method based on the first traffic data flowing through each first call link; determine the request parameter type and return parameter type of the service associated with each first call link, as well as the parameter list and return value type of the associated first method as one fourth link information.
[0097] In an optional embodiment, the first acquisition module 301 constructs a link topology model of the target service system based on multiple first link information, and is used to: determine at least one mutually related fifth link information from the multiple first link information based on the calling relationship between multiple services indicated by the multiple first link information; construct a corresponding link topology sub-model based on each fifth link information; and construct a link topology model of the target service system based on all link topology sub-models.
[0098] In an optional embodiment, the first acquisition module 301 constructs a link topology model of the target service system based on all the first traffic data obtained, and is used to: identify multiple tracking identifiers from all the first traffic data obtained; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; based on the first traffic data associated with each tracking identifier, generate a first prefix tree corresponding to the corresponding tracking identifier; the root node of the first prefix tree is the corresponding tracking identifier, and the path information from the root node to each leaf node is a first link information corresponding to the corresponding tracking identifier; based on the first prefix trees corresponding to the multiple tracking identifiers, a link topology model of the target service system is constructed.
[0099] In an optional embodiment, the first acquisition module 301 constructs a link topology model of the target service system according to the first prefix trees corresponding to the multiple tracking identifiers, and is used to: mine a corresponding frequent item set from the first prefix tree corresponding to each tracking identifier according to a preset frequent item support; generate a second prefix tree corresponding to the corresponding tracking identifier according to the frequent item set corresponding to each tracking identifier; and construct the link topology model of the target service system according to the second prefix trees corresponding to the multiple tracking identifiers.
[0100] In an optional embodiment, the second determination module 304 determines the test result of the actual modification information based on the second link information and the third link information, and is used to: display the comparison result of the second link information and the third link information; if the comparison results are consistent, determine that the actual modification information meets the modification requirements; if the comparison results are inconsistent, output the comparison results for adjusting the actual modification information.
[0101] In an optional embodiment, the first acquisition module 301 is further used to: respectively acquire second traffic data generated by multiple services in the target service system during execution; and update at least one first link information in the link topology model according to the acquired second traffic data.
[0102] It should be noted that the functional principles of each module in the above-mentioned testing device are the same as the implementation principles of the corresponding steps in the above-mentioned testing method. For details, please refer to the description of the corresponding parts in the above-mentioned method embodiment, which will not be repeated here.
[0103] See also Figure 4 , Figure 4 This is a structural block diagram of an electronic device provided in one or more embodiments of this specification. Figure 4 As shown, the electronic device 400 may include a processor 401 and a memory 402; the memory 402 may be coupled to the processor 401. It is worth noting that the Figure 4 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0104] In a possible implementation, the functions of the apparatus 300 may be integrated into the processor 401. The processor 401 may be configured to perform the following operations:
[0105] Acquire a link topology model of the target service system, wherein the link topology model includes a plurality of first link information, which is used to indicate a call relationship between a plurality of services in the target service system;
[0106] Obtaining expected modification information and actual modification information corresponding to a target service, wherein the target service is any one of a plurality of services, and the expected modification information and the actual modification information respectively include modification information of at least one of a request parameter type, a return parameter type, and a parameter list and a return value type of a method of the target service;
[0107] Determine, according to the link topology model, second link information associated with the target service after modification according to the expected modification information;
[0108] Determine, according to the link topology model, third link information associated with the target service after modification according to the actual modification information;
[0109] A test result of actually modifying the information is determined according to the second link information and the third link information.
[0110] In another possible implementation, the device 300 may be configured separately from the processor 401 . For example, the device 300 may be configured as a chip connected to the processor 401 and implemented under the control of the processor 401 .
[0111] In addition, in some optional implementations, the electronic device 400 may also include: a communication module, an input unit, an audio processor, a display, a power supply, etc. It is worth noting that the electronic device 400 does not necessarily include Figure 4 In addition, the electronic device 400 may also include Figure 4 For components not shown, reference may be made to the prior art.
[0112] In some optional implementations, the processor 401 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device, which receives input and controls the operation of various components of the electronic device 400.
[0113] The memory 402 may be, for example, a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices, or one or more thereof. The memory may store the above-mentioned information related to the device 300, and may also store a program for executing the related information. The processor 401 may execute the program stored in the memory 402 to implement information storage or processing, etc.
[0114] The input unit can provide input to the processor 401. The input unit is, for example, a key or a touch input device. The power supply can be used to provide power to the electronic device 400. The display can be used to display display objects such as images and text. The display can be, for example, an LCD display, but is not limited thereto.
[0115] The memory 402 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 402 may also be some other type of device. The memory 402 includes a buffer memory (sometimes referred to as a buffer). The memory 402 may include an application / function storage unit for storing application programs and function programs or processes for executing the operation of the electronic device 400 by the processor 401.
[0116] The memory 402 may also include a data storage unit for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit of the memory 402 may include various drivers for the communication function of the computer device and / or for executing other functions of the computer device (such as a messaging application, a contact book application, etc.).
[0117] The communication module is a transmitter / receiver that sends and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor 401 to provide input signals and receive output signals, which may be the same as in a conventional mobile communication terminal.
[0118] Based on different communication technologies, multiple communication modules may be provided in the same computer device, such as a cellular network module, a Bluetooth module and / or a wireless local area network module, etc. The communication module (transmitter / receiver) is also coupled to a speaker and a microphone via an audio processor to provide an audio output via the speaker and receive an audio input from the microphone, thereby realizing a common telecommunication function. The audio processor may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor is also coupled to the processor 401, so that recording can be performed on the machine through the microphone, and the sound stored on the machine can be played through the speaker.
[0119] One or more embodiments of the present specification also provide a computer-readable storage medium capable of implementing all the steps of the method in the above embodiments. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the method in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0120] Acquire a link topology model of the target service system, wherein the link topology model includes a plurality of first link information, which is used to indicate a call relationship between a plurality of services in the target service system;
[0121] Obtaining expected modification information and actual modification information corresponding to a target service, wherein the target service is any one of a plurality of services, and the expected modification information and the actual modification information respectively include modification information of at least one of a request parameter type, a return parameter type, and a parameter list and a return value type of a method of the target service;
[0122] Determine, according to the link topology model, second link information associated with the target service after modification according to the expected modification information;
[0123] Determine, according to the link topology model, third link information associated with the target service after modification according to the actual modification information;
[0124] A test result of actually modifying the information is determined according to the second link information and the third link information.
[0125] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).
[0126] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, devices (systems) or computer program products. Therefore, the embodiments of this specification may take the form of complete hardware embodiments, complete software embodiments or embodiments combining software and hardware. Moreover, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0127] One or more embodiments of the present specification are described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to one or more embodiments of the present specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0128] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0129] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0130] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0131] In this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. For those of ordinary skill in the art, the specific meaning of the above terms in one or more embodiments of this specification can be understood according to the specific circumstances.
[0132] It should be noted that, in the absence of conflict, one or more embodiments of this specification and the features in the embodiments may be combined with each other. One or more embodiments of this specification are not limited to any single aspect, nor to any single embodiment, nor to any combination and / or replacement of these aspects and / or embodiments. Moreover, each aspect and / or embodiment of one or more embodiments of this specification may be used alone or in combination with one or more other aspects and / or embodiments thereof.
[0133] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of one or more embodiments of this specification, rather than to limit them. Although one or more embodiments of this specification have been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features may be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of one or more embodiments of this specification, and they should all be included in the scope of the claims and the specification of one or more embodiments of this specification.
[0134] One or more embodiments of this specification are described above in conjunction with optional implementation methods, but these implementation methods are only exemplary and serve only as an illustration. On this basis, multiple replacements and improvements can be made to one or more embodiments of this specification, all of which fall within the scope of protection of one or more embodiments of this specification.
Claims
1. A testing method for program analysis, characterized in that: include: Acquire a link topology model of the target service system; the link topology model includes a plurality of first link information, which is used to indicate the calling relationship between a plurality of services in the target service system; Obtaining expected modification information and actual modification information corresponding to a target service; the target service is any one of the multiple services; the expected modification information and the actual modification information respectively include modification information of at least one of a request parameter type and a return parameter type of the target service, and a parameter list and a return value type of a method therein; Determine, according to the link topology model, second link information associated with the target service after modification according to the expected modification information; Determine, according to the link topology model, third link information associated with the target service after modification according to the actual modification information; A test result of the actual modification information is determined according to the second link information and the third link information.
2. The method according to claim 1, characterized in that Obtain the link topology model of the target service system, including: Respectively obtaining first flow data generated by a plurality of services in the target service system during execution; A link topology model of the target service system is constructed based on all the acquired first traffic data.
3. The method according to claim 2, characterized in that Respectively obtaining first flow data generated by a plurality of services in the target service system during execution, including: The first flow data during the execution of the multiple services is collected from the target service system through the service plug-in.
4. The method according to claim 2, characterized in that: Constructing a link topology model of the target service system according to all the acquired first traffic data, including: Identify multiple tracking identifiers from all the acquired first traffic data; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; determining a plurality of fourth link information according to the first flow data associated with the plurality of tracking identifiers; Deduplication processing is performed on the plurality of fourth link information to obtain a plurality of first link information; A link topology model of the target service system is constructed according to the multiple pieces of first link information.
5. The method according to claim 4, characterized in that Determining a plurality of fourth link information according to the first flow data associated with the plurality of tracking identifiers includes: Determine, according to the first traffic data associated with the plurality of tracking identifiers, a service associated with each tracking identifier and at least one first method in each service; Determine at least one first call link corresponding to each tracking identifier according to the call relationship between the service associated with each tracking identifier and each first method; Determine, according to the first traffic data flowing through each first call link, a request parameter type and a return parameter type of a service associated with the corresponding first call link, and a parameter list and a return value type of each associated first method; The request parameter type and return parameter type of the service associated with each first call link, and the parameter list and return value type of the associated first method are determined as a fourth link information.
6. The method according to claim 4, characterized in that Constructing a link topology model of the target service system according to the plurality of first link information includes: Determining at least one fifth link information that is mutually associated from the multiple pieces of first link information according to the calling relationships between the multiple services indicated by the multiple pieces of first link information; According to each piece of the fifth link information, construct a corresponding link topology sub-model; A link topology model of the target service system is constructed according to all link topology sub-models.
7. The method according to claim 2, characterized in that Constructing a link topology model of the target service system according to all the acquired first traffic data, including: Identify multiple tracking identifiers from all the acquired first traffic data; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; Generate a first prefix tree corresponding to the corresponding tracking identifier according to the first flow data associated with each tracking identifier; the root node of the first prefix tree is the corresponding tracking identifier, and the path information from the root node to each leaf node is a first link information corresponding to the corresponding tracking identifier; A link topology model of the target service system is constructed according to the first prefix trees respectively corresponding to the multiple tracking identifiers.
8. The method according to claim 7, characterized in that Constructing a link topology model of the target service system according to the first prefix trees respectively corresponding to the multiple tracking identifiers, including: According to the preset frequent item support, mining the corresponding frequent item set from the first prefix tree corresponding to each tracking identifier; According to the frequent item set corresponding to each tracking identifier, generate a second prefix tree corresponding to the corresponding tracking identifier; A link topology model of the target service system is constructed according to the second prefix trees respectively corresponding to the multiple tracking identifiers.
9. The method according to any one of claims 1 to 8, characterized in that: Determining a test result of the actual modification information according to the second link information and the third link information includes: Displaying the comparison result between the second link information and the third link information; If the comparison results are consistent, determining that the actual modification information meets the modification requirements; If the comparison result is inconsistent, the comparison result is output for adjusting the actual modification information.
10. The method according to any one of claims 1 to 8, characterized in that: Also includes: Respectively obtaining second flow data generated by multiple services in the target service system during execution; At least one first link information in the link topology model is updated according to the acquired second traffic data.
11. A testing device for program analysis, characterized in that: include: A first acquisition module, used to acquire a link topology model of a target service system; the link topology model includes a plurality of first link information, used to indicate a call relationship between a plurality of services in the target service system; The second acquisition module is used to acquire the expected modification information and the actual modification information corresponding to the target service; The target service is any one of the multiple services; the expected modification information and the actual modification information respectively include modification information of at least one of the request parameter type and return parameter type of the target service, and the parameter list and return value type of the method thereof; A first determination module is used to determine, according to the link topology model, second link information associated with the target service after modification according to the expected modification information; and determining, according to the link topology model, third link information associated with the target service after modification according to the actual modification information; The second determining module is used to determine the test result of the actual modification information according to the second link information and the third link information.
12. The device according to claim 11, characterized in that The first acquisition module acquires a link topology model of a target service system, and is used to: Respectively obtaining first flow data generated by a plurality of services in the target service system during execution; A link topology model of the target service system is constructed based on all the acquired first traffic data.
13. The device according to claim 12, characterized in that The first acquisition module respectively acquires first flow data generated during the execution of multiple services in the target service system, and is used to: The first flow data during the execution of the multiple services is collected from the target service system through the service plug-in.
14. The device according to claim 12, characterized in that The first acquisition module constructs a link topology model of the target service system according to all the acquired first traffic data, and is used to: Identify multiple tracking identifiers from all the acquired first traffic data; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; determining, by the first determining module, a plurality of fourth link information according to the first flow data associated with the plurality of tracking identifiers; Deduplication processing is performed on the plurality of fourth link information to obtain a plurality of first link information; A link topology model of the target service system is constructed according to the multiple pieces of first link information.
15. The device according to claim 14, characterized in that The first determining module determines a plurality of fourth link information according to the first flow data associated with the plurality of tracking identifiers, for: Determine, according to the first traffic data associated with the plurality of tracking identifiers, a service associated with each tracking identifier and at least one first method in each service; Determine at least one first call link corresponding to each tracking identifier according to the call relationship between the service associated with each tracking identifier and each first method; Determine, according to the first traffic data flowing through each first call link, a request parameter type and a return parameter type of a service associated with the corresponding first call link, and a parameter list and a return value type of each associated first method; The request parameter type and return parameter type of the service associated with each first call link, and the parameter list and return value type of the associated first method are determined as a fourth link information.
16. The device according to claim 14, characterized in that The first acquisition module constructs a link topology model of the target service system according to the plurality of first link information, and is used to: Determining at least one fifth link information that is mutually associated from the multiple pieces of first link information according to the calling relationships between the multiple services indicated by the multiple pieces of first link information; According to each piece of the fifth link information, construct a corresponding link topology sub-model; A link topology model of the target service system is constructed according to all link topology sub-models.
17. The device according to claim 12, characterized in that The first acquisition module constructs a link topology model of the target service system according to all the acquired first traffic data, and is used to: Identify multiple tracking identifiers from all the acquired first traffic data; each tracking identifier is a tracking identifier assigned to a request for one of the multiple services; generating a first prefix tree corresponding to the corresponding tracking identifier according to the first flow data associated with each tracking identifier; The root node of the first prefix tree is a corresponding tracking identifier, and the path information from the root node to each leaf node is a piece of first link information corresponding to the corresponding tracking identifier; A link topology model of the target service system is constructed according to the first prefix trees respectively corresponding to the multiple tracking identifiers.
18. The device according to claim 17, characterized in that The first acquisition module constructs a link topology model of the target service system according to the first prefix trees respectively corresponding to the multiple tracking identifiers, and is used to: According to the preset frequent item support, mining the corresponding frequent item set from the first prefix tree corresponding to each tracking identifier; According to the frequent item set corresponding to each tracking identifier, generate a second prefix tree corresponding to the corresponding tracking identifier; A link topology model of the target service system is constructed according to the second prefix trees respectively corresponding to the multiple tracking identifiers.
19. The device according to any one of claims 11 to 18, characterized in that: The second determining module determines the test result of the actual modification information according to the second link information and the third link information, and is used to: Displaying the comparison result between the second link information and the third link information; If the comparison results are consistent, determining that the actual modification information meets the modification requirements; If the comparison result is inconsistent, the comparison result is output for adjusting the actual modification information.
20. The device according to any one of claims 11 to 18, characterized in that The first acquisition module is also used for: Respectively obtaining second flow data generated by multiple services in the target service system during execution; At least one first link information in the link topology model is updated according to the acquired second traffic data.
21. An electronic device, characterized in that: The electronic device comprises: A memory for storing a computer program product; A processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, the method described in any one of claims 1 to 10 is implemented.
22. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed, implement the method described in any one of claims 1 to 10.
