Data processing method and device, electronic equipment, storage medium and program product

CN117349145BActive Publication Date: 2026-10-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210764354.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-29
Publication Date
2026-10-13
Estimated Expiration
2042-06-29

AI Technical Summary

Technical Problem

[0002]在当前互联网时代,开发的项目的应用场景众多并且软件架构也越来越复杂,软件的升级和更新频率也越来越频繁

Benefits of technology

通过对流量信息进行接口序列化、分割处理,得到的多个子接口序列,并将其作为候选场景,进而根据对候选场景进行赋权处理,从数量众多的候选场景中准确的确定出目标场景,最后根据目标场景对应的流量信息快速生成测试脚本,实现对集成测试场景自动的生成测试脚本,有效的提高了不同场景编写集成测试测试脚本的效率及质量。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117349145B_ABST
    Figure CN117349145B_ABST
Patent Text Reader

Abstract

The application provides a data processing method and device, electronic equipment, computer readable storage medium and computer program product. The method comprises: performing interface serialization processing on a plurality of traffic information respectively to obtain an interface sequence corresponding to each traffic information, wherein the traffic information comprises at least one interface; performing segmentation processing on the plurality of interface sequences to obtain a plurality of sub-interface sequences, and taking a scene corresponding to each sub-interface sequence as a candidate scene; performing weighting processing on the candidate scenes, and determining a target scene from the weighted candidate scenes; and generating a test script for testing the target scene according to the traffic information corresponding to the target scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to computer data processing technology, and more particularly to a data processing method, apparatus, electronic device, computer-readable storage medium, and computer program product. Background Technology

[0002] In today's internet age, developed projects have numerous application scenarios and increasingly complex software architectures, leading to more frequent software upgrades and updates. Therefore, the operational efficiency and quality of software in different scenarios are crucial, and automated backend testing, as an important means of ensuring software quality, is receiving increasing attention and professionalization.

[0003] Among related technologies, there are few methods for automatically generating test cases for integration interface testing. Most methods focus on using interface documentation to generate interface test cases, and then automatically generate test scripts for integration testing. Summary of the Invention

[0004] This application provides a data processing method, apparatus, electronic device, computer-readable storage medium, and computer program product that automatically generates test scripts for integration testing scenarios, effectively improving the efficiency and quality of writing integration test scripts for different scenarios.

[0005] The technical solution of this application embodiment is implemented as follows: This application provides a data processing method, including: Multiple traffic information items are serialized into interfaces to obtain an interface sequence corresponding to each traffic information item, wherein each traffic information item includes at least one interface. Multiple interface sequences are segmented to obtain multiple sub-interface sequences, and the scene corresponding to each sub-interface sequence is used as a candidate scene. The candidate scenarios are weighted, and the target scenario is determined from the weighted candidate scenarios. Based on the traffic information corresponding to the target scenario, generate test scripts for testing the target scenario.

[0006] This application provides a data processing apparatus, including: The interface serialization module is used to perform interface serialization processing on multiple traffic information respectively to obtain an interface sequence corresponding to each traffic information, wherein the traffic information includes at least one interface; The candidate scene determination module is used to segment multiple interface sequences to obtain multiple sub-interface sequences, and to use the scene corresponding to each sub-interface sequence as a candidate scene. The target scene determination module is used to assign weights to candidate scenes and determine the target scene from the weighted candidate scenes; The test script determination module is used to generate test scripts for testing the target scenario based on the traffic information corresponding to the target scenario.

[0007] In the above technical solution, the interface serialization module is further configured to perform the following processing on any one of the plurality of traffic information: The attribute information of each interface is obtained from the traffic information, wherein the attribute information includes an interface identifier and a timing identifier, and the timing identifier is used to characterize the time information when the interface is called; The interface information is sorted according to the chronological order of the time information, and an interface sequence corresponding to the traffic information is generated based on the sorting result.

[0008] In the above technical solution, the interface serialization module is further used to segment the sorting result by taking any interface as the dividing point when the difference between the time information of any interface in the sorting result and the adjacent previous interface is greater than the time interval threshold, thereby obtaining multiple interface sequences corresponding to the traffic information.

[0009] In the above technical solution, the candidate scene determination module is further used to segment the multiple interface sequences according to the first interface identifier of any interface sequence in the multiple interface sequences to obtain multiple first intermediate interface sequences; Based on the interface identifier of the (i+1)th interface in any (i)th intermediate interface sequence, the multiple (i)th intermediate interface sequences are divided to obtain multiple (i+1)th intermediate interface sequences, where i is a positive integer that increases sequentially and i is less than the number of interfaces in any interface sequence. The sub-interface sequence is obtained by concatenating the first interface identifier, the (i+1)th interface identifier, and multiple (i+1)th intermediate interface sequences.

[0010] In the above technical solution, the target scene determination module is further configured to determine the weight value of each candidate scene based on the number of times the multiple candidate scenes are used and the number of interfaces in the multiple candidate scenes; The candidate scene with the largest weight value is selected as the target scene.

[0011] In the above technical solution, the test script determination module is also used to classify and process multiple traffic information corresponding to the target scenario to obtain the target traffic information corresponding to the target scenario; Based on the target traffic information, a test script is generated for testing the target scenario.

[0012] In the above technical solution, the test script determination module is further used to group multiple traffic information corresponding to the target scenario according to the identification category of the traffic information to obtain multiple traffic information groups, wherein the identification category of the traffic information included in any one of the multiple traffic information groups is the same. The traffic information group that contains the most traffic information is identified as the candidate traffic information group; Text similarity processing is performed on the traffic information in the candidate traffic information group to obtain the text similarity value between the traffic information in the candidate traffic information group; Based on the text similarity value, the traffic information in the candidate traffic information group is clustered to obtain at least one candidate traffic information set; Based on at least one of the candidate traffic information sets, determine the target traffic information corresponding to the target scenario.

[0013] In the above technical solution, the test script determination module is also used to determine the candidate traffic information set corresponding to the one containing the most traffic information as the target traffic information set; Select one of the traffic information from the target traffic information set as the target traffic information corresponding to the target scenario.

[0014] In the above technical solution, the test script determination module is also used to obtain a test template; obtain parameter information from the target traffic information, replace the content in the test template with the parameter information, and obtain the replaced test template; The replaced test template is compiled to generate a test script for testing the target scenario.

[0015] In the above technical solution, the target scene determination module is further configured to obtain an evaluation score and a ranking score for each candidate scene before weighting the candidate scenes, wherein the evaluation score represents the object's preference for the candidate scenes, and the ranking score represents the object's preference for the ranking order of the candidate scenes. The candidate scenarios are evaluated based on their evaluation scores, ranking scores, number of objects, and number of candidate scenarios to obtain an evaluation result. Based on the evaluation results, multiple candidate scenarios are filtered to obtain a subset of candidate scenarios. The selected candidate scenarios are then weighted.

[0016] In the above technical solution, the target scene determination module is further configured to perform the following processing for any of the candidate scenes: The evaluation scores and ranking scores of the candidate scenarios are weighted and summed to obtain the evaluation score of the object for the candidate scenarios. The evaluation scores of multiple objects for the candidate scenario are summed to obtain a summed result; The product of the number of objects and the number of candidate scenes is determined, and the ratio of the sum to the product is used as the evaluation result.

[0017] This application provides an electronic device for data processing, the electronic device comprising: Memory, used to store executable instructions; The processor, when executing executable instructions stored in the memory, implements the data processing method provided in the embodiments of this application.

[0018] This application provides a computer-readable storage medium storing executable instructions for inducing a processor to execute and implement the data processing method provided in this application.

[0019] This application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement the data processing method provided in this application.

[0020] The embodiments of this application have the following beneficial effects: By serializing and segmenting traffic information into interfaces, multiple sub-interface sequences are obtained and used as candidate scenarios. Then, by assigning weights to the candidate scenarios, the target scenario is accurately determined from a large number of candidate scenarios. Finally, test scripts are quickly generated based on the traffic information corresponding to the target scenario, realizing the automatic generation of test scripts for integration test scenarios, which effectively improves the efficiency and quality of writing integration test scripts for different scenarios. Attached Figure Description

