System testing method, apparatus, device, storage medium, and program product
By establishing a mapping relationship between interface identification information and thread code coverage data in system testing, and combining it with code difference information, the problem of inaccurate recommendation results caused by cross-service calls in traditional system testing methods is solved, thus achieving high efficiency and accuracy in system testing.
Patent Information
- Application Number
- CN202410997919.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2044-07-24
AI Technical Summary
Traditional system testing methods often yield inaccurate results in multi-service system architectures when cross-service calls occur, leading to low system testing efficiency.
By acquiring service requests from the target system, a mapping relationship between interface identification information and thread code coverage data is established, a mapping knowledge base is built, and combined with code difference information between the target system and historical versions of the system, the interface identification information affected by system version changes is queried to locate the test scope.
It improves the efficiency of system testing, helps R&D personnel quickly locate the testing scope, and enhances the accuracy and efficiency of system testing.
Smart Images

Figure CN118820105B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, and in particular to a system testing method and device, equipment, a storage medium and a program product. BACKGROUND
[0002] With the development of computer technology, a large number of business systems have emerged, which has brought great convenience to people's daily work and life. Before going online, the developers usually perform various types of testing on the business system, including but not limited to function testing, performance testing, security testing and compatibility testing, to find potential defects in the business system, so as to more targetedly optimize the business system, and can guarantee the stability of the business system after going online.
[0003] In the traditional technology, a static call chain tool is usually used to establish the relationship between use cases and function call chains through automatic or manual methods, so as to gradually deduce the affected test cases. However, the traditional system testing method has the problem of inaccurate recommended results, especially for the case of cross-service calls in a multi-service system architecture, the recommended results will be even more inaccurate, thereby reducing the system testing efficiency. SUMMARY
[0004] Therefore, it is necessary to provide a system testing method, device, equipment, storage medium and program product capable of improving the system testing efficiency.
[0005] In a first aspect, the present application provides a system testing method, which comprises:
[0006] obtaining at least one service request for a target system to be tested;
[0007] For each service request, determining thread code coverage data of thread code processing the service request in the target system, and mapping interface identification information obtained by analyzing the service request to the thread code coverage data to obtain mapping data of the service request;
[0008] merging the mapping data of each of the at least one service request to obtain a mapping knowledge base of the target system;
[0009] obtaining code difference information of the target system and a historical version system of the target system;
[0010] Based on the code difference information, querying the interface identification information affected by the system version change from the mapping knowledge base; the queried interface identification information is used to locate the test range of the target system.
[0011] In a second aspect, the present application provides a system testing device, the device comprising:
[0012] an obtaining module, configured to obtain at least one service request for a target system to be tested;
[0013] a mapping module, configured to determine, for each of the service requests, thread code coverage data of thread code processing the service request in the target system, and map interface identification information obtained by resolving the service request to the thread code coverage data, to obtain mapping data of the service request;
[0014] a merging module, configured to merge the mapping data of the at least one service request respectively, to obtain a mapping knowledge base of the target system;
[0015] The obtaining module is further configured to obtain code difference information of the target system and a historical version system of the target system;
[0016] a querying module, configured to query interface identification information affected by system version change from the mapping knowledge base based on the code difference information; the interface identification information queried is used to locate a testing range of the target system.
[0017] In a third aspect, the present application provides a computer device, comprising a memory and a processor, the memory storing a computer program, and the processor implementing steps in each method embodiment of the present application when executing the computer program.
[0018] In a fourth aspect, the present application provides a computer readable storage medium, storing a computer program, and the computer program implementing steps in each method embodiment of the present application when executed by a processor.
[0019] In a fifth aspect, the present application provides a computer program product, comprising a computer program, and the computer program implementing steps in each method embodiment of the present application when executed by a processor.
[0020] The system test method, device, equipment, storage medium and program product described above, by acquiring at least one service request for a target system to be tested; for each service request, determining thread code coverage data of thread code in the target system processing the service request, and mapping interface identification information obtained by analyzing the service request and the thread code coverage data to obtain mapping data of the service request; merging the mapping data of each of the at least one service request to obtain a mapping knowledge base of the target system; acquiring code difference information of the target system and a historical version system of the target system; based on the code difference information, querying interface identification information affected by system version changes from the mapping knowledge base; the interface identification information queried is used to locate a test range of the target system. Compared with the traditional system test method, the application establishes the mapping relationship between the interface identification information of each service request and the different service application thread code coverage data to construct the mapping knowledge base of the target system, combines the code difference information of the target system and its historical version system, recommends the interface range affected by the system version changes, so as to facilitate the R&D personnel to quickly locate the test range of the target system as the reference direction of the system test, thereby improving the test efficiency of the system. BRIEF DESCRIPTION OF DRAWINGS
[0021] Figure 1 An application environment diagram of a system test method in an embodiment;
[0022] Figure 2 A flowchart of a system test method in an embodiment;
[0023] Figure 3 A diagram for obtaining interface identification information of an interface by analyzing a service request in an embodiment;
[0024] Figure 4 A diagram for obtaining interface identification information of an interface by analyzing a service request in another embodiment;
[0025] Figure 5 A flowchart of a system test method in another embodiment;
[0026] Figure 6 A structural block diagram of a system test device in an embodiment;
[0027] Figure 7 A structural block diagram of a system test device in another embodiment;
[0028] Figure 8 An internal structure diagram of a computer device in an embodiment;
[0029] Figure 9 An internal structure diagram of a computer device in another embodiment. DETAILED DESCRIPTION
[0030] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and not intended to limit the present application.
[0031] The system testing method provided by the present application can be applied to an application environment as shown in the figure. Figure 1 The terminal 102 communicates with the server 104 through the network. The data storage system can be separately arranged and can store data required to be processed by the server 104. The data storage system can be integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can be, but is not limited to, various desktop computers, notebook computers, smart phones, tablet computers, vehicle-mounted terminals, smart voice interaction devices, aircrafts, smart home appliances and portable wearable devices. The smart home appliances can be smart sound boxes, smart televisions and smart air conditioners, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be a stand-alone physical server, a server cluster composed of multiple physical servers or a distributed system, and can also be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, cloud security services, host security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 102 and the server 104 can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application.
[0032] The server 104 can be deployed with a precise testing system and a target system to be tested. For example, the target system can be a business system to be tested. It can be understood that the present application can perform precise testing on the target system to be tested through the precise testing system. Specifically, the server 104 can obtain at least one service request for the target system to be tested from the terminal 102 through the precise testing system. For each service request, the server 104 can determine thread code coverage data of thread code processing the service request in the target system through the precise testing system, and map the interface identification information obtained by analyzing the service request to the thread code coverage data to obtain mapping data of the service request. The server 104 can merge the mapping data of each of the at least one service request through the precise testing system to obtain a mapping knowledge base of the target system. The server 104 can obtain code difference information of the target system and a historical version system of the target system through the precise testing system, query interface identification information affected by system version changes from the mapping knowledge base based on the code difference information; and the queried interface identification information is used to locate the test range of the target system.
[0033] It can be understood that the present embodiment does not limit this, and optionally, the precision test system and the target system to be tested can also be deployed in different servers. It can be understood that Figure 1 The application scenarios in the above embodiments are only illustrative and are not limited thereto.
[0034] In one embodiment, as shown in Figure 2 A system test method is provided, which can be applied to a computer device, which can be a terminal or a server, that is, the method can be executed by the terminal or the server alone, or can be realized through interaction between the terminal and the server. The present embodiment takes the method applied to a computer device as an example for illustration, including the following steps:
[0035] Step 202, obtaining at least one service request for a target system to be tested.
[0036] In one embodiment, at least one service application is deployed in the target system, and it can be understood that the service application can include a micro-service application. The target system can be a business system under a multi-service architecture, or a business system under a single-service architecture. The computer device can obtain at least one service request for the target system to be tested. It can be understood that the service request is used to request a service from a service application indicated by the service request in the target system.
[0037] Step 204, for each service request, determining thread code coverage data of thread code in the target system for processing the service request, and mapping interface identification information obtained by parsing the service request to the thread code coverage data to obtain mapping data of the service request.
[0038] Among them, the thread code in the target system for processing the service request refers to the thread code in the application program code of the service application of the target system for processing the service request. The thread code coverage data is the code information of the thread code in the target system for processing the service request, and it can be understood that the thread code coverage data can include the class name in the thread covered code, the method name of the covered code, the method covered line number, the original line number of the method, etc. The interface identification information is used to uniquely identify a business interface. For example, the interface identification information can be the URI (Uniform Resource Identifier, Uniform Resource Identifier) of the business interface.
[0039] In an embodiment, for each service request in the obtained at least one service request, the computer device can determine thread code in the target system responsible for processing the service request, and collect thread code coverage data of the thread code. The computer device can parse the service request, obtain corresponding interface identification information, and associate and map the parsed interface identification information and the thread code coverage data to obtain mapping data of the service request.
[0040] Step 206, merging the mapping data of each of the at least one service request to obtain a mapping knowledge base of the target system.
[0041] In the mapping knowledge base, the association mapping relationship between the interface identification information of each business interface and the corresponding thread code coverage data is recorded. It can be understood that each business interface is a business interface corresponding to at least one service request requesting service from the target system.
[0042] In an embodiment, the computer device can directly merge the mapping data of each of the at least one service request to obtain the mapping knowledge base of the target system.
[0043] Step 208, obtaining code difference information of the target system and a historical version system of the target system.
[0044] The code difference information is the difference information between the source code of the target system and the source code of the historical version system. The historical version system is a system of a historical version of the target system. It can be understood that the target system is obtained by updating the version of the historical version system.
[0045] In an embodiment, the computer device can obtain the source code of the target system and the source code of the historical version system of the target system. The computer device can determine the code difference information between the source code of the target system and the source code of the historical version system. It can be understood that the code difference information can include changed class name, method name and line number information, etc.
[0046] Step 210, based on the code difference information, querying interface identification information affected by system version change from the mapping knowledge base; the queried interface identification information is used for positioning the test range of the target system.
[0047] In one embodiment, since the mapping knowledge base records the association mapping relationship between the interface identification information of each service interface and the corresponding thread code coverage data, and the thread code coverage data can contain the class name in the thread covered code, the method name of the covered code, the method covered line number, the original line number of the method and other information. Therefore, the computer device can take the class name and the method name in the code difference information as query information to query the interface identification information affected by the system version change from the mapping knowledge base. The queried interface identification information is used to locate the test range of the target system, provides a reference direction for the system test of the R&D personnel, and improves the test efficiency of the target system.
[0048] In the above system test method, at least one service request for the target system to be tested is obtained; for each service request, thread code coverage data of thread code in the target system processing the service request is determined, and the interface identification information obtained by parsing the service request is mapped with the thread code coverage data to obtain mapping data of the service request; the mapping data of each of the at least one service request is merged to obtain a mapping knowledge base of the target system; code difference information of the target system and a historical version system of the target system is obtained; based on the code difference information, interface identification information affected by the system version change is queried from the mapping knowledge base; and the queried interface identification information is used to locate the test range of the target system. Compared with the traditional system test method, the application establishes the mapping relationship between the interface identification information of each service request and the thread code coverage data of different service applications, constructs the mapping knowledge base of the target system, combines the code difference information of the target system and its historical version system, recommends the interface range affected by the system version change, so as to quickly locate the test range of the target system as a reference direction for the system test of the R&D personnel, thereby improving the test efficiency of the system.
[0049] In one embodiment, the mapping knowledge base is obtained by merging the thread code coverage data of the target system under the same interface identification information in a union set manner; the method further comprises: merging the mapping data of each of the at least one service request to obtain system code coverage data of the target system; wherein the thread code coverage data of the target system under the same method class is merged in a union set manner; the system code line number of the target system is determined; the system code coverage rate of the target system is determined according to the ratio of the system covered code line number indicated by the system code coverage data to the system code line number; and the system code coverage rate is used to evaluate the test quality of the target system.
[0050] The system code coverage data is the code information of the thread code responsible for processing each service request in the target system. The system code line number is the code line number of the source code of the target system. The system covered code line number is the code line number of the thread code responsible for processing the service request in the target system.
[0051] Specifically, the computer device can merge the thread code coverage data of the target system under the same method class in a union manner to obtain system code coverage data of the target system. The computer device can determine the number of system code lines of the target system and determine the number of system coverage code lines indicated by the system code coverage data. The computer device can determine the system code coverage rate of the target system according to the ratio of the number of system coverage code lines to the number of system code lines. The system code coverage rate is used to evaluate the test quality of the target system.
[0052] In the above embodiment, the thread code coverage data of the target system under the same method class is merged in a union manner to obtain system code coverage data of the target system, and the system code coverage rate of the target system is determined according to the ratio of the number of system coverage code lines indicated by the system code coverage data to the number of system code lines of the target system, so as to facilitate the evaluation of the test quality of the target system, thereby further improving the test efficiency of the system.
[0053] In one embodiment, the method further comprises: for each method class in the target system, determining the number of class code lines of the method class; and determining the class code coverage rate of the method class according to the ratio of the number of class coverage code lines of the method class indicated by the system code coverage data to the number of class code lines. The class code coverage rate is used to evaluate the test quality of the method class.
[0054] The number of class code lines is the number of lines of code contained in the method class. The number of class coverage code lines is the number of lines of code in the method class responsible for processing service requests.
[0055] In one embodiment, the source code of the target system contains a plurality of method classes. For each method class in the source code of the target system, the computer device can determine the number of class code lines of the method class and determine the number of class coverage code lines of the method class indicated by the system code coverage data. Further, the computer device can determine the class code coverage rate of the method class according to the ratio of the number of class coverage code lines to the number of class code lines. The class code coverage rate is used to evaluate the test quality of the method class.
[0056] In one embodiment, the computer device can directly use the ratio of the number of class coverage code lines to the number of class code lines as the class code coverage rate of the method class.
[0057] In the above embodiment, the class code coverage rate of the method class is determined according to the ratio of the number of class coverage code lines to the number of class code lines indicated by the system code coverage data, so as to facilitate the evaluation of the test quality of the method class, thereby further improving the test efficiency of the system.
[0058] In an embodiment, the method further comprises: determining a difference code line number of the difference code indicated by the code difference information; determining a difference code coverage rate of the difference code according to a ratio of the difference coverage code line number to the difference code line number indicated by the system code coverage data, wherein the difference code coverage rate is used to evaluate a test quality of the difference code.
[0059] In an embodiment, the difference code is a code in the source code of the target system that is different from a source code of a historical version system of the target system. The difference code line number is a total code line number of the difference code. The difference coverage code line number is a line number of a code in the difference code that is responsible for processing a service request.
[0060] In an embodiment, the computer device can determine the difference code indicated by the code difference information, and determine a difference code line number of the difference code indicated by the code difference information. The computer device can determine a difference coverage code line number of the difference code indicated by the system code coverage data, and determine a difference code coverage rate of the difference code according to a ratio of the difference coverage code line number to the difference code line number, wherein the difference code coverage rate is used to evaluate a test quality of the difference code.
[0061] In an embodiment, the computer device can directly use the ratio of the difference coverage code line number to the difference code line number as the difference code coverage rate of the difference code.
[0062] In the above embodiment, the difference code coverage rate of the difference code is determined according to the ratio of the difference coverage code line number to the difference code line number indicated by the system code coverage data, so as to facilitate the evaluation of the test quality of the difference code, thereby further improving the test efficiency of the system.
[0063] In an embodiment, the merging of the mapping data of the at least one service request respectively comprises: performing deduplication processing on the mapping data of the at least one service request respectively to obtain deduplicated mapping data; and merging the deduplicated mapping data to obtain the mapping knowledge base of the target system.
[0064] In an embodiment, since a function logic in some underlying common logic is called and executed more than once in the process of executing a test case used to test the target system, there are a large amount of repeated mapping data. Therefore, the deduplication processing is performed before the merging, so as to reduce the magnitude of the calculation. Specifically, the computer device can perform deduplication processing on the mapping data of the at least one service request respectively to obtain deduplicated mapping data, and merge the deduplicated mapping data to obtain the mapping knowledge base of the target system.
[0065] In the above embodiment, by performing deduplication processing on the mapping data of each of the at least one service request, the repeated redundant data can be removed, the deduplicated mapping data can be combined, and the mapping knowledge base of the target system can be obtained, thereby avoiding waste of computer resources for supporting data combination.
[0066] In one embodiment, the deduplication processing on the mapping data of each of the at least one service request to obtain the deduplicated mapping data includes: determining, for each service request, the summary information of the mapping data of the service request; when the summary information record table does not record the summary information of the mapping data of the service request, taking the mapping data of the service request as the deduplicated mapping data, and recording the summary information of the mapping data of the service request in the summary information record table.
[0067] The summary information is information generated by processing the mapping data by a summary generation algorithm, and can be understood as information used to represent the characteristics of the mapping data. Different mapping data has completely different summary information generated by the summary generation algorithm. Even if two different mapping data have a very high similarity, the summary information corresponding to the two different mapping data has a great difference. The summary information record table is a table for recording the summary information of the mapping data maintained for the target system.
[0068] Specifically, for each service request, the computer device can process the mapping data of the service request by a summary generation algorithm to generate the summary information of the mapping data of the service request. When the summary information record table for recording the summary information of the mapping data maintained for the target system does not record the summary information of the mapping data of the service request, it indicates that the mapping data of the service request has not been processed and is not repeated mapping data. Therefore, the computer device can take the mapping data of the service request as the deduplicated mapping data, and record the summary information of the mapping data of the service request in the summary information record table.
[0069] In one embodiment, the mapping data can be a JSON (JavaScript Object Notation, JS object profile, a lightweight data exchange format) string containing interface identification information, coverage class, coverage method, coverage line number, original line number of the coverage method, name of the target system service, version of the target system service, and the like.
[0070] In one embodiment, for each service request, the computer device can process the mapping data for the service request by a MD5 (Message-Digest Algorithm) to generate the MD5 value of the mapping data for the service request, i.e. the digest information. When the MD5 value record table, i.e. the digest information record table, maintained by the target system for recording the MD5 values of the mapping data does not record the MD5 value of the mapping data for the service request, it means that the mapping data for the service request has not been processed and is not repeated mapping data, and then the computer device can take the mapping data for the service request as the deduplicated mapping data and record the MD5 value of the mapping data for the service request in the MD5 value record table.
[0071] In the above embodiment, the digest information of the mapping data of the service request is used to determine whether the mapping data of the service request is repeated, which can quickly and accurately remove the redundant mapping data and improve the data merging efficiency, thereby further improving the test efficiency of the system.
[0072] In one embodiment, at least one service application is deployed in the target system; the method further comprises: for each service request, parsing the service request by the accurate test system started together with the target service application requested by the service request in the target system to obtain the interface identification information of the service request.
[0073] Specifically, at least one service application is deployed in the target system, and the target system can be a business system under a multi-service architecture or a business system under a single-service architecture. The service request can indicate a service request to the target service application in the target system. It can be understood that for each service request, the computer device can parse the service request by the accurate test system started together with the target service application requested by the service request in the target system to obtain the interface identification information of the service request.
[0074] In one embodiment, as Figure 3As shown, the computer device can be deployed with a precise testing system and a target system to be tested, for example, the target system can be a business system to be tested. The precise testing system can include a coverage data collection unit and a coverage data processing unit. The target system to be tested is deployed with at least one service application to be tested. It can be understood that the application can perform precise testing on the service application to be tested in the target system to be tested through the precise testing system. Specifically, the computer device can obtain a service request for the target system to be tested, and it can be understood that the service request corresponds to an interface A, which is used to request a service of a service application B in the target system. The precise testing system can parse the interface identifier information of the interface A corresponding to the service request through the Agent, i.e., the URI. The precise testing system can establish a mapping relationship between the parsed interface identifier information and the thread code responsible for processing the service request in the service application B through the Agent and store it, so as to subsequently establish a mapping relationship between the interface identifier information and the thread code coverage data based on the thread code. It can be understood that after the method execution in the thread code of the service application B is completed, the precise testing system can report the mapping relationship data through the Agent and cancel the URI mapping.
[0075] In the above embodiment, the precise testing system started together with the target service application requested by the service request in the target system parses the service request to obtain the interface identifier information of the service request, and the mapping relationship between the interface identifier information and the thread code can be established during the parsing process, so as to subsequently map the interface identifier information and the thread code coverage data, so that the interface identifier information affected by the change can be queried based on the code difference information.
[0076] In one embodiment, for each service request, the precise testing system started together with the target service application requested by the service request in the target system parses the service request to obtain the interface identifier information of the service request, including: for each service request, when the target service application needs to call a third-party service application to process the service request, the precise testing system started together with the target service application and the third-party service application parses the service request to obtain the interface identifier information of the service request; wherein the third-party service application is a service application in the target system except the target service application.
[0077] Specifically, for each service request, when the target service application needs to call a third-party service application for processing the service request, for example, a certain method in the target service application needs to call a third-party service application in the execution process, the computer device can analyze the service request through the Agent mode by means of the precision test system started together with the target service application and the third-party service application, and obtain the interface identification information of the service request. Among them, the third-party service application is a service application other than the target service application in at least one service application deployed by the target system.
[0078] In one embodiment, as Figure 4As shown, the computer device can be deployed with a precise testing system and a target system to be tested, such as a target system that is a business system to be tested. The precise testing system can include a coverage data collection unit and a coverage data processing unit. The target system to be tested is deployed with at least one service application to be tested. It can be understood that the application can perform precise testing on the service application to be tested in the target system to be tested through the precise testing system. Specifically, the computer device can obtain a service request for the target system to be tested, and it can be understood that the service request corresponds to a C interface for requesting a service of a service application D in the target system. Wherein, the service application D needs to call a service application E to process the service request, at this time, the computer device can parse the interface identifier information, i.e. URI, of the interface C corresponding to the service request through the precise testing system started together with the service application D and the service application E. Specifically, the precise testing system can parse the interface identifier information of the interface C corresponding to the service request through the Agent, and establish a mapping relationship between the parsed interface identifier information and the thread code responsible for processing the service request in the service application D and store it, so as to subsequently establish a mapping relationship between the interface identifier information and the thread code coverage data of the thread code based on the thread code of the service application D. When the service application D processes the service request, the service application E is called through a calling request, such as through an Http interface or a Dubbo interface call, the interface identifier information, i.e. URI, parsed by the service application D is carried in the calling request, such as through the Http request header or the RPC Attachments parameter to pass the URI. Further, the precise testing system can parse the interface identifier information of the interface C corresponding to the service request through the Agent, and establish a mapping relationship between the parsed interface identifier information and the thread code responsible for processing the service request in the service application E and store it, so as to subsequently establish a mapping relationship between the interface identifier information and the thread code coverage data of the thread code based on the thread code of the service application E. It can be understood that after the methods in the thread codes of the service application E and the service application D are executed, the precise testing system can report the related mapping relationship data through the Agent respectively, and cancel the related URI mapping.
[0079] In the above embodiment, when the target service application needs to call a third-party service application to process the service request, the precise testing system started together with the target service application and the third-party service application is used to parse the service request and obtain the interface identifier information of the service request. The mapping relationship between the interface identifier information and each thread code can be established in the parsing process, so as to subsequently map the interface identifier information and the thread code coverage data of each thread code, so that the interface identifier information affected by the change can be queried based on the code difference information.
[0080] In one embodiment, such as Figure 5 As shown, the accurate testing system can include a coverage data acquisition unit and a coverage data processing unit. The coverage data acquisition unit is primarily responsible for the following functions: parsing the interface identifier information (URI) of service requests; collecting thread code coverage data of the thread code handling service requests in the target system; mapping the parsed interface identifier information to the thread code coverage data to obtain mapping data; and storing the mapping data in a database. The coverage data processing unit is primarily responsible for the following functions: parsing the source code of the target system to obtain code information such as the number of lines of code in the target system; merging the mapping data of each service request to obtain a mapping knowledge base for the target system; determining the system code coverage of the target system; acquiring and parsing code difference information between the target system and historical versions of the system; and querying the interface identifier information affected by system version changes from the mapping knowledge base based on the code difference information.
[0081] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially, these steps are not necessarily executed in that order. Unless otherwise expressly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the above embodiments may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least a portion of the sub-steps or stages of other steps.
[0082] In one embodiment, such as Figure 6 As shown, a system testing apparatus 600 is provided, which specifically includes:
[0083] Module 602 is used to acquire at least one service request for the target system to be tested.
[0084] The mapping module 604 is used to determine the thread code coverage data of the thread code that processes the service request in the target system for each service request, and to map the interface identification information obtained by parsing the service request to the thread code coverage data to obtain the mapping data for the service request.
[0085] The merging module 606 is used to merge the mapping data of at least one service request to obtain the mapping knowledge base of the target system.
[0086] The acquisition module 602 is also used to acquire code difference information between the target system and its historical versions;
[0087] The query module 608 is configured to query interface identifier information of system version change influence from the mapping knowledge base based on the code difference information; and the queried interface identifier information is used to locate a test range of the target system.
[0088] In one embodiment, the mapping knowledge base is obtained by merging thread code coverage data of the target system under the same interface identifier information in a union set manner; the merging module 606 is further configured to merge the mapping data of the at least one service request to obtain system code coverage data of the target system; wherein the thread code coverage data of the target system under the same method class is merged in a union set manner; the number of code lines of the target system is determined; the system code coverage rate of the target system is determined according to a ratio of the system coverage code line number indicated by the system code coverage data to the number of code lines of the system; and the system code coverage rate is used to evaluate the test quality of the target system.
[0089] In one embodiment, the merging module 606 is further configured to determine, for each method class in the target system, the class code line number of the method class; determine the class code coverage rate of the method class according to a ratio of the class coverage code line number of the method class indicated by the system code coverage data to the class code line number; and the class code coverage rate is used to evaluate the test quality of the method class.
[0090] In one embodiment, the merging module 606 is further configured to determine the difference code line number of the difference code indicated by the code difference information; determine the difference code coverage rate of the difference code according to a ratio of the difference coverage code line number of the difference code indicated by the system code coverage data to the difference code line number; and the difference code coverage rate is used to evaluate the test quality of the difference code.
[0091] In one embodiment, the merging module 606 is further configured to perform deduplication processing on the mapping data of the at least one service request to obtain deduplicated mapping data; and merge the deduplicated mapping data to obtain the mapping knowledge base of the target system.
[0092] In one embodiment, the merging module 606 is further configured to determine, for each service request, the summary information of the mapping data of the service request; when the summary information record table does not record the summary information of the mapping data of the service request, the mapping data of the service request is taken as the deduplicated mapping data, and the summary information of the mapping data of the service request is recorded in the summary information record table.
[0093] In one embodiment, as shown in Figure 7 The apparatus further includes:
[0094] The parsing module 610 is configured to, for each service request, parse the service request by using the accurate test system started together with the target service application requested in the target system for the service request, and obtain interface identification information of the service request.
[0095] In one embodiment, the parsing module 610 is further configured to, for each service request, when the target service application needs to call a third-party service application when processing the service request, parse the service request by using the accurate test system started together with the target service application and the third-party service application, and obtain interface identification information of the service request; wherein the third-party service application is a service application in the target system except the target service application.
[0096] The system test apparatus described above obtains at least one service request for a target system to be tested; for each service request, determines thread code coverage data of thread code processing the service request in the target system, and maps interface identification information obtained by parsing the service request to the thread code coverage data to obtain mapping data of the service request; combines the mapping data of the at least one service request respectively to obtain a mapping knowledge base of the target system; obtains code difference information of the target system and a historical version system of the target system; based on the code difference information, queries interface identification information affected by system version change from the mapping knowledge base; and the queried interface identification information is used to locate a test range of the target system. Compared with a traditional system test method, the application establishes a mapping relationship between interface identification information of each service request and thread code coverage data of different service applications to construct a mapping knowledge base of the target system, combines code difference information of the target system and its historical version system, recommends an interface range affected by system version change, so as to help a developer to quickly locate a test range of the target system as a reference direction of system test, thereby improving the test efficiency of the system.
[0097] Each module in the system test apparatus described above can be realized by software, hardware, and a combination thereof in whole or in part. Each module described above can be embedded in or independent of a processor in a computer device in a hardware form, or can be stored in a memory in a computer device in a software form, so as to be called and executed by a processor to perform operations corresponding to each module.
[0098] In one embodiment, a computer device is provided, which can be a server, and an internal structure diagram of the computer device can be as shown in FIG. 8. Figure 8As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control ability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with the terminal outside through the network connection. The computer program is executed by the processor to realize a system test method.
[0099] In one embodiment, a computer device is provided, which can be a terminal, and its internal structure diagram can be as shown in the figure. Figure 9 As shown in the figure. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through the system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control ability. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with the terminal outside through the network connection. The computer program is executed by the processor to realize a system test method.
[0100] Those skilled in the art can understand that, Figure 8 and Figure 9The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0101] In one embodiment, a computer device is also provided, including a memory and a processor, the memory storing a computer program, and the processor implementing the steps in the above-mentioned method embodiments when executing the computer program.
[0102] In one embodiment, a computer readable storage medium is provided, storing a computer program, which, when executed by a processor, implements the steps in the above-mentioned method embodiments.
[0103] In one embodiment, a computer program product is provided, including a computer program, which, when executed by a processor, implements the steps in the above-mentioned method embodiments.
[0104] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0105] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned method embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium and can include the processes of the above-mentioned method embodiments when executed. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not as a limitation, RAM can be in various forms such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0106] Any combination of the technical features in the above embodiments can be made, and for the sake of brevity, not all possible combinations are described above, however, as long as the combination of the technical features does not exist in contradiction, it shall be considered within the scope of the present disclosure.
[0107] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it shall not be understood as a limitation on the patent scope of the present application. It shall be pointed out that, for ordinary skilled persons in the art, several modifications and improvements can be made without departing from the concept of the present application, and these shall be within the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.
Claims
1. A system testing method, characterized by, The method comprises: acquiring at least one service request for a target system to be tested; for each service request, determining thread code coverage data of thread code processing the service request in the target system, and mapping interface identification information obtained by analyzing the service request to the thread code coverage data to obtain mapping data of the service request; for each service request, determining summary information of the mapping data of the service request; when the summary information of the mapping data of the service request is not recorded in the summary information record table, taking the mapping data of the service request as de-duplicated mapping data, and recording the summary information of the mapping data of the service request in the summary information record table; merging the de-duplicated mapping data to obtain a mapping knowledge base of the target system; the mapping knowledge base is obtained by merging the thread code coverage data of the target system under the same interface identification information in a union manner; acquiring code difference information of the target system and a historical version system of the target system; based on the code difference information, querying interface identification information affected by system version change from the mapping knowledge base; the queried interface identification information is used for positioning a test range of the target system; merging the mapping data of each of the at least one service request to obtain system code coverage data of the target system; the thread code coverage data of the target system under the same method class is merged in a union manner; determining a system code line number of the target system; determining a system code coverage rate of the target system according to a ratio of a system coverage code line number indicated by the system code coverage data to the system code line number; the system code coverage rate is used for evaluating a test quality of the target system.
2. The method of claim 1, wherein, The method further comprises: for each method class in the target system, determining a class code line number of the method class; determining a class code coverage rate of the method class according to a ratio of a class coverage code line number of the method class indicated by the system code coverage data to the class code line number; the class code coverage rate is used for evaluating a test quality of the method class.
3. The method of claim 1, wherein, The method further comprises: determining a difference code line number of difference code indicated by the code difference information; determining a difference code coverage rate of the difference code according to a ratio of a difference coverage code line number of the difference code indicated by the system code coverage data to the difference code line number; the difference code coverage rate is used for evaluating a test quality of the difference code.
4. The method according to any one of claims 1 to 3, characterized in that, The target system is deployed with at least one service application; the method further comprises: for each service request, analyzing the service request by using a precision test system started together with a target service application requested by the service request in the target system to obtain interface identification information of the service request.
5. The method of claim 4, wherein, The interface identification information of the service request is obtained by resolving the service request through a precision test system started together with the target service application requesting the target service in the target system. When the target service application needs to call a third-party service application to process the service request, the interface identification information of the service request is obtained by resolving the service request through a precision test system started together with the target service application and the third-party service application. The third-party service application is a service application in the target system other than the target service application.
6. A system test apparatus, characterized by, The device comprises: The acquisition module is configured to acquire at least one service request for a target system to be tested. The mapping module is configured to determine thread code coverage data of thread code processing the service request in the target system for each service request, and map the interface identification information obtained by resolving the service request to the thread code coverage data to obtain mapping data of the service request. The merging module is configured to merge the mapping data of the at least one service request to obtain a mapping knowledge base of the target system. The acquisition module is further configured to acquire code difference information of the target system and a historical version of the target system. The query module is configured to query interface identification information affected by system version changes from the mapping knowledge base based on the code difference information, and the interface identification information is used to locate a test range of the target system. The merging module is further configured to determine summary information of the mapping data of the service request for each service request, and when the summary information of the mapping data of the service request is not recorded in a summary information record table, the mapping data of the service request is taken as de-duplicated mapping data, and the summary information of the mapping data of the service request is recorded in the summary information record table. The de-duplicated mapping data is merged to obtain the mapping knowledge base of the target system, which is obtained by merging the thread code coverage data under the same interface identification information in the target system in a union manner. The merging module is further configured to merge the mapping data of the at least one service request to obtain system code coverage data of the target system, wherein the thread code coverage data under the same method class in the target system is merged in a union manner, the system code line number of the target system is determined, the system code coverage rate of the target system is determined according to a ratio of the system coverage code line number indicated by the system code coverage data to the system code line number, and the system code coverage rate is used to evaluate the test quality of the target system.
7. A computer program product comprising a computer program, characterized in that, The computer program is executed by a processor to implement the steps of the method of any one of claims 1 to 5. The computer program is executed by a processor to implement the steps of the method of any one of claims 1 to 5.
Citation Information
Patent Citations
Code testing method, device, equipment, medium and program product
CN112506800A
Method and device for determining test coverage range
CN116010275A