An Intermittent Connection Method, System and Medium for Automated Testing
By reading and utilizing the context instance at the abnormal interrupt in automated tests, the continuous execution of tests is achieved, and the repeated execution problems caused by interrupts are solved, which improves the testing efficiency and maintenance convenience.
Patent Information
- Application Number
- CN202210238331.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-11
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-03-11
AI Technical Summary
The program is interrupted due to abnormal conditions in automated testing, which causes the tester to re-execute the test program from scratch, which takes a long time and is inconvenient to maintain, which reduces the efficiency of automated testing.
By confirming whether there is a context parameter at the exception interrupt at the beginning of the test, if it exists, the corresponding record file will be read from the database, the deserialization process generates a context instance, and the test script will continue to be executed from the interrupt according to the instance.
The continuous execution of automated tests at interrupts is realized, which reduces the repeated execution of test scripts, improves the efficiency of automated tests, and simplifies the maintenance process.
Smart Images

Figure CN114691500B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and particularly to a method, system and medium for resuming interrupted automated tests. Background Art
[0002] One of the main purposes of automated testing is to ensure that test scripts can be actively executed without human control. However, with the increasing popularity of automated testing, the automated testing process may be interrupted due to abnormal situations. At this time, the tester needs to restart the test program from the beginning, which is time-consuming, inconvenient to maintain, and also reduces the efficiency of automated testing. Summary of the Invention
[0003] In view of the above deficiencies of the prior art, the purpose of the present invention is to provide a method, system and medium for resuming interrupted automated tests, aiming to reduce the repeated execution of test scripts by resuming execution from the interruption point of the test and improve the efficiency of automated testing.
[0004] The technical solution of the present invention is as follows:
[0005] A method for resuming interrupted automated tests includes:
[0006] When a test script starts to execute, confirm whether there are context parameters at the abnormal interruption point;
[0007] If there are context parameters at the abnormal interruption point, read the corresponding stored record file from the database;
[0008] Perform deserialization processing on the record file to generate a corresponding context instance at the abnormal interruption point;
[0009] Control the test script to continue executing the test from the abnormal interruption point according to the context instance at the abnormal interruption point.
[0010] In one embodiment, after confirming whether there are context parameters at the abnormal interruption point when the test script starts to execute, the method further includes:
[0011] If there are no context parameters at the abnormal interruption point, generate a context instance corresponding to the currently executed step every time a step is executed.
[0012] In one embodiment, after generating a context instance corresponding to the currently executed step every time a step is executed if there are no context parameters at the abnormal interruption point, the method further includes:
[0013] When an abnormal interruption occurs, convert the context instance generated before the interruption into a record file and store it in the database.
[0014] In one embodiment, converting the context instance generated before the interruption into a record file and storing it in a database specifically includes:
[0015] Perform serialization processing on the context instance generated before the interruption, generate a corresponding record file, and store it in the database.
[0016] In one embodiment, after converting the context instance generated before the interruption into a record file and storing it in the database when an abnormal interruption occurs, the method further includes:
[0017] Modify the test script according to the repair instructions input by the user, and / or clean up dirty data, and / or build and maintain the test environment.
[0018] In one embodiment, the record file is a serialized json file.
[0019] In one embodiment, if there are context parameters at the abnormal interruption point, reading the corresponding stored record file from the database includes:
[0020] If there are context parameters at the abnormal interruption point, read the json file name saved in the database, and use the json file name as a parameter to execute to read the serialized json file.
[0021] In one embodiment, the context instance includes executed steps, a test environment, and data context attributes.
[0022] An automated test interruption continuation system, the system includes at least one processor; and,
[0023] A memory communicatively connected to the at least one processor; wherein,
[0024] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned automated test interruption continuation method.
[0025] A non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by one or more processors, the one or more processors can execute the above-mentioned automated test interruption continuation method.
[0026] Beneficial effects: The present invention discloses a method, system and medium for resuming interrupted automated testing. Compared with the prior art, in the embodiments of the present invention, by reading the record file saved during the previous test at the abnormal interruption of the test and generating a corresponding context instance, when the previous test is interrupted, the test can be continued from the interruption point during the next execution of the test without having to repeat the execution from the beginning, reducing the time for executing the automated test script, ensuring the test efficiency, and making it more convenient and fast to maintain the script. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The present invention will be further described below in conjunction with the drawings and embodiments. In the drawings:
[0028] Figure 1 is a flowchart of a method for resuming interrupted automated testing provided by an embodiment of the present invention;
[0029] Figure 2 is a schematic diagram of the functional modules of a device for resuming interrupted automated testing provided by an embodiment of the present invention;
[0030] Figure 3 is a schematic diagram of the hardware structure of a system for resuming interrupted automated testing provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0031] To make the objectives, technical solutions and effects of the present invention clearer and more definite, the present invention will be further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. The embodiments of the present invention are introduced below in conjunction with the drawings.
[0032] Please refer to Figure 1 , Figure 1 , which is a flowchart of an embodiment of the method for resuming interrupted automated testing provided by the present invention. The method for resuming interrupted automated testing provided in this embodiment is applicable to the situation of resuming the execution of abnormal interruptions in the automated testing process, and is specifically applied to a system composed of a terminal device, a network and a server. The network is a medium for providing a communication link directly between the terminal device and the server, and it can include various connection types, such as wired, wireless communication links or fiber optic cables, etc.; the operating system on the terminal device can include a handheld device operating system (iPhone operating system, iOS system), an Android system or other operating systems. The terminal device is connected to the server through the network to achieve interaction, so as to perform operations such as receiving or sending data. Specifically, it can be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, portable computers and desktop servers, etc. As Figure 1 shown, the method specifically includes the following steps:
[0033] S100. When the test script starts to execute, confirm whether there are context parameters at the abnormal interruption point.
[0034] In this embodiment, when starting to execute a test script, first confirm whether there are context parameters at the abnormal interruption point, that is, whether there was an abnormal interruption when the test script was executed last time. The abnormal interruption point is identified by the context parameters, so that when restarting the execution of the test script, the previous abnormal interruption situation can be accurately recognized, saving the script execution time.
[0035] S200. If there are context parameters at the abnormal interruption point, read the corresponding stored record file from the database.
[0036] In this embodiment, when it is confirmed that there are context parameters representing the abnormal interruption point, the record file stored during the previous execution is correspondingly obtained from the database, that is, the detailed information of the interruption is recorded in this file when an abnormal interruption occurs, so that the execution situation at the abnormal interruption point can be obtained in a timely and accurate manner during the subsequent continued execution, providing an accurate record document for the continued execution of the automated test.
[0037] Specifically, the record file is a serialized json file. JSON (JavaScript Object Notation) is a lightweight data exchange format. It uses a text format completely independent of programming languages to store and represent data. Its simple and clear hierarchical structure makes JSON an ideal data exchange language, easy for humans to read and write, and also easy for machines to parse and generate, effectively improving the network transmission efficiency. Therefore, when an abnormal interruption occurs, by generating a serialized json file to save and transmit the execution situation at the interruption point, the data processing efficiency during the subsequent continued execution can be effectively improved.
[0038] In one embodiment, step S200 includes:
[0039] If there are context parameters at the abnormal interruption point, read the json file name saved in the database, and use the json file name as a parameter to execute to read the serialized json file.
[0040] In this embodiment, when there are context parameters, read the json file name saved in the database, and use the json file name as a parameter to execute, so as to accurately read the serialized json file, providing accurate and reliable data for continuing to execute the test from the interruption point later, and improving the accuracy of the continued execution of the automated test.
[0041] S300. Deserialize the record file to generate a corresponding context instance at the abnormal interruption point.
[0042] In this embodiment, after obtaining the record file at the abnormal interruption, the serialized record file is correspondingly deserialized, so as to convert the record file, that is, the serialized json file, into the context instance at the abnormal interruption. The context instance is used to save the currently executed steps, test environment, and data context attributes. That is, the context instance obtained at this time instantiates and saves the data, environment, etc. before the interruption, thereby restoring the execution status at the previous abnormal interruption, facilitating the continuation of execution from the interruption point, without having to repeat the execution from the beginning, and reducing the execution time of the automated test script.
[0043] S400. Control the test script to continue the test from the abnormal interruption point according to the context instance at the abnormal interruption point.
[0044] In this embodiment, the execution steps, test environment, and data context attributes before the interruption are restored through the obtained context instance at the abnormal interruption point, and then the current test script can be controlled to continue to execute the subsequent steps from the abnormal interruption point. It can be understood that if an abnormal interruption occurred last time, the current test script can be the updated data in order to eliminate the cause of the previous abnormal interruption and achieve the purpose of testing and fixing problems. In this embodiment, by obtaining the context instance at the abnormal interruption point, when the previous test is interrupted, the test can be continued from the interruption point in the current test execution, without having to repeat the execution from the beginning, reducing the execution time of the automated test script, ensuring the test efficiency, and making it more convenient and fast to maintain the script.
[0045] In one embodiment, after step S100, the method further includes:
[0046] If there is no context parameter at the abnormal interruption point, a context instance corresponding to the currently executed step is generated every time a step is executed.
[0047] In this embodiment, if it is determined that there is no context parameter currently, it means that no abnormal interruption occurred during the previous execution. At this time, the script test is performed normally, and when the test script is executed, a context instance corresponding to the currently executed step is generated every time a step is executed. The currently executed steps, test environment, and data context attributes are saved through this context instance for traceability and positioning in case of interruption.
[0048] In one embodiment, after generating a context instance corresponding to the currently executed step every time a step is executed if there is no context parameter at the abnormal interruption point, the method further includes:
[0049] When an abnormal interruption occurs, convert the context instance generated before the interruption into a record file and store it in the database.
[0050] In this embodiment, after the test script starts to be normally executed, if it cannot proceed due to abnormal test environment, dirty data, test script bugs, etc., and an abnormal interruption occurs, the context instance generated before the interruption is converted into a record file and stored in the database to record the current interruption situation. Specifically, when generating the record file, the context instance generated before the interruption is first serialized, and the serialized json file is saved to the database to achieve lightweight data transmission and storage, facilitating subsequent data reading and parsing, improving the efficiency of continued execution of automated tests, and the preservation of interruption events also facilitates problem troubleshooting during testing and improves the efficiency of fixing vulnerabilities during testing.
[0051] In one embodiment, after converting the context instance generated before the interruption into a record file and storing it in the database when an abnormal interruption occurs, the method further includes:
[0052] According to the repair instructions input by the user, modify the test script, and / or clean the dirty data, and / or construct and maintain the test environment.
[0053] In this embodiment, after an abnormal interruption occurs, the test operator needs to repair the corresponding test data according to the situation of the abnormal interruption to solve the abnormality. Specifically, it can be to modify the test script, clean the dirty data, construct and maintain the test environment, etc. After solving the current abnormal interruption, the test program can be restarted, and the test can be continued for the modified test script. Since the data before the interruption is saved through instantiation when an abnormal interruption occurs, the context instance can be obtained through deserialization processing when continuing the test, so that the test can be directly restarted from the interruption point, shortening the test time and having higher convenience.
[0054] Another embodiment of the present invention provides an automated test interruption continuation device, including:
[0055] A judgment module 11, configured to confirm whether there are context parameters at the abnormal interruption point when the test script starts to execute;
[0056] A reading module 12, configured to, if there are context parameters at the abnormal interruption point, read the corresponding stored record file from the database;
[0057] A deserialization module 13, configured to perform deserialization processing on the record file to generate a context instance at the corresponding abnormal interruption point;
[0058] A continuation execution module 14, configured to control the test script to continue the test from the abnormal interruption point according to the context instance at the abnormal interruption point.
[0059] The judgment module 11, the reading module 12, the deserialization module 13, and the continuation execution module 14 are connected in sequence. The modules referred to in the present invention refer to a series of computer program instruction segments that can complete specific functions, which are more suitable for describing the execution process of continuation in automated testing than programs. For the specific implementation manners of each module, please refer to the corresponding method embodiments above, and will not be elaborated here.
[0060] Another embodiment of the present invention provides a system for continuation in automated testing interruption, as Figure 3 shown. The system 10 includes:
[0061] One or more processors 110 and a memory 120. Figure 3 Taking one processor 110 as an example for introduction, the processor 110 and the memory 120 can be connected through a bus or other means. Figure 3 Taking the connection through a bus as an example here.
[0062] The processor 110 is used to complete various control logics of the system 10. It can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a single-chip microcomputer, an ARM (Acorn RISC Machine), or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of these components. Moreover, the processor 110 can also be any conventional processor, microprocessor, or state machine. The processor 110 can also be implemented as a combination of computing devices, for example, a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors combined with a DSP and / or any other such configuration.
[0063] The memory 120, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions corresponding to the method for continuation in automated testing interruption in the embodiments of the present invention. The processor 110 executes various functional applications and data processing of the system 10 by running the non-volatile software programs, instructions, and units stored in the memory 120, that is, implementing the method for continuation in automated testing interruption in the above method embodiments.
[0064] The memory 120 may include a program storage area and a data storage area. The program storage area may store an operating system and application programs required for at least one function. The data storage area may store data created according to the use of the system 10 and the like. In addition, the memory 120 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 120 may optionally include a memory remotely disposed relative to the processor 110, and these remote memories may be connected to the system 10 through a network. Examples of the above networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0065] One or more units are stored in the memory 120 and, when executed by one or more processors 110, perform the automated test interruption resumption method in any of the above method embodiments. For example, perform the method steps S100 to S400 described above. Figure 1 in the method.
[0066] Embodiments of the present invention provide a non-volatile computer-readable storage medium storing computer-executable instructions, which are executed by one or more processors. For example, perform the method steps S100 to S400 described above. Figure 1 in the method.
[0067] By way of example, non-volatile storage media can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) as an external cache memory. By way of illustration and not limitation, RAM can be obtained in many forms such as synchronous RAM (SRAM), dynamic RAM, (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus (Rambus) RAM (DRRAM). The disclosed memory components or memories of the operating environment described herein are intended to include one or more of these and / or any other suitable types of memories.
[0068] In summary, in an automated test interruption resumption method, system, and medium disclosed by the present invention, the method confirms whether there are context parameters at an abnormal interruption point when the test script starts to execute; if there are context parameters at the abnormal interruption point, it reads the corresponding stored record file from the database; performs deserialization processing on the record file to generate a context instance corresponding to the abnormal interruption point; and controls the test script to continue executing the test from the abnormal interruption point according to the context instance corresponding to the abnormal interruption point. By reading the record file saved during the previous test at the abnormal interruption point of the test and generating a corresponding context instance, when the previous test is interrupted, the next execution of the test can continue from the interruption point without having to start over and repeat the execution, reducing the execution time of the automated test script, ensuring the test efficiency, and making it more convenient and fast to maintain the script.
[0069] Of course, those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above method embodiments. The storage medium can be a memory, a magnetic disk, a floppy disk, a flash memory, an optical memory, etc.
[0070] It should be understood that the application of the present invention is not limited to the above examples. For those of ordinary skill in the art, improvements or transformations can be made according to the above description, and all such improvements and transformations should fall within the protection scope of the appended claims of the present invention.
Claims
1. An intermittent connection method for automated testing, characterized in that Including: When the test script starts to execute, confirm whether there are context parameters at the abnormal interruption point; If there are context parameters at the abnormal interruption point, read the corresponding stored record file from the database; Deserialize the record file to generate a context instance corresponding to the abnormal interruption point; Control the test script to continue the test from the abnormal interruption point according to the context instance of the abnormal interruption point; After confirming whether there are context parameters at the abnormal interruption point when the test script starts to execute, the method further includes: If there are no context parameters at the abnormal interruption point, generate a context instance corresponding to the currently executed step every time a step is executed; After generating a context instance corresponding to the currently executed step every time a step is executed if there are no context parameters at the abnormal interruption point, the method further includes: When an abnormal interruption occurs, convert the context instance generated before the interruption into a record file and store it in the database; Identify the abnormal interruption point through context parameters so that the abnormal interruption situation can be recognized when restarting the execution of the test script; If there are context parameters at the abnormal interruption point, read the json file name saved in the database and use the json file name as a parameter to execute to read the serialized json file.
2. The automated test interruption resumption method according to claim 1, wherein The converting the context instance generated before the interruption into a record file and storing it in the database specifically includes: Serialize the context instance generated before the interruption to generate a corresponding record file and store it in the database.
3. The method for resuming interrupted automated testing according to claim 2, wherein After converting the context instance generated before the interruption into a record file and storing it in the database when an abnormal interruption occurs, the method further includes: According to the repair instructions input by the user, modify the test script, and / or clean up dirty data, and / or build and maintain the test environment.
4. The method for resuming interrupted automated testing according to any one of claims 1-3, characterized in that, The record file is a serialized json file.
5. The method for resuming an interrupted automated test according to claim 1, wherein The context instance includes the executed steps, test environment, and data context attributes.
6. An intermittent connection system for automated testing, characterized in that, The system includes at least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the automated test interruption continuation method according to any one of claims 1-5.
7. A non-volatile computer-readable storage medium, characterized in that, The non-volatile computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by one or more processors, the one or more processors can execute the automated test interruption continuation method according to any one of claims 1-5.
Citation Information
Patent Citations
Method, device and system for testing circuit board card
CN103593273A
Resuming testing after a destructive event
US9983988B1