[0021] Figure 1 This is a schematic diagram illustrating an application scenario of the data processing system provided in this application embodiment; Figure 2 This is a schematic diagram of the structure of an electronic device for data processing provided in an embodiment of this application; Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application; Figure 4 This is a flowchart illustrating an interface sequence for determining traffic information provided in an embodiment of this application. Figure 5 This is a flowchart illustrating the process of determining candidate scenarios provided in an embodiment of this application; Figure 6 This is a flowchart illustrating how multiple interface sequences are segmented to obtain multiple first intermediate sequences, as provided in an embodiment of this application. Figure 7 This is a flowchart illustrating the process of determining multiple (i+1)th intermediate interface sequences provided in an embodiment of this application. Figure 8 This is a schematic diagram illustrating the principle of determining the sub-interface sequence provided in an embodiment of this application; Figure 9 This is a schematic diagram of a process for assigning weights to candidate scenarios provided in an embodiment of this application; Figure 10 This is a flowchart illustrating the process of generating a test script for testing a target scenario, as provided in an embodiment of this application. Figure 11 This is a flowchart illustrating the process of determining target traffic information corresponding to a target scenario, as provided in an embodiment of this application. Figure 12 This is a flowchart illustrating a process for generating a test script for testing a target scenario based on a replaced test template, as provided in an embodiment of this application. Figure 13 This is a flowchart illustrating the process of determining a subset of candidate scenarios after screening, as provided in an embodiment of this application. Figure 14 This is a schematic diagram of a data processing principle provided in an embodiment of this application; Figure 15 This is a schematic diagram illustrating the data processing hierarchy principle provided in the embodiments of this application; Figure 16 This is a flowchart illustrating a data processing method provided in an embodiment of this application; Figure 17 This is a flowchart illustrating how the segmented interface name information sequence is obtained based on the parsing results, as provided in an embodiment of this application. Figure 18 This is a flowchart illustrating the process of mining and weighting a sequence of interface name information provided in an embodiment of this application. Figure 19 This is a schematic diagram of an interface name information mining process provided in an embodiment of this application; Figures 20A-20B This is a schematic diagram illustrating the interactive selection of relevant integration test scenarios through an embedded page in an integrated environment (IDE) plugin, as provided in this embodiment of the application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] In the following description, the terms used are... This merely distinguishes similar objects; it does not represent a specific ordering of objects. Understandably, Where permissible, specific orders or sequences may be interchanged so that the embodiments of this application described herein can be implemented in a sequence other than that illustrated or described herein.

[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0025] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0026] 1) Traffic Recording: Without affecting normal user use, obtain the real requests and service responses of online users, save or forward them to the target application. Different traffic recording methods can be used to collect traffic at different transmission stages.

[0027] 2) Alpha Experience: An internal beta version with incomplete features and many bugs. It is generally not recommended for users to download this version. It is mainly for development and testing purposes.

[0028] 3) Interface Testing: This is a type of testing that examines the interfaces between system components. Interface testing is mainly used to detect the interaction points between external systems and the system, as well as between internal subsystems. The focus of the test is to check the data exchange, transmission, and control management processes, as well as the logical dependencies between systems.

[0029] 4) Interface Auto Testing: A testing method that runs systems and applications under preset conditions based on interfaces and protocols to evaluate the results. The preset conditions should include normal conditions and abnormal conditions.

[0030] 5) Test Script: A series of instructions for a specific test that can be executed by automated testing tools. To improve the maintainability and reusability of test scripts, they must be constructed before execution. The writing of test scripts must correspond to the corresponding test cases.

[0031] 6) Test Case: A test case is a specific set of input data, operations or various environmental settings and expected results provided to the system under test for the purpose of conducting tests.

[0032] In related technologies, integration interface testing, because it tests from the perspective of the business access layer, often involves multiple services and interfaces, focusing on testing the impact of related requests on other services. Currently, there are two main methods for generating test case data: one is manual data entry and test case construction, and the other is automatic generation of test cases for integration interface testing. It can be seen that most related technologies focus on using interface documentation to generate interface test cases.

[0033] During the implementation of the embodiments of this application, the applicant discovered the following problems with the related technology: In related technologies, most systems lack the identification of hotspot integration test scenarios. In existing technical solutions, integration test scenarios need to be constructed manually, but there is still a gap between manually constructed integration test scenarios and hotspot operation scenarios. Secondly, although traffic recording solutions can achieve certain effects on recording and replaying interface tests, they lack the identification of traffic data in integration test scenarios and the automatic generation of test cases, and do not automatically extract traffic data from integration scenarios for testing.

[0034] To address the aforementioned issues, embodiments of this application provide a data processing method, apparatus, device, and computer-readable storage medium capable of automatically generating test scripts for integration testing scenarios, effectively improving the efficiency and quality of writing integration test scripts for different scenarios. The following describes exemplary applications of the data processing device provided in this application embodiment. The device provided in this application embodiment can be implemented as various types of user terminals such as laptops, tablets, desktop computers, set-top boxes, and mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), or as a server.

[0035] See Figure 1 , Figure 1 This is a schematic diagram of an application scenario for the data processing system provided in this application embodiment. The terminal 200 is connected to the server 100 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0036] In some embodiments, server 100 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminal 200 may be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, in-vehicle terminal, etc., but is not limited to these. The terminal and server can be directly or indirectly connected via wired or wireless communication, which is not limited in this embodiment.

[0037] Terminal 200 installs and runs a client with testing capabilities to provide software testing to users, and sends software testing requests to server 100.

[0038] Server 100 is used to receive test requests, parse the test requests to obtain traffic information, perform interface serialization processing on multiple traffic information to obtain an interface sequence corresponding to each traffic information, wherein the traffic information includes at least one interface; segment the multiple interface sequences to obtain multiple sub-interface sequences, and use the scenario corresponding to each sub-interface sequence as a candidate scenario; assign weights to the candidate scenarios, and determine the target scenario from the weighted candidate scenarios; and generate a test script for testing the target scenario based on the traffic information corresponding to the target scenario.

[0039] For example, taking the music playback scenario as an example, a client with specific interface functions for testing the music playback scenario is installed and run on terminal 200. The client receives a specific interface selected by an object on the test page and sends a test request for the music playback scenario to server 100. After receiving the test request, server 100 parses the test request to obtain traffic information. It then performs interface serialization processing on multiple traffic information items to obtain an interface sequence corresponding to each traffic information item, where each traffic information item includes at least one interface. The multiple interface sequences are then segmented to obtain multiple sub-interface sequences, and the scenario corresponding to each sub-interface sequence is used as a candidate scenario. The candidate scenarios are weighted, and a target scenario is determined from the weighted candidate scenarios, such as the scenario of "getting music information—collecting music—getting the music collection list". Based on the traffic information corresponding to the target scenario, a test script for testing the target scenario is generated.

[0040] It should be noted that the object that selects a specific interface includes either a user or a computer.

[0041] In some embodiments, the server 100 can implement the data processing method provided in this application embodiment by running a computer program. For example, the computer program can be a native program or software module in an operating system; it can be a native application (APP), that is, a program that needs to be installed in the operating system to run, such as a program test APP (i.e., the terminal 200 mentioned above); it can also be a mini-program, that is, a program that only needs to be downloaded to a browser environment to run; or it can be a mini-program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module or plugin.

[0042] Taking computer programs as an example, in actual implementation, the terminal has applications that support virtual scenarios installed and running. This application scenario can be any type of business application, whether it's an embedded page in a program plugin or a command-line interactive method.

[0043] In some embodiments, the terminal 200 may be a smartphone, tablet computer, laptop computer, or desktop computer. After the terminal 200 sends traffic information to the server 100, the server 100 performs interface serialization processing on multiple traffic information entries to obtain an interface sequence corresponding to each traffic information entry, wherein each traffic information entry includes at least one interface. The server 100 then segments the multiple interface sequences to obtain multiple sub-interface sequences, and uses the scenario corresponding to each sub-interface sequence as a candidate scenario. The server 100 then assigns weights to the candidate scenarios and determines the target scenario from the weighted candidate scenarios. Finally, based on the traffic information corresponding to the target scenario, a test script for testing the target scenario is generated.

[0044] In some embodiments, the embodiments of this application can also be implemented with the aid of cloud technology, which refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize the computation, storage, processing, and sharing of data.

[0045] Cloud technology is a general term encompassing network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form resource pools, allowing for on-demand use with flexibility and convenience. Cloud computing technology will become a crucial support. The backend services of cloud computing systems require substantial computing and storage resources.

