CN117112305A - Test data recovery method, device, equipment, medium and product - Google Patents

Test data recovery method, device, equipment, medium and product Download PDF

Info

Publication number
CN117112305A
CN117112305A CN202311132316.1A CN202311132316A CN117112305A CN 117112305 A CN117112305 A CN 117112305A CN 202311132316 A CN202311132316 A CN 202311132316A CN 117112305 A CN117112305 A CN 117112305A
Authority
CN
China
Prior art keywords
test
target
data
test data
operation action
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311132316.1A
Other languages
Chinese (zh)
Inventor
李加胜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC, ICBC Technology Co Ltd filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202311132316.1A priority Critical patent/CN117112305A/en
Publication of CN117112305A publication Critical patent/CN117112305A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1469Backup restoration techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a test data recovery method, a test data recovery device, a test data recovery computer device, a test data recovery storage medium and a test data recovery computer program product, and relates to the technical field of big data. The method comprises the following steps: acquiring identification information of a target test user, and acquiring corresponding log data from a log server according to the identification information; determining a target test step interval according to the sequence of all the test steps; aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from log data; determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement. The method provided by the application can effectively improve the test efficiency.

Description

Test data recovery method, device, equipment, medium and product
Technical Field
The present application relates to the field of big data technology, and in particular, to a test data recovery method, apparatus, computer device, storage medium, and computer program product.
Background
In the process of testing banking businesses by testers, initial business data corresponding to the tested businesses are required to be obtained from a database, the initial business data are modified according to the actual conditions of the tested businesses, and finally the modified business data are utilized to test the tested businesses, so that the testers often test the same tested businesses for a plurality of times in order to ensure the accuracy of test results.
In the existing service test method, when the same tested service is tested each time, corresponding initial service data is required to be obtained from a database, and the test is carried out after the initial service data is modified. The test method needs to carry out data screening and modifying processes every time of test, and is time-consuming and labor-consuming, so that the test efficiency is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a test data recovery method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve test efficiency.
In a first aspect, the present application provides a test data recovery method, the method comprising:
acquiring identification information of a target test user, and acquiring corresponding log data from a log server according to the identification information;
Determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process;
aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from the log data;
determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement.
In one embodiment, the restoring the target test data corresponding to the target test step based on the test reverse order, the operation action and the SQL statement includes:
restoring first test data corresponding to the last test step based on a first operation action included in the last test step and a first SQL statement corresponding to the first operation action;
And aiming at the rest test steps except the last test step in the target test step interval, sequentially recovering the corresponding test data of each rest test step according to the test reverse sequence based on the first test data, the operation action and the corresponding SQL statement included in each rest test step until the target test data is recovered.
In one embodiment, the operation actions include adding test data, deleting test data, and modifying test data.
In one embodiment, the first target operational action includes at least one of deleting test data or modifying test data; the restoring the first test data corresponding to the last test step based on the first operation action included in the last test step and the first SQL statement corresponding to the first operation action includes:
if the first operation action is to delete the test data or modify the test data, respectively acquiring the first test data queried by a last test data query request before the first operation action and the second test data obtained after the first operation action from a data backup component based on the first SQL statement;
And restoring the test data corresponding to the last test step to the first test data by comparing the first test data with the second test data.
In one embodiment, before the obtaining the identification information of the target test user, the method further includes:
acquiring a test data recovery request, and acquiring first identification information of a request user initiating the test data recovery request;
acquiring second identification information of a target test user corresponding to the target test process;
and if the first identification information is consistent with the second identification information, judging whether the tested part meets the preset recovery condition, and if so, executing the step of acquiring the identification information of the target test user.
In one embodiment, the preset recovery condition includes that the tested component corresponding to the target test process operates normally, and the tested component corresponding to the test data recovery request and the tested component corresponding to the target test process are the same tested component.
In a second aspect, the present application also provides a test data recovery apparatus, the apparatus comprising:
the first acquisition module is used for acquiring the identification information of the target test user and acquiring corresponding log data from the log server according to the identification information;
The determining module is used for determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process;
the second acquisition module is used for acquiring the operation action included in each test step aiming at each test step in the target test step interval, and acquiring the SQL statement corresponding to each operation action from the log data;
the data recovery module is used for determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the steps of the method of any of the embodiments described above when the computer program is executed by the processor.
In a fourth aspect, the present application also provides a computer-readable storage medium. A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of any of the embodiments described above.
In a fifth aspect, the present application also provides a computer program product. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any of the embodiments described above.
The test data recovery method, the device, the computer equipment, the storage medium and the computer program product acquire the identification information of the target test user, and acquire corresponding log data from the log server according to the identification information; determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process; aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from log data; determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement. According to the method provided by the application, based on the operation actions included in each test step and the SQL sentences corresponding to each operation action, all test data used in all test steps in the test process can be recovered, and only the target test data corresponding to the target test step can be recovered according to the requirement of the next test process, so that the recovered data can be directly used for testing in the next same test process, and the test efficiency can be effectively improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related art, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for those skilled in the art.
FIG. 1 is a flow chart of a test data recovery method according to an embodiment;
FIG. 2 is a flow diagram of a method of log data acquisition in one embodiment;
FIG. 3 is a flow diagram of a SQL statement retrieval method in one embodiment;
FIG. 4 is a flow chart of a target test data recovery method according to an embodiment;
FIG. 5 is a schematic diagram of a test data recovery process corresponding to different operation actions in one embodiment;
FIG. 6 is a flow chart of a test data recovery method in another embodiment;
FIG. 7 is a block flow diagram of a preprocessing process in another embodiment;
FIG. 8 is a block diagram of a test data recovery apparatus in one embodiment;
fig. 9 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In one embodiment, as shown in fig. 1, a test data recovery method is provided, where the method is applied to a terminal to illustrate the method, it is understood that the method may also be applied to a server, and may also be applied to a system including the terminal and the server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
s102, acquiring identification information of a target test user, and acquiring corresponding log data from a log server according to the identification information.
The identification information can comprise the identification information of the target test user and the information of a testing machine used when the target test user tests, and the terminal can capture the identification information of the target test user through the interface; the log server is used for storing log data of all test users when testing, the process of obtaining the log data corresponding to the target test users from the log server by the terminal according to the identification information is shown in fig. 2, the left side is the log data of all test users stored by the log server, the right side is the log data of the target test users, and the terminal screens out the log data of the target test users from the log server through the machine user information interface.
S104, determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process.
The test process comprises a plurality of test steps, and in some test scenes, only one target test step in the plurality of test steps is required to be reproduced, so that the test requirement can be met only by recovering the test data of the target test step. However, the target test step is not isolated in the whole test process, and the test data of the target test step will affect the test data of all the following test steps, so in order to recover the test data of the target test step, the test data needs to be recovered sequentially from the last test step until the test data of the target test step is recovered. Therefore, before restoring the test data corresponding to the target test step, the target test step interval in this embodiment needs to be determined.
S106, aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from log data.
The operation action is a corresponding process of the target test user on the test data, for example, the operation action may include adding test data, modifying test data, deleting test data and querying test data; the SQL statement is used for recording related data of the corresponding operation action, for example, the data recorded by the SQL statement can comprise an action ID of the operation action, a step ID of a corresponding test step of the operation action and a time point when the operation action is executed.
Specifically, as shown in fig. 3, the terminal may identify and parse the log data according to the keyword corresponding to each operation action, so as to extract the SQL statement corresponding to each operation action from the log data.
S108, determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering target test data corresponding to the target test steps based on the test reverse sequence, the operation action and the SQL sentence.
The terminal sequentially restores the corresponding test data of all the test steps in the target test step interval from the last test step according to the test reverse sequence; for the test data processed by different operation actions, different data recovery methods can be adopted for recovery.
In the test data recovery method, the identification information of the target test user is acquired, and corresponding log data is acquired from the log server according to the identification information; determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process; aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from log data; determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement. According to the method provided by the application, based on the operation actions included in each test step and the SQL sentences corresponding to each operation action, all test data used in all test steps in the test process can be recovered, and only the target test data corresponding to the target test step can be recovered according to the requirement of the next test process, so that the recovered data can be directly used for testing in the next same test process, and the test efficiency can be effectively improved.
In some embodiments, as shown in fig. 4, based on the test reverse order, the operation action and the SQL statement, the recovery of the target test data corresponding to the target test step includes:
s402, restoring first test data corresponding to the last test step based on the first operation action included in the last test step and the first SQL statement corresponding to the first operation action.
S404, aiming at the rest test steps except the last test step in the target test step interval, sequentially recovering the corresponding test data of each rest test step according to the test reverse order based on the first test data, the operation action and the corresponding SQL statement included in each rest test step until the target test data is recovered.
After the corresponding test data of all the test steps in the target test step interval are restored, only one of the test steps can be reproduced, and all the test steps in the target test step interval can be reproduced, so that the method is flexible.
In this embodiment, according to the reverse test sequence corresponding to the target test step interval, the test data corresponding to all the test steps in the target test step interval are sequentially recovered, and finally the target test data is recovered, so that the recovered target test data is more accurate.
In some embodiments, the operational actions include adding test data, deleting test data, and modifying test data.
All the test data processed by the operation actions are stored in the application database in real time, and all the data in the test process are stored in the data backup assembly.
If the operation action is newly added test data, the newly added test data can be obtained from the data backup component based on the SQL statement corresponding to the operation action, and the newly added test data is deleted from the test data subjected to the newly added test data operation action in the application database, so that the purpose of recovering the test data is achieved.
The operation actions may also include querying the test data, but since the data querying operation does not substantially process the test data stored in the application database, there is no need to recover the test data after the querying test data operation.
In this embodiment, the operation actions include multiple types, so that the recovery of the test data can be performed more specifically for different types of operation actions.
In some embodiments, the first target operational action includes at least one of deleting test data or modifying test data; based on the first operation action included in the last test step and the first SQL statement corresponding to the first operation action, recovering the first test data corresponding to the last test step, including: if the first operation action is to delete the test data or modify the test data, respectively acquiring the first test data queried by the last test data query request before the first operation action and the second test data obtained after the first operation action from the data backup component based on the first SQL statement; and restoring the test data corresponding to the last test step to the first test data by comparing the first test data with the second test data.
The test data recovery process corresponding to the different operation actions is shown in fig. 5. Because the operation of inquiring the test data is needed before deleting the test data and modifying the test data, the corresponding test data in the application database can be recovered according to the difference between the first test data obtained by inquiring the test data and the second test data obtained after corresponding operation actions.
In this embodiment, the test data processed by different operation actions is recovered by using different data recovery methods, so that the recovered test data is more accurate.
In some embodiments, before obtaining the identification information of the target test user, the method further includes: acquiring a test data recovery request, and acquiring first identification information of a request user initiating the test data recovery request; acquiring second identification information of a target test user corresponding to the target test process; if the first identification information is consistent with the second identification information, judging whether the tested part meets the preset recovery condition, and if so, executing the step of acquiring the identification information of the target test user.
Whether the request user and the target test user are the same user or not can be determined by judging whether the first identification information and the second identification information are consistent, and the subsequent test data recovery process can be performed only if the request user and the target test user are the same user.
In this embodiment, by determining whether the first identification information and the second identification information are identical, it is determined whether the requesting user and the target test user are the same user, so that the security of the subsequent test data recovery process can be improved.
In some embodiments, the preset recovery condition includes that the tested component corresponding to the target test process operates normally, and the tested component corresponding to the test data recovery request and the tested component corresponding to the target test process are the same tested component.
The method comprises the steps of testing a tested component corresponding to a data recovery request, and performing subsequent data recovery flow only when the tested component corresponding to a target testing process is the same tested component.
In this embodiment, the subsequent test data recovery process is performed only when the preset recovery condition is satisfied, so that the security of the test data recovery process can be further ensured.
In one embodiment, another test data recovery method is provided, the flow diagram of which is shown in FIG. 6. The system comprises two major components, namely a component for test data recovery and cleaning operation for user operation, and a test data recovery and cleaning component comprising a log acquisition, analysis, test data backup and recovery component.
Test data recovery and cleaning operation assembly: the component provides an operation entrance for a user, is mainly used for testing the preprocessing process before the data recovery process, and when the tested component is a database, the preprocessing flow is shown in figure 7. The component comprises a test data recovery and cleaning operation switch, defaults to be on, and can be used for configuring the addresses of a log acquisition server and an application database, and the default user of the component is the user of the current testing machine. Finally, two test data recovery and cleaning modes are provided, including time point recovery and operation step recovery.
Test data recovery and cleaning component: the assembly comprises four parts, namely a log acquisition assembly, a log analysis assembly, a data backup assembly and a data recovery assembly.
The log acquisition component: the component captures through the interface and acquires corresponding user or tester information. And then according to the machine user information, acquiring the current machine user log in the configured log server, and filtering other logs.
A log parsing component: the method is one of the cores of the invention, and the information of database operation in the log information is rapidly identified and analyzed through the key words, related SQL sentences of new addition, modification, deletion and inquiry are extracted and recorded, meanwhile, the operation steps (unique ID) and the acquisition time (the accuracy is based on the log) are recorded, and the current operation actions (addition, deletion, modification and check) are marked. For query statements, the component synchronizes database (database configuration in the operation component according to data cleaning and restoring) query execution by an executor, and records the returned data to the data backup device, and is assisted by corresponding operation IDs (1 to N).
A data backup component: the component stores the data queried each time by the log analysis device into a data file through data format conversion, and endows the file with operation steps and time attributes for the data recovery component.
A data recovery component: the component mainly uses SQL generation technology to generate recovery sentences aiming at the content related to new addition, deletion and modification in the operation steps by retrieving the operations recorded in the log analysis component according to the reverse order of time so as to enable the testers to recover the corresponding test data. For the new addition, directly generating a deleted sql statement, and using corresponding new addition data under the condition; for deleted test data, the data of the corresponding steps and conditions in the data backup assembly are required to be searched first, and then the corresponding data in the data backup assembly is inserted in an insert mode; for the modified test data, the data of the corresponding steps and conditions in the data backup assembly are also required to be searched first, and then the data is changed into the data in the data backup assembly by updating the conditions. Finally, the purpose of test data recovered by the testers is achieved.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a test data recovery device for realizing the above-mentioned test data recovery method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the test data recovery device provided below may be referred to the limitation of the test data recovery method hereinabove, and will not be repeated here.
In one exemplary embodiment, as shown in fig. 8, there is provided a test data recovery apparatus 800 comprising: a first acquisition module 801, a determination module 802, a second acquisition module 803, and a data recovery module 804, wherein:
the first obtaining module 801 is configured to obtain identification information of a target test user, and obtain corresponding log data from a log server according to the identification information.
A determining module 802, configured to determine a target test step interval according to the sequence of all the test steps, where the target test step interval includes all the test steps from the target test step to the last test step in the test process.
The second obtaining module 803 is configured to obtain, for each test step in the target test step interval, an operation action included in each test step, and obtain, from the log data, an SQL statement corresponding to each operation action.
The data recovery module 804 is configured to determine a reverse test sequence corresponding to the target test step interval according to the sequence of the test time points corresponding to all the test steps in the target test step interval, and recover the target test data corresponding to the target test step based on the reverse test sequence, the operation action and the SQL statement.
In some embodiments, the data recovery module 804 includes:
and the first data recovery unit is used for recovering the first test data corresponding to the last test step based on the first operation action included in the last test step and the first SQL statement corresponding to the first operation action.
The second data recovery unit is used for sequentially recovering the corresponding test data of each residual test step according to the first test data, the operation actions included in each residual test step and the corresponding SQL statement according to the test reverse sequence aiming at the residual test steps except the last test step in the target test step interval until the target test data is recovered.
In some embodiments, the test data recovery apparatus 800 is specifically configured to operate with operations including adding test data, deleting test data, and modifying test data.
In some embodiments, the first target operational action includes at least one of deleting test data or modifying test data; the first data recovery unit is further configured to, if the first operation action is to delete test data or modify test data, respectively obtain, from the data backup component, first test data queried by a last test data query request before the first operation action and second test data obtained after the first operation action based on the first SQL statement; and restoring the test data corresponding to the last test step to the first test data by comparing the first test data with the second test data.
In some embodiments, the test data recovery apparatus 800 is further configured to obtain a test data recovery request, and obtain first identification information of a requesting user that initiates the test data recovery request; acquiring second identification information of a target test user corresponding to the target test process; and if the first identification information is consistent with the second identification information, judging whether the tested part meets the preset recovery condition, and if so, executing the step of acquiring the identification information of the target test user.
In some embodiments, the test data recovery apparatus 800 is further configured to preset recovery conditions including that the tested component corresponding to the target test process operates normally, and that the tested component corresponding to the test data recovery request and the tested component corresponding to the target test process are the same tested component.
The above-described respective modules in the test data recovery apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In an exemplary embodiment, a computer device, which may be a terminal, is provided, and an internal structure thereof may be as shown in fig. 9. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program, when executed by a processor, implements a test data recovery method. The display unit of the computer device is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by persons skilled in the art that the architecture shown in fig. 9 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements are applicable, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one exemplary embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of: acquiring identification information of a target test user, and acquiring corresponding log data from a log server according to the identification information; determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process; aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from the log data; determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement.
In one embodiment, the restoring, based on the test reverse order, the operation action, and the SQL statement, the target test data corresponding to the target test step implemented when the processor executes the computer program includes: restoring first test data corresponding to the last test step based on a first operation action included in the last test step and a first SQL statement corresponding to the first operation action; and aiming at the rest test steps except the last test step in the target test step interval, sequentially recovering the corresponding test data of each rest test step according to the test reverse sequence based on the first test data, the operation action and the corresponding SQL statement included in each rest test step until the target test data is recovered.
In one embodiment, the operational actions implemented when the processor executes the computer program include adding test data, deleting test data, and modifying test data.
In one embodiment, the first target operational action implemented when the processor executes the computer program includes at least one of deleting test data or modifying test data; the restoring the first test data corresponding to the last test step based on the first operation action included in the last test step and the first SQL statement corresponding to the first operation action includes: if the first operation action is to delete the test data or modify the test data, respectively acquiring the first test data queried by a last test data query request before the first operation action and the second test data obtained after the first operation action from a data backup component based on the first SQL statement; and restoring the test data corresponding to the last test step to the first test data by comparing the first test data with the second test data.
In one embodiment, before the processor executes the computer program to obtain the identification information of the target test user, the method further includes: acquiring a test data recovery request, and acquiring first identification information of a request user initiating the test data recovery request; acquiring second identification information of a target test user corresponding to the target test process; and if the first identification information is consistent with the second identification information, judging whether the tested part meets the preset recovery condition, and if so, executing the step of acquiring the identification information of the target test user.
In one embodiment, the preset recovery condition implemented when the processor executes the computer program includes that the tested component corresponding to the target test process operates normally, and the tested component corresponding to the test data recovery request and the tested component corresponding to the target test process are the same tested component.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring identification information of a target test user, and acquiring corresponding log data from a log server according to the identification information; determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process; aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from the log data; determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement.
In one embodiment, recovering the target test data corresponding to the target test step based on the test reverse order, the operation action and the SQL statement, which is implemented when the computer program is executed by the processor, includes: restoring first test data corresponding to the last test step based on a first operation action included in the last test step and a first SQL statement corresponding to the first operation action; and aiming at the rest test steps except the last test step in the target test step interval, sequentially recovering the corresponding test data of each rest test step according to the test reverse sequence based on the first test data, the operation action and the corresponding SQL statement included in each rest test step until the target test data is recovered.
In one embodiment, the operational actions implemented when the computer program is executed by the processor include adding test data, deleting test data, and modifying test data.
In one embodiment, the first target operational action implemented when the computer program is executed by the processor includes at least one of deleting test data or modifying test data; the restoring the first test data corresponding to the last test step based on the first operation action included in the last test step and the first SQL statement corresponding to the first operation action includes: if the first operation action is to delete the test data or modify the test data, respectively acquiring the first test data queried by a last test data query request before the first operation action and the second test data obtained after the first operation action from a data backup component based on the first SQL statement; and restoring the test data corresponding to the last test step to the first test data by comparing the first test data with the second test data.
In one embodiment, before the computer program is executed by the processor, it further includes: acquiring a test data recovery request, and acquiring first identification information of a request user initiating the test data recovery request; acquiring second identification information of a target test user corresponding to the target test process; and if the first identification information is consistent with the second identification information, judging whether the tested part meets the preset recovery condition, and if so, executing the step of acquiring the identification information of the target test user.
In one embodiment, the preset recovery condition implemented when the computer program is executed by the processor includes that the tested component corresponding to the target test process operates normally, and the tested component corresponding to the test data recovery request and the tested component corresponding to the target test process are the same tested component.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of: acquiring identification information of a target test user, and acquiring corresponding log data from a log server according to the identification information; determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process; aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from the log data; determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement.
In one embodiment, recovering the target test data corresponding to the target test step based on the test reverse order, the operation action and the SQL statement, which is implemented when the computer program is executed by the processor, includes: restoring first test data corresponding to the last test step based on a first operation action included in the last test step and a first SQL statement corresponding to the first operation action; and aiming at the rest test steps except the last test step in the target test step interval, sequentially recovering the corresponding test data of each rest test step according to the test reverse sequence based on the first test data, the operation action and the corresponding SQL statement included in each rest test step until the target test data is recovered.
In one embodiment, the operational actions implemented when the computer program is executed by the processor include adding test data, deleting test data, and modifying test data.
In one embodiment, the first target operational action implemented when the computer program is executed by the processor includes at least one of deleting test data or modifying test data; the restoring the first test data corresponding to the last test step based on the first operation action included in the last test step and the first SQL statement corresponding to the first operation action includes: if the first operation action is to delete the test data or modify the test data, respectively acquiring the first test data queried by a last test data query request before the first operation action and the second test data obtained after the first operation action from a data backup component based on the first SQL statement; and restoring the test data corresponding to the last test step to the first test data by comparing the first test data with the second test data.
In one embodiment, before the computer program is executed by the processor, it further includes: acquiring a test data recovery request, and acquiring first identification information of a request user initiating the test data recovery request; acquiring second identification information of a target test user corresponding to the target test process; and if the first identification information is consistent with the second identification information, judging whether the tested part meets the preset recovery condition, and if so, executing the step of acquiring the identification information of the target test user.
In one embodiment, the preset recovery condition implemented when the computer program is executed by the processor includes that the tested component corresponding to the target test process operates normally, and the tested component corresponding to the test data recovery request and the tested component corresponding to the target test process are the same tested component.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are both information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to meet the related regulations.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. A method of test data recovery, the method comprising:
acquiring identification information of a target test user, and acquiring corresponding log data from a log server according to the identification information;
determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process;
Aiming at each test step in the target test step interval, acquiring an operation action included in each test step, and acquiring an SQL sentence corresponding to each operation action from the log data;
determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement.
2. The method of claim 1, wherein the restoring the target test data corresponding to the target test step based on the test reverse order, the operation action, and the SQL statement comprises:
restoring first test data corresponding to the last test step based on a first operation action included in the last test step and a first SQL statement corresponding to the first operation action;
and aiming at the rest test steps except the last test step in the target test step interval, sequentially recovering the corresponding test data of each rest test step according to the test reverse sequence based on the first test data, the operation action and the corresponding SQL statement included in each rest test step until the target test data is recovered.
3. The method of claim 1, wherein the action includes adding test data, deleting test data, and modifying test data.
4. A method according to claim 2 or 3, wherein the first target operational action comprises at least one of deleting test data or modifying test data; the restoring the first test data corresponding to the last test step based on the first operation action included in the last test step and the first SQL statement corresponding to the first operation action includes:
if the first operation action is to delete the test data or modify the test data, respectively acquiring the first test data queried by a last test data query request before the first operation action and the second test data obtained after the first operation action from a data backup component based on the first SQL statement;
and restoring the test data corresponding to the last test step to the first test data by comparing the first test data with the second test data.
5. The method according to claim 1, further comprising, before the obtaining the identification information of the target test user:
Acquiring a test data recovery request, and acquiring first identification information of a request user initiating the test data recovery request;
acquiring second identification information of a target test user corresponding to the target test process;
and if the first identification information is consistent with the second identification information, judging whether the tested part meets the preset recovery condition, and if so, executing the step of acquiring the identification information of the target test user.
6. The method of claim 5, wherein the preset recovery condition includes that the tested component corresponding to the target test procedure is operating normally, and the tested component corresponding to the test data recovery request and the tested component corresponding to the target test procedure are the same tested component.
7. A test data recovery apparatus, the apparatus comprising:
the first acquisition module is used for acquiring the identification information of the target test user and acquiring corresponding log data from the log server according to the identification information;
the determining module is used for determining a target test step interval according to the sequence of all the test steps, wherein the target test step interval comprises all the test steps from the target test step to the last test step in the test process;
The second acquisition module is used for acquiring the operation action included in each test step aiming at each test step in the target test step interval, and acquiring the SQL statement corresponding to each operation action from the log data;
the data recovery module is used for determining a test reverse sequence corresponding to the target test step interval according to the sequence of the corresponding test time points of all the test steps in the target test step interval, and recovering the target test data corresponding to the target test step based on the test reverse sequence, the operation action and the SQL statement.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202311132316.1A 2023-09-04 2023-09-04 Test data recovery method, device, equipment, medium and product Pending CN117112305A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311132316.1A CN117112305A (en) 2023-09-04 2023-09-04 Test data recovery method, device, equipment, medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311132316.1A CN117112305A (en) 2023-09-04 2023-09-04 Test data recovery method, device, equipment, medium and product

