CN114546830A - Regression testing method, regression testing device, electronic equipment and storage medium - Google Patents

Regression testing method, regression testing device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114546830A
CN114546830A CN202210066502.9A CN202210066502A CN114546830A CN 114546830 A CN114546830 A CN 114546830A CN 202210066502 A CN202210066502 A CN 202210066502A CN 114546830 A CN114546830 A CN 114546830A
Authority
CN
China
Prior art keywords
service
request
downstream
tested
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
Application number
CN202210066502.9A
Other languages
Chinese (zh)
Inventor
张晓明
孟文龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202210066502.9A priority Critical patent/CN114546830A/en
Publication of CN114546830A publication Critical patent/CN114546830A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The disclosure provides a regression testing method, a regression testing device, electronic equipment and a storage medium, and relates to the field of software testing and other internet, wherein the method comprises the following steps: recording corresponding real traffic of online service from a network layer aiming at a module to be tested needing regression testing in a system, wherein the real traffic comprises client request traffic and downstream dependence request traffic; and performing playback test on the tested service corresponding to the module to be tested based on the client request flow, and performing mock on the downstream dependent service of the tested service based on the downstream dependent request flow. By applying the scheme disclosed by the invention, the service intrusion can be avoided, the communication overhead is reduced, the system stability is ensured and the like.

Description

