Background
In the regression testing of the system, a recording playback technique is commonly used, and the recording playback technique is that a flow needing testing is completed manually, and communication information between a client and a server during the flow is recorded by a computer, wherein the information is generally some protocols and data, and forms a specific Script program (Script). And then, simultaneously generating a plurality of virtual users under the unified management of the system, running the script, monitoring the performance of hardware and software platforms, and providing analysis reports or related data. Thus, hundreds of users can be simulated to test the load capacity of the application system through a plurality of machines.
In the recording and playback technology, the verification environment can be divided into an online environment and an offline environment, the offline environment generally cannot be completely consistent with the online environment due to the reasons of a database, a cache, a cluster, hardware equipment and the like, and the online environment generally cannot completely simulate all real behaviors of a user due to the diversity of user behaviors; therefore, the problem that the online environment is difficult to verify can occur to the complex service and system. Unlike the offline environment, the online environment does not have these problems.
However, the current online recording playback scheme also has its drawbacks. Taking the relatively common mirror image drainage scheme as an example, the scheme needs to be modified in overall deployment in specific implementation: route configuration at a load balancing position or special load balancing equipment is required to be introduced, and the deployment of a database is modified; in addition, the application system needs to be modified to support special processing of the mirror image traffic, so as to avoid affecting the real service processing. Therefore, the current online recording and playback scheme needs to make a great change to the original system (i.e. the original system is invaded a lot).
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, and a system for system regression testing, so as to reduce intrusion to an original system while implementing online system regression testing.
In order to achieve the above object, in one aspect, an embodiment of the present application provides a method for system regression testing, including the following steps:
the recording server acquires a service request sent to an application server by a client and response data returned by the application server aiming at the service request according to predefined configuration information, converts the service request into data with a preset format and stores the data in a database;
and the playback server reads the preset format data stored in the database, restores the preset format data into original format data, performs playback processing, obtains a regression test result and outputs the regression test result.
On the other hand, the embodiment of the present application provides another method for system regression testing, including the following steps:
acquiring a service request sent to an application server by a client and response data returned by the application server aiming at the service request according to predefined configuration information;
converting the service request and response data returned by the application server aiming at the service request into data with a preset format;
and storing the data with the preset format into a database.
On the other hand, the embodiment of the present application provides another method for system regression testing, including the following steps:
reading data in a preset format stored in a database and restoring the data into original format data;
carrying out playback processing on the original format data to obtain a regression test result;
and outputting the regression test result.
In another aspect, an embodiment of the present application further provides a system for regression testing, including:
the recording server is used for acquiring a service request sent to the application server by the client and response data returned by the application server aiming at the service request according to predefined configuration information, converting the service request into data with a preset format and storing the data into a database;
and the playback server is used for reading the preset format data stored in the database, restoring the preset format data into original format data, then performing playback processing to obtain a regression test result and outputting the regression test result.
In another aspect, an embodiment of the present application further provides a recording server, including:
the data acquisition module is used for acquiring a service request sent to an application server by a client and response data returned by the application server aiming at the service request according to predefined configuration information;
the format conversion module is used for converting the service request and response data returned by the application server aiming at the service request into data with a preset format;
and the data storage module is used for storing the data with the preset format into a database.
In another aspect, an embodiment of the present application further provides a playback server, including:
the format reduction module is used for reading the preset format data stored in the database and reducing the preset format data into original format data;
the playback processing module is used for performing playback processing on the original format data to obtain a regression test result;
and the result output module is used for outputting the regression test result.
In the system regression testing scheme of the embodiment of the application, the recording server intercepts user traffic through predefined configuration information, performs format conversion on the user traffic, stores the user traffic, and performs playback processing on another specified device, so that online system regression testing is realized. Because the application system only needs to be introduced with the recording server and the related configuration, and the whole deployment does not need to be greatly modified, the intrusion of the application system is small.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application more apparent, the embodiments of the present application are described in further detail below with reference to the embodiments and the accompanying drawings. The exemplary embodiments and descriptions of the embodiments are provided to explain the embodiments and should not be construed as limiting the embodiments.
The following describes embodiments of the present application in further detail with reference to the accompanying drawings.
Referring to fig. 1, and referring to fig. 1, the method of the systematic regression test of the present example includes the following steps:
step S101, the recording server obtains a service request sent by the client to the application server and response data returned by the application server aiming at the service request according to predefined configuration information, converts the service request into data with a preset format and stores the data in a database.
In the embodiment of the application, the purpose of converting the intercepted data into the data in the predetermined format is to convert the recorded dynamic data into static information for storage, and the data in the predetermined format is in a format suitable for storage in the database.
In this embodiment of the application, the recording server may be an interceptor configured on the application server, and the predefined configuration information may be a pre-configured configuration file. The configuration content of the configuration file can include the IP identification of the online recording device, the online recording time length, which interfaces need to be recorded online, and the like, and the related configuration file can be pushed to the interceptor through the management system, and the interceptor starts to take effect. When a user sends a service request to an application server through a client, an interceptor intercepts the service request, and similarly, when the application server returns response data according to the service request, the interceptor intercepts the response data.
And S102, the playback server reads the preset format data stored in the database, restores the preset format data into original format data, performs playback processing, obtains a regression test result and outputs the regression test result.
In the embodiment of the application, the purpose of restoring the predetermined format data into the original format data is to restore the stored static information into corresponding dynamic data so as to facilitate playback processing. In particular implementations, the playback processing of the playback server may be triggered based on the playback instructions.
The system regression testing method of the embodiment of the application can be applied to the development stage of the application system and also can be applied to the release stage of the application system so as to verify or check the performance of the system. Wherein the application system publication comprises a blue-green publication.
The specific application of the system regression testing method of the present example is described below by way of example in the blue green publication. The related configuration is generally carried out before the blue green is released, and in the process, the configuration in the aspect of recording can be carried out. The specific blue-green release process is as follows:
step 1, changing the state of the green cluster into standby, and deleting the address of the green cluster from the load balancing server, so that the green cluster cannot receive a service request from a user. That is, the traffic is totally drained to the blue cluster, and the green cluster no longer has user traffic. In this step, the recording server records according to predefined configuration information, converts the recorded data into data with a predetermined format, and stores the data in a database.
And 2, performing system updating on the green cluster, and deploying new codes until the green cluster is successfully started.
And 3, after the green cluster is successfully started, the playback server reads the data in the preset format from the database, restores the data into the data in the original format, and performs playback processing to obtain and output a regression test result, so as to verify whether the performance of the green cluster system is normal.
And 4, interchanging the roles of the green cluster and the blue cluster, repeating the steps 1-3, and finally finishing the blue-green distribution.
In the method for system regression testing according to the embodiment of the application, the recording server intercepts user traffic through predefined configuration information, performs format conversion on the user traffic, stores the user traffic, and performs playback processing on another specified device, thereby realizing online system regression testing. Because the application system only needs to be introduced with the recording server and the related configuration, and the whole deployment does not need to be greatly modified, the intrusion of the application system is small.
Referring to fig. 2, a method for regression testing of a system according to an embodiment of the present application includes the following steps:
step S201, acquiring a service request sent by a client to an application server and response data returned by the application server for the service request according to predefined configuration information.
In this embodiment of the present application, an execution subject of each step may be a recording server, the recording server may be, for example, an interceptor configured on the application server, and the predefined configuration information may be a pre-configured configuration file. The configuration content of the configuration file may include the IP identification of the device that is recorded online, the length of time that the recording is performed online, which interfaces need to be recorded online, and so on. When a user sends a service request to an application server through a client, an interceptor intercepts the service request, and similarly, when the application server returns response data according to the service request, the interceptor intercepts the response data.
Step S202, converting the service request and the response data returned by the application server aiming at the service request into data with a preset format.
In the embodiment of the application, the purpose of converting the intercepted data into the data in the predetermined format is to convert the recorded dynamic data into static information for storage, and the data in the predetermined format is in a format suitable for storage in the database.
And step S203, storing the data with the preset format into a database.
In another embodiment, before converting the service request and the response data returned by the application server for the service request into data in a predetermined format, the method may further include:
and performing security desensitization processing on the service request and response data returned by the application server aiming at the service request. Since some user data are sensitive data, such as user telephone numbers, bank card numbers, etc., these data should not be directly stored in the database from the perspective of security design, so as to achieve reliable protection of the sensitive data.
In another embodiment, the converting the service request and the response data returned by the application server for the service request into data in a predetermined format may be, for example: and converting the service request and response data returned by the application server aiming at the service request into a preset format in an order cracking mode.
In another embodiment, the storing the data in the predetermined format into the database may be, for example: asynchronous operation or multithreading is started to store the data with the preset format into the database, so that the performance of an application system can be prevented from being influenced.
Referring to fig. 3, a method for regression testing of a system according to an embodiment of the present application includes the following steps:
step S301, reading the preset format data stored in the database and restoring the preset format data into the original format data. In this embodiment of the present application, the execution subject of each step may be a playback server, where the purpose of restoring the predetermined format data to the original format data is to restore the stored static information to the corresponding dynamic data to facilitate playback processing. In particular implementations, the playback processing of the playback server may be triggered based on the playback instructions.
Step S302, the original format data is played back to obtain a regression test result. The playback process may be, for example, a mock test. And the playback result can be obtained after the playback processing, the playback result is compared with the previous recording result, a report can be generated, and the report is the regression test result of the application system.
And S303, outputting the regression test result.
In another embodiment, the restoring the predetermined format data to the original format data may include: and restoring the data in the preset format into the data in the original format in a deserialization mode. For example, the original format data is jvm (Java Virtual Machine) object data, which becomes static information after serialization and stores the static information in the database, and the static information can be restored to jvm objects through deserialization.
While the process flows described above for the various method embodiments include a number of operations occurring in a particular order, it should be appreciated that the processes may include more or less operations, which may be performed sequentially or in parallel (e.g., using parallel processors or a multi-threaded environment).
Referring to fig. 4, a system for regression testing of a system according to an embodiment of the present application includes:
the recording server 41 is configured to obtain a service request sent by a client to an application server and response data returned by the application server in response to the service request according to predefined configuration information, convert the service request into data in a predetermined format, and store the data in a database.
In the embodiment of the application, the purpose of converting the intercepted data into the data in the predetermined format is to convert the recorded dynamic data into static information for storage, and the data in the predetermined format is in a format suitable for storage in the database.
In this embodiment of the application, the recording server 41 may be an interceptor configured on the application server, and the predefined configuration information may be a pre-configured configuration file. The configuration content of the configuration file can include the IP identification of the online recording device, the online recording time length, which interfaces need to be recorded online, and the like, and the related configuration file can be pushed to the interceptor through the management system, and the interceptor starts to take effect. When a user sends a service request to an application server through a client, an interceptor intercepts the service request, and similarly, when the application server returns response data according to the service request, the interceptor intercepts the response data.
And the playback server 42 is used for reading the preset format data stored in the database, restoring the preset format data into the original format data, then performing playback processing, obtaining a regression test result and outputting the regression test result.
In the embodiment of the application, the purpose of restoring the predetermined format data into the original format data is to restore the stored static information into corresponding dynamic data so as to facilitate playback processing. In particular implementations, the playback processing of the playback server 42 may be triggered based on the playback instructions.
The system of the system regression test of the embodiment of the application can be applied to the development stage of the application system and also can be applied to the release stage of the application system so as to verify or check the performance of the system. Wherein the application system publication comprises a blue-green publication. For the application of the method in the release stage of the application system, reference may be made to the above first method embodiment, which is not described herein again.
In the system of the system regression test according to the embodiment of the present application, the recording server 41 intercepts the user traffic through predefined configuration information, performs format conversion on the user traffic, and then stores the user traffic, and performs playback processing on another specified device (i.e., the playback server 42), thereby implementing the online system regression test. Since only the recording server 41 and the related configuration need to be introduced for the application system, the whole deployment does not need to be modified greatly, and therefore, the intrusion of the application system is small.
As shown in fig. 5, the recording server 41 of the system regression testing system according to the embodiment of the present application specifically includes:
the data obtaining module 411 is configured to obtain, according to predefined configuration information, a service request sent by a client to an application server and response data returned by the application server for the service request.
And a format conversion module 412, configured to convert the service request and response data returned by the application server for the service request into data in a predetermined format. In the embodiment of the application, the purpose of converting the intercepted data into the data in the predetermined format is to convert the recorded dynamic data into static information for storage, and the data in the predetermined format is in a format suitable for storage in the database.
And a data storage module 413, configured to store the data in the predetermined format in a database.
In another embodiment, the recording server 41 may further include:
and a security desensitization module, configured to perform security desensitization processing on the service request and the response data returned by the application server for the service request before the format conversion module 412 converts the service request and the response data returned by the application server for the service request into data in a predetermined format. Since some user data are sensitive data, such as user telephone numbers, bank card numbers, etc., these data should not be directly stored in the database from the perspective of security design, so as to achieve reliable protection of the sensitive data.
In another embodiment, the format conversion module 412 converts the service request and the response data returned by the application server for the service request into data in a predetermined format, which may be, for example: and converting the service request and response data returned by the application server aiming at the service request into a preset format in an order cracking mode.
In another embodiment, the data storage module 413 stores the data in the predetermined format in a database, for example, the data may be: asynchronous operation or multithreading is started to store the data with the preset format into the database, so that the performance of an application system can be prevented from being influenced.
As shown in fig. 6, the playback server 51 of the system regression testing system of the embodiment of the present application includes:
the format restoring module 511 is configured to read the predetermined format data stored in the database and restore the predetermined format data to the original format data.
And the playback processing module 512 is configured to perform playback processing on the original format data to obtain a regression test result. The playback process may be, for example, a mock test. And the playback result can be obtained after the playback processing, the playback result is compared with the previous recording result, a report can be generated, and the report is the regression test result of the application system.
And a result output module 513, configured to output the regression test result. In another embodiment, the restoring the predetermined format data to the original format data may include: and restoring the data in the preset format into the data in the original format in a deserialization mode. For example, the original format data is jvm object data, which becomes static information after serialization and stores the static information in the database, and the static information can be restored to jvm object by deserialization.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate a dedicated integrated circuit chip 2. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Language Description Language), traffic, pl (core unified Programming Language), HDCal, JHDL (Java Hardware Description Language), langue, Lola, HDL, laspam, hardbyscript Description Language (vhr Description Language), and the like, which are currently used by Hardware compiler-software (Hardware Description Language-software). It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic for the memory.
Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be considered a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
From the above description of the embodiments, it is clear to those skilled in the art that the present application can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments of the present application.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
While the present application has been described with examples, those of ordinary skill in the art will appreciate that there are numerous variations and permutations of the present application without departing from the spirit of the application, and it is intended that the appended claims encompass such variations and permutations without departing from the spirit of the application.