A test data recording method, device, equipment and computer storage medium

By monitoring target operation events and network processing events in the user interface, complete test data is generated, which solves the problem of low accuracy and completeness of test data in the prior art, and improves the accuracy of automated tests.

CN114443453BActive Publication Date: 2025-03-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011187265.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-30
Publication Date
2025-03-28
Estimated Expiration
2040-10-30

AI Technical Summary

Technical Problem

In the user interface automation test, the recorded test data is low in accuracy and completeness, resulting in a decrease in test accuracy.

Method used

By monitoring the target operation events and network processing events in the user interface, recording operation event sequence information and network processing sequence information, and performing correlation processing to generate complete test data.

Benefits of technology

It improves the completeness and accuracy of the test data and enhances the analysis and positioning capabilities of user interface automation testing scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114443453B_ABST
    Figure CN114443453B_ABST
Patent Text Reader

Abstract

The present application provides a test data recording method, device, equipment and computer storage medium, which relates to the field of computer technology and is used to improve the completeness of test data recorded for user interface automation testing. The method includes: monitoring each target operation event triggered by the target test scenario in the user interface, and obtaining operation event sequence information formed by each target operation event; monitoring the network processing events triggered by each target operation event, and obtaining network processing sequence information formed by each network processing event associated with each target operation event; performing a first association process on the network processing sequence information and the operation event sequence information, and obtaining test data recorded for the target test scenario. When recording test data, the method simultaneously records the information of the target operation event and the information of the network processing event associated with the target operation event, thereby improving the completeness of the recorded test data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a test data recording method, device, equipment and computer storage medium. Background Art

[0002] In the process of automated testing of user interfaces, related technologies record test scenarios by recording user operations in the user interface, and then later play back the recorded user operations during the playback of the test scenarios to achieve testing of interface functions. However, in this process, only the user operations in the user interface are recorded as test data for the test scenarios, and the recording accuracy and completeness of the test data are low, which in turn reduces the accuracy of automated user interface testing of test scenarios based on the recorded test data. Summary of the invention

[0003] Embodiments of the present application provide a test data recording method, apparatus, device, and computer storage medium for improving the integrity of test data recorded for user interface automation testing, thereby improving the accuracy of user interface automation testing.

[0004] In a first aspect of the present application, a test data recording method is provided, comprising:

[0005] In the monitoring user interface, for each target operation event triggered by the target test scenario, obtain operation event sequence information formed by each target operation event;

[0006] Monitor the network processing events triggered by each target operation event, and obtain network processing sequence information formed by each network processing event associated with each target operation event;

[0007] Based on the network processing sequence information and the operation event sequence information, first association processing is performed on each network processing event and each target operation event to obtain test data recorded for the target test scenario.

[0008] In a second aspect of the present application, a test data recording device is provided, comprising:

[0009] The first monitoring unit is used to monitor each target operation event triggered by the target test scenario in the user interface, and obtain operation event sequence information formed by each target operation event;

[0010] A second monitoring unit is used to monitor the network processing events triggered by each target operation event, and obtain network processing sequence information formed by each network processing event associated with each target operation event;

[0011] The processing unit is used to perform first association processing on each network processing event and each target operation event based on the network processing sequence information and the operation event sequence information to obtain test data recorded for the target test scenario.

[0012] In a possible implementation, the network processing event includes a network request triggered in the execution target operation event and a network response returned according to the network request, and the network processing description information includes:

[0013] request data of the network request;

[0014] The feedback data fed back by the network.

[0015] In a possible implementation manner, the network processing description information further includes at least one of the following information:

[0016] Network address information associated with the network request, the network address information being used to determine a network address for receiving the network request during playback of the target test scenario;

[0017] The request mode of the network request.

[0018] In a possible implementation, the target test scenario includes a test scenario for a target website, and the first monitoring unit is further configured to:

[0019] In the monitoring user interface, before each target operation event triggered by the target test scenario, an operation event of opening the target website is determined as an initial target operation event, and initial operation event sequence information formed by the initial target operation event is obtained;

[0020] Monitoring the initial network processing event triggered by the initial target operation event, and obtaining initial network processing sequence information formed by the initial network processing event associated with the initial target operation event;

[0021] Based on the initial operation event sequence information and the initial network processing sequence information, performing a third association process on the initial network processing event and the initial target operation event to obtain initialization data recorded for the target test scenario;

[0022] The processing unit is further configured to add the initialization data to the test data.

[0023] In a third aspect of the present application, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the methods described in the first aspect is implemented.

[0024] In a fourth aspect of the present application, a computer program product is provided, the computer program product comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various possible implementations of the first aspect above.

[0025] In a fifth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in the first aspect and any possible implementation manner.

[0026] Since the embodiment of the present application adopts the above technical solution, it has at least the following technical effects:

[0027] In the embodiment of the present application, when recording the test data of the target test scenario, not only the information of the target operation event is recorded, but also the information of the network processing event associated with the target operation event is recorded, thereby improving the completeness of the recorded test data and facilitating the analysis and location of problems that arise when the target test scenario is tested and replayed. In the embodiment of the present application, the target operation event and the network processing event are associated based on the network processing sequence information and the operation event sequence information, thereby improving the accuracy of the recorded test data, and further improving the accuracy of the automated testing of the target test scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application;

[0029] Figure 2 An example diagram of a test data recording process provided in an embodiment of the present application;

[0030] Figure 3 A schematic diagram of a playback process of a target test scenario provided in an embodiment of the present application;

[0031] Figure 4 A schematic diagram of a playback process of another target test scenario provided in an embodiment of the present application;