Regression testing method, regression testing device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of internet, and in particular, to a regression testing method and apparatus, an electronic device, and a storage medium in the field of software testing.
Background
In the regression test, in order to solve the problems of comprehensiveness of test cases, high environment construction cost and the like, a traffic recording playback technology can be adopted, namely, the real traffic of online services (namely online applications) is automatically copied and played back in a test environment.
In the current traffic recording and playback mode, traffic recording is achieved by capturing an interface call behavior initiated inside a service through invading the inside of the service, or a layer of middleware is added in a service topology, and the middleware stores and forwards traffic on a link. However, the former method can only be implemented for some specific languages and has a certain intrusiveness on services, and the latter method increases communication overhead and system stability risk due to the addition of a layer of network interaction in the service topology.
Disclosure of Invention
The disclosure provides a regression testing method, a regression testing device, an electronic device and a storage medium.
A regression testing method, comprising:
recording corresponding real traffic of online service from a network layer aiming at a module to be tested needing regression testing in a system, wherein the real traffic comprises client request traffic and downstream dependence request traffic;
and performing playback test on the tested service corresponding to the module to be tested based on the client request flow, and performing analog mock on the downstream dependent service of the tested service based on the downstream dependent request flow.
A regression testing apparatus comprising: a recording module and a playback module;
the recording module is used for recording corresponding real traffic of the online service from a network layer aiming at a module to be tested needing regression testing in the system, wherein the real traffic comprises client request traffic and downstream dependence request traffic;
and the playback module is used for carrying out playback test on the tested service corresponding to the module to be tested based on the client request flow and carrying out mock on the downstream dependent service of the tested service based on the downstream dependent request flow.
An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method as described above.
A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method as described above.
A computer program product comprising computer programs/instructions which, when executed by a processor, implement a method as described above.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a flow chart of an embodiment of a regression testing method according to the present disclosure;
FIG. 2 is a schematic diagram of a multi-module regression test scenario according to the present disclosure;
FIG. 3 is a diagram illustrating the effect of combining the values corresponding to the same key according to the disclosure;
FIG. 4 is a schematic diagram of an overall implementation process of the regression testing method according to the present disclosure;
FIG. 5 is a schematic diagram of a component structure of an embodiment 500 of a regression testing apparatus according to the present disclosure;
FIG. 6 illustrates a schematic block diagram of an electronic device 600 that may be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In addition, it should be understood that the term "and/or" herein is merely one type of association relationship that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
FIG. 1 is a flow chart of an embodiment of a regression testing method according to the present disclosure. As shown in fig. 1, the following detailed implementation is included.
In step 101, for a module to be tested that needs to perform regression testing in the system, recording real traffic of a corresponding online service from a network layer, including client request traffic and downstream dependent request traffic.
In step 102, a playback test is performed on a service to be tested corresponding to the module to be tested based on the client request traffic, and a simulation (mock) is performed on a downstream dependent service of the service to be tested based on the downstream dependent request traffic.
In the scheme of the embodiment of the method, the real traffic of the online service, including the client request traffic and the downstream dependent request traffic, can be recorded from the network layer, and the playback test of the tested service and the mock of the downstream dependent service can be realized based on the recorded real traffic, so that the service intrusion is avoided, the development language of the service is not required, the method has wide applicability, the communication overhead is reduced, the system stability is ensured, and the like.
In practical applications, the number of the modules to be tested that need to be regression tested in the system may be one, or may be multiple, and the number of the modules to be tested corresponds to a regression test scenario of a single module and a regression test scenario of multiple modules, respectively.
For a regression test scene of a single module, only a client request flow and a downstream dependence request flow of a module to be tested need to be recorded, a test environment of the module to be tested can be set up, all downstream dependence services of the module to be tested can be replaced by mock service (mock server), the recorded client request flows can be returned to the test environment according to the sequence of recording time from first to last, and the downstream dependence services use the downstream dependence request flows recorded together, so that the return value of the original function of the test environment is consistent with the online environment, and the read-write request can support playback, so that the regression test of the single module can be quickly realized.
FIG. 2 is a schematic diagram of a multi-module regression test scenario according to the present disclosure. As shown in fig. 2, for this scenario, a client request traffic and a downstream dependency request traffic of each module to be tested need to be recorded, the module to be tested may include a module m0, a module m11, and a module m12, and a multi-module test environment may be built, and the rest of the downstream dependency services that are not involved in change, such as the module m13, the module m21, the module m22, and the module m23 shown in fig. 2, may be replaced by a mock service. The ingress client request traffic to module m0 may be used for playback during the playback test.
In any of the above scenarios, for each module to be tested, the real traffic of the corresponding online service may be recorded from the network layer, that is, the real request of the online service, including the client request traffic and the downstream dependent request traffic, may be recorded.
In an embodiment of the present disclosure, a port of the online service may be used as a filter (filter) for copying network card traffic, and record a client request traffic, and a downstream dependent service and an address configured by the online service are used as a filter, and record a downstream dependent request traffic.
In addition, in practical application, the situation of machine resources can be monitored, the resources may include a Central Processing Unit (CPU), a Memory (Memory), a Disk (Disk), and the like, when it is monitored that an abnormality occurs or the load is greater than a predetermined threshold, the recording process may be stopped, and an alarm may be given, so that relevant personnel may handle the existing problem in time, thereby ensuring the continuation of recording and the quality of recording.
In an embodiment of the present disclosure, the recorded client request traffic and the downstream dependent request traffic may be analyzed into a predetermined format, and a predetermined optimization process may be performed on an analysis result.
The specific format of the predetermined format can be determined according to actual needs, subsequent processing can be facilitated by parsing into the predetermined format, and the specific processing of the predetermined optimization processing can also be determined according to actual needs, for example, a bad packet can be discarded, and the like, so that the accuracy of subsequent processing results is improved.
In one embodiment of the present disclosure, the client request traffic may include: client requests and corresponding responses, downstream dependent request traffic may include: the downstream dependency request and the corresponding response may be stored in a key-value manner, and the downstream dependency request and the corresponding response may be stored in a key-value manner.
The request and the corresponding response can be saved by adopting a key value pair mode in a Remote Dictionary service (Redis), the mode is simple to realize, and the subsequent reading access to the request and the response is convenient.
In an embodiment of the present disclosure, the values corresponding to the same key may also be merged, and the values are stored in a linked list form according to the sequence of the recording time from the first to the last.
Generally, in Redis, keys are not repeatable, and if the same key corresponds to a different value, the value recorded later will overwrite the previous value, resulting in a non-idempotent problem. After the above processing manner is adopted, the values corresponding to the same key may be merged, and the values are stored in a form of a linked list according to the sequence of the recording time from first to last, as shown in fig. 3, fig. 3 is a schematic diagram illustrating the effect of merging the values corresponding to the same key according to the present disclosure, where a value 1, a value 2, and the like represent the values corresponding to the same key. Because the sequence of different requests is stored when the client request flow and the downstream dependent request flow are recorded, correspondingly, the response corresponding to the same request can be stored in a form of a linked list according to the sequence of the recording time from the first to the last, so that the sequence of the client request and the sequence of the downstream dependent request are consistent, and when the client request is played back according to the time sequence, the corresponding downstream dependent request can be one-to-one.
Taking a regression test scenario of a single module as an example, for a module to be tested, playback test can be performed on a service to be tested corresponding to the module to be tested based on client request traffic, that is, client requests recorded on line can be sequentially sent to the service to be tested from first to last according to recording time.
The playback test may include a functional test, a performance test, and the like. The functional test may be a difference (diff) test, where the diff test is to compare whether returned content of the same interface in different versions or different environments meets expectations, for example, a difference between a response of a service under test to a sent client request and a recorded response may be obtained, and whether the difference meets expectations is determined. The performance test may refer to a performance test burst, or the like.
For any module to be tested, mock can be performed on the downstream dependent service of the service to be tested (the service to be tested corresponding to the module to be tested) based on the downstream dependent request traffic.
In an embodiment of the disclosure, a mock service may be started for any module to be tested, and the mock service may be used to obtain a downstream dependency request sent by the service to be tested, determine a response corresponding to the sent downstream dependency request through a downstream dependency request traffic corresponding to the module to be tested, and then return the response to the service to be tested.
After the mock service acquires the downstream dependency request sent by the tested service, the response corresponding to the acquired downstream dependency request can be determined by inquiring the stored key value pair of the downstream dependency request flow corresponding to the module to be tested, and then the response can be returned to the tested service.
Through mock service, the downstream dependent service of the tested service is not required to be built, so that the testing efficiency is improved.
In practical applications, only a portion of the mock downstream dependent service, i.e., a portion of the modules, may be needed, while the remaining modules wish to adopt a real environment.
Correspondingly, in an embodiment of the present disclosure, the mock service may be further configured to, if it is determined that a module corresponding to a downstream dependency request sent by the tested service is a module requiring mock, determine, through a downstream dependency request traffic corresponding to the module to be tested, a response corresponding to the sent downstream dependency request, and return the response to the tested service, otherwise, obtain, through accessing a downstream real environment of the module corresponding to the sent downstream dependency request, a response corresponding to the sent downstream dependency request, and return the response to the tested service.
Whether each module (each module required in the test) needs a mock and address information of a downstream real environment can be configured in advance through a configuration file. Therefore, after the mock service acquires any downstream dependency request sent by the tested service, whether the module corresponding to the downstream dependency request is a module needing mock can be determined according to the configuration file, if the module needing mock is the module needing mock, the response corresponding to the downstream dependency request can be determined through the corresponding downstream dependency request flow and returned to the tested service, if the module not needing mock is not the module needing mock, the response corresponding to the downstream dependency request can be obtained through accessing the downstream real environment of the module and returned to the tested service, and the module not needing mock can directly penetrate the downstream real environment.
By means of the configuration file, whether the modules need to perform mock can be flexibly configured, so that different scene requirements can be met, and more accurate response and the like can be obtained based on a downstream real environment.
As previously mentioned, the playback test may include a functional test. In an embodiment of the present disclosure, for any client request sent to a service under test, a corresponding functional test case (case) may also be generated respectively.
The generated functional test case can be used for performing secondary regression test on the module to be tested subsequently, test data are enriched, and test effects are improved.
In an embodiment of the present disclosure, the manner of generating the functional test case may include: and acquiring a first log record generated aiming at the current client request from the service to be tested, acquiring a second log record generated aiming at the current client request from the mock service, integrating the first log record and the second log record, and generating the function test case according to an integration result.
The first log record may record a request and a response used by the service side to be tested for the current client request, for example, the obtained client request and a response corresponding to the obtained client request may be included, and the second log record may record a request and a response used by the mock service side for the current client request, for example, the obtained downstream dependency request and a response corresponding to the obtained downstream dependency request may be included.
The first log record and the second log record can be integrated, and a required functional test case can be generated according to an integration result. How the integration is performed is not limiting. In addition, how to generate the required functional test case according to the integration result is also not limited, for example, the integration result may be converted into a predetermined format, or some other information may be further added to the integration result, where the other information may include a recorded response and the like.
After the integration is completed, reset requests can be sent to the tested service and the mock service respectively to inform the tested service and the mock service to clear the log records generated before and prepare for processing the next client request.
In summary, fig. 4 is a schematic diagram of an overall implementation process of the regression testing method according to the present disclosure.
As shown in fig. 4, taking the existence of only one module to be tested as an example, the real traffic of the online service corresponding to the module to be tested may be recorded from the network layer, where the real traffic includes a client request traffic and a downstream dependent request traffic, where the client request traffic includes: client requests and corresponding responses, downstream dependent request traffic comprising: downstream dependency requests and corresponding responses.
As shown in fig. 4, the recorded client request traffic and the downstream dependency request traffic may be stored separately, and the client request and the corresponding response may be stored in a key-value pair manner, and the downstream dependency request and the corresponding response may be stored in a key-value pair manner. Before storing, the recorded client request flow and the downstream dependent request flow can be analyzed into a preset format, and preset optimization processing can be carried out on the analysis result.
As shown in fig. 4, playback test may be performed on a service to be tested corresponding to a module to be tested by using the recorded client request traffic, and mock may be performed on a downstream dependent service of the service to be tested based on the recorded downstream dependent request traffic. For example, the client requests recorded on line can be sequentially sent to the service to be tested according to the sequence of the recording time from the beginning to the end. In addition, a mock service can be started, and the mock service can be used for acquiring a downstream dependency request sent by the tested service, determining a response corresponding to the downstream dependency request through the stored downstream dependency request flow, returning the response to the tested service, and the like.
For other specific implementations, reference may be made to the foregoing description, which is not repeated.
In a word, the regression testing method can avoid service intrusion, has no requirement on service development language, has wide applicability, reduces communication overhead and ensures system stability, and in addition, can avoid or reduce the establishment of downstream dependent services, further improves testing efficiency and the like.
It is noted that while for simplicity of explanation, the foregoing method embodiments are described as a series of acts, those skilled in the art will appreciate that the present disclosure is not limited by the order of acts, as some steps may, in accordance with the present disclosure, occur in other orders and concurrently. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required for the disclosure.
The above is a description of embodiments of the method, and the embodiments of the apparatus are further described below.
Fig. 5 is a schematic structural diagram illustrating a regression testing apparatus 500 according to an embodiment of the present disclosure. As shown in fig. 5, includes: a recording module 501 and a playback module 502.
The recording module 501 is configured to record, from the network layer, a corresponding real traffic of the online service, including a client request traffic and a downstream dependency request traffic, for a module to be tested that needs to perform a regression test in the system.
The playback module 502 is configured to perform playback test on a service to be tested corresponding to a module to be tested based on the client request traffic, and perform mock on a downstream dependent service of the service to be tested based on the downstream dependent request traffic.
In the scheme of the embodiment of the device, the real traffic of the online service, including the client request traffic and the downstream dependent request traffic, can be recorded from the network layer, and the playback test of the tested service and the mock of the downstream dependent service can be realized based on the recorded real traffic, so that the intrusion to the service is avoided, no requirement is made on the development language of the service, the device has wide applicability, the communication overhead is reduced, the system stability is ensured, and the like.
In practical applications, the number of the modules to be tested that need to be regression tested in the system may be one, or may be multiple, and the number of the modules to be tested corresponds to a regression test scenario of a single module and a regression test scenario of multiple modules, respectively.
In any scenario, for each module to be tested, the real traffic of the corresponding online service can be recorded from the network layer, that is, the real request of the online service, including the client request traffic and the downstream dependent request traffic, can be recorded.
In an embodiment of the present disclosure, the recording module 501 may use a port of the online service as a filter for the traffic of the copy network card, record the request traffic of the client, use a downstream dependent service configured by the online service and an address as a filter, and record the downstream dependent request traffic.
In an embodiment of the present disclosure, the recording module 501 may further analyze the recorded client request traffic and the downstream dependency request traffic into a predetermined format, and perform predetermined optimization processing on an analysis result.
In one embodiment of the present disclosure, the client request traffic may include: client requests and corresponding responses, downstream dependent request traffic may include: the downstream dependency request and the corresponding response may be stored in a key-value pair manner, and the downstream dependency request and the corresponding response may be stored in a key-value pair manner.
That is, the key value pair in Redis can be used to store the request and the corresponding response.
In an embodiment of the present disclosure, the recording module 501 may further merge values corresponding to the same key, and store the values in a linked list form according to the sequence of the recording time from first to last.
Generally, in Redis, keys are not repeatable, and if the same key corresponds to a different value, the value recorded later will overwrite the previous value, resulting in a non-idempotent problem. After the processing mode is adopted, the values corresponding to the same key can be combined, and the values are stored in a linked list form according to the sequence of the recording time from first to last, so that the problem of non-idempotent and the like is avoided.
The playback module 502 may perform playback test on the service to be tested corresponding to the module to be tested based on the client request traffic, and may perform mock on the downstream dependent service of the service to be tested based on the downstream dependent request traffic.
Taking the regression test scenario of a single module as an example, for the module to be tested, the playback module 502 may sequentially send the client requests recorded online to the service to be tested in the sequence of the recording time from the first to the last. The playback test may include a functional test, a performance test, and the like.
In addition, in an embodiment of the present disclosure, for any module to be tested, the playback module 502 may start a mock service, where the mock service may be used to obtain a downstream dependency request sent by the service to be tested, determine a response corresponding to the sent downstream dependency request through a downstream dependency request traffic corresponding to the module to be tested, and return the response to the service to be tested.
After the mock service acquires the downstream dependency request sent by the tested service, the response corresponding to the acquired downstream dependency request can be determined by inquiring the stored key value pair of the downstream dependency request flow corresponding to the module to be tested, and then the response can be returned to the tested service.
In practical applications, only a portion of the mock downstream dependent service, i.e., a portion of the modules, may be needed, while the remaining modules wish to adopt a real environment.
Correspondingly, in an embodiment of the present disclosure, the mock service may be further configured to, if it is determined that a module corresponding to a downstream dependency request sent by the tested service is a module requiring mock, determine, through a downstream dependency request traffic corresponding to the module to be tested, a response corresponding to the sent downstream dependency request, and return the response to the tested service, otherwise, obtain, through accessing a downstream real environment of the module corresponding to the sent downstream dependency request, a response corresponding to the sent downstream dependency request, and return the response to the tested service.
Whether each module needs the mock and the address information of the downstream real environment can be configured in advance through a configuration file. Therefore, after the mock service acquires any downstream dependency request sent by the tested service, whether the module corresponding to the downstream dependency request is a module needing mock can be determined according to the configuration file, if the module needing mock is the module needing mock, the response corresponding to the downstream dependency request can be determined through the corresponding downstream dependency request flow and returned to the tested service, if the module not needing mock is not the module needing mock, the response corresponding to the downstream dependency request can be obtained through accessing the downstream real environment of the module and returned to the tested service, and the module not needing mock can directly penetrate the downstream real environment.
As previously mentioned, the playback test may include a functional test. In an embodiment of the present disclosure, the playback module 502 may further generate corresponding functional test cases for any client request sent to the service under test.
In an embodiment of the present disclosure, the manner of generating the functional test case may include: and acquiring a first log record generated aiming at the current client request from the service to be tested, acquiring a second log record generated aiming at the current client request from the mock service, integrating the first log record and the second log record, and generating the function test case according to an integration result.
The specific work flow of the apparatus embodiment shown in fig. 5 may refer to the related description in the foregoing method embodiment, and is not repeated.
In a word, the regression testing device can avoid service intrusion, has no requirement on the development language of the service, has wide applicability, reduces communication overhead and ensures system stability, and in addition, can avoid or reduce the establishment of downstream dependent services, and further improves testing efficiency and the like.
The traffic in the embodiments of the present disclosure is not specific to a particular user and does not reflect personal information of a particular user. In the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure and other processing of the personal information of the related user are all in accordance with the regulations of related laws and regulations and do not violate the good customs of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 6 illustrates a schematic block diagram of an electronic device 600 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the apparatus 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The calculation unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
A number of components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, a mouse, or the like; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The computing unit 601 performs the various methods and processes described above, such as the methods described in this disclosure. For example, in some embodiments, the methods described in this disclosure may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the methods described in the present disclosure may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured by any other suitable means (e.g., by means of firmware) to perform the methods described in the present disclosure.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server with a combined blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (21)