[0046] Figure 2 This is a schematic diagram of the structure of an electronic device for data processing provided in an embodiment of this application. The electronic device 500 is described as a server. Figure 2The illustrated electronic device 500 for data processing includes at least one processor 510, a memory 550, and at least one network interface 520. The various components in the electronic device 500 are coupled together via a bus system 530. It is understood that the bus system 530 is used to implement communication between these components. In addition to a data bus, the bus system 530 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 2 The general labeled all buses as Bus System 530.

[0047] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.

[0048] Memory 550 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 550 described in this application embodiment is intended to include any suitable type of memory. Memory 550 may optionally include one or more storage devices physically located away from processor 510.

[0049] In some embodiments, memory 550 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.

[0050] Operating system 551 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks; The network communication module 553 is used to reach other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc. In some embodiments, the data processing apparatus provided in this application can be implemented in software. Figure 2A data processing device 555 stored in memory 550 is shown. It can be software in the form of programs and plug-ins, including the following software modules: interface serialization module 5551, candidate scene determination module 5552, target scene determination module 5553, and test script determination module 5554 for implementing the function of automatically generating test scripts. These modules are logical and can therefore be arbitrarily combined or further split according to the functions implemented.

[0051] In other embodiments, the data processing apparatus provided in this application can be implemented in hardware. As an example, the data processing apparatus provided in this application can be a processor in the form of a hardware decoding processor, which is programmed to execute the data processing method provided in this application. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0052] As previously stated, the data processing method provided in this application embodiment can be implemented by various types of electronic devices, such as servers. See also Figure 3 , Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application, combined with... Figure 3 The steps shown are explained.

[0053] In step 201, multiple traffic information are processed by interface serialization to obtain an interface sequence corresponding to each traffic information.

[0054] Here, the traffic information includes parsed request data and response files. Each interface in the traffic information has a corresponding timestamp, which is used to represent the time when the interface was triggered.

[0055] In some embodiments, the traffic information in step 201 can be obtained through the following steps: acquiring multiple traffic recording data, parsing the multiple traffic recording data, and obtaining traffic information corresponding to the multiple traffic recording data.

[0056] Here, the traffic recording data is processed by aspect-oriented programming (AOP) using bytecode enhancement to perform aspect processing on the requests in the traffic, thereby enabling the rapid collection of a large amount of traffic information.

[0057] For example, the recorded traffic data is intercepted, then parsed according to the Transmission Control Protocol (TCP), and then parsed into HTTP protocol traffic according to the Hypertext Transfer Protocol (HTTP). A Python script is then used to parse the HTTP protocol traffic to obtain traffic information, which includes various HTTP protocol elements such as request path, request parameters, and response. The parsed traffic information is then saved to a database in a custom format.

[0058] In some embodiments, see Figure 4 , Figure 4 This is a flowchart illustrating an embodiment of the present application for determining the interface sequence corresponding to traffic information. Figure 3 The interface serialization process for multiple traffic information in step 201 shown can be achieved through... Figure 4 Step 2011A Step 2012A is implemented.

[0059] In step 2011A, the attribute information of each interface is obtained from the traffic information.

[0060] For example, the attribute information includes an interface identifier and a timing identifier. The timing identifier is used to characterize the time information when the interface is called. The timing identifier can be generated by recording the corresponding timestamp when the interface is called. The interface identifier is used to identify the name of the interface being called.

[0061] In step 2012A, each interface information is sorted according to the chronological order of the time information, and an interface sequence corresponding to the traffic information is generated based on the sorting result.

[0062] Continuing from the previous example, let's say the timing identifier corresponding to interface information A, B, C, and D is a. t b t c t d t The order in which the timing identifier occurs is b. t a t c t d t Then, the interface information corresponding to the timing identifier is sorted to obtain the interface sequence BACD.

[0063] In some embodiments, when the difference in time information between any interface in the sorting result and the adjacent previous interface is greater than the time interval threshold, the sorting result is segmented using any interface as the dividing point to obtain multiple interface sequences corresponding to the traffic information.

[0064] For example, with a preset time interval threshold of t, when the sorting result contains an interface whose timing identifier is subtracted from the timing identifier of its preceding adjacent interface, and the result t1 is greater than t, the two interfaces are split to determine multiple interface sequences. For instance, when the difference between the timing identifiers corresponding to interface information A and C is greater than t, the two interfaces are split to determine multiple interface sequences. Then the interface sequence Divided into as well as Two interface sequences.

[0065] It should be noted that when multiple differences in the timing identifiers of adjacent interfaces in the sorting result are greater than the time interval t, the sorted interface sequence is divided multiple times to obtain multiple interface sequences. Since the division of the interface sequence is determined by the time interval between adjacent interfaces, the segmented interface sequence is more practical.

[0066] In step 202, the multiple interface sequences are segmented to obtain multiple sub-interface sequences, and the scene corresponding to each sub-interface sequence is taken as a candidate scene.

[0067] In actual implementation, the multiple interface sequences are divided as a whole according to the interface information in the multiple interface sequences, resulting in multiple sub-interface sequences determined by the interface information in the multiple interface sequences, and the scenarios corresponding to the sub-interface sequences are used as candidate scenarios.

[0068] In some embodiments, see Figure 5 , Figure 5 This is a flowchart illustrating the process of determining candidate scenarios provided in an embodiment of this application. Figure 3 In step 202 shown, candidate scenarios are determined based on multiple interface sequences, which can be achieved through... Figure 5 Steps 2021A-2023A are implemented.

[0069] In step 2021A, the multiple interface sequences are segmented according to the first interface identifier of any interface sequence in the multiple interface sequences to obtain multiple first intermediate interface sequences.

[0070] In actual implementation, an interface set, i.e., multiple interface sequences, is obtained. Based on the positional relationship of the interface identifier in any interface sequence, the interface identifier used to segment the multiple interface sequences is determined, resulting in multiple first intermediate interface sequences.

[0071] For example, see Figure 6 , Figure 6 This is a flowchart illustrating how multiple interface sequences are segmented to obtain multiple first intermediate sequences, as provided in an embodiment of this application.

[0072] like Figure 6 As shown, 601 is one of multiple interface sequences, 602 is the first interface identifier of the interface sequence, and 603 is one of multiple first intermediate interface sequences. For example, after dividing multiple interface sequences according to 602, the first intermediate interface sequence 603 is obtained.

[0073] In step 2022A, based on the identifier of the (i+1)th interface in any i-th intermediate interface sequence, multiple i-th intermediate interface sequences are segmented to obtain multiple (i+1)th intermediate interface sequences, where i is a positive integer that increases sequentially and i is less than the number of interfaces in any interface sequence.

[0074] Following the previous example, see [link to example]. Figure 7 , Figure 7 This is a flowchart illustrating the process of determining multiple (i+1)th intermediate interface sequences provided in an embodiment of this application.

[0075] Continuing from the previous example, such as Figure 7 As shown, 701 represents any i-th intermediate interface sequence, 702 represents the (i+1)-th interface identifier, and 703 represents one (i+1)-th intermediate interface sequence from among multiple (i+1)-th intermediate interface sequences, as follows. Figure 7 As shown, the intermediate interface sequence of 701 is obtained by segmenting the intermediate interface sequence of 703 according to the interface identifier of 702 (i+1).

[0076] In step 2023A, the first interface identifier, the (i+1)th interface identifier, and multiple (i+1)th intermediate interface sequences are concatenated to obtain a sub-interface sequence.

[0077] Following the previous example, see [link to example]. Figure 8 , Figure 8 This is a schematic diagram illustrating the principle of determining the sub-interface sequence provided in an embodiment of this application.

[0078] like Figure 8 As shown, 801 is the first interface identifier, 802 is the (i+1)th interface identifier, and 803 represents multiple (i+1)th intermediate interface sequences. The interface sequences from these multiple interface identifiers (including the first and (i+1)th interface identifiers) and the multiple (i+1)th intermediate interface sequences are concatenated to obtain multiple sub-interface sequences (804). The specific concatenation process is as follows: The interface information B from the first interface identifier 801 and the (i+1)th interface identifier 802 is concatenated with the interface information C from the multiple (i+1)th intermediate interface sequences 803 to obtain the sub-interface sequences in the multiple sub-interface sequences 804. .