[0032] Figure 5 A schematic diagram of a code segment for introducing a component library AopTest provided in an embodiment of the present application;

[0033] Figure 6 A schematic diagram of a code segment for configuring parameters of a recording engine provided in an embodiment of the present application;

[0034] Figure 7A schematic diagram of a log generated during the recording of test data provided in an embodiment of the present application;

[0035] Figure 8 A schematic diagram of operation event sequence information of multiple target operation events recorded according to an embodiment of the present application;

[0036] Fig. 9 A schematic diagram of network processing sequence information of multiple network processing events recorded according to an embodiment of the present application;

[0037] Fig.10 A schematic diagram of a process for recording test data provided in an embodiment of the present application;

[0038] Fig.11 A structural diagram of a test data recording device provided in an embodiment of the present application;

[0039] Fig.12 A structural diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0040] In order to better understand the technical solution provided by the embodiments of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0041] In order to help those skilled in the art better understand the technical solution of the present application, the technical terms involved in the present application are explained below.

[0042] Test scenarios and target test scenarios: The test scenarios in the embodiments of the present application may, but are not limited to, correspond to the functions of the product or user interface that need to be tested in the UI automation test, such as, but not limited to, directly setting one or more functions of the product or user interface as a test scenario; such as, but not limited to, setting the account login function, account registration function, commodity purchase function, function of publishing or editing information stream (such as, but not limited to, including audio, video, or text, etc.), function of viewing, editing, or publishing media stream (such as, but not limited to, including audio or video, etc.) as test scenarios; the target test scenario is a test scenario that requires recording test data.

[0043] Operation events and target operation events: The operation events in the embodiments of the present application may be, but are not limited to, various types of user operations implemented through the user interface, such as, but not limited to, click events, sliding events, input events, screenshot events, etc.; target operation events are operation events that need to be tested when performing automated testing on target test scenarios.

[0044] Network processing events: The test scenarios in the embodiments of the present application are generally recorded on the terminal device on the user side. Network processing events include various network processing interactions between the terminal device and the server, including network requests sent by the terminal device to the server based on the target operation event, and network feedback of the server based on the network request to feedback resource information, etc.

[0045] The design concept of this application is described below.

[0046] Among various automated testing technologies, the one that is closest to user needs is the user interface (UI) automated testing related to user interaction. UI automated testing technology mainly simulates manual operations to achieve automated interface function operations and test interface functions. In related technologies, user operations in test scenarios are recorded as test data, and then the user operations in test scenarios are replayed based on the recorded test data. During playback, the user operations in the recorded test data are simply re-executed. The input is a script (i.e., the above-mentioned test data). Since the entire process is coupled with the server, some scripts that contain network processing events cannot repeat the corresponding user operations. For example, for account registration operations, since the script lacks information about network processing events, replaying the script cannot complete the account registration process. Therefore, how to improve the integrity of the test data of recorded UI automated testing is an issue that needs to be considered.

[0047] In view of this, the inventor has designed a method, device, equipment and computer storage medium for recording test data; considering that executing some user operations in the target test scenario may trigger network processing events, in the embodiment of the present application, while recording the information of the target operation event, the information of the network processing event triggered by the execution of the target operation event is recorded to obtain test data, so that the target operation event and the network processing event in the target test scenario can be fully replayed based on the test data later. The test data recorded in this way includes both the target operation event on the user side and the various network processing events triggered by the target operation event, so that the recorded test data is more complete and the test playback process based on the test data is clearer. In addition, in order to improve the accuracy of the later playback of the target test scenario based on the test data, the embodiment of the present application also associates the various network processing events and the corresponding target operation events in the target test scenario based on the information of the target operation event and the information of the network processing event.

[0048] Furthermore, considering that the prior art can only play back the target test scene from the first user operation to the last user operation based on the recorded test data, but cannot play back the target test scene from the middle user operation, the applicant further designed that it can also obtain the data information associated with each target operation event, and associate the data information associated with each target operation event with the corresponding target operation event to obtain test data, thereby further improving the completeness of the recorded test data, so that it can be played back from the target operation event in the middle of the target test scene based on the test data in the later stage, and it is also conducive to analyzing and locating problems that arise during the test playback of the target test scene; the above-mentioned middle target operation events are target operation events other than the first target operation event and the last target operation event executed in the target test scene.

[0049] In order to more clearly understand the design concept of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.

[0050] In order to more clearly understand the design ideas of this application, the following application scenario is provided. Please refer to Figure 1 The application scenario includes at least one terminal device 100 and a test server 200. The terminal device 100 and the test server 200 can communicate with each other through a network, wherein:

[0051] The terminal device 100 (such as but not limited to including 100-1 or 100-2 in the figure) can present the user interface required in the target test scenario, such as but not limited to displaying the above user interface through a client installed on the terminal device 100; the terminal device 100 can obtain test data recorded for the above target test scenario based on the monitored target operation events triggered for the target test scenario in the user interface and the network processing events caused by each target operation event.

[0052] As an embodiment, a recording engine for recording test data can be installed on the terminal device 100, and the above-mentioned recording engine monitors each target operation event triggered by the target test scenario in the user interface and the network processing events caused by each target operation event to obtain the test data recorded for the above-mentioned target test scenario.

[0053] Furthermore, the terminal device 100 may play back the target test scenario according to the recorded test data, or send the test data to the test server 200 .

[0054] The test server 200 can receive the test data sent by the terminal device 100, and replay the above-mentioned target test scenario according to the received test data; the test server 200 can be an independent physical server, or it can be a server cluster or distributed system composed of multiple physical servers, or it can be multiple cloud servers (such as but not limited to server 200-1, server 200-2 or server 200-3 shown in the figure) that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the functions of the above-mentioned test server 200 can be implemented by one or more cloud servers, and can also be implemented by one or more cloud server clusters, etc.

[0055] The terminal device 100 in the embodiment of the present application can be a mobile terminal, a fixed terminal or a portable terminal, such as a mobile phone, a station, a unit, a device, a multimedia computer, a multimedia tablet, an Internet node, a communicator, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof.

[0056] based on Figure 1 The following is an example of the test data recording method involved in the embodiment of the present application; please refer to Figure 2 , a schematic diagram showing the process of the test data recording method designed in the embodiment of the present application, which is applied to the above-mentioned terminal device 100 or a recording engine installed on the above-mentioned terminal device 100, and the process is specifically as follows:

[0057] Step S201 : monitoring each target operation event triggered by a target test scenario in a user interface, and obtaining operation event sequence information formed by each target operation event.

[0058] As an embodiment, in order to reduce the impact on the normal data of the monitored target operation events, the embodiment of the present application can use aspect-oriented programming (AOP) technology to obtain the operation event sequence information formed by each target operation event; specifically, it can be but not limited to monitoring the target operation events in the user interface through the operation event monitoring function, such as the resize() function in the first code segment below can be used as an operation event monitoring function to monitor the target operation events in the window. The above-mentioned AOP technology is a technology that realizes unified maintenance of program functions through pre-compilation and dynamic proxy during runtime.

[0059] Example of the first code snippet:

[0060] Window.addEventListener('resize', functiond()){

[0061] This.getChartint().resize();

[0062] }

[0063] As an embodiment, the target test scenario may include a test scenario for a target website. In the target test scenario for the target website, the tester first needs to open the target website before performing subsequent target operation events. Therefore, when recording test data for the target test scenario for the target website, before the above-mentioned step S201, the information of the operation event of opening the target website can also be recorded, and the operation event of opening the target website is used as the first target operation event in the target test scenario.

[0064] Specifically, the operation event of opening the above-mentioned target website can be determined as the initial target operation event, and the initial operation event sequence information formed by the above-mentioned initial target operation event can be obtained; the initial network processing event triggered by the above-mentioned initial target operation event can be monitored, and the initial network processing sequence information formed by the initial network processing event associated with the above-mentioned initial target operation event can be obtained; based on the initial operation event sequence information and the above-mentioned initial network processing sequence information, the above-mentioned initial network processing event and the above-mentioned initial target operation event are subjected to a third association processing to obtain the initialization data recorded for the above-mentioned target test scenario; and when the test data recorded for the above-mentioned target test scenario is obtained, the above-mentioned initialization data is added to the above-mentioned test data.

[0065] Step S202: monitor the network processing events triggered by each target operation event, and obtain network processing sequence information formed by each network processing event associated with each target operation event.

[0066] As an embodiment, in order to reduce the impact on the normal processing process of monitored network processing events, the embodiment of the present application can use the network AOP technology to copy the relevant information of each monitored network processing event through the HOOK function in the AOP technology, and process the relevant information of each copied network processing event to obtain the network processing sequence information formed by each network processing event.

[0067] Step S203: Based on the network processing sequence information and the operation event sequence information, each network processing event and each target operation event are subjected to first association processing to obtain test data recorded for the target test scenario.

[0068] Specifically, after the first association processing is performed, the test data recorded for the target test scenario includes the following data: operation event sequence information formed by each monitored target operation event, network processing sequence information formed by each network processing event associated with each target operation event, and the first association result of the first association processing between each network processing event and each target operation event.

[0069] As an embodiment, after step S203, the above-mentioned test data can be saved locally or sent to the test server 200 according to actual test requirements, so that the above-mentioned test server 200 can replay the above-mentioned target test scenario; if the test requirement is to perform UI automation testing within a short time after obtaining the test data, the terminal device 100 can save the obtained test data locally, and after triggering the UI automation test, replay the target test scenario according to the above-mentioned test data; if the test requirement is to perform UI automation testing within a long period of time after obtaining the test data, the terminal device 100 can send the test data to the test server 200, so that the test server 200 can replay the target test scenario based on the test data after receiving the playback instruction.

[0070] The target operation event, operation event sequence information, network processing event and network processing sequence information in the embodiments of the present application are described in detail below.

[0071] (I) Target operation events and operation event sequence information

[0072] The operation events in the embodiments of the present application may include but are not limited to user operations implemented through the user interface, and the target operation events may be operation events that need to be tested when performing automated testing on the target test scenario; the operation events may include operations of different types, and the above operation types may include but are not limited to click operations, long press operations, sliding operations, input operations, scrolling operations, screenshot operations, etc.

[0073] As an embodiment, in order to improve the accuracy of playback of the target test scenario, the operation event sequence information of a target operation event in the embodiment of the present application may be information describing the specific operation content of the target operation event and describing the execution order of the target operation event in the target test scenario; specifically, the above-mentioned operation event sequence information may include event execution sequence information and event description information of the target operation event, the event execution sequence information is used to characterize the execution order of the target operation event in the target test scenario, and the event description information is used to characterize the specific operation content of the target operation event.