1. A regression testing method, comprising:
recording corresponding real traffic of online service from a network layer aiming at a module to be tested needing regression testing in a system, wherein the real traffic comprises client request traffic and downstream dependence request traffic;
and performing playback test on the tested service corresponding to the module to be tested based on the client request flow, and performing analog mock on the downstream dependent service of the tested service based on the downstream dependent request flow.
2. The method of claim 1, wherein the recording real traffic of the corresponding online service from the network layer comprises:
and taking the port of the online service as a filter of the copy network card flow, recording the client request flow, taking the downstream dependent service and the address configured by the online service as the filter, and recording the downstream dependent request flow.
3. The method of claim 1, further comprising:
and analyzing the recorded client request flow and the downstream dependent request flow into a preset format, and performing preset optimization processing on an analysis result.
4. The method of claim 1, 2, or 3,
the client request traffic comprises: client requests and corresponding responses;
the downstream dependency request traffic includes: a downstream dependency request and corresponding response;
the method further comprises the following steps: and storing the client request and the corresponding response in a key-value pair mode, and storing the downstream dependency request and the corresponding response in a key-value pair mode.
5. The method of claim 4, further comprising:
and combining the values corresponding to the same key, and storing the values in a linked list form according to the sequence of the recording time from the first to the last.
6. The method of claim 4, wherein the mock of downstream dependent services of the service under test based on the downstream dependent request traffic comprises:
and starting a mock service aiming at any module to be tested, wherein the mock service is used for acquiring a downstream dependence request sent by the tested service corresponding to the module to be tested, determining a response corresponding to the sent downstream dependence request through the flow of the downstream dependence request corresponding to the module to be tested, and returning the response to the tested service.
7. The method of claim 6, wherein,
the mock service is further configured to, if it is determined that the module corresponding to the issued downstream dependency request is the module requiring mock, determine, through the downstream dependency request traffic corresponding to the module to be tested, a response corresponding to the issued downstream dependency request, and return the response to the service to be tested, otherwise, obtain, through accessing the downstream real environment of the module corresponding to the issued downstream dependency request, a response corresponding to the issued downstream dependency request, and return the response to the service to be tested.
8. The method of claim 6, wherein,
the playback test comprises: functional testing;
the method further comprises the following steps: and respectively generating corresponding functional test cases for any client request sent to the tested service.
9. The method of claim 8, wherein the generating the corresponding functional test case comprises:
acquiring a first log record generated aiming at the client request from the tested service;
acquiring a second log record generated aiming at the client request from the mock service;
and integrating the first log record and the second log record, and generating the functional test case according to an integration result.
10. A regression testing apparatus comprising: a recording module and a playback module;
the recording module is used for recording corresponding real traffic of the online service from a network layer aiming at a module to be tested needing regression testing in the system, wherein the real traffic comprises client request traffic and downstream dependence request traffic;
and the playback module is used for carrying out playback test on the tested service corresponding to the module to be tested based on the client request flow and carrying out mock on the downstream dependent service of the tested service based on the downstream dependent request flow.
11. The apparatus of claim 10, wherein,
and the recording module records the request flow of the client by taking the port of the online service as a filter of the flow of the copy network card, and records the downstream dependent request flow by taking the downstream dependent service and the address configured by the online service as the filter.
12. The apparatus of claim 10, further comprising:
the recording module is further used for analyzing the recorded client request flow and the downstream dependency request flow into a preset format and performing preset optimization processing on an analysis result.
13. The apparatus of claim 10, 11 or 12,
the client request traffic comprises: a client request and a corresponding response;
the downstream dependency request traffic includes: a downstream dependency request and corresponding response;
the recording module is further used for storing the client request and the corresponding response in a key-value pair mode, and storing the downstream dependency request and the corresponding response in a key-value pair mode.
14. The apparatus of claim 13, wherein,
the recording module is further used for merging the values corresponding to the same key and storing the values in a linked list form according to the sequence of the recording time from first to last.
15. The apparatus of claim 13, wherein,
the playback module starts a mock service for any module to be tested, the mock service is used for obtaining a downstream dependency request sent by the service to be tested corresponding to the module to be tested, determining a response corresponding to the sent downstream dependency request according to the downstream dependency request flow corresponding to the module to be tested, and returning the response to the service to be tested.
16. The apparatus of claim 15, wherein,
the mock service is further configured to, if it is determined that the module corresponding to the issued downstream dependency request is the module requiring mock, determine, through the downstream dependency request traffic corresponding to the module to be tested, a response corresponding to the issued downstream dependency request, and return the response to the service to be tested, otherwise, obtain, through accessing the downstream real environment of the module corresponding to the issued downstream dependency request, a response corresponding to the issued downstream dependency request, and return the response to the service to be tested.
17. The apparatus of claim 15, wherein,
the playback test comprises: functional testing;
the playback module is further configured to generate corresponding functional test cases for any client request sent to the service under test.
18. The apparatus of claim 17, wherein,
the playback module acquires a first log record generated aiming at the client request from the tested service, acquires a second log record generated aiming at the client request from the mock service, integrates the first log record and the second log record, and generates the function test case according to the integration result.
19. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
20. A non-transitory computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any one of claims 1-9.
21. A computer program product comprising a computer program/instructions which, when executed by a processor, implement the method of any one of claims 1-9.
CN202210066502.9A 2022-01-20 2022-01-20 Regression testing method, regression testing device, electronic equipment and storage medium Pending CN114546830A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210066502.9A CN114546830A (en) 2022-01-20 2022-01-20 Regression testing method, regression testing device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210066502.9A CN114546830A (en) 2022-01-20 2022-01-20 Regression testing method, regression testing device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114546830A true CN114546830A (en) 2022-05-27