[0079] It should be noted that after the multiple interface sequences are divided into a whole based on the interface information in the multiple interface sequences, multiple sub-interface sequences are obtained through a balanced splicing method, so that the spliced ​​multiple sub-interface sequences can completely cover the possible combinations of each interface information. Then, the sub-interface sequences are used as candidate scenarios, that is, the candidate scenarios include the permutations and combinations of different situations of each interface information.

[0080] In step 203, the candidate scenes are weighted, and the target scene is determined from the weighted candidate scenes.

[0081] Here, weighting refers to determining the weight values ​​of multiple candidate scenarios based on their relevant characteristics, and then selecting the target scenario from the weighted candidate scenarios.

[0082] In some embodiments, see Figure 9 , Figure 9 This is a schematic diagram of a process for assigning weights to candidate scenarios provided in an embodiment of this application. Figure 3 Step 203, as shown, involves weighting the candidate scenes, which can be achieved through... Figure 9 Step 2031A Step 2032A is implemented.

[0083] In step 2031A, the weight value of each candidate scenario is determined based on the number of times the multiple candidate scenarios are used and the number of interfaces in the multiple candidate scenarios.

[0084] In practice, if the interface sequence corresponding to one of the candidate scenarios X is ABC, then the number of its interfaces is 3. Assume that candidate scenario X is matched by B users out of a total of A users, where B is a positive integer less than or equal to A.

[0085] For example, see Formula 1, which is a method for calculating the weight of a candidate scenario X provided in an embodiment of this application.

[0086]

[0087] Based on Formula 1 above, multiple candidate scenarios are weighted to obtain the weighted candidate scenarios. In Formula 1, parameter M is the number of interfaces in candidate scenario x, B is the number of times the candidate scenario is used, k represents the user (here, the i-th and j-th interfaces), d(k, i), and (k, j) represent the distance between the interfaces clicked by the object, that is, the distance between the i-th and j-th interfaces in the interface sequence corresponding to the object.

[0088] In step 2032A, the candidate scene with the largest weight value is selected as the target scene.

[0089] Continuing the previous example, multiple candidate scenarios, including candidate scenario X, are considered, and all are weighted to obtain corresponding weights. For example, the weights for multiple candidate scenarios X, M, N, G, and H are respectively... , , , , ,in, Finally, the candidate scene X with the highest weight value among all the candidates is determined as the target scene.

[0090] It should be noted that the target scenario is determined based on the weight values ​​determined among multiple candidate scenarios, thus avoiding subjective interpretation of the candidate scenarios and determining the target scenario based on objective evaluation criteria.

[0091] In step 204, a test script for testing the target scenario is generated based on the traffic information corresponding to the target scenario.

[0092] Here, the traffic information corresponding to the target scenario includes the request path, request parameters, and test scripts used for automated testing.

[0093] In some embodiments, see Figure 10 , Figure 10 This is a flowchart illustrating a process for generating test scripts for testing a target scenario, as provided in an embodiment of this application. Figure 3 The process of generating the test script in step 204 shown can be achieved through... Figure 10 Step 2041A Step 2042A is implemented.

[0094] In step 2041A, multiple traffic information corresponding to the target scenario are classified and processed to obtain the target traffic information corresponding to the target scenario.

[0095] For example, if a certain number of users click on a target scene within a time period, the traffic information generated by multiple users is classified, and the target traffic information corresponding to the target scene is selected from the classified traffic information.

[0096] In step 2042A, a test script for testing the target scenario is generated based on the target traffic information.

[0097] Here, the target traffic information includes some key test parameters, such as request path and time parameters. Based on the key test parameters in the target traffic information, test scripts are generated to test the target scenario.

[0098] In some embodiments, see Figure 11 , Figure 11 This is a flowchart illustrating the process of determining target traffic information corresponding to a target scenario, as provided in an embodiment of this application. Figure 10 Step 2041A shown can be achieved through Figure 11 Steps 2041B-2045B are implemented.

[0099] In step 2041B, multiple traffic information items corresponding to the target scenario are grouped according to the identification category of the traffic information to obtain multiple traffic information groups. Among these multiple traffic information groups, the identification category of the traffic information included in any one of the traffic information groups is the same.

[0100] For example, the identification category of traffic information includes the content index of traffic information. Based on the content index of traffic information, traffic information with the same content index is grouped into the same group, and multiple traffic information groups are determined based on the content index of traffic information.

[0101] In step 2042B, the traffic information group that contains the most traffic information is identified as the candidate traffic information group.

[0102] Continuing from the previous example, since multiple traffic information groups are classified together based on the same content index, the number of traffic information included in each traffic information group is not fixed. Therefore, the traffic information group that includes the most traffic information is determined as the candidate traffic information group.

[0103] In step 2043B, text similarity processing is performed on the traffic information in the candidate traffic information group to obtain the text similarity value between the traffic information in the candidate traffic information group.

[0104] Here, after the first screening based on the content index of the traffic information in the candidate traffic information group, there is a high degree of similarity between the traffic information content in the candidate traffic information group.

[0105] In practice, multiple traffic information entries in the candidate traffic information group are converted to plain text format. These plain text entries are then hash-encoded to obtain a hash-encoded group. This hash-encoded group is then weighted, merged, and dimensionality-reduced to obtain a processed hash-encoded group. Hamming distance is calculated on the hash codes within this group, and the Hamming distance is converted into a similarity value. For example, a hash-encoded group may contain two strings: s1: 0000011100110111111100010100000101011111001111011101101110110011, s2: 1001011110110001101101010101001101011111101101001001100110101011, The two strings differ in 16 places, so the Hamming distance of 16 translates to a similarity value of 0.0047.

[0106] In step 2044B, the traffic information in the candidate traffic information group is clustered according to the text similarity value to obtain at least one candidate traffic information set.

[0107] Following the previous discussion, multiple traffic information entries in the candidate traffic information group have corresponding values ​​for each pair. Assume that after hash encoding, weighting, merging, dimensionality reduction, and Hamming distance calculation, multiple similarity values ​​are obtained: d1(s1, s2), d2(s1, s3), d3(s1, s4), d4(s1, s5), d5(s2, s5), d6(s2, s4), d7(s2, s3), d8(s3, s5), d9(s3, s4), and d10(s4, s5). When the similarity... When the difference between them is less than the similarity threshold, the traffic information corresponding to s1-s3 in the traffic information group is taken as the candidate traffic information set.

[0108] It should be noted that when the similarity When the difference between them is less than the threshold, after taking the traffic information corresponding to s1-s3 in the traffic information group as the candidate traffic information set, it is also necessary to confirm the similarity values ​​involved in s2 and s3. When the similarity values ​​involved in s2 and s3 are less than the threshold, the similarity values ​​between them are less than the threshold. When the difference between them is also less than the similarity threshold, the traffic information corresponding to the similarity values ​​of s2 and s3 is added to the candidate traffic information set. For example, when the difference between d1(s1, s2), d2(s1, s3), and d6(s2, s4) is less than the similarity threshold, the traffic information corresponding to s1-s4 in the traffic information group is used as the candidate traffic information set.

[0109] In step 2045B, target traffic information corresponding to the target scenario is determined based on at least one candidate traffic information set.

[0110] For example, after determining multiple candidate traffic information sets, the multiple candidate traffic information sets are sorted. The sorting process can be based on the number of traffic information included in the candidate traffic information set, or it can be based on the size of the information content of the traffic information included in the candidate traffic information set.

[0111] In some embodiments, the candidate traffic information set corresponding to the most traffic information is determined as the target traffic information set; a traffic information is selected from the target traffic information set as the target traffic information corresponding to the target scenario.

[0112] For example, the traffic information corresponding to multiple candidate traffic information sets Q, P, and O are x1, x2, and x3, where Therefore, the candidate traffic information set Q is taken as the target traffic information set, and then a traffic information is randomly selected from the target traffic information set, and the randomly selected traffic information is taken as the target traffic information corresponding to the target scenario.

[0113] It should be noted that another method for selecting a single traffic information from the target traffic information set includes: sorting multiple traffic information pieces in the target traffic information set according to a similarity threshold, and then determining the target traffic information corresponding to the target scenario from the sorting results. In some embodiments, see Figure 12 , Figure 12 This is a flowchart illustrating a process for generating a test script for testing a target scenario based on a replaced test template, as provided in an embodiment of this application. Figure 10 Step 2042A shown can be achieved through Figure 12 Steps in accomplish.