Publications (1)

Publication Number Publication Date
CN117112305A true CN117112305A (en) 2023-11-24

Family

ID=88810794

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311132316.1A Pending CN117112305A (en) 2023-09-04 2023-09-04 Test data recovery method, device, equipment, medium and product

Country Status (1)

Country Link
CN (1) CN117112305A (en)

Similar Documents

Publication Publication Date Title
CN109034993B (en) Account checking method, account checking equipment, account checking system and computer readable storage medium
CN109783457B (en) CGI interface management method, device, computer equipment and storage medium
JP2018116496A (en) Difference detection device and program
CN109101412B (en) Test file generation method, test file generation device, test file testing method, test file testing device, storage medium and computer equipment
CN108228611B (en) Document information copying method and device
CN116561003A (en) Test data generation method, device, computer equipment and storage medium
CN117112305A (en) Test data recovery method, device, equipment, medium and product
CN115344428A (en) Data processing method, data processing apparatus, computer device, storage medium, and program product
CN116821102B (en) Data migration method, device, computer equipment and storage medium
CN117555955B (en) Data conversion method, data conversion device, computer device, and storage medium
CN115115433B (en) Order data processing method, device, computer equipment and storage medium
CN116795723B (en) Chain unit test processing method and device and computer equipment
CN115118616B (en) Display result testing method, device, computer equipment and storage medium
CN117389897A (en) Test script generation method, device, computer equipment and storage medium
CN116756022A (en) Data preparation method, device, computer equipment and storage medium
CN117827978A (en) Data conflict processing method, device, computer equipment and storage medium
CN118132656A (en) Knowledge graph construction method, knowledge graph construction device, computer equipment and storage medium
CN118193396A (en) Test method, test apparatus, computer device, storage medium, and program product
CN116975870A (en) System security assessment method, device, computer equipment and storage medium
CN118132448A (en) Test case processing method, device, computer equipment and storage medium
CN117033242A (en) Test data generation method, device, computer equipment and storage medium
CN115391225A (en) Pressure measurement method and device
CN117950942A (en) Log management method, device, equipment, storage medium and program product
CN117435478A (en) Program logic function detection method, device, computer equipment and storage medium
CN117056228A (en) Page loading test method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination