System testing method and device, equipment, storage medium and program product
By building a mapping knowledge base of the target system and combining the code difference information of historical versions of the system, the problem of inaccurate recommendation results of traditional system testing methods in multi-service system architecture is solved, and the accuracy and efficiency of system testing are improved.
Patent Information
- Application Number
- CN202410997919.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-24
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-24
AI Technical Summary
Traditional system testing methods have inaccurate recommendation results when there are cross-service calls in a multi-service system architecture, resulting in reduced system testing efficiency.
By obtaining the service request of the target system, determine the thread code coverage data, map the interface identification information with the thread code coverage data, merge the mapping data of each service request, build a mapping knowledge base, and combine the code difference information of historical versions of the system to query Interface identification information affected by system version changes to locate the test scope.
It improves the accuracy and efficiency of system testing, helps R&D personnel quickly locate the test range, and improves system testing efficiency.
Smart Images

Figure CN118820105A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a system testing method, device, equipment, storage medium and program product. Background Art
[0002] With the development of computer technology, a large number of business systems have emerged, bringing great convenience to people's daily work and life. Before the business system goes online, R&D personnel usually conduct various types of tests on the business system, including but not limited to functional testing, performance testing, security testing and compatibility testing, to discover potential defects in the business system, so as to optimize the business system more targetedly and ensure the stability of the business system after it goes online.
[0003] In traditional technology, static call chain tools are usually used to establish the relationship between use cases and function call chains in an automated or manual manner, thereby gradually deriving the affected test cases. However, traditional system testing methods have the problem of inaccurate recommendation results, especially for cross-service calls in multi-service system architectures, where the recommendation results are even more inaccurate, resulting in reduced system testing efficiency. Summary of the invention
[0004] Based on this, it is necessary to provide a system testing method, device, equipment, storage medium and program product that can improve system testing efficiency in response to the above technical problems.
[0005] In a first aspect, the present application provides a system testing method, the method comprising:
[0006] Obtaining at least one service request for a target system to be tested;
[0007] For each of the service requests, determining thread code coverage data of the thread code for processing the service request in the target system, and mapping the interface identification information obtained by parsing the service request with the thread code coverage data to obtain mapping data for the service request;
[0008] Merging the mapping data of the at least one service request to obtain a mapping knowledge base of the target system;
[0009] Obtain code difference information between the target system and a historical version system of the target system;
[0010] Based on the code difference information, the interface identification information affected by the system version change is queried from the mapping knowledge base; the queried interface identification information is used to locate the test scope of the target system.
[0011] In a second aspect, the present application provides a system testing device, the device comprising:
[0012] An acquisition module, used to acquire at least one service request for a target system to be tested;
[0013] A mapping module, for determining, for each of the service requests, thread code coverage data of the thread code for processing the service request in the target system, and mapping the interface identification information obtained by parsing the service request with the thread code coverage data to obtain the mapping data for the service request;
[0014] A merging module, used for merging the mapping data of the at least one service request to obtain a mapping knowledge base of the target system;
[0015] The acquisition module is also used to acquire code difference information between the target system and the historical version system of the target system;
[0016] A query module is used to query the interface identification information affected by the system version change from the mapping knowledge base based on the code difference information; the interface identification information obtained is used to locate the test scope of the target system.
[0017] In a third aspect, the present application provides a computer device including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in the method embodiments of the present application are implemented.
[0018] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the method embodiments of the present application.
[0019] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps in the method embodiments of the present application when the computer program is executed by a processor.
[0020] The above-mentioned system testing method, device, equipment, storage medium and program product obtain at least one service request for the target system to be tested; for each service request, determine the thread code coverage data of the thread code that processes the service request in the target system, and map the interface identification information obtained by parsing the service request with the thread code coverage data to obtain the mapping data for the service request; merge the mapping data of at least one service request to obtain a mapping knowledge base of the target system; obtain the code difference information between the target system and the historical version system of the target system; based on the code difference information, 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 scope of the target system. Compared with the traditional system testing method, the present application constructs a mapping knowledge base of the target system by establishing a mapping relationship between the interface identification information of each service request and the thread code coverage data of different service applications, and recommends the interface range affected by the system version change in combination with the code difference information between the target system and its historical version system, so as to facilitate R&D personnel to quickly locate the test scope of the target system as a reference direction for system testing, thereby improving the testing efficiency of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 An application environment diagram of a system testing method in an embodiment;
[0022] Figure 2 A schematic diagram of a flow chart of a system testing method in an embodiment;
[0023] Figure 3 A schematic diagram of parsing a service request to obtain interface identification information of an interface in an embodiment;
[0024] Figure 4 A schematic diagram of parsing a service request to obtain interface identification information of an interface in another embodiment;
[0025] Figure 5 is a flow chart of a system testing method in another embodiment;
[0026] Figure 6 is a structural block diagram of a system testing device in one embodiment;
[0027] Figure 7 is a structural block diagram of a system testing device in another embodiment;
[0028] Figure 8 is an internal structure diagram of a computer device in one embodiment;
[0029] FIG. 9 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0031] The system testing method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can be set up separately and can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other servers. Among them, the terminal 102 can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, vehicle-mounted terminals, intelligent voice interaction devices, aircraft, smart home appliances and portable wearable devices. Smart home appliances can be smart speakers, smart TVs and smart air conditioners. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, cloud security, host security and other network 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 by wired or wireless communication, and this application is not limited here.
[0032] The server 104 may be deployed with a precision test system and a target system to be tested, for example, the target system may be a business system to be tested. It is understood that the present application may perform precision testing on the target system to be tested through the precision test system. Specifically, the server 104 may obtain at least one service request for the target system to be tested from the terminal 102 through the precision test system. For each service request, the server 104 may determine the thread code coverage data of the thread code for processing the service request in the target system through the precision test system, and map the interface identification information obtained by parsing the service request with the thread code coverage data to obtain the mapping data for the service request. The server 104 may merge the mapping data of at least one service request through the precision test system to obtain the mapping knowledge base of the target system. The server 104 may obtain the code difference information between the target system and the historical version system of the target system through the precision test system, and query the interface identification information affected by the system version change from the mapping knowledge base based on the code difference information; the queried interface identification information is used to locate the test scope of the target system.
[0033] It is understood that this embodiment does not limit this. Optionally, the precision test system and the target system to be tested may also be deployed in different servers. Figure 1 The application scenarios are only for illustration and are not limited to this.
[0034] In one embodiment, Figure 2 As shown, a system testing method is provided, which can be applied to a computer device, and the computer device can be a terminal or a server, that is, the method can be executed by the terminal or the server alone, or can be implemented through interaction between the terminal and the server. This embodiment takes the method applied to a computer device as an example for explanation, and includes the following steps:
[0035] Step 202: Obtain at least one service request for the target system to be tested.
[0036] In one embodiment, at least one service application is deployed in the target system. It is understood that the service application may include a microservice application. The target system may be a business system under a multi-service architecture or a business system under a single service architecture. The computer device may obtain at least one service request for the target system to be tested. It is understood that the service request is used to request a service from the service application indicated by the service request in the target system.
[0037] Step 204, for each service request, determine the thread code coverage data of the thread code processing the service request in the target system, and map the interface identification information obtained by parsing the service request with the thread code coverage data to obtain the mapping data for the service request.
[0038] Among them, the thread code for processing the targeted service request in the target system refers to the thread code in the application code of the service application of the target system, which is used to process the targeted service request. The thread code coverage data is the code information of the thread code responsible for processing the targeted service request in the target system. 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 line number of the method covered, the original line number of the method and other information. The interface identification information is used to uniquely identify the business interface. For example, the interface identification information can be the URI (Uniform Resource Identifier) of the business interface.
[0039] In one embodiment, for each service request in at least one service request obtained, the computer device may determine the 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 may parse the service request, obtain corresponding interface identification information, and associate and map the interface identification information obtained by the parsing with the thread code coverage data to obtain mapping data for the service request.
[0040] Step 206: merge the mapping data of at least one service request to obtain a mapping knowledge base of the target system.
[0041] The mapping knowledge base records the association mapping relationship between the interface identification information of each business interface and the corresponding thread code coverage data. It can be understood that each business interface is a business interface corresponding to at least one service request for requesting service to the target system.
[0042] In one embodiment, the computer device may directly merge the mapping data of the at least one service request to obtain a mapping knowledge base of the target system.
[0043] Step 208: Obtain code difference information between the target system and the 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 the historical version of the target system. It can be understood that the target system is obtained by updating the historical version system.
[0045] In one embodiment, the computer device may obtain the source code of the target system and the source code of the historical version system of the target system. The computer device may determine the code difference information between the source code of the target system and the source code of the historical version system. It is understood that the code difference information may include the changed class name, method name and line number information, etc.
[0046] Step 210: Based on the code difference information, query the mapping knowledge base for interface identification information affected by the system version change; the queried interface identification information is used to locate the test scope 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 business interface and the corresponding thread code coverage data, and the thread code coverage data may include the class name in the thread covered code, the method name of the covered code, the line number of the method covered, the original line number of the method and other information. Therefore, the computer device can use the class name and 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. Among them, the queried interface identification information is used to locate the test scope of the target system, provide a reference direction for R&D personnel to conduct system testing, and improve the test efficiency of the target system.
[0048] In the above system testing method, at least one service request for the target system to be tested is obtained; for each service request, the thread code coverage data of the thread code for processing the service request in the target system is determined, and the interface identification information obtained by parsing the service request is mapped with the thread code coverage data to obtain the mapping data for the service request; the mapping data of at least one service request is merged to obtain a mapping knowledge base of the target system; the code difference information between the target system and the historical version system of the target system is obtained; based on the code difference information, the interface identification information affected by the system version change is queried from the mapping knowledge base; the queried interface identification information is used to locate the test scope of the target system. Compared with the traditional system testing method, the present application constructs a mapping knowledge base of the target system by establishing a mapping relationship between the interface identification information of each service request and the thread code coverage data of different service applications, and recommends the interface range affected by the system version change in combination with the code difference information between the target system and its historical version system, so as to facilitate R&D personnel to quickly locate the test scope of the target system as a reference direction for system testing, thereby improving the testing efficiency of the system.
[0049] In one embodiment, the mapping knowledge base is obtained by merging the thread code coverage data under the same interface identification information of the target system in a union manner; the method also includes: merging the mapping data of at least one service request to obtain the system code coverage data of the target system; wherein the thread code coverage data under the same method class of the target system is merged in a union manner; determining the number of system code lines of the target system; determining the system code coverage rate of the target system 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; 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 number of system code lines is the number of code lines of the source code of the target system. The number of system coverage code lines is the number of code lines of the thread code responsible for processing the targeted service request in the target system.
[0051] Specifically, the computer device may merge the thread code coverage data under the same method class of the target system in a union manner to obtain the system code coverage data of the target system. The computer device may determine the number of system code lines of the target system and determine the number of system covered code lines indicated by the system code coverage data. The computer device may determine the system code coverage rate of the target system based on the ratio of the number of system covered 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 under the same method class of the target system is merged in a union manner to obtain the system code coverage data of the target system, and the system code coverage rate of the target system is determined based on 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 also includes: determining the number of class code lines of the targeted method class for each method class in the target system; determining the class code coverage rate of the targeted method class based on the ratio of the number of class coverage code lines of the targeted method class to the number of class code lines indicated by the system code coverage data; and the class code coverage rate is used to evaluate the test quality of the targeted method class.
[0054] The class code lines are the number of lines of code contained in the method class. The class coverage code lines are 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 includes multiple 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 targeted method class, and determine the number of class coverage code lines of the targeted method class indicated by the system code coverage data. Furthermore, the computer device can determine the class code coverage rate of the targeted method class based on 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 targeted method class.
[0056] In one embodiment, the computer device may 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 targeted method class.
[0057] In the above embodiment, the class code coverage rate of the method class is determined by the ratio of the number of class coverage code lines to the number of class code lines of the method class 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 testing efficiency of the system.
[0058] In one embodiment, the method also includes: determining the number of difference code lines of the difference code indicated by the code difference information; determining the difference code coverage rate of the difference code based on the ratio of the number of difference coverage code lines of the difference code indicated by the system code coverage data to the number of difference code lines; the difference code coverage rate is used to evaluate the test quality of the difference code.
[0059] The difference code is the code in the source code of the target system that is different from the source code of the historical version of the target system. The number of difference code lines is the total number of code lines in the difference code. The number of difference coverage code lines is the number of code lines in the difference code that are responsible for processing service requests.
[0060] In one embodiment, the computer device may determine the difference code indicated by the code difference information, and determine the number of difference code lines of the difference code indicated by the code difference information. The computer device may determine the number of difference coverage code lines of the difference code indicated by the system code coverage data, and determine the difference code coverage rate of the difference code according to the ratio of the number of difference coverage code lines to the number of difference code lines, wherein the difference code coverage rate is used to evaluate the test quality of the difference code.
[0061] In one embodiment, the computer device may directly use the ratio of the number of lines of code covered by the difference to the number of lines of the difference code 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 by the ratio of the number of difference coverage code lines of the difference code indicated by the system code coverage data to the number of difference code lines to facilitate the evaluation of the test quality of the difference code, thereby further improving the test efficiency of the system.
[0063] In one embodiment, the mapping data of at least one service request are merged to obtain a mapping knowledge base of the target system, including: deduplicating the mapping data of at least one service request to obtain deduplicated mapping data; and merging the deduplicated mapping data to obtain the mapping knowledge base of the target system.
[0064] In one embodiment, since the function logic in some underlying common logic is called and executed more than once during the execution of the test case used to test the target system, there will be a large amount of repeated mapping data, so deduplication is performed before merging, which can reduce the magnitude of calculation. Specifically, the computer device can deduplicate the mapping data of at least one service request to obtain the 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 deduplicating the mapping data of at least one service request, duplicate redundant data can be removed, and the deduplicated mapping data can be merged to obtain a mapping knowledge base of the target system, thereby avoiding the waste of computer resources used to support data merging.
[0066] In one embodiment, the mapping data of at least one service request are deduplicated to obtain deduplicated mapping data, including: for each service request, determining summary information of the mapping data for the service request; when the summary information of the mapping data for the service request is not recorded in the summary information recording table, the mapping data for the service request is used as the deduplicated mapping data, and the summary information of the mapping data for the service request is recorded in the summary information recording table.
[0067] The summary information is the information generated by processing the mapping data through the summary generation algorithm. It can be understood that the summary information can be used to characterize the characteristics of the mapping data. Different mapping data have completely different summary information generated by the summary generation algorithm. Even if the similarity of two different mapping data is very high, the summary information corresponding to them is very different. The summary information recording table is a table maintained for the target system to record the summary information of the mapping data.
[0068] Specifically, for each service request, the computer device may process the mapping data for the service request through a summary generation algorithm to generate summary information of the mapping data for the service request. When the summary information recording table for recording mapping data maintained for the target system does not record the summary information 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. Then, the computer device may use the mapping data for the service request as deduplicated mapping data and record the summary information of the mapping data for the service request in the summary information recording table.
[0069] In one embodiment, the mapping data may be a JSON (JavaScript Object Notation, JS object notation, a lightweight data exchange format) string including interface identification information, overridden class, overridden method, overridden line number, original line number of overridden method, name of target system service, version of target system service and other information.
[0070] In one embodiment, for each service request, the computer device may process the mapping data for the service request through the MD5 message digest algorithm to generate the MD5 value of the mapping data for the service request, i.e., summary information. When the MD5 value of the mapping data for the service request is not recorded in the MD5 value record table for recording mapping data, i.e., the summary information record table, maintained for the target system, it indicates that the mapping data for the service request has not been processed and is not repeated mapping data. Then, the computer device may use the mapping data for the service request as 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, by using summary information of the mapping data of the service request to determine whether the mapping data of the service request is repeated, redundant mapping data can be removed quickly and accurately, data merging efficiency can be improved, and thus system testing efficiency can be further improved.
[0072] In one embodiment, at least one service application is deployed in the target system; the method also includes: for each service request, a precision testing system is started together with the target service application requested by the targeted service request in the target system, the targeted service request is parsed, and the interface identification information of the targeted service request is obtained.
[0073] Specifically, at least one service application is deployed in the target system, and the target system may be a business system under a multi-service architecture or a business system under a single service architecture. The service request may indicate a request for service from a target service application in the target system, and it is understood that for each service request, the computer device may parse the service request through a precision test system started together with the target service application requested by the service request in the target system, and obtain the interface identification information of the service request.
[0074] In one embodiment, Figure 3As shown, a precise test system and a target system to be tested may be deployed in a computer device, for example, the target system may be a business system to be tested. A coverage data acquisition unit and a coverage data processing unit may be included in the precise test system. At least one service application to be tested is deployed in the target system to be tested. It can be understood that the present application can perform precise testing on the service application to be tested in the target system to be tested through a precise test system. Specifically, the computer device can obtain a service request for the target system to be tested. It can be understood that the service request corresponds to an A interface, which is used to request the service of a service application B in the target system. The precise test system can parse the interface identification information of the interface A corresponding to the service request, that is, the URI, by means of an Agent. The precise test system can establish a mapping relationship between the parsed interface identification information and the thread code in the service application B responsible for processing the service request by means of an Agent and store it, so as to facilitate the subsequent establishment of a mapping relationship between the interface identification information and the thread code coverage data of the thread code based on the thread code. It can be understood that after the execution of the method in the thread code of the service application B is completed, the precise test system can report the mapping relationship data by means of an Agent and cancel the URI mapping.
[0075] In the above embodiment, by starting a precise test system together with a target service application requested by the targeted service request in the target system, the targeted service request is parsed to obtain interface identification information of the targeted service request. During the parsing process, a mapping relationship between the interface identification information and the thread code can be established to facilitate subsequent mapping of the interface identification information with thread code coverage data of the thread code, thereby enabling the interface identification information affected by the change to be queried based on the code difference information.
[0076] In one embodiment, for each service request, a precise testing system is started together with a target service application requested by the targeted service request in a target system to parse the targeted service request and obtain interface identification information of the targeted service request, including: for each service request, when the target service application needs to call a third-party service application to process the targeted service request, a precise testing system is started together with the target service application and the third-party service application to parse the targeted service request and obtain interface identification information of the targeted service request; wherein, the third-party service application is a service application other than the target service application in the target system.
[0077] Specifically, for each service request, when the target service application needs to call a third-party service application to process the service request, for example, when a method in the target service application needs to call a third-party service application during execution, the computer device can parse the service request through an agent through a 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, Figure 4As shown, a precise test system and a target system to be tested may be deployed in a computer device, for example, the target system may be a business system to be tested. A coverage data acquisition unit and a coverage data processing unit may be included in the precise test system. At least one service application to be tested is deployed in the target system to be tested. It can be understood that the present application can perform precise testing on the service application to be tested in the target system to be tested through a precise test system. Specifically, the computer device can obtain a service request for the target system to be tested. It can be understood that the service request corresponds to the C interface, which is used to request the service of the service application D in the target system. Among them, the service application D needs to call the service application E to process the service request. At this time, the computer device can parse the interface identification information of the interface C corresponding to the service request, that is, the URI, through the precise test system started together with the service application D and the service application E. Specifically, the precise test system can parse the interface identification information of the interface C corresponding to the service request by means of an Agent, and establish a mapping relationship between the parsed interface identification information and the thread code in the service application D responsible for processing the service request and store it, so as to facilitate the subsequent establishment of a mapping relationship between the interface identification information and the thread code coverage data of the thread code based on the thread code of the service application D. When service application D processes the service request, it calls service application E through a call request, such as through an Http interface or a Dubbo interface. The call request carries the interface identification information parsed by service application D, that is, the URI. For example, the URI is transmitted through an Http request header or an RPC Attachments parameter. Then, the precise test system can parse the interface identification information of interface C corresponding to the service request through an Agent, and establish a mapping relationship between the parsed interface identification information and the thread code responsible for processing the service request in service application E and store it, so as to facilitate the subsequent establishment of a mapping relationship between the interface identification information and the thread code coverage data of the thread code based on the thread code of service application E. It can be understood that after the methods in the thread codes of service application E and service application D are executed respectively, the precise test system can report the relevant mapping relationship data through an Agent and cancel the relevant 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 targeted service request is parsed through the precise testing system started together with the target service application and the third-party service application to obtain the interface identification information of the targeted service request. During the parsing process, a mapping relationship between the interface identification information and each thread code can be established to facilitate the subsequent mapping of the interface identification information with the thread code coverage data of each thread code, so that the interface identification information affected by the change can be queried based on the code difference information.
[0080] In one embodiment, Figure 5 As shown, the precision test system may include a coverage data acquisition unit and a coverage data processing unit. Among them, the coverage data acquisition unit is mainly responsible for the following functions: parsing the interface identification information of the service request, that is, the URI; collecting the thread code coverage data of the thread code that processes the service request in the target system; mapping the parsed interface identification information with the thread code coverage data to obtain the mapping data; storing the mapping data in the database. The coverage data processing unit is mainly responsible for the following functions: parsing the source code of the target system, obtaining the code information of the source code of the target system, such as the number of system code lines of the target system, etc.; merging the mapping data of each service request to obtain the mapping knowledge base of the target system; determining the system code coverage of the target system; obtaining and parsing the code difference information between the target system and the historical version system; based on the code difference information, querying the interface identification information affected by the system version change from the mapping knowledge base.
[0081] It should be understood that, although each step in the flow chart of the above-mentioned embodiments is shown in order, these steps are not necessarily performed in order. Unless there is a clear explanation in this article, the execution of these steps does not have strict order restrictions, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned embodiments may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in order, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.
[0082] In one embodiment, Figure 6 As shown, a system testing device 600 is provided, and the device specifically includes:
[0083] An acquisition module 602 is used to acquire at least one service request for a target system to be tested;
[0084] A mapping module 604 is used to determine, for each service request, thread code coverage data of the thread code that processes the service request in the target system, and map the interface identification information obtained by parsing the service request with the thread code coverage data to obtain mapping data for the service request;
[0085] A merging module 606, configured to merge the mapping data of at least one service request to obtain a mapping knowledge base of a target system;
[0086] The acquisition module 602 is also used to acquire code difference information between the target system and the historical version system of the target system;
[0087] The query module 608 is used to query the interface identification information affected by the system version change from the mapping knowledge base based on the code difference information; the interface identification information obtained is used to locate the test scope of the target system.
[0088] In one embodiment, the mapping knowledge base is obtained by merging the thread code coverage data under the same interface identification information of the target system in a union manner; the merging module 606 is also used to merge the mapping data of at least one service request to obtain the system code coverage data of the target system; wherein, the thread code coverage data under the same method class of the target system is merged in a union manner; the number of system code lines of the target system is determined; 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; the system code coverage rate is used to evaluate the test quality of the target system.
[0089] In one embodiment, the merge module 606 is also used to determine the number of class code lines of the targeted method class for each method class in the target system; determine the class code coverage rate of the targeted method class based on the ratio of the number of class coverage code lines of the targeted method class to the number of class code lines indicated by the system code coverage data; and the class code coverage rate is used to evaluate the test quality of the targeted method class.
[0090] In one embodiment, the merge module 606 is also used to determine the number of difference code lines of the difference code indicated by the code difference information; determine the difference code coverage rate of the difference code based on the ratio of the number of difference coverage code lines of the difference code indicated by the system code coverage data to the number of difference code lines; 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 used to perform deduplication processing on the mapping data of at least one service request to obtain deduplication mapping data; and merge the deduplication mapping data to obtain a mapping knowledge base of the target system.
[0092] In one embodiment, the merging module 606 is also used to determine the summary information of the mapping data for each service request; when the summary information of the mapping data for the service request is not recorded in the summary information recording table, the mapping data for the service request is used as the deduplicated mapping data, and the summary information of the mapping data for the service request is recorded in the summary information recording table.
[0093] In one embodiment, Figure 7 As shown, at least one service application is deployed in the target system; the device also includes:
[0094] The parsing module 610 is used to parse each service request through a precision testing system started together with a target service application requested by the service request in a target system to obtain interface identification information of the service request.
[0095] In one embodiment, the parsing module 610 is also used to parse the targeted service request for each service request, and obtain the interface identification information of the targeted service request through a precise testing system started together with the target service application and the third-party service application when the target service application needs to call a third-party service application to process the targeted service request; wherein the third-party service application is a service application other than the target service application in the target system.
[0096] The above-mentioned system testing device obtains at least one service request for the target system to be tested; for each service request, determines the thread code coverage data of the thread code that processes the service request in the target system, and maps the interface identification information obtained by parsing the service request with the thread code coverage data to obtain the mapping data for the service request; merges the mapping data of at least one service request to obtain a mapping knowledge base of the target system; obtains the code difference information between the target system and the historical version system of the target system; based on the code difference information, queries 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 scope of the target system. Compared with the traditional system testing method, the present application constructs a mapping knowledge base of the target system by establishing a mapping relationship between the interface identification information of each service request and the thread code coverage data of different service applications, and recommends the interface range affected by the system version change in combination with the code difference information between the target system and its historical version system, so as to facilitate R&D personnel to quickly locate the test scope of the target system as a reference direction for system testing, thereby improving the testing efficiency of the system.
[0097] Each module in the above system test device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0098] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a system testing method is implemented.
[0099] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG9. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. 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 an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a system testing method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0100] Those skilled in the art will understand that Figure 8 The structure shown in FIG. 9 is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0101] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0102] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0103] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[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 used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0105] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0106] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0107] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A system testing method, characterized in that: The method comprises: Obtaining at least one service request for a target system to be tested; For each of the service requests, determining thread code coverage data of the thread code for processing the service request in the target system, and mapping the interface identification information obtained by parsing the service request with the thread code coverage data to obtain mapping data for the service request; Merging the mapping data of the at least one service request to obtain a mapping knowledge base of the target system; Obtain code difference information between the target system and a historical version system of the target system; Based on the code difference information, the interface identification information affected by the system version change is queried from the mapping knowledge base; the queried interface identification information is used to locate the test scope of the target system.
2. The method according to claim 1, characterized in that: The mapping knowledge base is obtained by merging the thread code coverage data under the same interface identification information of the target system in a union manner; the method further includes: Merging the mapping data of the at least one service request to obtain the system code coverage data of the target system; wherein the thread code coverage data under the same method class of the target system is merged in a union manner; Determining the number of system code lines of the target system; 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; the system code coverage rate is used to evaluate the test quality of the target system.
3. The method according to claim 2, characterized in that The method further comprises: For each method class in the target system, determine the number of class code lines of the method class; The class code coverage rate of the targeted method class is determined according to the ratio of the number of class coverage code lines of the targeted 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 targeted method class.
4. The method according to claim 2, characterized in that: The method further comprises: Determine the number of difference code lines of the difference code indicated by the code difference information; The difference code coverage rate of the difference code is determined according to the ratio of the number of difference coverage code lines of the difference code indicated by the system code coverage data to the number of difference code lines; the difference code coverage rate is used to evaluate the test quality of the difference code.
5. The method according to claim 1, characterized in that The step of merging the mapping data of the at least one service request to obtain the mapping knowledge base of the target system includes: Deduplication processing is performed on the mapping data of each of the at least one service request to obtain deduplication mapping data; The deduplicated mapping data are merged to obtain a mapping knowledge base of the target system.
6. The method according to claim 5, characterized in that The deduplicating the mapping data of each of the at least one service request to obtain the deduplicated mapping data includes: For each of the service requests, determining summary information of the mapping data for the service request; When the summary information recording table does not record the summary information of the mapping data for the service request, the mapping data for the service request is used as the deduplicated mapping data, and the summary information of the mapping data for the service request is recorded in the summary information recording table.
7. The method according to any one of claims 1 to 6, characterized in that At least one service application is deployed in the target system; the method further includes: For each of the service requests, the targeted service request is parsed through a precise testing system started together with a target service application requested by the targeted service request in the target system to obtain interface identification information of the targeted service request.
8. The method according to claim 7, characterized in that For each of the service requests, the targeted service request is parsed through a precision testing system started together with a target service application requested by the targeted service request in the target system to obtain interface identification information of the targeted service request, including: For each of the service requests, when the target service application needs to call a third-party service application to process the targeted service request, the targeted service request is parsed through a precision testing system started together with the target service application and the third-party service application to obtain interface identification information of the targeted service request; The third-party service application is a service application in the target system other than the target service application.
9. A system testing device, characterized in that: The device comprises: An acquisition module, used to acquire at least one service request for a target system to be tested; A mapping module, for determining, for each of the service requests, thread code coverage data of the thread code for processing the service request in the target system, and mapping the interface identification information obtained by parsing the service request with the thread code coverage data to obtain the mapping data for the service request; A merging module, used for merging the mapping data of the at least one service request to obtain a mapping knowledge base of the target system; The acquisition module is also used to acquire code difference information between the target system and the historical version system of the target system; A query module is used to query the interface identification information affected by the system version change from the mapping knowledge base based on the code difference information; the interface identification information obtained is used to locate the test scope of the target system.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Code testing method, device, equipment, medium and program product
CN112506800A
Incremental code coverage rate analysis method, device and system and medium
CN115543810A
Method and device for determining test coverage range
CN116010275A
System and method for providing code coverage
US20160328314A1