[0114] In step 2041C, the test template is obtained.

[0115] Here, the test template is test code that conforms to the test standards. The test code includes a temporary code template. The key parameter information in the temporary code template is replaced without changing the code's writing logic.

[0116] In step 2042C, the parameter information in the target traffic information is obtained, and the content in the test template is replaced with the parameter information to obtain the replaced test template.

[0117] Here, the parameter information includes the request path and response file parameters. The specific process of replacing the key parameter information of the temporary code template included in the test template to obtain the replaced test template can be understood as embedding a set of text with parameter information into another set of text templates to obtain the replaced test template.

[0118] In step 2043C, the replaced test template is compiled to generate a test script for testing the target scenario.

[0119] For example, the test file code for this interface is generated in the specified directory, that is, data-driven testing is implemented through a specific automated testing interface to generate test scripts for testing the target scenario.

[0120] It should be noted that by identifying the corresponding traffic information from the target scenario and automatically generating test scripts based on the traffic information, the time spent writing test cases, fetching data, and constructing test scripts is reduced, thereby effectively improving the efficiency and quality of writing test cases and test scripts in different test scenarios.

[0121] In some embodiments, see Figure 13 , Figure 13 This is a flowchart illustrating the process of determining a subset of candidate scenarios after screening, as provided in an embodiment of this application. Figure 3 Step 203 shown can also be achieved through Figure 13 Steps 2021B-2024B in the process perform weighting on the candidate scenarios.

[0122] In step 2021B, the evaluation score and the ranking score of each candidate scenario are obtained, wherein the evaluation score represents the object's preference for the candidate scenario, and the ranking score represents the object's preference for the ranking order of the candidate scenarios.

[0123] Here, the evaluation score for each candidate scenario is determined by the subjective scoring of the candidate scenario by the object, that is, the object's judgment on the number of times the candidate scenario appears during use. The object that subjectively scores the candidate scenario includes users or computers.

[0124] In step 2022B, multiple candidate scenarios are evaluated based on the evaluation score of each candidate scenario, the ranking score of each candidate scenario, the number of objects, and the number of candidate scenarios to obtain the evaluation results.

[0125] In some embodiments, the evaluation scores and ranking scores of candidate scenarios are weighted and summed to obtain the evaluation score of an object for a candidate scenario. The evaluation scores of multiple objects for candidate scenarios are summed to obtain a summed result. The product of the number of objects and the number of candidate scenarios is determined, and the ratio of the summed result to the product is used as the evaluation result.

[0126] In practice, the evaluation score for each candidate scenario is determined based on its evaluation score A and the corresponding first weight a. The ranking score x for each candidate scenario is determined based on its ranking score B and the corresponding second weight b. i The sum of the first weight and the second weight equals 1. The sum of the evaluation score and the ranking score is used as the intermediate score of the object. The intermediate scores of each object are summed to obtain the intermediate evaluation result. The product of the number of objects and the number of candidate scenarios is determined, and the ratio of the intermediate evaluation result to the product is used as the evaluation result.

[0127] In step 2023B, multiple candidate scenarios are screened based on the evaluation results to obtain a partial list of candidate scenarios.

[0128] For example, multiple candidate scenarios are sorted in ascending order based on the evaluation results, and the top k candidate scenarios in the ascending order are selected as the filtered candidate scenarios, where k is a natural number.

[0129] In step 2024B, the selected candidate scenarios are weighted.

[0130] It should be noted that after screening multiple candidate scenarios, the screened candidate scenarios are weighted. That is, after obtaining the screened candidate scenarios, the technical features in step 203 are replaced by weighting the screened candidate scenarios, and the target scenario is determined from the weighted candidate scenarios.

[0131] It should be noted that by subjectively evaluating candidate scenarios and considering the time cost required to find a suitable ranking among them, a unified scoring system is established for multiple candidate scenarios, thereby objectively determining the target scenario from the weighted candidate scenarios.

[0132] The following will describe an exemplary application of the embodiments of this application in a real-world application scenario.

[0133] This application's embodiments can implement various interactive scenarios based on integrated development environment (IDE) plugins, such as IDE plugin embedded pages and command-line interaction methods. The following explanation uses the IDE plugin embedded page scenario as an example: In related technologies, the original interface document is usually formatted. After obtaining the formatted interface document, test cases are generated based on the formatted interface document. Alternatively, traffic recording and playback tools based on programming languages ​​(Golang) are used to record traffic in the production environment and then play back the recorded traffic for testing. Among them, the dual-engine regression platform (doom) replicates real online traffic for automatic regression testing. The system focuses on recording, playback, and comparison. However, all related technologies lack hot spot integration test scenario identification, automatic construction of integration test cases from traffic, and technical solutions for automatically generating homogeneous integration test code.

[0134] To address the aforementioned problems, this application proposes a data processing scheme. See also... Figure 14 , Figure 14 This is a schematic diagram of a data processing principle provided in an embodiment of this application. Figure 15 This is a schematic diagram of the data processing hierarchy principle provided in the embodiments of this application.

[0135] like Figure 14 As shown, in some embodiments, the terminal recorded traffic is first parsed through a protocol middleware to obtain traffic data, and the parsed traffic data is stored in the traffic middleware. The traffic data stored in the traffic middleware is cleaned to obtain the corresponding interface sequence (i.e., screening test cases). The obtained interface sequence is then processed by an improved PrefixSpan data mining algorithm (including mining and weighted processing) to mine integration test scenarios (i.e., multiple candidate scenarios). Finally, based on the most frequent traffic corresponding to the hot scenarios (i.e. target scenarios) in the integration test scenarios, traffic is converted into test cases, and test code is generated. Finally, the specific business service is tested in the background automated testing platform using the test code.

[0136] It should be noted that the protocol platform can parse and replace key parameters in the test code to update the test code and enable testing of different business services.

[0137] like Figure 15 As shown, in some embodiments, the technical framework may include recording access, data generation, traffic parsing, traffic cleaning, scenario definition, traffic filtering, data storage, and code generation. Recording access includes recording traffic data through a test version program or directly, and then combining the generated online traffic data with the development... Testers parse the debugging data according to protocol type (including network protocols, wireless unified protocols, hypertext protocols, push requests, communication protocols, etc.), and perform real-time calculations on the parsed traffic. After incremental updates, data deduplication, and sequence segmentation, the data is stored in the protocol platform. Then, based on our integration test scenario identification algorithm, hotspot scenarios are identified through sequence pattern mining, text generation NLP, and alpha+ probability analysis. Traffic similarity analysis, traffic frequency analysis, and traffic filling are performed on the traffic information corresponding to these hotspot scenarios. The processed traffic information is then stored in a telecom data repository or a distributed file database, allowing search engines to retrieve the stored traffic information. Finally, the target traffic information corresponding to the hotspot scenarios is parsed, and test code is generated according to Go coding standards. This code can then be sent via the protocol platform for local debugging. The pipeline executes the test and reports the test results.

[0138] It should be noted that after parsing the target traffic information corresponding to the hotspot scenarios, test code can be generated according to C++ code standards or JAVA code standards.

[0139] In some embodiments, see Figure 16 , Figure 16This is a flowchart illustrating a data processing method provided in an embodiment of this application.

[0140] Step 401: Record the traffic and parse the recorded traffic through the protocol middleware to obtain the parsing result (i.e., traffic information).

[0141] For example, traffic will be recorded through the terminal alpha version. The recorded traffic will be parsed by the protocol middleware and then stored in the traffic middleware.

[0142] It should be noted that the protocol platform parses the recorded traffic to obtain the parsing results through protocols, including trpc, qmf, wup, etc.

[0143] Step 402: Filter the parsing results of the recorded traffic, aggregate them by end user identifier, and then perform serialization processing (i.e., segmentation processing) based on the time field. Extract the interface name information, perform long sequence segmentation on the interface name information, and obtain the segmented interface name information sequence (i.e., candidate scenarios).

[0144] Here, since the alpha test version has a large amount of traffic, PySpark modules can be used to process the large volume of traffic. The large volume of traffic includes request data and response data. Request data includes information such as the request Uniform Resource Locator (URL), computer port (IP port), raw header names (raw HeaderNames), method (method), headers (headers), and body (body). Response data includes information such as IP port, raw header names, status code (status code), status message (status message), headers, size (size), and body (body).

