CN117349153A - Data recording and playback platform, method, electronic device and storage medium - Google Patents
Data recording and playback platform, method, electronic device and storage medium Download PDFInfo
- Publication number
- CN117349153A CN117349153A CN202311248815.7A CN202311248815A CN117349153A CN 117349153 A CN117349153 A CN 117349153A CN 202311248815 A CN202311248815 A CN 202311248815A CN 117349153 A CN117349153 A CN 117349153A
- Authority
- CN
- China
- Prior art keywords
- recording
- playback
- data
- request
- module
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
- G06F9/548—Object oriented; Remote method invocation [RMI]
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Software Systems (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application relates to a data recording and playback platform, a method, an electronic device and a storage medium, wherein the data recording and playback method comprises the following steps: the method comprises the steps that configuration information is added to a port through deployment of a data recording tool at the front end of an application program; the method comprises the steps of issuing a data event by acquiring a user request, recording the data event in a set environment, and generating a recording file; the method and the device have the advantages that the technical problems that software testing needs to prepare test data, scripts are written and coverage rate is low are solved, greatly simplified testing workload is realized, and working efficiency is greatly improved.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data recording and playback platform, a method, an electronic device, and a storage medium.
Background
Software testing is an important means of software quality assurance, and is classified into manual testing and automated testing in terms of execution mode. Rapid iteration and rapid delivery force one to want to improve efficiency through automated testing. Regression testing refers to re-testing after modifying the original code to determine that the modification did not introduce new errors or caused other code to produce errors. Compared with a manual regression test, the automatic regression test can greatly reduce the upgrade and reconstruction cost in the software development process. Regression testing is performed every time a full upgrade is performed, with considerable effort and difficulty.
The manual operation is used for inputting various parameter values for testing, and the case message data needs to be manually configured, and the case execution and the verification result are carried out one by one. With the increase of the complexity of the interface message and the number of interfaces, the implementation of the complete interface test is quite complex, the test coverage degree is limited, and the working efficiency is low. In addition, in the current multi-version test and multi-environment test, the prior art needs to maintain different use cases in different test environments, and can not well multiplex the same use case to different test environments, and needs to input additional labor cost to perform use case maintenance.
Conventional automated test tools need to prepare test data, write scripts, and have low coverage, so that the requirements of regression verification after reconstruction cannot be met. Although the regression test path priority can be calculated, the test cases with high priority can be selectively executed, commercial software cannot pass through any function test point, and the test is required to be fully covered.
Aiming at the technical problems that software testing in the related technology needs to prepare test data, write scripts and is low in coverage rate, no effective solution is proposed at present.
Disclosure of Invention
The embodiment provides a data recording and playback platform, a method, an electronic device and a storage medium, so as to solve the problems that software testing needs to prepare test data, script is written and coverage rate is not high in the related technology.
In a first aspect, in this embodiment, there is provided a data recording and playback platform, where the data recording and playback platform is provided with: the configuration module is used for adding configuration information to the interface by deploying a data recording tool at the front end of the application program; the recording module is used for acquiring a user request according to the interface, issuing a data event, recording the data event in a set environment and generating a recording file; and the playback module is used for acquiring a playback request, determining the recorded file according to the playback request, processing the recorded file, generating a playback file, and placing the playback file in a test environment for playback.
In some of these embodiments, the configuration module further comprises: the monitoring sub-module is used for deploying the data recording tool to the application program server, carrying out mounting of the service processing module and realizing monitoring of the service request interface; the building sub-module is used for configuring the target environment, the target application and the target interface information to be monitored, and building the heartbeat after the configuration is completed.
In some embodiments, the recording module includes: the sampling sub-module is used for filtering, sampling calculation and format processing of the data event to generate the recording file; and the storage sub-module is used for carrying out recording request, response and sub-call on the user request meeting the recording condition, and processing and storing after serialization.
In some embodiments, the data recording playback platform further comprises: and the result comparison module is used for comparing the result of the playback test with the original result to generate a report.
In a second aspect, in this embodiment, there is provided a data recording playback method, including:
the method comprises the steps that configuration information is added to a port through deployment of a data recording tool at the front end of an application program; the method comprises the steps of issuing a data event by acquiring a user request, recording the data event in a set environment, and generating a recording file; and acquiring a playback request, determining the recorded file according to the playback request, processing the recorded file to generate a playback file, and placing the playback file in a test environment for playback.
In some embodiments, the adding configuration information to the interface by deploying a data recording tool at the front end of the application program includes: the data recording tool is deployed to an application server to carry out the mounting of the service processing module, so that the monitoring of the service request interface is realized; and configuring the target environment, the target application and the target interface information to be monitored, and establishing heartbeat after the configuration is completed.
In some embodiments, the step of issuing the data event by obtaining the user request, recording the data event in the setting environment, and generating the recording file includes: filtering, sampling calculation and format processing are carried out on the data event, and the recording file is generated; and carrying out recording request, response and sub-call on the user request meeting the recording condition, and processing and storing after serialization.
In some of these embodiments, the method further comprises: and comparing the result of the playback test with the original result to generate a report.
In a third aspect, in this embodiment, there is provided an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the data recording and playback method according to the second aspect.
In a fourth aspect, in this embodiment, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the data recording playback method of the second aspect described above.
Compared with the related art, the data recording and playback platform, the method, the electronic device and the storage medium provided in the embodiment add configuration information to the interface by deploying a data recording tool at the front end of an application program; the method comprises the steps of issuing a data event by acquiring a user request, recording the data event in a set environment, and generating a recording file; the method comprises the steps of obtaining a playback request, determining a recorded file according to the playback request, processing the recorded file, generating the playback file, and placing the playback file in a test environment for playback, so that the technical problems that software test needs to prepare test data, scripts are written and coverage rate is low in the prior art are solved, greatly simplified test workload is realized, and the technical effect of working efficiency is greatly improved.
The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below to provide a more thorough understanding of the other features, objects, and advantages of the application.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute an undue limitation to the application. In the drawings:
fig. 1 is a hardware configuration block diagram of a terminal that performs a data recording playback method of the present embodiment;
fig. 2 is a frame diagram of a data recording and playback platform according to the present embodiment;
fig. 3 is a flowchart of a data recording playback method according to the present embodiment;
FIG. 4 is a software architecture diagram of a data recording and playback system according to the preferred embodiment;
FIG. 5 is a flow chart of a method of recording and playback of data in accordance with the preferred embodiment;
FIG. 6 is a schematic diagram of a data recording process according to the preferred embodiment;
fig. 7 is a schematic diagram of a data playback process according to the preferred embodiment.
Detailed Description
For a clearer understanding of the objects, technical solutions and advantages of the present application, the present application is described and illustrated below with reference to the accompanying drawings and examples.
Unless defined otherwise, technical or scientific terms used herein shall have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terms "a," "an," "the," "these," and the like in this application are not intended to be limiting in number, but rather are singular or plural. The terms "comprising," "including," "having," and any variations thereof, as used in the present application, are intended to cover a non-exclusive inclusion; for example, a process, method, and system, article, or apparatus that comprises a list of steps or modules (units) is not limited to the list of steps or modules (units), but may include other steps or modules (units) not listed or inherent to such process, method, article, or apparatus. The terms "connected," "coupled," and the like in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. Reference to "a plurality" in this application means two or more. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., "a and/or B" may mean: a exists alone, A and B exist together, and B exists alone. Typically, the character "/" indicates that the associated object is an "or" relationship. The terms "first," "second," "third," and the like, as referred to in this application, merely distinguish similar objects and do not represent a particular ordering of objects.
The method embodiments provided in the present embodiment may be executed in a terminal, a computer, or similar computing device. For example, the terminal is operated, and fig. 1 is a block diagram of the hardware structure of the terminal for executing a data recording playback method of the present embodiment. As shown in fig. 1, the terminal may include one or more (only one is shown in fig. 1) processors 102 and a memory 104 for storing data, wherein the processors 102 may include, but are not limited to, a microprocessor MCU, a programmable logic device FPGA, or the like. The terminal may also include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 1 is merely illustrative and is not intended to limit the structure of the terminal. For example, the terminal may also include more or fewer components than shown in fig. 1, or have a different configuration than shown in fig. 1.
The memory 104 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a data recording and playback method in the present embodiment, and the processor 102 executes the computer program stored in the memory 104 to perform various functional applications and data processing, that is, to implement the above-mentioned method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. The network includes a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
Hereinafter, steps involved in the automated test method according to the exemplary embodiment of the present invention will be explained and illustrated in detail with reference to the accompanying drawings.
First, the proper nouns involved in the present invention are explained as follows:
http interface: the interface for communication between the client and the server provides data display for the page of the client and provides an entry for the data filled in by the user at the client to be submitted to the system.
Test scenario: from the use angle of a user, abstract generalized function points, such as user login, are a scene; wherein, the test scene implementation depends on interfaces, and complex scenes can be realized by cooperation of a plurality of interfaces.
Client side: or called a user side, a program for providing local services for clients, such as an application program page widely used in the mobile internet era, and functions of scenes on the page can include data presentation, data deletion, data modification and the like. The operation function on the page can send an Http request to the server, and the Java method for analyzing the Http request and making a reply is the Http interface.
The server side: the server runs on the server of the service provider and communicates with the client using a network protocol as opposed to the client running locally on the client only.
On-line flow rate: data collected by the online server is transmitted to the online server by a network protocol using the generated data on the client by the user.
Micro-services: micro-service architecture is a new technology for deploying applications and services in the cloud. The micro-service may run in a "self-program" and communicate with the Http-type API through a "lightweight device". The key is that the service can run in its own program. By this we can distinguish service disclosures from micro-service frameworks (distributing an API in existing systems). In service disclosure, many services may be limited by internal independent processes. If any one of the services needs to add a certain function, the process must be narrowed. In a micro-service architecture, only the required functionality needs to be added to a particular service, without affecting the overall process architecture.
API: an API (Application-Programming-Interface) is a number of predefined functions or conventions that refer to the engagement of different components of a software system. The objective is to provide the application and developer the ability to access a set of routines based on some software or hardware without having to access the native code or understand the details of the internal operating mechanisms.
In this embodiment, a data recording and playback platform is provided, and the terms "module," "unit," "subunit," and the like are used below to implement a combination of software and/or hardware for a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementations in hardware, or a combination of software and hardware, are also possible and contemplated.
The following modules may be functional modules or program modules, and may be implemented by software or hardware. For modules implemented in hardware, the various modules described below may be located in the same processor; or the various modules described below may be located in different processors, respectively, in any combination.
Fig. 2 is a frame diagram of a data recording and playback platform according to the present embodiment, and when recording or playing back data is required, a user may configure recording conditions and/or playback conditions in the data recording and playback platform shown in fig. 2 according to the need, so as to automatically complete recording, playback and testing of data. As shown in fig. 2, the data recording playback platform is provided with: a configuration module 10, a recording module 20 and a playback module 30; firstly, the recording module collects the environment (such as an online environment) of the data to generate recording data, then the recording data is played back in another environment (such as a test environment) to generate playback data, and then the recording data and the playback data are automatically compared to generate test result data.
The configuration module 10 is configured to add configuration information to an interface by deploying a data recording tool at the front end of an application program, the recording module 20 is configured to acquire a user request according to the interface, issue a data event, record the data event in a set environment to generate a recording file, and the playback module 30 is configured to acquire a playback request, determine the recording file according to the playback request, process the recording file to generate a playback file, and place the playback file in a test environment for playback.
In some of these embodiments, the data recording tools may perform environmental data recording tasks for Kibana, jvm-sadbox-repeater repeater, goreplay, hua Cheng cloud, and other data recording tools.
In this embodiment, the data recording tool is a microservice-Sandbox-repeater.
In some of these embodiments, the configuration module 10 further comprises: the monitoring sub-module 11 is used for deploying the data recording tool to the application server, carrying out the mounting of the service processing module and realizing the monitoring of the service request interface; the establishing sub-module 12 is configured to configure the target environment, the target application and the target interface information to be monitored, and establish the heartbeat after the configuration is completed.
In some embodiments, the recording module 20 includes a sampling sub-module 21 and a saving sub-module 22, where the sampling sub-module 21 is configured to perform filtering, sampling calculation and format processing on the data event to generate a recording file; the save sub-module 22 is configured to perform recording request, response and sub-call on the user request meeting the recording condition, and perform processing and save after serialization.
Specifically, the recording module 20 is a repeater, performs filtering and sampling calculation on the event, copies the copy request meeting the copy condition, copies the configuration parameter and the response value corresponding to the copy request and the sub-call and the response value sent through the Http interface or the remote procedure call interface or the Java method interface, and obtains the scene test data.
In some embodiments, the data recording and playback platform further includes a result comparison module, where the result comparison module is configured to compare a result of the playback test with an original result to generate a report.
In this embodiment, a data recording and playback method is provided, and the device for executing the data recording and playback method may be a mobile phone, a computer, a server, or other intelligent terminals capable of recording environmental data and playing back data according to the environmental data. Fig. 3 is a flowchart of a data recording playback method according to the present embodiment, as shown in fig. 3, the flowchart includes the following steps:
in step S302, the configuration information is added to the interface by deploying the data recording tool at the front end of the application.
In this embodiment, the data recording tool is a micro service-Sandbox-repeater, and the micro service-Sandbox-repeater module is installed under the business module of the Java-type application. And the micro-service-sadbox sandbox technology is used, the micro-service-sadbox sandbox technology is mounted on an application in a java agent or attach mode, the repeater repeat module records or plays back data according to configured rules, and the console LED module is mainly responsible for triggering and data interaction. Adding configuration information to the interface comprises configuring information such as a target environment, a target application, a target interface and the like to be monitored, and establishing a heartbeat after the configuration is completed.
Step S304, by acquiring the user request, issuing the data event, recording the data event in the set environment, and generating a recording file.
Specifically, the completion of monitoring the relevant service request interface includes the acquisition and recording of data such as the entry value, the return value and the like of the http, java, dubbo type interface; recording and storing the data monitored by the service module, providing a download address and supporting download and storing as an excel form; and acquiring interface data information of the application program by analyzing the excel form through codes, wherein the interface data information comprises information such as a request address, a request method, a request body, a status code, a response body and the like, and automatically generating an interface test case.
Step S306, a playback request is obtained, a recorded file is determined according to the playback request, the recorded file is processed, a playback file is generated, and the playback file is placed in a test environment for playback.
Specifically, through a request library in python, program circulation is utilized after the relevant information of the interface is acquired, and a relevant interface test case is assembled by a request address, a request method and a request head aiming at a get type request; executing the interface test cases, completing the execution work of the related interface test cases by using a request function through code circulation, taking the downloaded interface return data as an expected result, taking the execution result of the assembled cases as an actual result, and performing differential comparison on the two execution results; generating a test report, preparing a test report template, completing the rendering of the result of the interface test case execution to the test report through a jinja2 (template engine) library in python, and mainly displaying the information of the index such as the passing rate, response time, interface list, differential result and the like.
Through the steps, the logical correctness of the code is verified by copying the real data (i.e. data recording) on the line and then performing a simulation request (i.e. data playback) in the test environment. And comparing each sub-call difference with the entry call result one by one in the test environment playback through collecting the online data to find out whether the interface code has a problem. Regression testing with this mechanism has many advantages: the recorded data replaces the test cases, so that the method is simple and efficient, and rich test cases are easy to form; the data on the playback line can perfectly simulate the real behavior of the user, so that the variability of manual writing is avoided; in addition, the system logic can be verified deeply and finely by adopting an object comparison mode for the recorded data and the playback data; and finally, the recorded data is not required to be maintained and is taken and used at any time.
In some of these embodiments, adding configuration information to the interface by deploying a data recording tool at the front end of the application includes: the data recording tool is deployed to an application server to carry out the mounting of the service processing module, so that the monitoring of the service request interface is realized; and configuring the target environment, the target application and the target interface information to be monitored, and establishing heartbeat after the configuration is completed.
In some embodiments, the generating the recording file includes, by acquiring a user request, issuing a data event, recording the data event in a setting environment: filtering, sampling calculation and format processing are carried out on the data event, and a recording file is generated; and carrying out recording request, response and sub-call on the user request meeting the recording condition, and processing and storing after serialization.
In some embodiments, the data recording playback method further includes: and comparing the result of the playback test with the original result to generate a report.
The method and the device are based on the quick regression of the business (interface) taking the micro service (application) as a unit, and do not need to manually prepare test scripts and test data through automatic recording and playback. Intercepting a test request sent by a client, and inquiring configuration parameters corresponding to the test request according to a scene to be tested included in the test request; then determining a data acquisition path of the scene to be tested according to the configuration parameters, and acquiring scene test data required by the scene to be tested from a preset database according to the data acquisition path and the configuration parameters; the scene test data are obtained by recording real data of the on-line interface; finally, generating a test case according to the scene test data, and sending the test case to the client, so that the client can complete the test to be tested according to the test case without testing through a preset value corresponding to the scene to be tested, thereby obviously reducing time cost and labor cost caused by the need of simulating the preset value of each scene to be tested, avoiding the problem that the preset value cannot fully reflect the real test condition of the scene due to the fact that the data structure is complex, further enabling the accuracy of the test result to be lower, and bringing better experience to users.
The present embodiment is described and illustrated below by way of preferred embodiments.
Fig. 4 is a software architecture diagram of a data recording and playback system according to the preferred embodiment. As shown in fig. 4, the system for recording and playing back data includes: console LEDs, repeater and sandboxed container JVM-Sandbox; the console control desk LED comprises an application service, a recording service, a playback service and a comparison service; the repeater comprises an entry plugin, a sub-call plugin, a playback device, a core module and an event monitoring processor; the JVM-Sandbox comprises an event distribution processing module and an HTTP management interface module.
The application service comprises white list management, state management, heartbeat management, interface management and configuration management, the playback service comprises playback execution, result comparison, task management, data management and data statistics, the recording service comprises data cleaning, link series connection, interface extraction and data management, and the comparison service comprises noise reduction management and difference display.
The entrance plug-in is an HTTP interface, the sub-call plug-in comprises a Feign component, a Mybatis component, a Redisson component (distributed component), an ES component (big data component), an MQ component (message queue component) and an asynchronous call component, and the core module comprises a heartbeat module and an HTTP management module.
The event listening processor is used for listening to a Beform event (event Before method execution), a Return event (Return event) and a threads event (throw exception event).
Fig. 5 is a flowchart of a method of recording and playback of data in accordance with the preferred embodiment. As shown in fig. 5, the process of recording and playback of data may include the steps of:
in step S502, the data is recorded in the recording environment.
Specifically, the data recording method includes: copying configuration parameters sent by a user through an online interface and response values corresponding to the configuration parameters to obtain the scene test data; the online interface may include, among other things, an HTTP interface, a remote procedure call interface, a Java method interface, and so on.
Referring to fig. 6, a user operates on a page, generates a user request, and a micro-service receiving processing request includes an entry request and a sub-call; the sandbox senses the request release event; the repeater monitors the event and starts to process the monitored event, judges whether the event needs to be processed and whether the event can be processed or not, processes sampling calculation event filtering, if not, ends event tracking, if yes, distributes event processing according to the event type, the event type comprises a method pre-execution event (Before event), a Return event (Return event) and a throwing exception event (threads event), processes the method pre-execution event (Before event), processes the Return event (Return event) and the throwing exception event (threads event) after the method pre-execution event (Before event), ends event tracking, enters callback storage, and stores recording records in a control console LED.
In some embodiments, the repeater calculates the filtering and sampling of the event, copies the configuration parameter and the response value, and the sub-call and the response value, which are sent through the HTTP interface or the remote procedure call interface or the Java method interface and correspond to the copy request, for the copy request meeting the copy condition, and obtains the scene test data.
In some embodiments, when a tester performs regression testing on a target function of a target service in a testing environment, acquiring a plurality of operation requests of a user on an external system through a micro-service interface; the sand box senses the request release event and records the test data of the target function; recording test data of the target function in a recording environment, and recording associated information corresponding to each test data of the target function, wherein the associated information comprises called interface information, sub-called request information and response parameter information. The core capabilities of the repeater include general recording/playback capability/non-intrusive recording HTTP/Java/Dubbo in-reference/return value recording capability (business system unaware)/providing multi-threaded sub-call tracking based on TTL, call path entry request (HTTP/Dubbo/Java) traffic playback, sub-call (Java/Dubbo) return value Mock capability that tracks a request entirely.
In some embodiments, the data recording refers to intercepting and storing data calling the HTTP interface, and adding a unique ID and a sequential identification to each record. The flow playback refers to analyzing the recorded data according to the unique ID and the sequential identification, and sequentially playing back the data on the tested environment. The interface Diff is used for forwarding a request of a client by proxy HTTP request, and aims at consistency analysis of HTTP interface protocol messages, and the content comparison of HTTP Response Header and HTTP Response Body is included.
In some embodiments, when a sub-call set exists, whether the sub-call needs to be Mock (dummy function) is judged, and if the sub-call needs to be Mock, the execution result is directly replaced by the target test result.
Illustratively, the embodiment includes a plurality of micro services, such as micro service a, micro service B, and the following. The repeater filters and samples the event, records the request, the response, the sub-call and the response to the request meeting the recording condition, and notifies the console LED to process and store after serialization.
For example, when a redis (Remote Dictionary Server, remote dictionary service) plugin is enabled, a sub-request method, parameters and responses from a micro service A to a redis are recorded, when the micro service A sends a request to the redis again during playback, a repeater judges whether a Mock is needed, when the Mock is needed, a Mock request is spliced according to information in a playback context, and Mock response data is obtained through calculation of a Mock strategy. At present, the Mock is carried out by acquiring the response of a request with 100% similarity in source codes. And after the playback is finished, the repeater can serialize the playback information and the result and then inform the console LED to process and store.
In step S504, the recorded data is played back in the test environment.
Specifically, referring to fig. 7, the console receives a user request, and invokes the repeater interface to initiate a playback request; the repeater receives the request, newly builds a playback event, issues a message (pushes the event message to the inside), pulls the reverse-sequenced recording information (receives the message through the internal event bus), calls a console interface to acquire the recording record on the one hand, returns the recording information according to the input parameters of the repeater, and selects a proper playback device according to the entry type by using a flow distributor after the reverse-sequenced recording information is successfully acquired on the other hand, after the proper playback device is successfully acquired, puts the playback information into a cache, calls different playback devices to execute playback, and the playback device initiates a request of the same parameters according to the recording information, receives and processes the request through a micro service, senses the request through a sandbox, and issues the event; the micro-service finishes the request processing, the repeater acquires the request result, the thread tracking is finished, the request return result and the mock operation result are stored in a playback result object, the playback result is sent to the console, and the console stores the playback result; the repeater monitors events (monitors events in event bus), processes the events, if the events are events Before the sub-calling processing method is executed (Before events), continuously judges whether the events are mock, if the events are not processed, executing a false function (mock operation), and putting the execution result of the false function into a cache; if the event is a pre-processing method of the portal request, a pre-processing event (Before event) or a Return event (Return event) and a throwing exception event (threads event) are not processed.
The project environment, stable environment (steady state environment), production environment, java-based (object oriented programming language) can be supported in the data recording and playback method, and the method is not necessarily a micro-service; simulating the same request, playing back to our designated environment will result in a playback result. Screening target data to be played back from the recorded test data of the target function; and after the target function is online, playing back the target data in the test environment, and acquiring a target data playback result.
During playback, the user requests the playback interface of the console LED to clearly indicate which recorded data needs to be played back. The console LED then issues a playback task by invoking the repeater provide put playback task receive interface. During the process of executing the playback task, the repeater can reverse the recorded wraperrecord, make a request for the mounted task according to the same request of the information construction, and track the processing flow of the playback request so as to record the playback result and execute the Mock action.
Step S506, comparing the playback data with the recorded data, and carrying out monitoring statistics on the comparison result.
In the present embodiment, the target function is verified according to the target data playback result. Comparing the playback result with the recorded result, if the playback result is consistent with the recorded result, the recorded item interface is correct, and if the playback result is inconsistent with the recorded result, the recorded item interface is incorrect.
In the embodiment, the application environment is not limited, the sub-call is performed in the form of micro-service, and monitoring is performed in which link; interface testing is performed in an application environment. There is a mechanism for recording and playback to replace the original handwritten program.
It should be noted that the steps illustrated in the above-described flow or flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order other than that illustrated herein.
There is also provided in this embodiment an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, where the transmission device is connected to the processor, and the input/output device is connected to the processor.
Alternatively, in the present embodiment, the above-described processor may be configured to execute the following steps by a computer program:
s1, adding configuration information to the interface by deploying a data recording tool at the front end of an application program.
S2, by acquiring a user request, issuing a data event, recording the data event in a set environment, and generating a recording file.
And S3, acquiring a playback request, determining a recorded file according to the playback request, processing the recorded file, generating a playback file, and placing the playback file in a test environment for playback.
It should be noted that, specific examples in this embodiment may refer to examples described in the foregoing embodiments and alternative implementations, and are not described in detail in this embodiment.
In addition, in combination with the data recording and playback method provided in the above embodiment, a storage medium may be further provided in this embodiment. The storage medium has a computer program stored thereon; the computer program, when executed by a processor, implements any of the methods of the data recording playback apparatus of the above embodiments.
It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to be limiting. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present application, are within the scope of the present application in light of the embodiments provided herein.
It is evident that the drawings are only examples or embodiments of the present application, from which the present application can also be adapted to other similar situations by a person skilled in the art without the inventive effort. In addition, it should be appreciated that while the development effort might be complex and lengthy, it would nevertheless be a routine undertaking of design, fabrication, or manufacture for those of ordinary skill having the benefit of this disclosure, and thus should not be construed as an admission of insufficient detail.
The term "embodiment" in this application means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive. It will be clear or implicitly understood by those of ordinary skill in the art that the embodiments described in this application can be combined with other embodiments without conflict.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the patent. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.
Claims (10)
1. A data recording playback platform, characterized in that the data recording playback platform is provided with:
the configuration module is used for adding configuration information to the interface by deploying a data recording tool at the front end of the application program;
the recording module is used for acquiring a user request according to the interface, issuing a data event, recording the data event in a set environment and generating a recording file;
and the playback module is used for acquiring a playback request, determining the recorded file according to the playback request, processing the recorded file, generating a playback file, and placing the playback file in a test environment for playback.
2. The data recording playback platform of claim 1, wherein the configuration module further comprises:
the monitoring sub-module is used for deploying the data recording tool to the application program server, carrying out mounting of the service processing module and realizing monitoring of the service request interface;
the building sub-module is used for configuring the target environment, the target application and the target interface information to be monitored, and building the heartbeat after the configuration is completed.
3. The data recording playback platform of claim 1, wherein the recording module comprises:
the sampling sub-module is used for filtering, sampling calculation and format processing of the data event to generate the recording file;
and the storage sub-module is used for carrying out recording request, response and sub-call on the user request meeting the recording condition, and processing and storing after serialization.
4. The data recording playback platform of claim 1, wherein the data recording playback platform further comprises:
and the result comparison module is used for comparing the result of the playback test with the original result to generate a report.
5. A method of recording and playback of data, the method comprising:
the method comprises the steps that configuration information is added to a port through deployment of a data recording tool at the front end of an application program;
the method comprises the steps of issuing a data event by acquiring a user request, recording the data event in a set environment, and generating a recording file;
and acquiring a playback request, determining the recorded file according to the playback request, processing the recorded file to generate a playback file, and placing the playback file in a test environment for playback.
6. The method for recording and playing back data according to claim 5, wherein the adding configuration information to the interface by deploying a data recording tool at the front end of the application program comprises:
the data recording tool is deployed to an application server to carry out the mounting of the service processing module, so that the monitoring of the service request interface is realized;
and configuring the target environment, the target application and the target interface information to be monitored, and establishing heartbeat after the configuration is completed.
7. The method for recording and playing back data according to claim 5, wherein said generating a recording file by acquiring a user request, issuing a data event, recording said data event in a set environment comprises:
filtering, sampling calculation and format processing are carried out on the data event, and the recording file is generated;
and carrying out recording request, response and sub-call on the user request meeting the recording condition, and processing and storing after serialization.
8. The data recording playback method of claim 5, wherein the method further comprises:
and comparing the result of the playback test with the original result to generate a report.
9. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the data recording playback method of any one of claims 5 to 8.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the data recording playback method of any one of claims 5 to 8.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311248815.7A CN117349153A (en) | 2023-09-25 | 2023-09-25 | Data recording and playback platform, method, electronic device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202311248815.7A CN117349153A (en) | 2023-09-25 | 2023-09-25 | Data recording and playback platform, method, electronic device and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN117349153A true CN117349153A (en) | 2024-01-05 |
Family
ID=89362312
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202311248815.7A Pending CN117349153A (en) | 2023-09-25 | 2023-09-25 | Data recording and playback platform, method, electronic device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN117349153A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119383106A (en) * | 2024-10-29 | 2025-01-28 | 中国民航信息网络股份有限公司 | A system for microservice interface testing |
| CN119537148A (en) * | 2024-11-20 | 2025-02-28 | 北京航空航天大学 | Distributed system deterministic data recording and playback method, device and medium based on event causality |
-
2023
- 2023-09-25 CN CN202311248815.7A patent/CN117349153A/en active Pending
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119383106A (en) * | 2024-10-29 | 2025-01-28 | 中国民航信息网络股份有限公司 | A system for microservice interface testing |
| CN119383106B (en) * | 2024-10-29 | 2025-10-17 | 中国民航信息网络股份有限公司 | System for testing micro-service interface |
| CN119537148A (en) * | 2024-11-20 | 2025-02-28 | 北京航空航天大学 | Distributed system deterministic data recording and playback method, device and medium based on event causality |
| CN119537148B (en) * | 2024-11-20 | 2025-11-07 | 北京航空航天大学 | Distributed system deterministic data recording and playback method, equipment and medium based on event causality relationship |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111159049B (en) | Automatic interface testing method and system | |
| US6772107B1 (en) | System and method for simulating activity on a computer network | |
| CN107302476B (en) | Automatic testing method and system for testing asynchronous interactive system | |
| CN113672441B (en) | Method and device for testing intelligent equipment | |
| CN108228444B (en) | Test method and device | |
| CN110750458A (en) | Big data platform testing method and device, readable storage medium and electronic equipment | |
| CN117349153A (en) | Data recording and playback platform, method, electronic device and storage medium | |
| CN110119350A (en) | Software Development Kit test method, device and equipment and computer storage medium | |
| CN112948195A (en) | Interface testing method and device, electronic equipment and storage medium | |
| CN111930625A (en) | Log obtaining method, device and system based on cloud service platform | |
| CN111400127A (en) | Service log monitoring method and device, storage medium and computer equipment | |
| CN114546814A (en) | Recording playback method, recording playback device and storage medium | |
| CN104468288A (en) | Terminal network data testing method and device | |
| CN111324480A (en) | Large host transaction fault positioning system and method | |
| CN116112413B (en) | Testing methods, systems, devices, storage media, and electronic equipment for network devices | |
| CN116074228B (en) | Network card testing method, device, storage medium and electronic equipment | |
| CN107577600A (en) | A kind of method of testing of equipment, device and computer equipment | |
| CN115237808A (en) | Software online test method, device and system | |
| CN114253823B (en) | Distributed test method and related equipment | |
| CN113934552A (en) | Method and device for determining function code, storage medium and electronic device | |
| CN112650815A (en) | Method and device for synchronizing environmental data, storage medium and electronic device | |
| CN114706738B (en) | Method and device for automatically burying points at client | |
| EP4369203A1 (en) | Cloud platform docking debugging method and apparatus, and electronic device and storage medium | |
| CN117453529A (en) | Automatic testing method and system based on meta universe | |
| CN118550839B (en) | Embedded automatic test system and test method thereof |
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 |