[0074] As an embodiment, in order to conveniently and quickly obtain the event execution sequence information of the target operation event, in the embodiment of the present application, the operation sequence number of the target operation event can be used as the above-mentioned event execution sequence information, and the operation sequence number can be represented by at least one of numbers (such as Arabic numerals), letters (such as the uppercase and lowercase forms of the 26 English letters, etc.), punctuation marks (such as but not limited to "?", ","." or "!", etc.) or special symbols (such as but not limited to @, #, %, * or &, etc.); for ease of understanding, an exemplary explanation is given here in the form of the operation sequence number shown in Table 1.

[0075] Table 1: Operation sequence numbers in different forms

[0076]

[0077] In the above Table 1, "1, 2, 3" are operation sequence numbers expressed in digital form, "A, AA and AAA" are operation sequence numbers expressed in alphabetical form, and "A1, A2 and A3" are operation sequence numbers identified in the form of letters and numbers. Technical personnel in this field can also express the above operation sequence numbers in other forms besides Table 1 based on actual needs.

[0078] As an embodiment, since the triggering times of different target operation events in the same target test scenario are generally different, in order to quickly and conveniently obtain the event execution sequence information of the target operation event, the event triggering time information of the target operation event can be directly used as the above-mentioned event execution sequence information, such as but not limited to using the timestamp representing the triggering time of the target operation event as the event execution sequence information.

[0079] As an embodiment, considering that the specific contents of the operator events are different for target operation events of different operation types, the specific contents of the event description information of target operation events of different operation types in the embodiment of the present application may be different; the event description information in the embodiment of the present application may include, but is not limited to, the operation type and key operation parameter information of the target operation event. The event description information is illustrated below with an actual example:

[0080] When the target operation event is a click operation, there will be a corresponding operation position (coordinates in the display screen coordinate system of the terminal device 100), and the operation position can be used as the above-mentioned key operation parameter information. For example, a target operation event is that the tester clicks on a UI control, and the two-dimensional coordinates of the click position are (100, 200). The event description information of the target operation event can be, but is not limited to, represented as Click: x=100&y=200, where Click indicates that the operation type of the target operation event is a click operation, and "x=100&y=200" indicates that the key operation parameter is the click position (100, 200); when the target operation event is a sliding event, there will be a corresponding sliding start position, sliding end position, sliding path information and sliding distance, etc., then the key operation parameter information in the event description information of the sliding operation may include the sliding start position and the sliding end position, and the above-mentioned key operation parameter information may also include the sliding start position, the sliding end position and the sliding path information. The above-mentioned key operation parameter information may also include the sliding start position, the sliding path information, etc. Technical personnel in this field can set the key operation parameter information of different types of target operation events according to actual needs.

[0081] It should be noted that the target operation event may have a corresponding operation object or may not have a corresponding operation object. If the target operation event has a corresponding operation object, the operation object may also be recorded in the above event description information.

[0082] (II) Network processing events and network processing sequence information

[0083] In order to improve the accuracy of replaying network processing events in the target test scenario, the network processing sequence information of a network request processing in an embodiment of the present application may be information describing the specific network processing content of the network processing event and describing the execution order of the network processing event in the target test scenario; specifically, the above-mentioned network processing sequence information may be but is not limited to including network processing execution sequence information and network processing description information of the network processing event, the network processing execution sequence information is used to characterize the execution order of the network processing event in the target test scenario, or the network processing execution sequence information is used to characterize the execution order of a network processing event in the target operation event associated with the network processing event, and the above-mentioned network processing description information is used to characterize the specific network processing content of the network processing event.

[0084] As an embodiment, the network processing execution order information can be the network processing serial number of the network processing event. The network processing serial number can be represented by at least one of numbers (such as Arabic numerals), letters (such as the uppercase and lowercase forms of the 26 English letters, etc.), punctuation marks (such as but not limited to "?", ",","." or "!", etc.) or special symbols (such as but not limited to @, #, %, * or &, etc.). No excessive restrictions are made here, and technicians in this field can set it according to actual needs.

[0085] As an embodiment, since the triggering times of different network processing events in the same target test scenario are generally different, the triggering times of each network processing event in multiple network processing events triggered by the same target operation event are generally different. Therefore, in order to quickly and conveniently obtain the network processing execution sequence information of the network processing event, the request trigger time information of the network processing event can be directly determined as the above-mentioned network processing execution sequence information, such as but not limited to using the timestamp representing the triggering time of the network processing event as the network processing execution sequence information.

[0086] As an embodiment, in order to completely record the network processing information related to the target operation event, the network processing event in the embodiment of the present application may include but is not limited to including the network request triggered in the process of executing the target operation event and the network response returned based on the above network request. Therefore, the network processing description information of the above network request processing may include the request data of the network request and the feedback data of the above network feedback.

[0087] As an embodiment, in order to improve the completeness of the information of the recorded network processing event, the network processing description information in the embodiment of the present application may also include at least one of the following information:

[0088] Network address information associated with the network request, the network address information being used to determine a network address for receiving the network request during playback of the target test scenario;

[0089] The request method of the above network request may include but is not limited to a post request method or a get request method.

[0090] As an embodiment, based on the target operation event, operation event sequence information, network processing event and network processing sequence information introduced in the above content, when the first association processing is performed in the above step S203, if the operation event sequence information includes the event identifier of the target operation event, and the network processing sequence information includes the network processing identifier of the network processing event, then each target operation event can be associated with each network processing event according to the event identifier of each target operation event in each operation event sequence information, and the network processing identifier of each network processing event in each network processing event sequence.

[0091] Specifically, a network processing identifier of a network processing event and an event identifier that triggers the network processing event can be associated with each other. The above-mentioned event identifier can be the event execution sequence information or event triggering time information of the above-mentioned target operation event. The event identifier can also be other information that can identify the target operation event. The above-mentioned network processing identifier can be the network processing execution sequence information or request triggering time information of the above-mentioned network processing event, the network processing identifier or other information that can identify the network processing event; for example, it is possible but not limited to associating each target operation event with each network processing event based on the event execution sequence information of each target operation event and the network processing execution sequence information of each network processing event.

[0092] In some embodiments, each target operation event can be associated with each network processing event according to the trigger relationship. For example, when the target operation event is a click operation that triggers a data packet sending event, the network processing event can be a data packet sending event. In this case, the target operation time can be associated with the data packet sending event. The target operation event and the network processing event can be associated according to the occurrence time of the target operation event and the network processing event. For example, when the difference between the occurrence time of the target operation event and the network processing event is less than a threshold, the two are associated, or the target operation event and the network processing event are executed in an order to associate each target operation event with each network processing event. The association processing speed according to the occurrence time of the target operation event and the network processing event is fast, consumes less storage and computing power, and the test recording process occupies fewer resources. In some embodiments, in order to further improve the accuracy of associating each target operation event with each network processing event, the target operation event type that will trigger the network processing event can be pre-stored, and when associating the target operation event with the network processing event according to the occurrence time, the target operation event that will trigger the network processing event can be screened out according to the pre-stored target operation event type, and the screened target operation event and the network processing event are associated, so that the accuracy of associating the target operation event with the network processing event can be further improved in this way. It can be understood that the data information associated with each target operation event can also be associated with each target operation event in the second association process in the same manner as the first association of the target operation event and the network processing event in the above-mentioned embodiment, and has similar technical effects, which will not be repeated here.

[0093] As an embodiment, in the above step S203, before obtaining the test data recorded for the above target test scenario, data information associated with each target operation event can also be obtained; and based on the above operation event sequence information, the data information associated with each target operation event is subjected to a second association process with each target operation event.

[0094] The data information associated with the above target operation event may include, but is not limited to: data accessed, newly added data or modified data, etc. by each operation event in the target test scenario before the above target operation event is executed in the target test scenario.

[0095] That is, after the second association processing is performed in the embodiment of the present application, the test data recorded for the target test scenario includes the following data: operation event sequence information formed by each monitored target operation event, network processing sequence information formed by each network processing event associated with each target operation event, first association results of the first association processing between each network processing event and each target operation event, data information associated with each target operation event, and second association results of the second association processing between the data information associated with each target operation event and each target operation event.

[0096] As an embodiment, based on the target operation event, operation event sequence information, network processing event and network processing sequence information introduced in the above content, when performing the second association processing, if the operation event sequence information includes an event identifier, then for a target operation event, the data information associated with the target operation event can be associated with the event identifier of the target operation event; the above event identifier can be but is not limited to the event execution sequence information or event trigger time information of the target operation event.

[0097] The test data obtained in the embodiment of the present application can be used to replay the target test scenario, see Figure 3 The following provides an example of a playback process of a target test scenario according to test data, and the playback process specifically includes:

[0098] Step S301 : determining a first playback sequence of each target operation event based on event execution sequence information of each target operation event in the test data of the target test scenario.

[0099] Step S302: based on the event description information of each target operation event, play the above target operation events in a first play order.

[0100] In step S302, the playing process of any one of the above target operation events is as follows:

[0101] Step S303: determining each network processing event triggered by the target operation event based on the first correlation result in the test data.

[0102] Step S304: determining a second playback order of each network processing event triggered by the target operation event based on the network processing execution order of each network processing event triggered by the target operation event.

[0103] Step S305 , based on the network processing description information of each network processing event triggered by the target operation event, play each network processing event triggered by the target operation event in a second play order.

[0104] See also Figure 4 Another example of a playback process of a target test scenario according to test data is provided below. The playback process specifically includes the following steps:

[0105] Step S401: receiving a playback instruction triggered by a tester, where the playback instruction is triggered by a target operation event in a target test scenario.

[0106] Step S402: based on the second association result in the target test data of the target test scenario, obtain data information associated with the target operation event indicated by the playback instruction.

[0107] Step S403: play the data information associated with the target operation event indicated by the playback instruction, and monitor the target operation event indicated by the playback instruction.

[0108] It should be noted that the above two playback processes can be applied to the above terminal device 100 and also to the test server 200, and the above two playback processes are only exemplary descriptions. Technical personnel in this field can flexibly set the specific method of replaying the target test scenario based on the obtained test data.

[0109] The following content of the embodiment of the present application provides a specific example of test data recording.

[0110] In this example, the test data for the target test scenario is recorded by a recording engine installed on the terminal device 100. The recording engine can be used, but is not limited to, in the recording process of UI automation testing of all website service classes (also known as web service classes), and can completely record the target operation events triggered by user behavior.

[0111] Before recording test data for the target test scenario through the above recording engine, you need to configure the recording engine and the network service that provides the target website, mainly including the following configurations:

[0112] The first aspect of configuration: Introducing website services into the recording engine:

[0113] The component library of AOP technology can be introduced into the entry file of the target website (i.e. the homepage file of the target website). For example, when the webpage of the target website is implemented in the javascript programming language, the component library AopTest (i.e. the component library of the above AOP technology) can be introduced into the entry file index.js of the first page of the target website when it is first opened, and the component library AopTest is placed in the first place to be initialized; for details, please refer to Figure 5, you can, but are not limited to, import the above component library AopTest in the index.js file through the code field "import AopTest from'. / AopTest / aop';" in the figure, and use the ReactDOM.render() method in the figure <aoptest / > Implement the call of component library AopTest.

[0114] The second aspect of configuration: Configuring the recording engine

[0115] In the embodiment of this application, the parameters such as the characteristics and functions of the recording engine are mainly configured. Figure 6 The main configuration parameters of the recording engine can include but are not limited to the following:

[0116] Network address parameter url (Uniform Resource Location): also known as network address, that is, the network address of the test server 200 that receives the test data sent by the terminal device 100. The test server 200 is mainly used to receive the test data sent by the terminal device 100 and store the test data in a database.

[0117] Product parameter product: used to distinguish different products. The parameter value of product can be the product name or product number of the product corresponding to the target test scenario.

[0118] Test scene parameter scene: the name of the target test scene for this recording. The name can be, but is not limited to, the function that the target test scene needs to implement, such as, but not limited to, account login, product purchase, and other functions.

[0119] Storage table parameter table_info: the name of the table used to store test data in the test server 200; the test server 200 stores the received test data in the table named "table_info".

[0120] Initial target operation event parameter init_event_id: the event identifier of the initial target operation event of opening the target website for the first time. The event identifier of the initial target operation event can be but is not limited to the event execution sequence information or event triggering time information of the initial target operation event. init_event_id is used to distinguish the initial target operation event from other target operation events to simulate the operation event of opening the target website for the first time and finally complete the network processing flow association.

[0121] The third aspect of configuration: start the network service of the target website

[0122] That is, it may include but is not limited to starting a server that provides services for the target website, ensuring that the network communication environment is available, etc.

[0123] After completing the configurations of the first to third aspects above, the recording engine can be used to obtain the test data of the target test scenario; in the process of recording the test data, the following Figure 7 The log shown can be viewed in the console of a browser such as Chrome. If there is no error in the log, it means that the recording is successful.

[0124] After the recording engine obtains the test data, it will send the test data to the corresponding test server 200 through the configured url, table_info and other information. For ease of understanding, an example of an operation event stream (i.e., the operation event sequence information of multiple target operation events recorded) is given here. Figure 8 , each column from the left represents the event identifier of the target operation event (here the timestamp of the target operation event is used as the event identifier for explanation), the product name of the product corresponding to the target test scenario, the test scenario name of the target test scenario, and the event description information of the target operation event.

[0125] Here is an example of a network processing flow (that is, the network processing sequence information of multiple network processing events recorded), see Fig. 9 , each column after the left represents, in turn, the event identifier of the target operation event associated with the network processing event (here, the timestamp of the target operation event is used as the event identifier for explanation), the network processing identifier of the network processing event (here, the timestamp of the network request in the network processing event is used as the event identifier for explanation), the timestamp, the product name of the product corresponding to the target test scenario, the test scenario name of the target test scenario, the request method of the network request in the network processing event (such as but not limited to including post method or get method), and the network address information associated with the above network request.

[0126] See also Fig.10 ,In the process of recording test data using the recording engine, the ,tester first determines the target test scenario and triggers the start of ,the target test scenario, and then the tester opens the target website and ,trigger the test process.

[0127] After the recording engine monitors the operation of opening the target website, it initializes the operation of opening the target website as the initial target operation event; and the recording engine monitors each target operation event in the target test scenario and the network processing event caused by each target operation event through the HOOK network in the AOP technology, obtains the operation event sequence information formed by each target operation event, obtains the network processing sequence information formed by each network processing event, and based on the network processing sequence information and the operation event sequence information, performs a first association processing on each network processing event and each target operation event, and obtains the data information associated with each target operation event; and performs a second association processing on the data information associated with each target operation event with each target operation event to obtain test data.

[0128] It should be noted that Fig.10 The hook click event function in the HOOK network is used to monitor click operations, obtain the operation event sequence information of click operations and upload it to the test server 200; the hook scroll event function in the figure is used to monitor scroll operations, obtain the operation event sequence information of the monitored scroll operations and upload it to the test server 200; the hook keyup event function is used to monitor input events, obtain the operation event sequence information of input events and upload it to the test server 200; the hook compositioned event function is used to monitor Chinese input operations, obtain the operation event sequence information of Chinese input operations and upload it to the test server 200.

[0129] In the embodiment of the present application, information on the target operation event and information on the network processing event associated with the target operation event are recorded simultaneously. In this way, the recorded test data includes both the target operation event on the user side and the various network processing events triggered by the target operation event, making the test data more complete and the test playback process clearer. The target operation event and the network processing event are associated, thereby improving the accuracy of the recorded test data. When the target test scenario is played back based on the test data, a complete operation event stream of the target operation event and a network processing stream of the network processing event can be automatically formed based on the test data, thereby improving the accuracy of automated testing of the target test scenario based on the test data.

[0130] Please refer to Fig.11 Based on the same inventive concept, the present application embodiment provides a test data recording device 1100, including:

[0131] The first monitoring unit 1101 is used to monitor each target operation event triggered by the target test scenario in the user interface, and obtain operation event sequence information formed by each target operation event;

[0132] The second monitoring unit 1102 is used to monitor the network processing events triggered by each target operation event, and obtain network processing sequence information formed by each network processing event associated with each target operation event;

[0133] The processing unit 1103 is used to perform a first association process on each network processing event and each target operation event based on the network processing sequence information and the operation event sequence information, so as to obtain the test data recorded for the target test scenario.

[0134] As an embodiment, the processing unit 1103 is also used to: obtain data information associated with each target operation event before obtaining the test data recorded for the above-mentioned target test scenario; and based on the above-mentioned operation event sequence information, perform a second association processing on the data information associated with each target operation event and each target operation event.

[0135] As an embodiment, the processing unit 1103 is further used to: replay the target test scenario according to the test data, or send the test data to the test server 200 so that the test server 200 replays the target test scenario.

[0136] As an embodiment, the operation event sequence information includes event execution sequence information and event description information of each target operation event, the event execution sequence information of each target operation event is used to determine the execution sequence of each target operation event in the target test scenario, and the event description information is used to play each target operation event;

[0137] The above-mentioned network processing sequence information includes network processing execution order information and network processing description information of each network processing event. The above-mentioned network processing execution order information is used to determine the execution order of each network processing event in the above-mentioned target test scenario, and the above-mentioned network processing description information is used to play each network processing event.

[0138] As an embodiment, the processing unit 1103 is specifically used to associate each target operation event with each network processing event according to the event execution sequence information of each target operation event in each operation event sequence information, and the network processing execution sequence information of each network processing event in each network processing event sequence.

[0139] As an embodiment, the network processing event includes a network request triggered in the execution target operation event and a network response returned according to the network request, and the network processing description information includes:

[0140] The request data of the above network request; the feedback data of the above network feedback.

[0141] As an embodiment, the network processing description information further includes at least one of the following information:

[0142] Network address information associated with the network request, the network address information being used to determine a network address for receiving the network request during playback of the target test scenario;

[0143] The request method for the above network request.

[0144] As an embodiment, the target test scenario includes a test scenario for a target website, and the first monitoring unit 1101 is further configured to:

[0145] In the monitoring user interface, before each target operation event triggered by the target test scenario, an operation event of opening the target website is determined as an initial target operation event, and initial operation event sequence information formed by the initial target operation event is obtained;

[0146] Monitoring the initial network processing events triggered by the initial target operation events, and obtaining initial network processing sequence information formed by the initial network processing events associated with the initial target operation events;

[0147] Based on the initial operation event sequence information and the initial network processing sequence information, the initial network processing event and the initial target operation event are subjected to a third association process to obtain initialization data recorded for the target test scenario;

[0148] The processing unit 1103 is further configured to add the initialization data to the test data.

[0149] As an example, Fig.11 The device in can be used to implement any of the test data recording methods discussed above.

[0150] Based on the same inventive concept, an embodiment of the present application provides a terminal device 100, which is introduced below.

[0151] Please refer to Fig.12 The terminal device 100 includes a display unit 1240, a processor 1280 and a memory 1220, wherein the display unit 1240 includes a display panel 1241, which is used to display information input by a user or information provided to a user with various operation pages, etc. In the embodiment of the present application, it is mainly used to display pages, shortcut windows, etc. of the client installed in the terminal device 100.

[0152] Optionally, the display panel 1241 may be configured in the form of a liquid crystal display (LCD) or an organic light-emitting diode (OLED).

[0153] The processor 1280 is used to read the computer program and then execute the method defined by the computer program, for example, the processor 1280 reads each application, so as to run the application on the terminal device 100 and display the application page on the display unit 1240. The processor 1280 may include one or more general-purpose processors and may also include one or more DSPs (Digital Signal Processors) to perform related operations to implement the technical solutions provided in the embodiments of the present application.

[0154] The memory 1220 generally includes internal memory and external memory, and the internal memory can be a random access memory (RAM), a read-only memory (ROM), and a cache (CACHE), etc. The external memory can be a hard disk, an optical disk, a USB disk, a floppy disk or a tape drive, etc. The memory 1220 is used to store computer programs and other data, and the computer program includes an application corresponding to the client, etc. Other data may include data generated after the operating system or the application is run, and the data includes system data (such as configuration parameters of the operating system) and user data. In the embodiment of the present application, program instructions are stored in the memory 1220, and the processor 1280 executes the program instructions in the memory 1220 to implement any test data recording method discussed in the previous figure.

[0155] In addition, the terminal device 100 may also include a display unit 1240 for receiving input digital information, character information or contact touch operation or non-contact gesture, and generating signal input related to user settings and function control of the terminal device 100. Specifically, in the embodiment of the present application, the display unit 1240 may include a display panel 1241. The display panel 1241 is, for example, a touch screen, which can collect the user's touch operation on or near it (such as the user's operation on the display panel 1241 or on the display panel 1241 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the display panel 1241 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact point coordinates, and then sends it to the processor 1280, and can receive and execute commands sent by the processor 1280. In an embodiment of the present application, if the user performs a click operation or a sliding operation, the touch detection device in the display panel 1241 detects the touch operation, and sends a signal corresponding to the detected touch operation to the touch controller. The touch controller converts the signal into touch point coordinates and sends them to the processor 1280. The processor 1280 performs subsequent operations based on the received touch point coordinates.

[0156] The display panel 1241 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the display unit 1240, the terminal device 100 can also include an input unit 1230, which can include, but is not limited to, an image input device 1231 and other input devices 1232, such as a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, etc. One or more.

[0157] In addition to the above, the terminal device 100 may also include a power supply 1290 for supplying power to other modules, an audio circuit 1260, a near field communication module 1270, and an RF circuit 1210. The terminal device 100 may also include one or more sensors 1250, such as an acceleration sensor, a light sensor, a pressure sensor, etc. The audio circuit 1260 specifically includes a speaker 1261 and a microphone 1262, etc. For example, the terminal device 100 can collect the user's voice through the microphone 1262 and perform corresponding operations.

[0158] As an embodiment, the number of processors 1280 may be one or more, and the processor 1280 and the memory 1220 may be coupled or relatively independently configured.

[0159] As an example, Fig.12The processor 1280 in can be used to implement the following Fig.11 The functions of the first monitoring unit 1101, the second monitoring unit 1102 and the processing unit 1103.

[0160] As an embodiment, various aspects of the test data recording method provided in the embodiments of the present application can also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the test data recording method according to various exemplary embodiments of the present application described above in this specification.

[0161] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.

[0162] Alternatively, if the above-mentioned integrated unit of the invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the above-mentioned methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0163] Based on the same technical concept, the embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions. When the above computer instructions are executed on a computer, the computer executes the test data recording method discussed above.

[0164] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0165] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A test data recording method, characterized in that: include: Determine an operation event of opening a target website for the first time as an initial target operation event, and obtain initial operation event sequence information formed by the initial target operation event; Monitoring the initial network processing event triggered by the initial target operation event, and obtaining initial network processing sequence information formed by the initial network processing event associated with the initial target operation event; Based on the initial operation event sequence information and the initial network processing sequence information, the initial network processing event and the initial target operation event are subjected to a third association process to obtain initialization data recorded for a target test scenario; the target test scenario includes a test scenario for the target website; In the monitoring user interface, for each target operation event triggered by the target test scenario, operation event sequence information formed by each target operation event is obtained; the operation event sequence information at least includes event description information, and the event description information is used to characterize the specific operation content of the corresponding target operation event; Monitor the network processing events triggered by each target operation event, and obtain network processing sequence information formed by each network processing event associated with each target operation event; Based on the triggering relationship or the difference in occurrence time between the network processing sequence information and the operation event sequence information, in combination with the pre-stored target operation event types that can trigger each network processing event, each network processing event and each target operation event are subjected to a first association process, and data information associated with each target operation event is obtained, and based on the triggering relationship or the difference in occurrence time between the operation event sequence information and the data information, the data information associated with each target operation event is subjected to a second association process with each target operation event, to obtain test data recorded for the target test scenario; The initialization data is added to the test data; each data information includes: data accessed, newly added data or modified data by each operation event in the target test scenario before the corresponding target operation event is executed in the target test scenario.