[0145] It should be noted that after extracting the interface name information, the interface name information is split into long sequences to distinguish the usage scenarios of each user.

[0146] In some embodiments, see Figure 17 , Figure 17 This is a flowchart illustrating how the segmented interface name information sequence is obtained based on the parsing results, as provided in an embodiment of this application. Figure 16 The filtering process for the parsing results of the recorded traffic in step 402 shown can be achieved through... Figure 17 Steps 4021-4023 are implemented.

[0147] Step 4021: Differentiate each user's traffic based on their unique identifier.

[0148] Step 4022: For the user's traffic set, sort the traffic according to the interface identifier of each traffic according to the operation time of the interface to obtain the sorting result.

[0149] For example, user A goes to buy something to eat, scans the payment QR code (interface 1), obtains the payment method (interface 2), selects the payment method and enters the password to pay (interface 3), and refreshes the latest balance after successful payment (interface 4)... opens the food to eat (30 seconds have passed here), browses Moments (interface 5), gives someone a like (interface 6), and refreshes Moments (interface 7).

[0150] Step 4023: Divide the sorted result to obtain the segmented interface name information sequence.

[0151] For example, based on the sorting result obtained in step 4022, such as the sorting result including interfaces 1-7, the sorting result is segmented. For example, if it is determined that the interval between interfaces 4 and 5 exceeds the interval threshold, the sequence is segmented into two sequences: .

[0152] Step 403: Evaluate the integration test scenarios (i.e., candidate scenarios).

[0153] It should be noted that mining within traffic... When the generated integration test scenarios are provided to development users, the development users select appropriate integration test scenarios to generate test cases based on their own understanding of the business. This involves a certain degree of subjective judgment, and it is difficult to have a corresponding programmatic way to directly judge.

[0154] For example, see Formula 2-3, which is an evaluation method for an integration test scenario provided by an embodiment of this application.

[0155]

[0156]

[0157] It should be noted that the parameter r in Formula 2-3 is the final measurement score. This refers to the user's evaluation score for the i-th integration test scenario (i.e., the evaluation score of the candidate scenario), which mainly examines whether the desired and reasonable integration test scenario can be found. This refers to the user's ranking score for the i-th integration test scenario (i.e., the ranking score of the candidate scenarios). It mainly examines whether the integration test scenario score can be found quickly. 'a' is the weighting coefficient of the two scoring dimensions, which is set to 0.8 by default. N is the number of users who scored the scenario, used to calculate the average. M is the number of interfaces in the A3 integration test scenario, used to calculate the average.

[0158] It should be noted that here This is based on subjective scoring. Let's assume A, B, and C are music development colleagues. The recognition results for the above scenarios (shown in sorted order) are as follows: Scenario 1: Get music information—Add music to favorites—Get music favorites list, ... Scenario 31: Change username—Play MV—Get music favorites list Here, object A can score scene 1 95 points (which is the scene I want) and scene 31 50 points (which is not the result I want), S(A,1)=95, S(A,31)=50; C(A,1)=sorting score (object B can score scene 1 90 points (which is also the scene he wants) and scene 31 60 points (which is not the result he wants but not too bad), S(A,1)=90, S(A,31)=60.

[0159] Step 404: Identify the segmented interface name information sequence according to the scene recognition algorithm, and determine the weighted interface name information sequence.

[0160] Here, taking business X as an example, business X has 300 backend interfaces. The number of integration test scenarios with an interface link length of 3 may be 27 million, while the number with a length of 4 may be 81 million. Therefore, there may be tens of millions or even hundreds of millions of integration test scenarios. A scenario recognition algorithm is needed to identify the hot scenarios. In this embodiment, the improved PrefixSpan and Prefix-Projected Pattern Growth algorithm is used to identify closely related interface data in the traffic sequence data.

[0161] For example, taking the "Collect Music" interface as an example, there are currently 270,000 possible integration test scenarios for the interface. It is necessary to use algorithms to identify the hot scenarios, such as: "Get music information - Collect music - Get music collection list".

[0162] In some embodiments, see Figure 18 , Figure 18 This is a flowchart illustrating the process of mining and weighting a sequence of interface name information provided in an embodiment of this application. Figure 16 In step 403 shown, the interface name information sequence is identified to determine hotspot scenarios, which can be achieved through... Figure 18 Steps 4031-4032 are implemented.

[0163] Step 4031: Mining the interface name information sequence to obtain the mined interface name information sequence.

[0164] The following section addresses step 4031; see [link / reference]. Figure 19 , Figure 19 This is a schematic diagram of an interface name information mining process provided in an embodiment of this application.

[0165] like Figure 19 As shown, the sequence mining scheme is explained. Each user has corresponding sequence data; for example, A is the interface for obtaining music information, B is the interface for collecting music, and C is the interface for obtaining the music collection list. Based on the sequence pattern mining algorithm (PrefixSpan), a recursive tree-structured mining method is used to mine the integration test scenarios, performing sequence mining one by one. A balanced mining strategy is employed: first, the set of interfaces is extracted; then, data containing interfaces is extracted in turn, followed by round-robin mining to ensure that the final integration test scenario results contain data from all interfaces.

[0166] Step 4032: Perform weighted processing on the mined interface name information sequence to obtain the weighted interface name information sequence.

[0167] Adaptive weighting: By changing the counting of the mining sequence results to distance-weighted calculation results, it can effectively discover more tightly integrated test scenarios.

[0168] For example, see Formula 4, which is a weight calculation method for a test scenario provided in an embodiment of this application.

[0169]

[0170] It should be noted that the parameter M in Formula 4 is the number of interfaces in the test scenario. For example, in the case of ABC, M=3. Therefore, M=5. N is the number of users who matched the scenario. For example, in the bottom right corner of the diagram (ABC), 3 users matched the scenario. Therefore, users 2 and 3 are two users who fit this scenario. Taking ABC as an example: Since parameter M is 3, each is divided by 3. : k represents the user (i.e., the i-th interface), j-th interface, d(k, i), and (k, j) represent the distance between interfaces of a given user. For example, k=2 (user 2), i=1, j=2, here representing the distance AB between user 2. .

[0171] Step 405: Filter and populate the traffic corresponding to the weighted interface name information sequence.

[0172] Here, for the integration test scenario, there will be a certain amount of user information. The traffic of the integrated test scenario is determined and filled with a suitable traffic by a traffic approximation calculation and filtering algorithm. Here, a text similarity algorithm using Levenshtein distance and SimHash distance calculation methods is used for experimental comparison and analysis. See Table 1, which is a comparative table of experimental results provided in the embodiments of this application.

[0173] Table 1

[0174] It's important to note that the first step in comparing the two algorithms is to compare the primary keys of the content (Body) (i.e., the traffic information in the candidate traffic information group). If they are different, they are directly determined to be different traffic. Only when the primary index identifier (key) (i.e., the identifier category of the traffic information) is the same will the similarity calculation of the Body based on the two algorithms begin. The Body refers to the specific content of the traffic, while the primary key refers to the outermost index interface. For example, when retrieving music information, the specific content is:

[0175] Here, the first-level key is .

[0176] It should be noted that the process of traffic filtering and filling involves classifying the traffic, finding the most similar type of traffic, and then filling this most frequent type of traffic.

[0177] For example, if the scenario is: get music information - collect music - get music collection list, there are 100 users' traffic. After similarity calculation, 70 similar items are found and classified as A, 20 similar items are classified as B, and 10 similar items are classified as C. That is, the 70 items in A are similar. Then any one item in A can represent the 70 items and fill this traffic (i.e. the traffic corresponding to the target scenario).

[0178] Step 406: Generate test code.

[0179] The code is generated according to the company's Golang code standards and the test code template for issuing packages. The generated test code and test cases are separated into files. The assertion code only asserts whether the interface request is successful. The relevant custom assertion information still needs to be customized and supplemented.

[0180] Here, standard test code is used, and this standard test code is abstracted into a standard (template) code template. Replaceable content in the template is extracted, such as the request URL and specific Body parameters.

[0181] It should be noted that Golang's template package implements data-driven templates for generating text output. That is, you can embed one set of text into another set of text templates, return the text you expect, and generate test file code for this interface in the specified directory.

