Test data preservation method and device based on large model, storage medium and equipment
By intercepting and transforming database operation commands and utilizing a large model to obtain the initial and current states of test data, the problem of dynamic changes in test data is solved, enabling precise management and preservation of test data, and improving the reliability and efficiency of testing.
Patent Information
- Application Number
- CN202511269562.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-05
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-09-05
AI Technical Summary
Existing test data management technologies cannot effectively cope with the dynamic changes in test data during use, resulting in outdated test data that affects test quality and reliability.
By intercepting the database operations of the service system under test, a pre-trained instruction conversion model is used to convert the original database operation instructions into data query instructions, obtain the initial state of the test data, and obtain the current state again after use, and perform data preservation processing based on the state differences.
To ensure the accuracy and validity of test data, improve the reliability and efficiency of testing, prevent test omissions and errors, and guarantee test coverage and quality.
Smart Images

Figure CN120743796B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of application testing, and in particular to a test data preservation method and device based on a large model, a storage medium and equipment. BACKGROUND
[0002] In the field of software testing, the freshness of test data plays a crucial role in quality assurance. The quality of test data directly affects the accuracy and reliability of test results. If there are problems with test data, it is likely to miss critical scenarios in testing, which may lead to online problems and cause serious losses to application services.
[0003] Currently, test data lacks effective real-time updating mechanisms. In actual service scenarios, service data is constantly changing. For example, the storage model structure of a service provider may be adjusted at any time, or data may be modified due to the execution of other test cases. However, existing test data acquisition and usage methods often fail to timely perceive these changes. When testers obtain outdated test data or the service storage model structure has changed, the code logic and service rules verified based on these data will differ from the actual situation. Taking inventory testing of an e-commerce platform as an example, when testing the inventory management function of a product, the test data includes the initial inventory quantity of the product. During testing, multiple test cases may involve operations on the inventory of this product, such as purchase, return, etc. However, the existing test data management method cannot monitor the changes in inventory quantity in real time. When the inventory quantity is changed after the execution of a test case, subsequent test cases that rely on this inventory data may draw incorrect test results due to inaccurate data. For example, the prompt function when inventory is insufficient is supposed to be tested, but due to the failure to update the inventory data in a timely manner after the execution of a previous test case, the current test case mistakenly believes that the inventory is sufficient, thereby failing to trigger the expected prompt, causing the testing of this function point to be missed and increasing the risk of inventory management problems online.
[0004] In summary, the existing test data management technology cannot effectively cope with the dynamic changes of test data during use, making it difficult to ensure the freshness and accuracy of test data and thus affecting the quality of testing. SUMMARY
[0005] Therefore, the embodiments of the present application provide a test data preservation method and device based on a large model, a storage medium and a computer device to ensure the accuracy and effectiveness of test data and improve testing reliability and efficiency.
[0006] According to an aspect of the present application, a test data preservation method based on a large model is provided, which comprises:
[0007] intercepting a data operation on a database corresponding to a service system under test, determining a database operation original instruction based on the intercepted data operation, and executing the data operation to implement an operation on test data in the database;
[0008] converting the database operation original instruction into a data query instruction through a pre-trained instruction conversion large model, and executing the data query instruction to obtain an initial state of the test data in the database;
[0009] When the test data is used, the data query instruction is executed again to obtain a current state of the test data.
[0010] According to the initial state and the current state, the test data is subjected to data preservation processing.
[0011] Optionally, before intercepting a data operation on a database corresponding to a service system under test and determining a database operation original instruction based on the intercepted data operation, the method further comprises:
[0012] link analysis is performed on the service system under test to obtain link information of the service system under test;
[0013] Correspondingly, intercepting a data operation on a database corresponding to a service system under test and determining a database operation original instruction based on the intercepted data operation comprise:
[0014] According to the link information, a database to be analyzed corresponding to the service system under test is determined;
[0015] A data operation on the database to be analyzed corresponding to the service system under test is intercepted, and a database operation original instruction is determined based on the intercepted data operation.
[0016] Optionally, intercepting a data operation on a database to be analyzed corresponding to a service system under test and determining a database operation original instruction based on the intercepted data operation comprise:
[0017] The database to be analyzed corresponding to the service system under test is subjected to underlying code interception to intercept execution information of a SQL statement to be executed, the execution information comprising a SQL statement template and incoming parameters; and the database operation original instruction is generated based on the SQL statement template and the incoming parameters.
[0018] Optionally, the training method of the instruction conversion large model comprises:
[0019] According to the database operation original instruction sample and the corresponding data query instruction sample, a training sample is constructed, wherein the database operation original instruction sample includes data directory and feature information, and the data query instruction sample is used to query the feature information under the data directory;
[0020] A pre-trained SQL understanding large model is loaded, a low-rank matrix is added to the SQL understanding large model, and the SQL understanding large model is trained using the training sample to optimize the parameters of the low-rank matrix to realize model fine-tuning of the SQL understanding large model;
[0021] Based on the model fine-tuned SQL understanding large model, the instruction conversion large model is determined.
[0022] Optionally, the data preservation processing of the test data according to the initial state and the current state comprises:
[0023] According to the preset core field, an initial core field state corresponding to the initial state and a current core field state corresponding to the current state are extracted;
[0024] The consistency of the initial core field state and the current core field state is compared;
[0025] If the initial core field state and the current core field state are inconsistent, the data preservation processing is performed on the test data;
[0026] If the initial core field state and the current core field state are consistent, the test data remains unchanged.
[0027] Optionally, the data preservation processing of the test data comprises:
[0028] The test data is deleted, and test data reconstruction is performed on the database based on the initial state; or,
[0029] The test data is rolled back based on the initial state.
[0030] Optionally, the method further comprises:
[0031] When the test data is used, a linkage database corresponding to the test data is determined according to the link information;
[0032] According to the current state of the linkage test data corresponding to the test data in the linkage database and the initial state of the test data, the data preservation processing is performed on the test data.
[0033] According to another aspect of the present application, a test data preservation device based on a large model is provided, the device comprising:
[0034] An original instruction obtaining module is configured to intercept a data operation on a database corresponding to a service system under test, determine a database operation original instruction based on the intercepted data operation, and execute the data operation to implement an operation on test data in the database;
[0035] An instruction conversion module is configured to convert the database operation original instruction into a data query instruction by using a pre-trained instruction conversion large model;
[0036] An initial state obtaining module is configured to execute the data query instruction to obtain an initial state of the test data in the database;
[0037] A current state obtaining module is configured to execute the data query instruction again to obtain a current state of the test data when the test data is used;
[0038] A data preservation module is configured to perform data preservation processing on the test data according to the initial state and the current state.
[0039] Optionally, the apparatus further comprises:
[0040] A link analysis module is configured to perform link analysis on the service system under test to obtain link information of the service system under test;
[0041] Correspondingly, the original instruction obtaining module is further configured to:
[0042] determine, according to the link information, a database to be analyzed corresponding to the service system under test;
[0043] intercept a data operation on the database to be analyzed corresponding to the service system under test, and determine a database operation original instruction based on the intercepted data operation.
[0044] Optionally, the original instruction obtaining module is further configured to:
[0045] perform bottom-layer code interception on the database to be analyzed corresponding to the service system under test to intercept execution information of a SQL statement to be executed, the execution information including a SQL statement template and incoming parameters; and generate the database operation original instruction based on the SQL statement template and the incoming parameters.
[0046] Optionally, the instruction conversion module is further configured to train the instruction conversion large model by using the following method:
[0047] According to the database operation original instruction sample and the corresponding data query instruction sample, a training sample is constructed, wherein the database operation original instruction sample includes data directory and feature information, and the data query instruction sample is used to query the feature information under the data directory;
[0048] A pre-trained SQL understanding large model is loaded, a low-rank matrix is added to the SQL understanding large model, and the SQL understanding large model is trained using the training sample to optimize the parameters of the low-rank matrix to realize model fine-tuning of the SQL understanding large model;
[0049] Based on the SQL understanding large model after model fine-tuning, the instruction conversion large model is determined.
[0050] Optionally, the data preservation module is further configured to:
[0051] According to the preset core field, an initial core field state corresponding to the initial state and a current core field state corresponding to the current state are extracted;
[0052] The consistency of the initial core field state and the current core field state is compared;
[0053] If the initial core field state and the current core field state are inconsistent, the test data is subjected to data preservation processing;
[0054] If the initial core field state and the current core field state are consistent, the test data remains unchanged.
[0055] Optionally, the data preservation module is further configured to:
[0056] The test data is deleted, and test data reconstruction is performed in the database based on the initial state; or,
[0057] The test data is subjected to data rollback based on the initial state.
[0058] Optionally, the data preservation module is further configured to:
[0059] When the test data is used, a linkage database corresponding to the test data is determined according to the link information;
[0060] According to the current state of the linkage test data corresponding to the test data in the linkage database and the initial state of the test data, the test data is subjected to data preservation processing.
[0061] According to another aspect of the present application, a storage medium having a computer program stored thereon is provided, and the program is executed by a processor to implement the above-mentioned test data preservation method based on a large model.
[0062] According to another aspect of the present application, a computer device is provided, comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, wherein the processor implements the above-mentioned large model-based test data preservation method when executing the program.
[0063] By means of the above technical solution, the large model-based test data preservation method and device, storage medium, and computer device provided by the embodiments of the present application can first obtain original instructions according to data operations of a database of a service system to be tested, convert the original instructions into data query instructions by means of a pre-trained instruction conversion large model, and obtain an initial state of test data after execution; then obtain a current state of the test data by executing the query instructions again after the test data is used, and finally perform preservation processing on the test data according to the two states. The present application can accurately obtain the data state, efficiently convert the instructions by means of the large model, discover data changes in a timely manner and process them, ensure the accuracy and effectiveness of the test data, improve the reliability and efficiency of the test, and guarantee the test coverage and quality.
[0064] The above description is only a summary of the technical solutions of the present application. In order to more clearly understand the technical means of the present application, the embodiments of the present application can be implemented in accordance with the content of the description, and in order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application are described below.
[0065] The technical solutions of the present application can be applied to transactions and delivery services of instant e-commerce platforms, such as Taobao flash shopping, Taofxian, Eleme takeout, and retail, etc. BRIEF DESCRIPTION OF DRAWINGS
[0066] The drawings described herein are used to provide further understanding of the present application, and form a part of the present application. The schematic embodiments of the present application and their descriptions are used to explain the present application, and do not constitute an improper limitation on the present application. In the drawings:
[0067] Figure 1 A flowchart of a large model-based test data preservation method provided by an embodiment of the present application is shown;
[0068] Figure 2 A flowchart of another large model-based test data preservation method provided by an embodiment of the present application is shown;
[0069] Figure 3 A flowchart of still another large model-based test data preservation method provided by an embodiment of the present application is shown;
[0070] Figure 4 A flowchart of yet another large model-based test data preservation method provided by an embodiment of the present application is shown;
[0071] Figure 5 A structural schematic diagram of a test data preservation device based on a large model is shown. DETAILED DESCRIPTION
[0072] The present application will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0073] In the present embodiment, a test data preservation method based on a large model is provided, as shown in the method comprises: Figure 1
[0074] Step 101, intercepting data operations on the database corresponding to the tested service system, determining the database operation original instruction based on the intercepted data operations, and executing the data operations to realize the operation of the test data in the database.
[0075] In the present embodiment, in the software testing process, the tested service system will perform various data operations on the corresponding database, such as insertion, update, etc. For example, a new customer user will have a new customer large red packet on the transaction link, and after purchasing a transaction once, it will not be issued. If the current user expects to verify the new customer logic, after the user data is created, it may be accidentally consumed and used by other testers or service operations. At this time, when the creator uses the data again, it cannot walk to the new customer logic path, resulting in that the test cannot accurately cover the new customer scene and miss potential problems. For these data operations on the database, the original database operation instruction (database operation original instruction) is first obtained, and then the data operation is executed to realize the insertion, update, etc. of the test data in the database. These original instructions record the specific content of the system operation on the database, providing an original basis for accurately understanding the changes of the test data under system operation.
[0076] In the present embodiment, optionally, before intercepting the data operation on the database corresponding to the tested service system and determining the database operation original instruction based on the intercepted data operation, the method further comprises: performing link analysis on the tested service system to obtain link information of the tested service system; accordingly, intercepting the data operation on the database corresponding to the tested service system and determining the database operation original instruction based on the intercepted data operation comprises: determining the database to be analyzed corresponding to the tested service system according to the link information; intercepting the data operation on the database to be analyzed corresponding to the tested service system and determining the database operation original instruction based on the intercepted data operation.
[0077] In this embodiment, link analysis is performed on the tested service system before data operations on the database corresponding to the tested service system are performed. The link analysis aims to sort out the interaction relationship and data flow between various components and modules in the tested service system, and through such analysis, link information of the tested service system can be obtained. The link information records in detail how different parts of the system are connected and cooperated, and provides a key basis for subsequent determination of related databases. In specific application scenarios, there are various ways of service link calling, and the calling link also has long and short differences. The embodiments of the present application can deploy corresponding distributed link calling analysis tools, such as skywalking, zipkin and the like, on the tested service system to perform link monitoring. After the service is operated, corresponding link information (such as application name, server IP address and the like) can be obtained through a corresponding API interface. When the original instruction of the database operation is obtained, the link information obtained in the foregoing is used to determine the database to be analyzed corresponding to the tested service system. The link information clearly shows which databases are closely related to the service logic of the tested service system, and which databases have data operations that will affect the test result. For example, Figure 2As shown, it is determined through link analysis that a piece of link information is to synchronously call application B and application N and asynchronously call application C when application A is called. Then it can be determined that the databases that need to be analyzed when application A is called are application A, B, N and C. In this way, the databases that need to be focused on and analyzed can be located, unnecessary operations and analysis on irrelevant databases are avoided, and work efficiency and accuracy are improved. After the databases to be analyzed are determined, the data operations of the databases corresponding to the tested service system can be monitored and analyzed, so as to obtain database operation original instructions. These original instructions are real records of system and database interaction, and contain various operation details of the system on the database, such as specific instruction contents of data insertion, data update and other operations, which lay a foundation for subsequent data query and state management based on these instructions. In the embodiment of the present application, link analysis is helpful to comprehensively understand the architecture and running mechanism of the tested service system, so as to only focus on the databases directly related to the test target when determining the databases to be analyzed, avoid operations and analysis on irrelevant databases, improve the efficiency of data processing, and reduce unnecessary resource consumption. After the databases to be analyzed are accurately determined through link information, the obtained database operation original instructions are more targeted and effective. These original instructions can accurately reflect the actual operation of the system on the database in the key service process, and provide high-quality input data for subsequent instruction conversion and data query based on large models. In this way, the initial state and the current state of the test data obtained in the subsequent steps will be more accurate and reliable, and then the data preservation processing can more accurately guarantee the quality of the test data, avoid test omissions and errors caused by inaccurate or irrelevant data, and thus improve the accuracy and reliability of the entire test process.
[0078] In the embodiment of the present application, optionally, the data operation on the database to be analyzed corresponding to the tested service system is intercepted, and the database operation original instruction is determined based on the intercepted data operation, including: performing bottom layer code interception on the database to be analyzed corresponding to the tested service system to intercept execution information of a to-be-executed SQL statement, the execution information including a SQL statement template and incoming parameters; and generating the database operation original instruction based on the SQL statement template and the incoming parameters.
[0079] In this embodiment, the process of system and database interaction is monitored through bottom code interception in the corresponding to-be-analyzed database scenario of the tested service system. In the actual execution flow of database operation, SQL statements are the key carriers of system and database communication, and bottom code interception can accurately locate to these to-be-executed SQL statements. This interception is carried out at the bottom of the system and does not have a significant impact on the normal running logic of the system, and can obtain relevant information of database operation without affecting the service flow. In a specific application scenario, part of the data needs to be persisted during the running process of the internal flow of the tested service system, and the corresponding running executeSQL needs to be intercepted through javaagent, which is a precondition for the next stage of SQL analysis and conversion. As shown in Figure 3 , the database operation original instructions of the database application A DB, the database application B DB and the database application C DB corresponding to the applications A, B and C in the tested system are intercepted through javaagent. The persistence layer framework runs in multiple ways such as xml configuration, dynamic SQL, annotation annotation, etc. If starting from the application code level, the processing logic will be relatively complex, and with the change of the mode, the logic needs to be updated and iterated continuously, which is not very convenient, so the framework bottom code can be intercepted to intercept the method of generating to-be-executed SQL and obtain information. The SQL statement records in detail the operation to be performed by the system on the database, such as specific operations such as insertion (INSERT), update (UPDATE), and information such as data tables, fields and conditions involved in the operation. These original instructions are the basis for subsequent analysis of data operation, and provide raw data for subsequent instruction conversion and query using a large model. For example, in a specific application scenario, SQL is dynamically generated by calling the MappedStatement.getBoundSql(parameter) method in the execution flow. This method will parse and generate the final SQL string (containing placeholders) that can be used for database execution according to the original SQL template (from XML, annotation or dynamic SQL builder) combined with the input parameters. This SQL is encapsulated in BoundSql.getSql(). Intercepting the return result of the MappedStatement.getBoundSql method using JavaAgent is the most accurate and unified way to obtain the runtime SQL, and is suitable for all MyBatis configuration forms (XML, annotation, dynamic SQL), without the need to care about the differences in upper-layer writing. The embodiment of the present application obtains the SQL actually executed by the framework by losslessly intercepting the Class method and variable in the jvm memory through javaagent, avoids the distortion of information caused by data conversion or processing in the middle link, and ensures that the obtained database operation original instruction can truly reflect the actual operation intention of the system to the database.
[0080] Step 102, convert the database operation original instruction into a data query instruction by a pre-trained instruction conversion large model, and execute the data query instruction to obtain the initial state of the test data in the database.
[0081] In the embodiments of the present application, the operation original instruction for the database is converted into a data query instruction by using a pre-trained instruction conversion large model, so that the initial state of the test data after the operation original instruction creates, updates, etc. The test data in the database can be queried by executing the data query instruction. The instruction conversion large model is trained by a large amount of data and has the ability to accurately convert the original operation instruction into a suitable data query instruction. The converted data query instruction can point to the test data to be queried, and the initial state of the test data before being used can be obtained after executing the instruction, which provides an accurate benchmark for subsequent comparison of data changes.
[0082] In the embodiments of the present application, optionally, the training method of the instruction conversion large model comprises: constructing a training sample according to a database operation original instruction sample and a corresponding data query instruction sample, wherein the database operation original instruction sample comprises data directory and feature information, and the data query instruction sample is used to query the feature information under the data directory; loading a pre-trained SQL understanding large model, adding a low-rank matrix to the SQL understanding large model, training the SQL understanding large model using the training sample to optimize the parameters of the low-rank matrix and realize model fine-tuning of the SQL understanding large model; and determining the instruction conversion large model based on the SQL understanding large model after model fine-tuning.
[0083] In the above embodiment, first, the database operation original instruction sample and the corresponding data query instruction sample are collected to build a training sample set. The database operation original instruction sample covers data directory and feature information. The data directory specifies the storage location of the data in the database, and the feature information describes the specific attributes and characteristics of the data. The data query instruction sample is specifically used to query the feature information under the data directory, which defines how to extract the required data from the database. Through the construction of this corresponding relationship, a clear learning goal is provided for the subsequent model training. During the training process, a pre-trained SQL understanding large model is loaded. The model has been pre-trained on a large amount of SQL related data and has certain SQL statement understanding and processing ability. On this basis, in order to make the model better adapt to the instruction conversion task, a low-rank matrix is added to the SQL understanding large model. The introduction of the low-rank matrix can enhance the expression ability of the model without significantly increasing the number of model parameters. Then, the SQL understanding large model is trained using the constructed training sample. During the training process, the parameters of the low-rank matrix are continuously optimized to fine-tune the SQL understanding large model, so that it can more accurately convert the database operation original instruction into the data query instruction. After the above model fine-tuning process, an optimized and adjusted SQL understanding large model is obtained. Based on this model fine-tuned model, it is determined as the instruction conversion large model. The model has the ability to convert the database operation original instruction into the data query instruction. Thus, the reasoning speed can be guaranteed not to be affected; the content can also persist, without the need to load external knowledge base in the form of RAG.
[0084] Step 103, when the test data is used, the data query instruction is executed again to obtain the current state of the test data.
[0085] In the embodiment of the application, after the test data is used by other test cases or service operations, its state may have changed. At this time, the data query instruction converted before is executed again to obtain the current state of the test data after use. By comparing with the initial state, it can be known which changes the test data has experienced in the test process, so as to judge whether the data still meets the test requirements.
[0086] Step 104, according to the initial state and the current state, data preservation processing is performed on the test data.
[0087] In the embodiments of the present application, data preservation refers to a process of monitoring, recording and managing the state changes of test data through technical means during software testing, ensuring that the test data can be accurately restored or updated before and after use, so as to maintain its consistency, accuracy and reusability. The core goal is to prevent test data from being contaminated or invalidated due to single testing, thereby ensuring the reliability and effectiveness of subsequent testing, especially in multiple rounds, concurrent or automated testing scenarios, so that the test data can be "continuously available, state controllable and result reliable", just like keeping food fresh, hence the name "preservation". After obtaining the initial state and the current state of the test data, the test data can be processed for data preservation according to the difference between the two. If it is found that the data state has changed unexpectedly, such as data being modified or expired, appropriate measures can be taken, such as restoring the data to the initial state, updating the data to a new state that meets the test requirements, etc., to ensure that the test data remains fresh and accurate and can truly reflect the data state required by the test scenario.
[0088] In the embodiments of the present application, optionally, the data preservation processing of the test data according to the initial state and the current state comprises: extracting an initial core field state corresponding to the initial state and a current core field state corresponding to the current state according to a preset core field; comparing the consistency of the initial core field state and the current core field state; if the initial core field state and the current core field state are inconsistent, performing data preservation processing on the test data; if the initial core field state and the current core field state are consistent, keeping the test data unchanged.
[0089] In this embodiment, after obtaining the initial state and the current state of the test data, the corresponding initial core field state and the current core field state are extracted from the initial state and the current state respectively according to the preset core field. The preset core field plays a key role in the accuracy and effectiveness of the test data, and is usually closely related to the core service logic of the test scenario. By extracting the states of these core fields, the focus can be on the key parts of the data changes, avoiding indiscriminate comparison of all fields and improving processing efficiency. For example, the preset core field includes whether the user is a new customer. The extracted initial core field state and the current core field state are compared to determine whether they are consistent, aiming to detect whether the core part of the test data has changed unexpectedly during use. This avoids unnecessary calculation and resource consumption, enabling the data preservation process to be carried out more quickly. If they are consistent, it means that the core data has not been modified or damaged accidentally; if they are not consistent, it means that the core data may have a problem and needs to be further processed. If the initial core field state and the current core field state are inconsistent, it means that the test data has changed in a way that does not meet the test requirements, and the data preservation process is performed on the test data. The data preservation process can include various operations, such as restoring the data to the initial state, updating the data to a new state that meets the test requirements according to the service rules, etc., to ensure that the test data can continue to meet the requirements of the test scenario. If they are consistent, it means that the test data state is normal and no additional processing is required, so the test data remains unchanged.
[0090] In the embodiments of the present application, the data preservation process of the test data includes deleting the test data and reconstructing the test data in the database based on the initial state, or rolling back the test data based on the initial state.
[0091] In this embodiment, when it is determined that the test data needs to be preserved, all the test data in the current database that has problems can be deleted so as to completely eliminate the existing data that can be damaged or not in accordance with the test requirements, and to prepare for subsequent reconstruction of clean and accurate test data. After the test data is deleted, the test data is reconstructed in the database according to the pre-recorded initial state information of the test data. The initial state information contains the complete state of the test data before being used or modified, including the values of various fields, the association relationship between the data, and the like. By reconstructing according to the initial state, it can be ensured that the reconstructed test data is completely consistent with the state at the beginning of the test, so as to restore the accuracy and effectiveness of the test data. In addition, data rollback is an operation of restoring the test data to a certain specific state before by using the transaction management feature of the database. In this application, the rollback is based on the initial state of the test data. The database usually records the change history of the data, and through the rollback operation, the system can gradually roll back the test data from the current state to the initial state according to these historical records.
[0092] In the embodiments of the present application, optionally, the method further includes: when the test data is used, determining a linkage database corresponding to the test data according to the link information; and performing data preservation processing on the test data according to the current state of the linkage test data corresponding to the test data in the linkage database and the initial state of the test data.
[0093] In this embodiment, after the test data is used, the linkage database corresponding to the test data is determined according to the link information obtained by link analysis before. The link information records in detail the interaction relationship and data flow direction between each component, module and database in the service system under test. By analyzing these information, other databases that have service association with the current test data, i.e. linkage databases, can be accurately found out. For example, in an e-commerce system, the order data in the order database may have linkage relationship with the inventory data in the inventory database, when the order data is used, the inventory data may change accordingly, at this time the inventory database is the linkage database of the order data. From the determined linkage database, the current state of the linkage test data corresponding to the test data is obtained. The linkage test data is the data that is logically associated with the test data in service, and its current state reflects the change of the relevant data in the linkage database in the process of using the test data. For example, when the order data is used (such as generating a new order), the inventory quantity of the corresponding commodity in the inventory database may be reduced, and this reduced inventory quantity is the current state of the linkage test data. Further, the current state of the linkage test data is compared with the initial state of the test data. If it is found that the current state of the linkage test data does not match the initial state of the test data, i.e. the data change in the linkage database does not meet the expectation, the data preservation processing is performed on the test data. The way of data preservation processing can be to delete the test data and reconstruct the test data in the database based on the initial state, or to roll back the test data based on the initial state, so as to ensure the consistency and effectiveness of the test data in the whole test environment. Through determining the linkage database and considering the current state of the linkage test data, the data preservation processing is performed on the test data, which can ensure the consistency of the test data in the whole service system. In a complex service scenario, the data between different databases is often associated and influenced each other. If only the test data itself is concerned and the data change in the linkage database is ignored, the test data may be out of line with the actual service logic, thereby affecting the accuracy of the test result.
[0094] By applying the technical solution of the embodiment, the original instruction is obtained according to the data operation of the database of the service system under test, the original instruction is converted into a data query instruction by means of the pre-trained instruction conversion large model, the initial state of the test data is obtained after execution, the current state is obtained by executing the query instruction again after the test data is used, and finally the test data is preserved according to the states of the two. The embodiment can accurately obtain the data state, efficiently convert the instruction by using the large model, timely find the data change and process it, ensure the accuracy and effectiveness of the test data, improve the test reliability and efficiency, and guarantee the test coverage and quality.
[0095] In a specific application scenario, for example, Figure 4As shown, the user first initiates the process, using the Data Factory to generate test data. The Data Factory produces various types of test data based on preset rules and service requirements. Subsequently, through a standardized API call mechanism, the generated test data is transmitted to the application system (the service system under test), ensuring the accuracy and standardization of data transmission.
[0096] After data enters the application system, to analyze the data flow and processing logic within the system, the data is transmitted to the link analysis module through the application link acquisition function. The link analysis module parses the details of data operations, and then the Java agent obtains the original SQL based on the link analysis results. Subsequently, the original SQL is input into the SQLCoder large model (instruction conversion large model), which, with its powerful intelligent processing capabilities, transforms the SQL into corresponding data query instructions.
[0097] The converted data query command is used to query the application system DB (database). The application system DB serves as the core of the application system's data storage, storing actual service data. During the query process, the system records a data snapshot (including the initial state) and sends the snapshot information back to the data factory, providing a basis for subsequent data comparison.
[0098] In the data consistency comparison stage (this is performed before each use of test data; if consistent, the data is used; if inconsistent, it is reconstructed to preserve its freshness; alternatively, it can be performed after each use of test data, ensuring fresh test data for subsequent use and improving testing efficiency), users can obtain data from the Data Factory. The Data Factory retrieves the latest test data information from its own Data Factory DB by querying test data snapshot information, while the application system provides data from its application system DB. The Data Factory DB, as the data storage unit of the Data Factory, stores the generated test data and related information. The snapshot information is compared with the latest version information (current state). If the data is inconsistent, the system performs data clearing and reconstruction to ensure data accuracy and reliability; if the data is consistent, it is returned to the user, providing accurate data support for subsequent testing or service operations. The entire solution, through the collaborative operation of various technical modules, achieves full-process management of test data and effective assurance of data consistency.
[0099] Furthermore, as Figure 1 In terms of specific implementation, this application provides a test data preservation device based on a large model, such as... Figure 5 As shown, the device includes:
[0100] An original instruction obtaining module is configured to intercept a data operation on a database corresponding to a service system under test, determine a database operation original instruction based on the intercepted data operation, and execute the data operation to implement an operation on test data in the database;
[0101] An instruction conversion module is configured to convert the database operation original instruction into a data query instruction by using a pre-trained instruction conversion large model;
[0102] An initial state obtaining module is configured to execute the data query instruction to obtain an initial state of the test data in the database;
[0103] A current state obtaining module is configured to execute the data query instruction again to obtain a current state of the test data when the test data is used;
[0104] A data preservation module is configured to perform data preservation processing on the test data according to the initial state and the current state.
[0105] Optionally, the apparatus further comprises:
[0106] A link analysis module is configured to perform link analysis on the service system under test to obtain link information of the service system under test;
[0107] Correspondingly, the original instruction obtaining module is further configured to:
[0108] determine, according to the link information, a database to be analyzed corresponding to the service system under test;
[0109] intercept a data operation on the database to be analyzed corresponding to the service system under test, and determine a database operation original instruction based on the intercepted data operation.
[0110] Optionally, the original instruction obtaining module is further configured to:
[0111] perform bottom-layer code interception on the database to be analyzed corresponding to the service system under test to intercept execution information of a SQL statement to be executed, the execution information including a SQL statement template and incoming parameters; and generate the database operation original instruction based on the SQL statement template and the incoming parameters.
[0112] Optionally, the instruction conversion module is further configured to train the instruction conversion large model by using the following method:
[0113] construct a training sample according to a database operation original instruction sample and a corresponding data query instruction sample, wherein the database operation original instruction sample includes a data directory and feature information, and the data query instruction sample is used to query the feature information in the data directory;
[0114] loading a pre-trained SQL understanding large model, adding a low-rank matrix to the SQL understanding large model, training the SQL understanding large model using the training sample to optimize parameters of the low-rank matrix to realize model fine-tuning of the SQL understanding large model;
[0115] determining the instruction conversion large model based on the SQL understanding large model after model fine-tuning.
[0116] Optionally, the data preservation module is further configured to:
[0117] extract an initial core field state corresponding to the initial state and a current core field state corresponding to the current state according to the preset core field;
[0118] compare consistency of the initial core field state and the current core field state;
[0119] if the initial core field state and the current core field state are inconsistent, perform data preservation processing on the test data;
[0120] if the initial core field state and the current core field state are consistent, keep the test data unchanged.
[0121] Optionally, the data preservation module is further configured to:
[0122] delete the test data and perform test data reconstruction in the database based on the initial state; or,
[0123] perform data rollback on the test data based on the initial state.
[0124] Optionally, the data preservation module is further configured to:
[0125] when the test data is used, determine a linkage database corresponding to the test data according to the link information;
[0126] perform data preservation processing on the test data according to a current state of linkage test data corresponding to the test data in the linkage database and the initial state of the test data.
[0127] It should be noted that other corresponding descriptions of each functional unit involved in the test data preservation device based on a large model provided by the embodiments of the present application can be referred to the corresponding descriptions in the method, which will not be repeated here. Figures 1 to 4
[0128] The embodiments of the present application also provide a computer device, which can be a personal computer, a server, a network device, etc. The computer device comprises a bus, a processor, a memory and a communication interface, and can further comprise an input / output interface and a display device. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises 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 running the operating system and the computer program in the non-volatile storage medium. The database of the computer device is configured to store location information. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement the steps in the method embodiments.
[0129] Those skilled in the art can understand that the structure of the computer device described above is only part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can comprise more or fewer components, or combine certain components, or have a different component arrangement.
[0130] In one embodiment, a computer readable storage medium is provided, which can be non-volatile or volatile, and has a computer program stored thereon. The computer program is executed by the processor to implement the steps in the method embodiments described above.
[0131] In one embodiment, a computer program product is provided, which comprises a computer program. The computer program is executed by the processor to implement the steps in the method embodiments described above.
[0132] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties.
[0133] Those skilled 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. The computer program can be stored in a non-volatile computer readable storage medium, and when the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical storage, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The database involved in the embodiments provided in the present application can include at least one of a relational database and a non-relational database. The non-relational database can include a distributed database based on a block chain, etc., without being limited thereto. The processor involved in the embodiments provided in the present application can be a general-purpose processor, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., without being limited thereto.
[0134] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.
[0135] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent of the present application. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are within the scope of protection of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A method for preserving test data based on a large model, characterized in that, The method includes: Intercept data operations on the database corresponding to the service system under test, determine the original database operation instructions based on the intercepted data operations, and then execute the data operations to perform operations on the test data in the database. The pre-trained instruction transformation model converts the original database operation instructions into data query instructions, and executes the data query instructions to obtain the initial state of the test data in the database. After the test data is used, the data query instruction is executed again to obtain the current status of the test data; Based on the initial state and the current state, the test data is subjected to data preservation processing; The training methods for the large instruction conversion model include: Training samples are constructed based on the original database operation instruction samples and the corresponding data query instruction samples. The original database operation instruction samples include a data directory and feature information, and the data query instruction samples are used to query the feature information under the data directory. Load a pre-trained SQL understanding model, add a low-rank matrix to the SQL understanding model, and train the SQL understanding model using the training samples to optimize the parameters of the low-rank matrix to achieve model fine-tuning of the SQL understanding model. Based on the SQL understanding of the model after fine-tuning, the large model is determined, and the instruction conversion large model is determined.
2. The method according to claim 1, characterized in that, Before intercepting data operations on the database corresponding to the service system under test, and determining the original database operation instructions based on the intercepted data operations, the method further includes: Perform link analysis on the service system under test to obtain the link information of the service system under test; Accordingly, data operations on the database corresponding to the service system under test are intercepted, and the original database operation instructions are determined based on the intercepted data operations, including: Based on the link information, determine the database to be analyzed corresponding to the service system under test; Intercept data operations on the database to be analyzed corresponding to the service system under test, and determine the original database operation instructions based on the intercepted data operations.
3. The method according to claim 2, characterized in that, Intercepting data operations on the database to be analyzed corresponding to the service system under test, and determining the original database operation instructions based on the intercepted data operations, including: The underlying code of the database to be analyzed corresponding to the service system under test is intercepted to intercept the execution information of the SQL statement to be executed, the execution information including the SQL statement template and input parameters; The original database operation instructions are generated based on the SQL statement template and the input parameters.
4. The method according to any one of claims 1 to 3, characterized in that, The step of performing data preservation processing on the test data based on the initial state and the current state includes: Based on preset core fields, extract the initial core field state corresponding to the initial state and the current core field state corresponding to the current state; Compare the consistency between the initial core field state and the current core field state; If the initial core field state and the current core field state are inconsistent, then the test data will be preserved. If the initial core field state is consistent with the current core field state, then the test data remains unchanged.
5. The method according to claim 4, characterized in that, The data preservation process for the test data includes: Delete the test data and reconstruct the test data in the database based on the initial state; or, The test data is rolled back based on the initial state.
6. The method according to claim 2, characterized in that, The method further includes: Once the test data is used, the corresponding linked database is determined based on the link information. Based on the current state of the linked test data corresponding to the test data in the linked database and the initial state of the test data, the test data is subjected to data preservation processing.
7. A test data preservation device based on a large model, characterized in that, The device includes: The original instruction acquisition module is used to intercept data operations on the database corresponding to the service system under test. After determining the original instruction for database operation based on the intercepted data operations, the module executes the data operation to realize the operation on the test data in the database. The instruction conversion module is used to convert the original database operation instructions into data query instructions through a pre-trained instruction conversion model. An initial state acquisition module is used to execute the data query instruction to acquire the initial state of the test data in the database; The current status acquisition module is used to execute the data query instruction again after the test data has been used in order to obtain the current status of the test data. A data preservation module is used to perform data preservation processing on the test data based on the initial state and the current state; The instruction conversion module is also used to train the instruction conversion large model using the following methods: Training samples are constructed based on the original database operation instruction samples and the corresponding data query instruction samples. The original database operation instruction samples include a data directory and feature information, and the data query instruction samples are used to query the feature information under the data directory. Load a pre-trained SQL understanding model, add a low-rank matrix to the SQL understanding model, and train the SQL understanding model using the training samples to optimize the parameters of the low-rank matrix to achieve model fine-tuning of the SQL understanding model. Based on the SQL understanding of the model after fine-tuning, the large model is determined, and the instruction conversion large model is determined.
8. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 6.
9. An apparatus comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 6.
Citation Information
Patent Citations
Voice security interaction method, terminal device and storage medium
CN120164463A
Multi-language intelligent query method, device, equipment, medium and program
CN120316242A