2. The method according to claim 1, characterized in that The method further comprises: replaying the target test scenario according to the test data, or; The test data is sent to a test server so that the test server plays back the target test scenario.

3. The method according to claim 2, characterized in that The event description information is used to play each target operation event, and the operation event sequence information also includes event execution order information of each target operation event, and the event execution order information of each target operation event is used to determine the execution order of each target operation event in the target test scenario; The network processing sequence information includes network processing execution order information and network processing description information of each network processing event, the network processing execution order information is used to determine the execution order of each network processing event in the target test scenario, and the network processing description information is used to play each network processing event.

4. The method according to claim 3, characterized in that The first associating each network processing event with each target operation event based on the network processing sequence information and the operation event sequence information includes: According to the event execution sequence information of each target operation event in each operation event sequence information and the network processing execution sequence information of each network processing event in each network processing event sequence, each target operation event is associated with each network processing event.

5. The method according to claim 3, characterized in that The network processing event includes a network request triggered by executing the target operation event and a network response returned according to the network request, and the network processing description information includes: request data of the network request; The network requests feedback data.

6. The method according to claim 5, characterized in that The network processing description information also includes at least one of the following information: Network address information associated with the network request, the network address information being used to determine a network address for receiving the network request during playback of the target test scenario; The request mode of the network request.