[0182] This application proposes a solution for an integrated testing scenario. See also... Figures 20A-20B , Figures 20A-20B This is a schematic diagram illustrating the interactive selection of relevant integration test scenarios through an embedded page in an integrated environment (IDE) plugin, as provided in this embodiment of the application.

[0183] Figure 20A The displayed object is an illustration of the plugin page. Figure 20B The display shows how to generate test cases by filling in relevant parameter information for an object, such as... Figure 20A The test plugin page button 2001 is shown. After clicking button 2001, the user enters the test plugin page and then clicks... Figure 20A After accessing the Traffic to Test Case toolbar 2002 as shown, you can convert recorded traffic information into test cases, and click as shown... Figure 20A The "Scenario Generation Page" button (2003) indicates that you will be taken to the scenario generation page. On this page, select the corresponding business interface name and generate the corresponding test scenario. Then, as shown... Figure 20B The generated test case interface 2004 shown allows users to automatically generate test cases to test the corresponding test scenarios.

[0184] It should be noted that users fill in the interface name and other information in the data serialization format (YAML) file, execute the command directly in the command-line interactive tool, and select the desired integration test scenario in the command line. The tool will automatically generate the test code and test cases in the directory.

[0185] The above embodiments of this application have the following beneficial technical effects: (1) The integration test scenario identification scheme based on data mining algorithm can identify integration test scenarios and perform offline analysis based on the traffic recorded by the terminal. It can identify tens of thousands of hot scenarios from hundreds of millions of possible integration test scenarios in a business, while being unaware of the business.

[0186] (2) The SimHash text similarity calculation scheme is used to calculate the integration test traffic. Dissimilar traffic is statistically analyzed separately. Then, the online real operation scenario traffic with the highest frequency and the same user is selected to generate test cases, thereby realizing automatic construction of test cases.

[0187] (3) Based on the Golang code template and the company's related package delivery tools and protocol platform, the same source test code is automatically generated, and developers can directly perform tests to improve the efficiency of integration testing.

[0188] It is understood that, in the embodiments of this application, user data and other related data are required to obtain user permission or consent when the embodiments of this application are applied to specific products and technologies, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0189] The following description continues to illustrate the exemplary structure of the data processing apparatus 555 provided in the embodiments of this application as a software module. In some embodiments, such as... Figure 2 As shown, the software modules stored in the data processing device 555 of the memory 550 may include: The interface serialization module 5551 is used to perform interface serialization processing on multiple traffic information to obtain an interface sequence corresponding to each traffic information, wherein the traffic information includes at least one interface; the candidate scenario determination module 5552 is used to segment the multiple interface sequences to obtain multiple sub-interface sequences, and use the scenario corresponding to each sub-interface sequence as a candidate scenario; the target scenario determination module 5553 is used to assign weights to the candidate scenarios and determine the target scenario from the weighted candidate scenarios; the test script determination module 5554 is used to generate a test script for testing the target scenario based on the traffic information corresponding to the target scenario.

[0190] In some embodiments, the interface serialization module is further configured to perform the following processing on any one of the multiple traffic information: obtain the attribute information of each interface from the traffic information, wherein the attribute information includes an interface identifier and a timing identifier, the timing identifier being used to characterize the time information when the interface is called; sort each interface information according to the order of the timing information, and generate an interface sequence corresponding to the traffic information according to the sorting result.

[0191] In some embodiments, the interface serialization module is further configured to, when the difference between the time information of any interface in the sorting result and the adjacent previous interface is greater than the time interval threshold, divide the sorting result by any interface as the dividing point to obtain multiple interface sequences corresponding to the traffic information.

[0192] In some embodiments, the candidate scenario determination module is further configured to: segment the multiple interface sequences according to the first interface identifier of any interface sequence in the multiple interface sequences to obtain multiple first intermediate interface sequences; segment the multiple i-th intermediate interface sequences according to the (i+1)-th interface identifier in any i-th intermediate interface sequence to obtain multiple (i+1)-th intermediate interface sequences, where i is a positive integer that increases sequentially and i is less than the number of interfaces in any interface sequence; and concatenate the first interface identifier, the (i+1)-th interface identifier, and the multiple (i+1)-th intermediate interface sequences to obtain a sub-interface sequence.

[0193] In some embodiments, the target scenario determination module is further configured to determine the weight value of each candidate scenario based on the number of times the multiple candidate scenarios are used and the number of interfaces in the multiple candidate scenarios; and to select the candidate scenario with the largest weight value as the target scenario.

[0194] In some embodiments, the test script determination module is further configured to classify and process multiple traffic information corresponding to the target scenario to obtain target traffic information corresponding to the target scenario; and generate a test script for testing the target scenario based on the target traffic information.

[0195] In some embodiments, the test script determination module is further configured to group multiple traffic information corresponding to the target scenario according to the identifier category of the traffic information to obtain multiple traffic information groups, wherein the traffic information included in any one of the multiple traffic information groups has the same identifier category; determine the traffic information group corresponding to the traffic information with the most traffic information as a candidate traffic information group; perform text similarity processing on the traffic information in the candidate traffic information group to obtain the text similarity value between the traffic information in the candidate traffic information group; perform clustering processing on the traffic information in the candidate traffic information group according to the text similarity value to obtain at least one candidate traffic information set; and determine the target traffic information corresponding to the target scenario according to at least one candidate traffic information set.

[0196] In some embodiments, the test script determination module is further configured to determine the candidate traffic information set corresponding to the one containing the most traffic information as the target traffic information set; and select a traffic information from the target traffic information set as the target traffic information corresponding to the target scenario.

[0197] In some embodiments, the test script determination module is further configured to obtain a test template; obtain parameter information from the target traffic information, replace the content in the test template with the parameter information to obtain a replaced test template; and compile the replaced test template to generate a test script for testing the target scenario.

[0198] In some embodiments, the target scenario determination module is further configured to, before weighting the candidate scenarios, obtain an evaluation score and a ranking score for each candidate scenario, wherein the evaluation score represents the object's preference for the candidate scenario, and the ranking score represents the object's preference for the ranking order of the candidate scenarios; evaluate multiple candidate scenarios based on the evaluation score of each candidate scenario, the ranking score of each candidate scenario, the number of objects, and the number of candidate scenarios to obtain an evaluation result; filter multiple candidate scenarios based on the evaluation result to obtain a filtered subset of candidate scenarios; and perform weighted processing on the filtered subset of candidate scenarios.

[0199] In some embodiments, the target scene determination module is further configured to perform the following processing for any candidate scene: perform weighted summation of the evaluation scores and ranking scores of the candidate scenes to obtain the evaluation score of the object for the candidate scene; sum the evaluation scores of multiple objects for the candidate scene to obtain a summation result; determine the product of the number of objects and the number of candidate scenes, and use the ratio of the summation result to the product as the evaluation result.

[0200] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the data processing method described in this application.

[0201] This application provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored and, when executed by a processor, will cause the processor to execute the data processing method provided in this application.

[0202] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.

[0203] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0204] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple collaborating files (e.g., a file that stores one or more modules, subroutines, or code sections).

[0205] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.

Claims

1. A data processing method, characterized in that, include: Perform the following processing on any one of the multiple traffic information pieces: The traffic information includes at least one interface; attribute information of each interface is obtained from the traffic information, wherein the attribute information includes an interface identifier and a timing identifier, and the timing identifier is used to characterize the time information when the interface is called; Each interface is sorted according to the chronological order of the time information, and an interface sequence corresponding to the traffic information is generated based on the sorting result. Based on the first interface identifier of any interface sequence in the plurality of interface sequences, the plurality of interface sequences are segmented to obtain a plurality of first intermediate interface sequences; Based on the interface identifier of the (i+1)th interface in any (i)th intermediate interface sequence, the multiple (i)th intermediate interface sequences are divided to obtain multiple (i+1)th intermediate interface sequences, where i is a positive integer that increases sequentially and i is less than the number of interfaces in any interface sequence. The first interface identifier, the (i+1)th interface identifier, and multiple (i+1)th intermediate interface sequences are concatenated to obtain a sub-interface sequence, and the scene corresponding to each sub-interface sequence is taken as a candidate scene. The candidate scenarios are weighted, and the target scenario is determined from the weighted candidate scenarios. Based on the traffic information corresponding to the target scenario, a test script is generated for testing the target scenario.

