Application testing method and device, program product and electronic equipment
By constructing a code relationship network and a pre-set risk identification model, the system intelligently identifies changes in the change chain and interface call, generates targeted testing strategies, solves the problems of low application testing accuracy and incomplete load testing, and improves load testing efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- INDUSTRIAL AND COMMERCIAL BANK OF CHINA
- Filing Date
- 2026-01-30
- Publication Date
- 2026-05-12
Smart Images

Figure CN122019385A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of financial technology, and more specifically, to an application testing method and apparatus, program product, and electronic device. Background Technology
[0002] As business application architectures become increasingly complex and change more frequently, and business requirements are delivered at an ever-accelerating pace, the need for performance testing is becoming more urgent and frequent. Currently, testers may miss some performance risks when identifying them, and they cannot prevent modifications from introducing them. Furthermore, they rely on fixed rules to confirm whether these program changes require load testing to ensure production stability. However, these methods are not only time-consuming and labor-intensive, but also suffer from incomplete and inaccurate load testing scope assessments, leading to omissions during load testing.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This invention provides a testing method, apparatus, program product, and electronic device for applications, to at least address the technical problem of low accuracy in application testing in related technologies.
[0005] According to one aspect of the present invention, a method for testing an application is provided, comprising: constructing a code relationship network of a target application, wherein the code relationship network is used to characterize the call relationships in the code corresponding to the target application; determining change links from the code relationship network based on changed code to obtain change link information, wherein the changed code is used to update the target application; determining database change information based on the changed code, and determining interface call information of the target application based on the changed code; generating code risk information of the target application using a preset risk identification model based on the change link information, the database change information, and the interface call information; generating a test strategy based on the code risk information, and using the test strategy to test the target application.
[0006] Furthermore, the steps for constructing the code relationship network of the target application include: obtaining the full code of the target application; parsing the full code to determine the first call relationship between code segments and the second call relationship between code segments and the database; and constructing the code relationship network based on the first call relationship and the second call relationship.
[0007] Furthermore, the step of determining change links from the code relationship network based on the change code and obtaining change link information includes: identifying all change codes whose code submission time is within a preset time range, wherein each change code corresponds to a change requirement; for each change code, identifying all change code segments involved in the change code; based on all change code segments, performing deduction in the code relationship network to extract links; integrating all links to obtain change links, and determining change link information based on all entity nodes involved in the change links, wherein entity nodes are nodes represented by code segments or databases.
[0008] Furthermore, the steps for determining database change information based on the change code include: determining the first type of code that interacts with the database based on the change code; determining whether the current change involves operations on a preset data table based on the first type of code, and if the current change involves operations on a preset data table, obtaining data table operation change information; determining whether the current change changes the database call frequency based on the first type of code, and if the current change changes the database call frequency, obtaining call frequency information; determining whether the current change changes the database storage method based on the change requirements of the change code, and if the current change changes the database storage method, obtaining storage method information; and determining the database change information based on the data table operation change information, call frequency information, and storage method information.
[0009] Furthermore, the step of determining the interface call information of the target application based on the changed code includes: determining whether the interface call volume of the target application's external interface has changed based on the changed code; and determining the interface call information if the interface call volume of the external interface has changed.
[0010] Furthermore, before generating code risk information for the target application using a preset risk identification model based on change link information, database change information, and interface call information, the process includes: acquiring historical change codes and determining the risk information corresponding to each historical change code; constructing historical knowledge data based on all historical change codes and the risk information corresponding to them; training the initial risk identification model based on the historical knowledge data, wherein the initial risk identification model is used to extract code features of historical change codes and obtain predicted risk information by processing the code features; and determining that the initial risk identification model has been trained successfully when the similarity between the predicted risk information and the actual risk information is greater than a preset threshold, thus obtaining the preset risk identification model.
[0011] Furthermore, the step of generating code risk information for the target application based on change link information, database change information, and interface call information using a preset risk identification model includes: representing change link information, database change information, and interface call information as reference information; inputting the changed code and reference information into the preset risk identification model for processing to generate code risk information.
[0012] According to another aspect of the present invention, an application testing apparatus is also provided, comprising: a construction unit for constructing a code relationship network of a target application, wherein the code relationship network is used to characterize the call relationships in the code corresponding to the target application; a first determining unit for determining change links from the code relationship network based on changed code, and obtaining change link information, wherein the changed code is used to update the target application; a second determining unit for determining database change information based on the changed code, and determining interface call information of the target application based on the changed code; a generation unit for generating code risk information of the target application based on the change link information, database change information, and interface call information, using a preset risk identification model; and a testing unit for generating a testing strategy based on the code risk information, and using the testing strategy to test the target application.
[0013] Furthermore, the construction unit includes: a first acquisition module for acquiring the full code of the target application; a first determination module for parsing the full code to determine the first call relationship between code segments and the second call relationship between code segments and the database; and a first construction module for constructing a code relationship network based on the first call relationship and the second call relationship.
[0014] Further, the first determining unit includes: a second determining module, used to determine all changed codes whose code submission time is within a preset time range, wherein each changed code corresponds to a change requirement; a third determining module, used to determine all changed code segments involved in each changed code; a first derivation module, used to deduce in the code relationship network based on all changed code segments to extract links; and a first integration module, used to integrate all links to obtain changed links, and determine changed link information based on all entity nodes involved in the changed links, wherein entity nodes are nodes represented by code segments or databases.
[0015] Furthermore, the second determining unit includes: a fourth determining module, used to determine a first type of code interacting with the database based on the change code; a first judging module, used to determine whether the current change involves operations on a preset data table based on the first type of code, and to obtain data table operation change information if the current change involves operations on a preset data table; a second judging module, used to determine whether the current change changes the database call frequency based on the first type of code, and to obtain call frequency information if the current change changes the database call frequency; a third judging module, used to determine whether the current change changes the database storage method based on the change requirements of the change code, and to obtain storage method information if the current change changes the database storage method; and a fifth determining module, used to determine database change information based on the data table operation change information, call frequency information, and storage method information.
[0016] Furthermore, the second determining unit also includes: a fourth determining module, used to determine whether the interface call volume of the target application's external calling interface has changed based on the changed code; and a sixth determining module, used to determine the interface call information when the interface call volume of the external calling interface changes.
[0017] Furthermore, the testing device also includes: a seventh determining module, used to acquire historical changed codes and determine the risk information corresponding to each historical changed code before generating code risk information of the target application based on the changed link information, database changed information, and interface call information using a preset risk identification model; a second construction module, used to construct historical knowledge data based on all historical changed codes and the risk information corresponding to the historical changed codes; a first training module, used to train the initial risk identification model based on the historical knowledge data, wherein the initial risk identification model is used to extract code features of historical changed codes and obtain predicted risk information by processing the code features; and an eighth determining module, used to determine that the initial risk identification model training is complete and the preset risk identification model is obtained when the similarity between the predicted risk information and the risk information is greater than a preset threshold.
[0018] Furthermore, the generation unit includes: a first characterization module, used to characterize the change link information, database change information, and interface call information as reference information; and a first processing module, used to input the change code and reference information into a preset risk identification model for processing, and generate code risk information.
[0019] According to another aspect of the present invention, a computer program product is also provided, including a non-volatile computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements a test method for any of the above applications.
[0020] According to another aspect of the present invention, an electronic device is also provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the test method of any of the above applications.
[0021] In this invention, a code relationship network of the target application is constructed. Based on the changed code, the change links are determined from the code relationship network to obtain change link information. Based on the changed code, database change information is determined, and based on the changed code, the interface call information of the target application is determined. Based on the change link information, database change information, and interface call information, a preset risk identification model is used to generate code risk information of the target application. Based on the code risk information, a test strategy is generated, and the test strategy is used to test the target application, thereby solving the technical problem of low accuracy in application testing in related technologies.
[0022] This invention employs a method of constructing a code relationship network for the target application. By analyzing the changed code and its call relationships within this network, the change chain is determined, achieving the goal of intelligently identifying load testing risks. This automates the analysis of potential performance risks arising from technical changes, thus solving the technical problems of incomplete assessments and inaccurate scope in traditional load testing design phases, which lead to missed issues and high labor costs. Specifically, a code relationship network for the target application is first established to capture the call relationships between code segments. Then, for the changed code, not only are its direct link information confirmed, but changes in database calls and API calls are also analyzed. Subsequently, a pre-set risk identification model is used to comprehensively assess the impact of the changes, generating targeted testing strategies to ensure that load testing covers all potential risk points, effectively improving the efficiency and accuracy of load testing. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings:
[0024] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a testing method for an application is shown.
[0025] Figure 2 This is a flowchart of a test method for the application of Embodiment 1 of the present invention;
[0026] Figure 3 This is a schematic diagram of a testing apparatus for an optional application according to an embodiment of the present invention;
[0027] Figure 4 This is a structural block diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0030] It should be noted that all relevant 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, and displayed data) collected and involved in this invention are information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, storage, use, processing, transmission, provision, disclosure, and application of this data comply with the relevant laws, regulations, and standards of the relevant regions, necessary confidentiality measures have been taken, and it does not violate public order and good morals. Corresponding operation entry points are provided for users to choose to authorize or refuse. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, a request to obtain the information needs to be sent to the aforementioned user or organization through the interface. The relevant information is obtained only after receiving consent from the aforementioned user or organization. If the user chooses to refuse, the process proceeds to an expert decision-making process.
[0031] In this invention, to improve the efficiency and accuracy of performance risk identification and avoid problems from being missed, an intelligent stress testing risk identification method is proposed. This method utilizes the reasoning capabilities of a large model, combined with current change codes, historical problem codes, design tables, production status, and requirement design, to intelligently analyze risks and provide risk paths.
[0032] The present invention will now be described in detail with reference to various embodiments.
[0033] Example 1
[0034] According to an embodiment of this application, an embodiment of a testing method for an application is also provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0035] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal (or mobile device) for implementing a testing method for an application is shown. Figure 1 As shown, computer terminal 10 (or mobile device) may include one or more ( Figure 1 The processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission device 106 for communication functions may also be included. In addition, it may include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera, wherein the network interface can be connected to wired and / or wireless networks. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0036] It should be noted that the aforementioned one or more processors 102 and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be integrated, in whole or in part, into any other element within the computer terminal 10 (or mobile device). As involved in the embodiments of this application, the data processing circuits serve as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).
[0037] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the application testing method in this embodiment. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the aforementioned application testing method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0038] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0039] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10 (or mobile device).
[0040] Under the aforementioned operating environment, this application provides the following: Figure 2 The test method for the application is shown. Figure 2 This is a flowchart of a test method for the application of Embodiment 1 of the present invention, as shown below. Figure 2 As shown, the method includes the following steps:
[0041] Step S201: Construct a code relationship network for the target application, wherein the code relationship network is used to represent the call relationships in the code corresponding to the target application.
[0042] In this embodiment of the invention, static code analysis and dynamic tracing techniques are used to collect the call relationships between all code segments in the target application to construct a code relationship network for the target application. For example, static code analysis tools can be used to scan the entire codebase corresponding to the target application, identify direct call relationships such as function calls and class references, and form a preliminary relationship graph. Then, combined with dynamic tracing techniques, the application is run in a specific environment or test environment to capture the actual code execution path, verify and supplement the static analysis results, and ensure the accuracy and completeness of the code relationship network. The final code relationship network is a detailed graph structure that includes the correlation between various code elements within the target application and their interaction with external resources (such as databases).
[0043] Step S202: Based on the change code, determine the change link from the code relationship network and obtain the change link information, wherein the change code is used to update the target application.
[0044] In this embodiment of the invention, when new modified code is detected in the codebase, i.e., modifications have been made to a certain function or module, these modified codes can be automatically parsed to locate their positions in the code relationship network. Then, the entire network is traversed from front to back to identify all code links directly or indirectly affected by the modified codes, thereby obtaining modification link information. Here, the modification link information includes the location of the modified code, the affected upstream and downstream components, and the connection strength between the modified code and other code elements in the network.
[0045] Step S203: Based on the change code, determine the database change information, and based on the change code, determine the interface call information of the target application.
[0046] In this embodiment of the invention, the parts of the modified code that interact with the database are analyzed to determine whether there are changes to the database query and read / write logic, and the frequency of database operations is quantified. Simultaneously, the external interface calls involved in the modified code are detected to check for newly added interface calls or changes to existing interface call behavior, and information such as the frequency and parameter types of the interface calls are recorded.
[0047] Step S204: Based on the change link information, database change information, and interface call information, a preset risk identification model is used to generate code risk information for the target application.
[0048] In this embodiment of the invention, all the integrated information (i.e., change link information, database change information, and interface call information) is input into a pre-trained risk identification model for analysis. This model is trained based on various historical data (such as past performance test results, production environment fault records, code change logs, etc.) and can predict potential performance risk points based on the input information, outputting code risk information, including risk level and possible risk scenarios.
[0049] Step S205: Based on the code risk information, generate a test strategy and use the test strategy to test the target application.
[0050] In this embodiment of the invention, a set of testing strategies is automatically generated based on the code risk information generated by the model. This includes the functional modules to be tested, the expected test scenarios, specific test methods, and parameter configurations. Then, according to the generated strategy, corresponding performance tests are executed to verify the accuracy of the risk information and to promptly identify and resolve problems.
[0051] In summary, by constructing a code relationship network for the target application and analyzing the changed code and its call relationships within this network, the method identifies the change paths, achieving the goal of intelligently identifying load testing risks. This automates the analysis of potential performance risks caused by technical changes, thus solving the technical problems of incomplete assessments and inaccurate scope in traditional load testing design phases, which lead to missed issues and high labor costs. Specifically, a code relationship network for the target application is first established to capture the call relationships between code segments. Then, for the changed code, not only are its direct link information confirmed, but changes in database calls and API calls are also analyzed. Finally, a pre-set risk identification model is used to comprehensively assess the impact of the changes, generating targeted test strategies to ensure that load testing covers all potential risk points, effectively improving the efficiency and accuracy of load testing.
[0052] To improve the accuracy of constructing the code relationship network, in the application testing method provided in Embodiment 1 of this application, the full code of the target application is obtained; the full code is parsed to determine the first call relationship between code segments and the second call relationship between code segments and the database; and a code relationship network is constructed based on the first call relationship and the second call relationship.
[0053] In this embodiment of the invention, the latest version of the full code of the target application can be extracted through a code version control system. The full code includes, but is not limited to, business logic code, database access code, and API call code, covering all functional modules of the application. Then, a code parsing tool is used to analyze the full code, identifying the first call relationship between code segments (such as functions) and the second call relationship between code segments and the database. Subsequently, based on the parsed first and second call relationships, a code relationship network is constructed using graph database technology. In this network, each code segment or database operation point is considered a node, and the call relationship is represented as an edge between nodes. In this way, the code call chain and database interaction can be visually displayed, facilitating more in-depth risk assessment by subsequent change chain confirmation, database analysis, and other modules.
[0054] In this embodiment, a comprehensive and accurate code relationship network of the target application can be constructed, including not only the direct call relationships between various code segments but also the interaction relationships between the code and the database. The construction of this network provides a solid foundation for subsequent risk identification, enabling the system to intelligently analyze the potential impact of each code change, rather than simply focusing on the changed code itself, but assessing the potential performance risks from the perspective of the entire application.
[0055] To improve the accuracy of determining change link information, in the testing method of the application provided in Embodiment 1 of this application, all changed codes whose code submission time is within a preset time range are identified, wherein each changed code corresponds to a change requirement; for each changed code, all changed code segments involved in the changed code are identified; based on all changed code segments, a deduction is made in the code relationship network to extract the link; all links are integrated to obtain the change link, and based on all entity nodes involved in the change link, the change link information is determined, wherein the entity node is a node represented by a code segment or a database.
[0056] In this embodiment of the invention, an integrated code version control system is used to filter out all modified code submitted within a preset time frame. This preset time frame can be set according to the specific needs of the project, such as a few weeks before or after the most recent software version update. Each modified code is closely associated with a corresponding change requirement, ensuring that the business context and objectives of the code changes can be tracked. Then, for each filtered modified code, a code parsing tool is used to analyze it, identifying the specific modified code segments, including functions, classes, and modules. Next, using a constructed code relationship network, a graph traversal is performed on all identified modified code segments to find the direct or indirect call relationships between the modified code segments and other code segments, forming "links." Then, all extracted links are integrated and optimized, deduplicated, and merged into a "change link." Based on all entity nodes involved in the change link, including code segments and database-represented nodes, change link information is generated. This information typically includes the type of node, the relationships between nodes, and the call frequency of nodes.
[0057] In this embodiment, the potential performance impact of code changes can be accurately located and analyzed. By associating the changed code with entity nodes, it is possible not only to intelligently identify which functional modules or database operations may be at risk due to the changes, but also to generate detailed change chain information, providing a solid data foundation for subsequent risk assessment and stress testing strategy generation.
[0058] To improve the accuracy of determining database change information, the testing method for the application provided in Embodiment 1 of this application determines a first type of code that interacts with the database based on the change code; based on the first type of code, it is determined whether the current change involves operations on a preset data table, and if the current change involves operations on a preset data table, data table operation change information is obtained; based on the first type of code, it is determined whether the current change changes the database call frequency, and if the current change changes the database call frequency, call frequency information is obtained; based on the change requirements of the change code, it is determined whether the current change changes the database storage method, and if the current change changes the database storage method, storage method information is obtained; based on the data table operation change information, call frequency information, and storage method information, database change information is determined.
[0059] In this embodiment of the invention, static code analysis tools can be used to perform syntax parsing on the modified code, identifying all code fragments related to database interaction. For example, this can be achieved by examining specific database access function calls (such as SQL (Structured Query Language) statement execution, database connection and closure, etc.) or the usage of database operation APIs (Application Programming Interfaces). During code parsing, the location, calling method, and involved database table names of all first-type code can be recorded. By analyzing the parameters of the SQL statements or database operation APIs involved in the first-type code, it can be determined whether the change has operated on a preset data table (such as a large table or a critical table). Here, a preset data table refers to a database table that has a significant impact on system performance; these tables become performance bottlenecks due to their large data volume or high access frequency. If the change involves operations on a preset data table, the specific operation type (such as INSERT, UPDATE, DELETE, SELECT, etc.) and the table name will be recorded. For changes confirmed to involve operations on preset data tables, detailed information such as the type of operation, the column names involved, changes in data size before and after the operation, and whether the data structure or indexes have been changed will be recorded. This information can be obtained using code analysis tools in conjunction with database design tables (i.e., database architecture descriptions). Furthermore, it's possible to analyze call patterns in the first type of code, such as checking for newly added database access code or optimizations to existing data access logic, thereby altering database access frequency. For changes in call frequency, the call frequency, access patterns, and potential concurrent access impacts before and after the change will be recorded. When a change in call frequency is identified, specific call frequency data will be collected, including historical call frequencies, expected call frequencies after the change, and changes in business logic that may affect call frequency. This information can be obtained by analyzing historical code versions, business requirement documents, or performance test results. It's also possible to check if the changed code includes modifications to the database storage layer, such as changes to data formats, replacement of storage engines, or adjustments to data partitioning strategies. For changes in storage methods, the differences in the storage layer before and after the change, and the potential impact of these differences on database read / write performance, will be analyzed. Then, all information related to changes in database storage methods will be recorded, including the type of change, the scope of impact, and potential performance impact points. This can be achieved by comparing database design tables, database logs, or performance monitoring data before and after the change. Then, by combining all the information (data table operation change information, call frequency information, and storage method information), detailed database change information is generated, including details of data table operation changes, changes in database call frequency, and changes in storage method.
[0060] In this final version, the focus is on identifying performance risks at the database level. By meticulously dividing the first type of code that interacts with the database, a systematic analysis of changes in database table operations, call frequency, and storage methods is conducted. This not only intelligently predicts database performance bottlenecks and risks but also guides the development of more precise load testing strategies, ensuring that database performance stability can be fully verified before software version updates.
[0061] To improve the accuracy of determining interface call information, in the application testing method provided in Embodiment 1 of this application, based on the changed code, it is determined whether the interface call volume of the target application's external interface has changed; if the interface call volume of the external interface has changed, the interface call information is determined.
[0062] In this embodiment of the invention, code analysis tools can be used to parse the modified code and identify the external API calls involved. These tools can automatically identify code snippets such as function calls and API calls, and confirm whether they are external API calls. Then, by comparing historical API call data with the call logic for these APIs in the modified code, it can be determined whether the API call volume has changed due to the code change. Once it is confirmed that the call volume of a certain API has changed due to the code change, detailed API call information can be collected, including but not limited to the name of the API, call parameters, call frequency, call time distribution, average response time, and error rate. This information will be obtained through an integrated monitoring system, log analysis, or direct performance testing to ensure that it accurately reflects the changes in API calls and their potential impact on application performance.
[0063] In this embodiment, by analyzing the changed code using automated tools, changes in API call volume can be automatically detected and quantified, and detailed API call information can be accurately collected when changes occur. This not only reduces the complexity and time cost of manual analysis but also improves the accuracy and efficiency of identifying API performance risks, helping to discover and address potential API performance bottlenecks before software updates go live.
[0064] To improve the prediction accuracy of the preset risk identification model, in the application testing method provided in Embodiment 1 of this application, before generating code risk information of the target application based on change link information, database change information, and interface call information using the preset risk identification model, historical change codes are obtained, and the risk information corresponding to each historical change code is determined; historical knowledge data is constructed based on all historical change codes and the risk information corresponding to the historical change codes; the initial risk identification model is trained based on the historical knowledge data, wherein the initial risk identification model is used to extract code features of historical change codes, and the predicted risk information is obtained by processing the code features; if the similarity between the predicted risk information and the risk information is greater than a preset threshold, it is determined that the initial risk identification model has been trained successfully, and the preset risk identification model is obtained.
[0065] In this embodiment of the invention, all modified code within a certain time range in the past is extracted from the code repository, including but not limited to update records of the most recent versions. For each historical modified code, its impact on application performance is analyzed using pre-established risk identification rules or algorithms. For example, by analyzing the syntax of the modified code, comparing performance test results, and analyzing system monitoring data, the specific risk information introduced by the modified code is determined, such as performance degradation, increased resource consumption, or potential stability issues. Then, the historical modified code and its corresponding risk information are structured to establish a historical knowledge dataset containing code features, risk types, and impact levels. Subsequently, the historical knowledge dataset is used as training data to iteratively train the initial risk identification model. This model, based on technologies such as deep learning, natural language processing, or graph neural networks, learns how to predict potential risks from modified code by analyzing the relationship between code features (such as function calls, data structures, algorithm complexity, etc.) and historical risk information. During training, the model parameters are continuously optimized by comparing the similarity between the risk information predicted by the model and the risk information that actually occurred in the past, thereby improving the accuracy of risk prediction. When the similarity between the predicted risk information and the actual risk information exceeds a preset threshold, it indicates that the model has reached a certain level of maturity and accuracy. At this point, the training process can be stopped, and the model is regarded as a "preset risk identification model" that can be used to identify the risks that new code changes may bring.
[0066] In this embodiment, by constructing and training a pre-defined risk identification model, intelligent prediction of performance risks introduced by changed code is achieved. Through analysis of historical changed code and its risk information, the model can learn the complex relationship between changes and risks, thereby quickly and accurately identifying potential performance issues when new changed code appears. This not only improves the efficiency and accuracy of load testing risk identification but also reduces reliance on human experience and knowledge, making performance testing more systematic and automated. It ensures that performance risks are comprehensively assessed and addressed before software version updates, improving software stability and user experience after deployment.
[0067] To improve the accuracy of identifying code risk information, in the testing method of the application provided in Embodiment 1 of this application, change link information, database change information, and interface call information are represented as reference information; the changed code and reference information are input into a preset risk identification model for processing to generate code risk information.
[0068] In this embodiment of the invention, through data structuring, change link information, database change information, and interface call information are integrated into a unified reference information format to facilitate processing by the preset risk identification model. This information can be converted into feature vectors, structured tables, or specific data structures to ensure the model can efficiently understand and analyze it. Specifically, data processing techniques (such as natural language processing and data mining) can be used to extract and standardize key features of this information, such as the scope of changes, database operation types, and changes in interface call frequency. Then, the changed code and the aforementioned reference information are input into the preset risk identification model for processing. The model can utilize the knowledge learned during its training phase to perform in-depth analysis of the input data to identify potential risks introduced by the changed code. After processing the input data, the preset risk identification model generates code risk information, including a quantitative assessment of the changed code risk, such as the probability of the risk, the degree of impact, and the potential risk type, as well as a description of the risk path, i.e., how the risk propagates from the changed code to other parts of the application, and possible mitigation measures.
[0069] In this embodiment, by integrating the changed code and its related change chain information, database change information, and interface call information into reference information, and using a preset risk identification model to conduct in-depth analysis, code risk information is ultimately generated. This not only improves the accuracy and efficiency of risk identification but also reduces reliance on human experience, making performance risk assessment more systematic and intelligent.
[0070] The application testing method provided in this application constructs a code relationship network for the target application. By analyzing the changed code and its call relationships within the code relationship network, it determines the change links, achieving the goal of intelligently identifying load testing risks. This realizes the technical effect of automating the analysis of performance risks that may be caused by technical changes, thereby solving the technical problems of incomplete evaluation and inaccurate scope in the traditional load testing design phase, which leads to the omission of problems and high labor costs. Specifically, a code relationship network for the target application is first established to capture the call relationships between codes. Then, for the changed code, not only is its direct link information confirmed, but changes in database calls and interface calls are also analyzed. Afterwards, a preset risk identification model is used to comprehensively evaluate the impact of the changes and generate targeted testing strategies to ensure that load testing covers all potential risk points, effectively improving the efficiency and accuracy of load testing.
[0071] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0072] Example 2
[0073] This application also provides an application testing apparatus. It should be noted that the application testing apparatus of this application can be used to execute the application testing methods provided in this application. The application testing apparatus provided in this application is described below.
[0074] According to an embodiment of this application, an apparatus for implementing the testing method described above is also provided. Figure 3 This is a schematic diagram of a testing apparatus for an optional application according to an embodiment of the present invention, such as... Figure 3 As shown, the testing device may include: a construction unit 30, a first determination unit 31, a second determination unit 32, a generation unit 33, and a testing unit 34.
[0075] Among them, the construction unit 30 is used to construct the code relationship network of the target application, wherein the code relationship network is used to represent the calling relationship in the code corresponding to the target application;
[0076] The first determining unit 31 is used to determine the change link from the code relationship network based on the change code and obtain change link information, wherein the change code is used to update the target application;
[0077] The second determining unit 32 is used to determine database change information based on the change code, and to determine the interface call information of the target application based on the change code;
[0078] The generation unit 33 is used to generate code risk information of the target application based on change link information, database change information and interface call information, using a preset risk identification model.
[0079] Test unit 34 is used to generate test strategies based on code risk information and to test the target application using the test strategies.
[0080] The testing apparatus provided in this application embodiment constructs a code relationship network for the target application. By analyzing the changed code and its call relationships within the code relationship network, it determines the change links, achieving the goal of intelligently identifying load testing risks. This realizes the technical effect of automating the analysis of performance risks that may be caused by technical changes, thereby solving the technical problems of incomplete evaluation and inaccurate scope in the traditional load testing design phase, which leads to the omission of problems and high labor costs. Specifically, a code relationship network for the target application is first established to capture the call relationships between codes. Then, for the changed code, not only is its direct link information confirmed, but changes in database calls and interface calls are also analyzed. Afterward, a preset risk identification model is used to comprehensively evaluate the impact of the changes and generate targeted testing strategies to ensure that load testing covers all potential risk points, effectively improving the efficiency and accuracy of load testing.
[0081] Optionally, the construction unit includes: a first acquisition module for acquiring the full code of the target application; a first determination module for parsing the full code to determine the first call relationship between code segments and the second call relationship between code segments and the database; and a first construction module for constructing a code relationship network based on the first call relationship and the second call relationship.
[0082] Optionally, the first determining unit includes: a second determining module, used to determine all changed codes whose code submission time is within a preset time range, wherein each changed code corresponds to a change requirement; a third determining module, used to determine all changed code segments involved in each changed code; a first derivation module, used to deduce in the code relationship network based on all changed code segments to extract links; and a first integration module, used to integrate all links to obtain changed links, and determine changed link information based on all entity nodes involved in the changed links, wherein entity nodes are code segments or nodes represented by databases.
[0083] Optionally, the second determining unit includes: a fourth determining module, used to determine a first type of code interacting with the database based on the change code; a first judging module, used to determine whether the current change involves operations on a preset data table based on the first type of code, and to obtain data table operation change information if the current change involves operations on a preset data table; a second judging module, used to determine whether the current change changes the database call frequency based on the first type of code, and to obtain call frequency information if the current change changes the database call frequency; a third judging module, used to determine whether the current change changes the database storage method based on the change requirements of the change code, and to obtain storage method information if the current change changes the database storage method; and a fifth determining module, used to determine database change information based on the data table operation change information, call frequency information, and storage method information.
[0084] Optionally, the second determining unit further includes: a fourth determining module, used to determine whether the interface call volume of the target application's external calling interface has changed based on the changed code; and a sixth determining module, used to determine the interface call information when the interface call volume of the external calling interface changes.
[0085] Optionally, the testing device further includes: a seventh determining module, used to acquire historical changed codes and determine the risk information corresponding to each historical changed code before generating code risk information of the target application based on the changed link information, database changed information, and interface call information using a preset risk identification model; a second construction module, used to construct historical knowledge data based on all historical changed codes and the risk information corresponding to the historical changed codes; a first training module, used to train an initial risk identification model based on the historical knowledge data, wherein the initial risk identification model is used to extract code features of historical changed codes and obtain predicted risk information by processing the code features; and an eighth determining module, used to determine that the initial risk identification model training is complete and a preset risk identification model is obtained when the similarity between the predicted risk information and the risk information is greater than a preset threshold.
[0086] Optionally, the generation unit includes: a first characterization module, used to characterize the change link information, database change information and interface call information as reference information; and a first processing module, used to input the change code and reference information into a preset risk identification model for processing to generate code risk information.
[0087] The aforementioned testing device may also include a processor and a memory. The aforementioned construction unit 30, first determining unit 31, second determining unit 32, generation unit 33, testing unit 34, etc., are all stored in the memory as program units, and the processor executes the aforementioned program units stored in the memory to realize the corresponding functions.
[0088] The aforementioned processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured; by adjusting kernel parameters, test strategies are generated based on code risk information, and these strategies are then used to test the target application.
[0089] The aforementioned memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0090] It should be noted that the aforementioned construction unit 30, first determining unit 31, second determining unit 32, generation unit 33, and testing unit 34 correspond to steps S201 to S205 in Embodiment 1. The instances and application scenarios implemented by the aforementioned units and corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should be noted that the aforementioned units may be hardware or software components stored in memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n). The aforementioned units may also be part of a device and can run in the computer terminal 10 provided in Embodiment 1.
[0091] Example 3
[0092] Embodiments of this application may provide an electronic device. Figure 4 This is a structural block diagram of an electronic device according to an embodiment of the present invention. Figure 4 As shown, the electronic device may include: one or more ( Figure 4 (Only one is shown) Processor 402, memory 404, memory controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.
[0093] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the testing methods and apparatus of the applications in this application embodiment. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby implementing the aforementioned application testing methods. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0094] The processor can access information and applications stored in memory via a transmission device to perform the following steps: constructing a code relationship network for the target application, wherein the code relationship network is used to characterize the call relationships in the code corresponding to the target application; determining change links from the code relationship network based on changed code to obtain change link information, wherein the changed code is used to update the target application; determining database change information based on the changed code, and determining interface call information of the target application based on the changed code; generating code risk information for the target application using a preset risk identification model based on the change link information, database change information, and interface call information; generating a test strategy based on the code risk information, and using the test strategy to test the target application.
[0095] The processor can access information and applications stored in memory via a transmission device to perform the following steps: obtain the full code of the target application; parse the full code to determine the first calling relationship between code segments and the second calling relationship between code segments and the database; and construct a code relationship network based on the first and second calling relationships.
[0096] The processor can access information and applications stored in memory via a transmission device to perform the following steps: identify all changed codes whose submission times fall within a preset time range, where each changed code corresponds to a change requirement; for each changed code, identify all changed code segments involved; based on all changed code segments, deduce links in the code relationship network to extract them; integrate all links to obtain the changed links, and based on all entity nodes involved in the changed links, determine the changed link information, where entity nodes are code segments or nodes represented by a database.
[0097] The processor can invoke information and application programs stored in memory via a transmission device to perform the following steps: Based on the change code, determine a first type of code that interacts with the database; based on the first type of code, determine whether the current change involves operations on a preset data table, and if the current change involves operations on a preset data table, obtain data table operation change information; based on the first type of code, determine whether the current change changes the database call frequency, and if the current change changes the database call frequency, obtain call frequency information; based on the change requirements of the change code, determine whether the current change changes the database storage method, and if the current change changes the database storage method, obtain storage method information; based on the data table operation change information, call frequency information, and storage method information, determine database change information.
[0098] The processor can access information and applications stored in memory via a transmission device to perform the following steps: based on the changed code, determine whether the interface call volume of the target application's external calling interface has changed; if the interface call volume of the external calling interface has changed, determine the interface call information.
[0099] The processor can access information and applications stored in the memory via a transmission device to perform the following steps: acquire historical change codes and determine the risk information corresponding to each historical change code; construct historical knowledge data based on all historical change codes and the risk information corresponding to them; train an initial risk identification model based on the historical knowledge data, wherein the initial risk identification model is used to extract code features of historical change codes and obtain predicted risk information by processing the code features; if the similarity between the predicted risk information and the actual risk information is greater than a preset threshold, determine that the initial risk identification model has been trained and obtain a preset risk identification model.
[0100] The processor can access the information and application programs stored in the memory via the transmission device to perform the following steps: characterize the changed link information, database change information, and interface call information as reference information; input the changed code and reference information into a preset risk identification model for processing to generate code risk information.
[0101] This application provides a testing scheme for an application. By constructing a code relationship network of the target application and analyzing the changed code and its call relationships within the code relationship network, the scheme identifies the change links, achieving the goal of intelligently identifying load testing risks. This automates the analysis of potential performance risks caused by technical changes, thus solving the technical problems of incomplete assessment and inaccurate scope in traditional load testing design phases, which lead to missed issues and high labor costs. Specifically, a code relationship network of the target application is first established to capture the call relationships between code. Then, for the changed code, not only is its direct link information confirmed, but changes in database calls and interface calls are also analyzed. Finally, a preset risk identification model is used to comprehensively assess the impact of the changes, generating targeted testing strategies to ensure that load testing covers all potential risk points, effectively improving the efficiency and accuracy of load testing.
[0102] Those skilled in the art will understand that Figure 4 The structure shown is for illustrative purposes only. Electronic devices can also be terminal devices such as smartphones, tablets, PDAs, and mobile internet devices (MIDs). Figure 4 This does not limit the structure of the aforementioned electronic device. For example, electronic devices may also include components that are more... Figure 4The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 4 The different configurations shown.
[0103] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0104] Example 4
[0105] Embodiments of this application also provide a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the testing method of the application provided in Embodiment 1.
[0106] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0107] This application also provides a computer program product that, when executed on a data processing device, is suitable for performing test method steps of an application.
[0108] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0109] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0110] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0111] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0112] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0113] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0114] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A testing method for an application, characterized in that, include: Construct a code relationship network for a target application, wherein the code relationship network is used to characterize the call relationships in the code corresponding to the target application; Based on the change code, change links are determined from the code relationship network to obtain change link information, wherein the change code is used to update the target application; Based on the change code, the database change information is determined, and based on the change code, the interface call information of the target application is determined; Based on the change link information, the database change information, and the interface call information, a preset risk identification model is used to generate code risk information for the target application. Based on the code risk information, a test strategy is generated, and the target application is tested using the test strategy.
2. The test method according to claim 1, characterized in that, The steps to construct the code relationship network of the target application include: Obtain the full code of the target application; The entire code is parsed to determine the first calling relationship between code segments and the second calling relationship between the code segments and the database; Based on the first call relationship and the second call relationship, the code relationship network is constructed.
3. The test method according to claim 1, characterized in that, The steps of determining change links from the code relationship network based on the change code and obtaining change link information include: Identify all the changed code whose submission time falls within a preset time range, wherein each of the changed code corresponds to a change requirement; For each of the aforementioned change codes, identify all the change code segments involved in the change code; Based on all the aforementioned modified code segments, inferences are made in the code relationship network to extract the links; All the links are integrated to obtain the changed link, and the changed link information is determined based on all entity nodes involved in the changed link, wherein the entity node is a node represented by a code segment or a database.
4. The test method according to claim 1, characterized in that, The steps for determining database change information based on the change code include: Based on the changed code, a first type of code for interacting with the database is determined; Based on the first type of code, determine whether the current change involves operations on a preset data table, and if the current change involves operations on the preset data table, obtain data table operation change information; Based on the first type of code, determine whether the current change alters the database call frequency, and if the current change alters the database call frequency, obtain the call frequency information; Based on the change requirements of the change code, determine whether the current change changes the storage method of the database, and if the current change changes the storage method of the database, obtain the storage method information; The database change information is determined based on the data table operation change information, the call frequency information, and the storage method information.
5. The test method according to claim 1, characterized in that, The step of determining the interface call information of the target application based on the modified code includes: Based on the changed code, determine whether the number of API calls to the target application's external API has changed; When the number of calls to the external interface changes, the interface call information is determined.
6. The test method according to claim 1, characterized in that, Before generating code risk information for the target application based on the change link information, the database change information, and the interface call information using a preset risk identification model, the process further includes: Obtain historical change codes and determine the risk information corresponding to each historical change code; Based on all the historical change codes and the risk information corresponding to the historical change codes, historical knowledge data is constructed. The initial risk identification model is trained based on the historical knowledge data, wherein the initial risk identification model is used to extract the code features of the historical change codes, and by processing the code features, predicted risk information is obtained; If the similarity between the predicted risk information and the actual risk information is greater than a preset threshold, it is determined that the initial risk identification model has been trained and the preset risk identification model is obtained.
7. The test method according to claim 1, characterized in that, Based on the change link information, the database change information, and the interface call information, the step of generating code risk information for the target application using a preset risk identification model includes: The change link information, the database change information, and the interface call information are represented as reference information; The modified code and the reference information are input into the preset risk identification model for processing to generate the code risk information.
8. A testing apparatus for an application, characterized in that, include: A construction unit is used to construct a code relationship network of a target application, wherein the code relationship network is used to characterize the call relationships in the code corresponding to the target application; The first determining unit is used to determine the change link from the code relationship network based on the change code and obtain change link information, wherein the change code is used to update the target application; The second determining unit is used to determine database change information based on the change code, and to determine the interface call information of the target application based on the change code; The generation unit is used to generate code risk information of the target application based on the change link information, the database change information, and the interface call information, using a preset risk identification model. The testing unit is used to generate a testing strategy based on the code risk information, and to test the target application using the testing strategy.
9. A computer program product, characterized in that, The invention includes a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements a test method for the application as described in any one of claims 1 to 7.
10. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the test method of the application according to any one of claims 1 to 7.