7. A test data recording device, characterized in that: include: A first monitoring unit is used to determine an operation event of opening a target website for the first time as an initial target operation event, and obtain initial operation event sequence information formed by the initial target operation event; Monitoring the initial network processing event triggered by the initial target operation event, and obtaining initial network processing sequence information formed by the initial network processing event associated with the initial target operation event; Based on the initial operation event sequence information and the initial network processing sequence information, the initial network processing event and the initial target operation event are subjected to a third association process to obtain initialization data recorded for a target test scenario; the target test scenario includes a test scenario for the target website; In the monitoring user interface, for each target operation event triggered by the target test scenario, obtain operation event sequence information formed by each target operation event; The target test scenario includes a test scenario for a target website; the operation event sequence information includes at least event description information, and the event description information is used to characterize the specific operation content of the corresponding target operation event; A second monitoring unit is used to monitor the network processing events triggered by each target operation event, and obtain network processing sequence information formed by each network processing event associated with each target operation event; a processing unit configured to perform a first association process on each network processing event and each target operation event based on a trigger relationship or a difference in occurrence time between the network processing sequence information and the operation event sequence information, in combination with each pre-stored target operation event type that can trigger each network processing event, and to obtain data information associated with each target operation event, and to perform a second association process on the data information associated with each target operation event and each target operation event based on a trigger relationship or a difference in occurrence time between the operation event sequence information and the data information, to obtain test data recorded for the target test scenario; The initialization data is added to the test data; each data information includes: data accessed, newly added data or modified data by each operation event in the target test scenario before the corresponding target operation event is executed in the target test scenario.

8. The device according to claim 7, characterized in that The processing unit is also used for: replaying the target test scenario according to the test data, or; The test data is sent to a test server so that the test server plays back the target test scenario.

9. The device according to claim 8, characterized in that The event description information is used to play each target operation event, and the operation event sequence information also includes event execution order information of each target operation event, and the event execution order information of each target operation event is used to determine the execution order of each target operation event in the target test scenario; The network processing sequence information includes network processing execution order information and network processing description information of each network processing event, the network processing execution order information is used to determine the execution order of each network processing event in the target test scenario, and the network processing description information is used to play each network processing event.

10. The device according to claim 9, characterized in that The processing unit is specifically used for: According to the event execution sequence information of each target operation event in each operation event sequence information and the network processing execution sequence information of each network processing event in each network processing event sequence, each target operation event is associated with each network processing event.

11. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Webpage operation playback and collection method, computing device, storage medium and system

    CN111274105A

  • Application program testing method and device, electronic equipment and computer readable storage medium

    CN111694757A

  • Replaying captured network interactions

    US20090063968A1