2. The method according to claim 1, characterized in that, The step of generating the interface sequence corresponding to the traffic information based on the sorting result includes: When the difference in time information between any interface in the sorting result and its adjacent preceding interface is greater than the time interval threshold, the sorting result is segmented using any interface as the dividing point to obtain multiple interface sequences corresponding to the traffic information.

3. The method according to claim 1, characterized in that, The step of assigning weights to the candidate scenes and determining the target scene from the weighted candidate scenes includes: The weight value of each candidate scenario is determined based on the number of times each candidate scenario is used and the number of interfaces in each candidate scenario. The candidate scene with the largest weight value is selected as the target scene.

4. The method according to claim 1, characterized in that, The step of generating a test script for testing the target scenario based on the traffic information corresponding to the target scenario includes: The target traffic information corresponding to the target scenario is classified and processed to obtain the target traffic information corresponding to the target scenario. Based on the target traffic information, a test script is generated for testing the target scenario.

5. The method according to claim 4, characterized in that, The step of classifying and processing multiple traffic information corresponding to the target scenario to obtain target traffic information corresponding to the target scenario includes: Based on the identifier category of the traffic information, multiple traffic information corresponding to the target scenario are grouped to obtain multiple traffic information groups, wherein the identifier category of the traffic information included in any one of the multiple traffic information groups is the same. The traffic information group that contains the most traffic information is identified as the candidate traffic information group; Text similarity processing is performed on the traffic information in the candidate traffic information group to obtain the text similarity value between the traffic information in the candidate traffic information group; Based on the text similarity value, the traffic information in the candidate traffic information group is clustered to obtain at least one candidate traffic information set; Based on the at least one set of candidate traffic information, the target traffic information corresponding to the target scenario is determined.

6. The method according to claim 5, characterized in that, The step of determining the target traffic information corresponding to the target scenario based on the at least one candidate traffic information set includes: The candidate traffic information set containing the most traffic information is determined as the target traffic information set; Select one of the traffic information from the target traffic information set as the target traffic information corresponding to the target scenario.

7. The method according to claim 4, characterized in that, The step of generating a test script for testing the target scenario based on the target traffic information includes: Get the test template; Obtain the parameter information from the target traffic information, replace the content in the test template with the parameter information, and obtain the replaced test template; The replaced test template is compiled to generate a test script for testing the target scenario.

8. The method according to claim 1, characterized in that, Before performing the weighting process on the candidate scenes, the method further includes: Obtain an evaluation score and a ranking score for each candidate scenario, wherein the evaluation score represents the object's preference for the candidate scenario, and the ranking score represents the object's preference for the ranking order of the candidate scenarios; The candidate scenarios are evaluated based on their evaluation scores, ranking scores, number of objects, and number of candidate scenarios to obtain an evaluation result. Based on the evaluation results, multiple candidate scenarios are filtered to obtain a subset of candidate scenarios. The weighting process for the candidate scenarios includes: The selected candidate scenarios are then weighted.

9. The method according to claim 8, characterized in that, The evaluation of multiple candidate scenarios based on the evaluation score of each candidate scenario, the ranking score of each candidate scenario, the number of objects, and the number of candidate scenarios to obtain the evaluation result includes: For any of the candidate scenarios, perform the following processing: The evaluation scores and ranking scores of the candidate scenarios are weighted and summed to obtain the evaluation score of the object for the candidate scenarios. The evaluation scores of multiple objects for the candidate scenario are summed to obtain a summed result; The product of the number of objects and the number of candidate scenes is determined, and the ratio of the sum to the product is used as the evaluation result.

10. A data processing apparatus, characterized in that, The device includes: An interface serialization module is used to perform the following processing on any one of a plurality of traffic information: the traffic information includes at least one interface; obtain attribute information of each interface from the traffic information, wherein the attribute information includes an interface identifier and a timing identifier, the timing identifier being used to characterize the time information when the interface is called; sort each interface according to the chronological order of the timing information, and generate an interface sequence corresponding to the traffic information based on the sorting result; The candidate scene determination module is used to segment the multiple interface sequences according to the first interface identifier of any interface sequence in the multiple interface sequences to obtain multiple first intermediate interface sequences; to segment the multiple i-th intermediate interface sequences according to the (i+1)-th interface identifier in any i-th intermediate interface sequence to obtain multiple (i+1)-th intermediate interface sequences, where i is a sequentially increasing positive integer and i is less than the number of interfaces in the arbitrary interface sequence; to concatenate the first interface identifier, the (i+1)-th interface identifier, and the multiple (i+1)-th intermediate interface sequences to obtain sub-interface sequences, and to use the scene corresponding to each sub-interface sequence as a candidate scene; The target scene determination module is used to assign weights to the candidate scenes and determine the target scene from the weighted candidate scenes; The test script determination module is used to generate a test script for testing the target scenario based on the traffic information corresponding to the target scenario.

11. The apparatus according to claim 10, characterized in that, The interface serialization module is further configured to, when the difference between the time information of any interface in the sorting result and the adjacent preceding interface is greater than the time interval threshold, use any interface as the dividing point to perform segmentation processing on the sorting result to obtain multiple interface sequences corresponding to the traffic information.

12. The apparatus according to claim 10, characterized in that, The target scene determination module is further configured to determine the weight value of each candidate scene based on the number of times the multiple candidate scenes are used and the number of interfaces in the multiple candidate scenes; The candidate scene with the largest weight value is selected as the target scene.

13. The apparatus according to claim 10, characterized in that, The test script determination module is also used to classify and process multiple traffic information corresponding to the target scenario to obtain target traffic information corresponding to the target scenario; Based on the target traffic information, a test script is generated for testing the target scenario.

14. The apparatus according to claim 13, characterized in that, The test script determination module is further configured to group multiple traffic information corresponding to the target scenario according to the identification category of the traffic information to obtain multiple traffic information groups, wherein the identification category of the traffic information included in any one of the multiple traffic information groups is the same. The test script determination module is further configured to: determine the traffic information group corresponding to the one containing the most traffic information as a candidate traffic information group; perform text similarity processing on the traffic information in the candidate traffic information group to obtain text similarity values ​​between the traffic information in the candidate traffic information group; perform clustering processing on the traffic information in the candidate traffic information group based on the text similarity values ​​to obtain at least one candidate traffic information set; and determine the target traffic information corresponding to the target scenario based on the at least one candidate traffic information set.

15. The apparatus according to claim 14, characterized in that, The test script determination module is further configured to determine the candidate traffic information set corresponding to the most traffic information as the target traffic information set; and select one of the traffic information from the target traffic information set as the target traffic information corresponding to the target scenario.

16. The apparatus according to claim 13, characterized in that, The test script determination module is also used to obtain a test template; obtain parameter information from the target traffic information, replace the content in the test template with the parameter information, and obtain the replaced test template; The replaced test template is compiled to generate a test script for testing the target scenario.

17. The apparatus according to claim 10, characterized in that, The target scene determination module is further configured to, before weighting the candidate scenes, obtain an evaluation score and a ranking score for each candidate scene, wherein the evaluation score represents the object's preference for the candidate scene, and the ranking score represents the object's preference for the ranking order of the candidate scenes; evaluate multiple candidate scenes based on the evaluation score, the ranking score, the number of objects, and the number of candidate scenes to obtain an evaluation result; filter multiple candidate scenes based on the evaluation result to obtain a filtered subset of candidate scenes; and perform weighted processing on the filtered subset of candidate scenes.

18. The apparatus according to claim 17, characterized in that, The target scene determination module is further configured to perform the following processing for any candidate scene: perform a weighted summation of the evaluation score and the ranking score of the candidate scene to obtain the evaluation score of the object for the candidate scene; sum the evaluation scores of multiple objects for the candidate scene to obtain a summation result; determine the product of the number of objects and the number of candidate scenes, and use the ratio of the summation result to the product as the evaluation result.

19. A data processing device, characterized in that, The data processing device includes: Memory, used to store executable instructions; A processor, when executing executable instructions stored in the memory, implements the method according to any one of claims 1 to 9.

20. A computer-readable storage medium storing executable instructions, characterized in that, When the executable instructions are executed by the processor, they implement the method according to any one of claims 1 to 9.

21. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, they implement the method described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method for restoring test script of graphical user interface based on event reachability mode

    CN102411538A

  • Access request recognition method and device, electronic equipment and storage medium

    CN108763274A