Family

ID=81671912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210066502.9A Pending CN114546830A (en) 2022-01-20 2022-01-20 Regression testing method, regression testing device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114546830A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002011A (en) * 2022-06-16 2022-09-02 平安普惠企业管理有限公司 Flow bidirectional test method and device, electronic equipment and storage medium
CN116028376A (en) * 2023-03-27 2023-04-28 云筑信息科技(成都)有限公司 Method for rapidly generating interface automation use cases based on flow recording

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002011A (en) * 2022-06-16 2022-09-02 平安普惠企业管理有限公司 Flow bidirectional test method and device, electronic equipment and storage medium
CN115002011B (en) * 2022-06-16 2023-12-08 湖北华中电力科技开发有限责任公司 Flow bidirectional test method and device, electronic equipment and storage medium
CN116028376A (en) * 2023-03-27 2023-04-28 云筑信息科技(成都)有限公司 Method for rapidly generating interface automation use cases based on flow recording
CN116028376B (en) * 2023-03-27 2023-08-29 云筑信息科技(成都)有限公司 Method for rapidly generating interface automation use cases based on flow recording

Similar Documents

Publication Publication Date Title
CN114546830A (en) Regression testing method, regression testing device, electronic equipment and storage medium
CN110209700B (en) Data stream association method and device, electronic equipment and storage medium
CN110428319B (en) Data comparison platform, method, equipment and storage medium
CN112860356A (en) API call control method and device, electronic equipment and storage medium
CN113792341A (en) Privacy compliance automation detection method, device, equipment and medium for application program
CN115757150A (en) Production environment testing method, device, equipment and storage medium
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN113515462A (en) Method, device, equipment and storage medium for testing
CN113127357A (en) Unit testing method, device, equipment, storage medium and program product
EP4160421A1 (en) Method and apparatus for obtaining browser running data, and storage medium
CN113778849A (en) Method, apparatus, device and storage medium for testing code
CN115022201B (en) Data processing function test method, device, equipment and storage medium
CN114003497A (en) Method, device and equipment for testing service system and storage medium
CN115391204A (en) Test method and device for automatic driving service, electronic equipment and storage medium
CN113590447B (en) Buried point processing method and device
CN114462030A (en) Privacy policy processing and evidence obtaining method, device, equipment and storage medium
CN114091909A (en) Collaborative development method, system, device and electronic equipment
CN112948195A (en) Interface testing method and device, electronic equipment and storage medium
CN112994976A (en) Gateway testing method and device, electronic equipment and storage medium
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN112532747B (en) Method, apparatus, device and storage medium for outputting information
CN115484200B (en) Buried point testing method, buried point testing device, server, storage medium and buried point testing system
CN115858364A (en) Method and system for testing application starting time of cloud terminal
CN117539719A (en) Application operation monitoring method, device, equipment and medium
CN115687141A (en) Application program testing method and device, electronic equipment and storage medium

Legal Events

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