Interface testing method, electronic device and storage medium based on flow data

By filtering and playing back the traffic data shards, the response data is detected to determine the interface test results, the problem of inaccurate existing interface test data is solved and the testing efficiency and accuracy are improved.

CN112214395BActive Publication Date: 2024-11-05ZHEJIANG DASOUCHE FINANCIAL LEASING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010910758.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-02
Publication Date
2024-11-05
Estimated Expiration
2040-09-02

AI Technical Summary

Technical Problem

The data in the existing interface testing technology is inaccurate and the test results are poor, which fails to effectively solve the accuracy of interface testing.

Method used

By receiving test requests, multiple traffic data shards are obtained, candidate data shards are filtered according to interface parameters, and sent to the benchmark server and test server for traffic playback, and the playback response data is detected to determine the interface test results.

Benefits of technology

It realizes convenient data acquisition and accurate acquisition of traffic data, and improves the efficiency and accuracy of interface testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112214395B_ABST
    Figure CN112214395B_ABST
Patent Text Reader

Abstract

The present application relates to an interface testing method, device, electronic device and storage medium based on traffic data. The interface testing method based on traffic data includes: receiving a test request, and obtaining multiple traffic data slices corresponding to the test request, the test request carrying the interface parameters of the interface to be tested; screening out candidate traffic data slices from the multiple traffic data slices at least according to the interface parameters; sending the candidate traffic data slices to a preset reference server and a preset test server respectively, and performing traffic playback according to preset configuration parameters to obtain first playback response data and second playback response data; detecting target playback response data in the first playback response data and the second playback response data, and determining the interface test result according to the target playback response data. Through the present application, the problems of inaccurate data and poor test effect of interface testing in the related art are solved, and the beneficial effect of improving the accuracy of interface testing is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for interface testing based on flow data. Background Art

[0002] With the rapid growth of business and technological updates, more and more projects are facing the problem of technical reconstruction. In order to ensure that the built projects, systems, and servers can guarantee the stability of external services, and also take into account the performance of the reconstruction of their own services, effective testing is required before reconstruction to verify and ensure the realization of system problems and functions.

[0003] The existing technical solution for testing service systems is to publish traffic to the test environment server and the benchmark environment server for playback, and complete simple interface testing by monitoring server performance and interface error conditions.

[0004] The existing testing technical solutions do not filter or clean up the traffic data after collection, and the data returned by the interface after the interface test is not verified. The data of the interface test is inaccurate and the test effect is poor.

[0005] Currently, no effective solution has been proposed to address the problems of inaccurate data and poor testing results in interface testing in related technologies. Summary of the invention

[0006] The embodiments of the present application provide an interface testing method, device, electronic device and storage medium based on traffic data, so as to at least solve the problems of inaccurate data and poor testing effect of interface testing in related technologies.

[0007] In a first aspect, an embodiment of the present application provides an interface testing method based on traffic data, comprising: receiving a test request, and obtaining multiple traffic data slices corresponding to the test request, wherein the test request carries interface parameters of the interface to be tested; screening out candidate traffic data slices from the multiple traffic data slices at least according to the interface parameters; sending the candidate traffic data slices to a preset reference server and a preset test server respectively, and performing traffic playback according to preset configuration parameters to obtain first playback response data and second playback response data; detecting target playback response data in the first playback response data and the second playback response data, and determining the interface test result according to the target playback response data.

[0008] In some embodiments, detecting target playback response data in the first playback response data and the second playback response data includes: traversing the first playback response data and the second playback response data respectively, and obtaining first keyword information corresponding to the first playback response data and second keyword information corresponding to the second playback response data; detecting corresponding preset keyword information in the first keyword information and the second keyword information respectively; in the case of detecting the corresponding preset keyword information, determining whether the information value of the corresponding preset keyword information includes preset information, wherein the preset information at least includes information type; in the case of determining that the information value includes preset information, determining that the first playback response data and / or the second playback response data corresponding to the preset keyword information are the target playback response data.

[0009] In some embodiments, determining the interface test result based on the target playback response data includes: extracting a reference information value and a measurement information value corresponding to the first playback response data and the second playback response data in the target playback response data, respectively; comparing the reference information value and the measurement information value, and determining the test result based on the comparison result.

[0010] In some embodiments, the preset configuration parameters include at least one first configuration parameter, and the candidate traffic data slices are sent to a preset benchmark server and a preset test server respectively, and traffic playback is performed according to the preset configuration parameters, including: performing at least one traffic data screening in the traffic data of the candidate traffic data slice according to the at least one first configuration parameter to obtain first traffic playback data; and performing traffic playback on the preset benchmark server and the preset test server.

[0011] In some embodiments, the first configuration parameter includes noise data, and performing at least one traffic data screening on the traffic data of the candidate traffic data segment to obtain the first traffic playback data includes: removing noise from the traffic data of the candidate traffic data segment based on the noise data to obtain the first traffic playback data.

[0012] In some embodiments, the first configuration parameter includes a traffic replay ratio, and at least one traffic data screening is performed on the traffic data of the candidate traffic data shards to obtain the first traffic replay data, including: selecting the traffic data of the candidate traffic data shards according to the traffic replay ratio, and determining that the selected traffic data is the first traffic replay data.

[0013] In some embodiments, the first configuration parameter includes interface address information, and at least one traffic data screening is performed in the traffic data of the candidate traffic data segment to obtain the first traffic playback data, including: selecting the traffic data corresponding to the interface address information from the traffic data of the candidate traffic data segment, and determining that the first traffic playback data includes the selected traffic data corresponding to the interface address information, wherein the interface address information includes the domain name address information corresponding to the interface to be tested in the preset reference server and the preset test server.

[0014] In some embodiments, the first configuration parameter includes noise data, a traffic playback ratio and interface address information, and at least one traffic data screening is performed in the traffic data of the candidate traffic data slice to obtain the first traffic playback data, including: according to the noise data, removing noise from the traffic data of the candidate traffic data slice to obtain second traffic playback data; selecting third traffic playback data from the second traffic playback data according to the traffic playback ratio; selecting fourth traffic playback data corresponding to the interface address information from the third traffic playback data, and determining that the first traffic playback data includes the fourth traffic playback data, wherein the interface address information includes the domain name address information corresponding to the interface to be tested in the preset benchmark server and the preset test server.

[0015] In some embodiments, the interface parameters include target interface information, and screening out candidate traffic data slices from the multiple traffic data slices at least based on the interface parameters includes: reading the slice information of each of the multiple traffic data slices, wherein the slice information includes interface information associated with the traffic data slice; selecting the slice information whose interface information matches the target interface information; and determining that the traffic data slice corresponding to the selected slice information is the candidate traffic data slice.

[0016] In some embodiments, filtering out candidate traffic data slices from the multiple traffic data slices at least based on the interface parameters includes: obtaining the traffic data slice corresponding to the selected slice information as the traffic data slice to be selected; screening the traffic data slice to be selected, and determining that the filtered traffic data slice is the candidate traffic data slice, wherein the screening process at least includes filtering the traffic data slice to be selected, deduplicating the structure, and detecting that the traffic data is empty.

[0017] In a second aspect, an embodiment of the present application provides an interface testing device based on flow data, including:

[0018] An acquisition module, used to receive a test request and acquire multiple traffic data slices corresponding to the test request, wherein the test request carries interface parameters of the interface to be tested;

[0019] A screening module, configured to screen out candidate flow data slices from the plurality of flow data slices at least according to the interface parameters;

[0020] A playback module, used to send the candidate traffic data slices to a preset reference server and a preset test server respectively, and perform traffic playback according to preset configuration parameters to obtain first playback response data and second playback response data;

[0021] The processing module is used to detect target playback response data in the first playback response data and the second playback response data, and determine the interface test result according to the target playback response data.

[0022] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the interface testing method based on traffic data described in the first aspect.

[0023] In a fourth aspect, an embodiment of the present application provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the interface testing method based on traffic data described in the first aspect when running.

[0024] Compared with the related art, the embodiment of the present application provides an interface testing method, device, electronic device and storage medium based on traffic data, which receives a test request and obtains multiple traffic data slices corresponding to the test request, and the test request carries the interface parameters of the interface to be tested; at least selects candidate traffic data slices from the multiple traffic data slices according to the interface parameters; sends the candidate traffic data slices to a preset reference server and a preset test server respectively, and plays back the traffic according to the preset configuration parameters to obtain first playback response data and second playback response data; detects target playback response data in the first playback response data and the second playback response data, and determines the interface test result according to the target playback response data; solves the problems of inaccurate data and poor test effect of interface testing in the related art, and achieves the beneficial effects of convenient data collection, accurate acquisition of playback traffic data, and improved interface testing efficiency and accuracy.

[0025] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0027] Figure 1 It is a hardware structure block diagram of a terminal of the interface testing method based on flow data according to an embodiment of the present invention;

[0028] Figure 2 is a flow chart of an interface testing method based on traffic data according to an embodiment of the present application;

[0029] Figure 3 is a flowchart of comparing playback response data in a preferred embodiment of the present application;

[0030] Figure 4 is a flowchart of screening candidate traffic data slices according to a preferred embodiment of the present application;

[0031] Figure 5 It is a structural block diagram of an interface testing device based on flow data according to an embodiment of the present application. DETAILED DESCRIPTION

[0032] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0033] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0034] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0035] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0036] The various techniques described in this application can be used for query-type interface testing and interface testing of extended functions that support data modification types.

[0037] Before describing and illustrating the embodiments of the present application, the related technologies used in the present application are described as follows:

[0038] A reference environment is an agreed upon environment used to calibrate and compare test results obtained in other environments.

[0039] A testing environment is a description of the software and hardware environment on which the tests are run, as well as any other software that interacts with the software under test.

[0040] Website traffic refers to the number of visits to a website, which is used to describe the number of users visiting a website and track user behavior.

[0041] A dictionary is an unordered collection of objects. Dictionary elements are accessed by keys rather than index values. Dictionaries use key-value pairs for storage, and dictionary searches are fast. Dictionaries are mutable data types. In other languages, dictionaries are also called maps.

[0042] The method embodiment provided in this embodiment can be executed in a terminal, a computer or a similar test platform. Taking running on a terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a terminal for running an interface test method based on flow data according to an embodiment of the present invention. Figure 1 As shown, the terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the above terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0043] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the interface test method based on flow data in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0044] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (Radio Frequency, referred to as RF) module, which is used to communicate with the Internet wirelessly.

[0045] This embodiment provides an interface testing method based on traffic data. Figure 2 is a flow chart of an interface testing method based on traffic data according to an embodiment of the present application. Figure 2 As shown, the process includes the following steps:

[0046] Step S201, receiving a test request, and obtaining a plurality of traffic data slices corresponding to the test request, wherein the test request carries interface parameters of the interface to be tested.

[0047] In this embodiment, the subject that completes the interface testing method includes but is not limited to an interface comparison platform. The traffic data tested in the embodiment of the present application is traffic data collected through a traffic collection platform, and the traffic data includes website traffic.

[0048] In this embodiment, the test request received by the interface comparison platform is a test request generated by the test item selected by the tester on the interface comparison platform, which carries at least the interface parameters of the interface to be tested. After receiving the test request, the interface comparison platform will collect multiple flow data slices corresponding to the test request from the flow collection platform, wherein the flow collection platform will generate flow data slices correspondingly after collecting the flow data, and each flow data slice corresponds to a slice name.

[0049] In this embodiment, after the interface comparison platform obtains multiple traffic data slices, the multiple traffic data slices will be stored, and the subsequent test steps will filter the multiple traffic data slices according to the operation options corresponding to the test request.

[0050] It should be noted that, in this embodiment, the test request will include information of the interface to be tested that needs to be tested. After the interface comparison platform obtains the test request, it will determine the interface to be tested according to the test request.

[0051] Step S202: selecting candidate flow data slices from a plurality of flow data slices at least according to the interface parameters.

[0052] In this embodiment, after the interface comparison platform obtains multiple traffic data slices corresponding to the test request, by entering the interface parameters on the interface comparison platform, that is, the slice name of the corresponding traffic data slice, the interface comparison platform will display the traffic data slice corresponding to the interface parameter. In this way, the candidate traffic data slices can be screened out.

[0053] In this embodiment, in the process of screening out candidate traffic data slices, the basic item for screening the candidate traffic data slices is: whether the traffic data slice corresponding to the interface parameters of the interface to be tested is selected. At the same time, in this embodiment, optional items are also added, and the optional items include: filtering according to the configured filtering conditions, performing structural deduplication according to the configured structural deduplication algorithm, and detecting whether the traffic data slice is empty; using the basic items and optional items as screening conditions to screen and process multiple traffic data slices to obtain candidate traffic data slices. The screened and processed traffic data slices are beneficial to improving test efficiency.

[0054] Step S203, sending the candidate traffic data slices to a preset reference server and a preset test server respectively, and performing traffic playback according to preset configuration parameters to obtain first playback response data and second playback response data.

[0055] In this embodiment, the candidate traffic data is fragmented and traffic is replayed in the reference server and the test server, thereby obtaining the data difference of the interface test in the two environments. In this embodiment, the data for traffic replay is the traffic replay data that meets the preset configuration parameter conditions.

[0056] In this embodiment, the environment corresponding to the benchmark server is the aforementioned benchmark environment, and the environment corresponding to the test server is the aforementioned test environment. By placing the candidate traffic data shards into two specified environments respectively, and comparing the data differences returned by the interfaces in the two environments, the first playback response data and the second playback response data are obtained.

[0057] Step S204: detecting target playback response data in the first playback response data and the second playback response data, and determining an interface test result according to the target playback response data.

[0058] In this embodiment, after obtaining the first playback response data and the second playback response data, it is also necessary to verify whether the returned response data is correct. By detecting the target playback response data in the first playback response data and the second playback response data, the verification of whether the response data returned in the two environments is correct is completed accordingly; after verifying or testing that the returned response data is correct, the corresponding interface test results and reports are generated according to the verified correct response data.

[0059] Through the above steps S201 to S204, a test request is received, and multiple traffic data slices corresponding to the test request are obtained, wherein the test request carries the interface parameters of the interface to be tested; candidate traffic data slices are screened out from the multiple traffic data slices at least according to the interface parameters; the candidate traffic data slices are sent to a preset reference server and a preset test server respectively, and traffic is played back according to preset configuration parameters to obtain first playback response data and second playback response data; target playback response data is detected in the first playback response data and the second playback response data, and the interface test result is determined according to the target playback response data; the problems of inaccurate data and poor test effect of interface tests in related technologies are solved, and the beneficial effects of conveniently obtaining case data, accurately obtaining playback traffic data, and improving interface test efficiency are achieved.

[0060] In some embodiments, detecting target playback response data in the first playback response data and the second playback response data comprises the steps of:

[0061] Step 1: traverse the first playback response data and the second playback response data respectively, and obtain first keyword information corresponding to the first playback response data and second keyword information corresponding to the second playback response data.

[0062] In this embodiment, the first playback response data and the second playback response data are both returned json strings, and before traversal, the json strings need to be converted into dictionary types, and traversing the first playback response data and the second playback response data is traversing the key values ​​in the dictionary.

[0063] Step 2: Detect corresponding preset keyword information in the first keyword information and the second keyword information respectively.

[0064] In this embodiment, after traversing and acquiring the first keyword information and the second keyword information, firstly verify whether the first keyword information and the second keyword information are in the noise data, so as to detect whether the first keyword information and the second keyword information are the preset keyword information expected to be detected.

[0065] Step 3: when the corresponding preset keyword information is detected, determine whether the information value of the corresponding preset keyword information includes preset information, wherein the preset information at least includes information type.

[0066] In this embodiment, when it is verified that the first keyword information and the second keyword information correspond to the expected keyword information, that is, the result data set (a collection of multiple types of data) of the traffic data playback associated with the interface to be tested, it is necessary to determine whether there is an expected data of a certain type in the first keyword information and the second keyword information. When the expected data of a certain type is detected, it means that the first keyword information and the second keyword information are the keyword information corresponding to the expected target playback response data. By comparing the expected data of a certain type in the first keyword information and the second keyword information, the test result of the interface can be generated.

[0067] Step 4: when it is determined that the information value includes preset information, determine the first playback response data and / or the second playback response data corresponding to the preset keyword information as the target playback response data.

[0068] It should be noted that in the specific interface testing process, the tested interface is set to the corresponding interface of the price-related traffic data, the first playback response data and the second playback response data are the return result data of the playback traffic data of the associated price, the preset keyword information is set to the price information data associated with a certain food in the price, and the preset information is set to the price increase of the food; the return result data of the playback traffic data of the associated price obtained after traffic playback in the benchmark server and the test server is obtained by traversing, and when the price information data associated with the certain food and the price increase of the food are detected in the return result data of the playback traffic data of the associated price, the return result data of the playback traffic data of the associated price is determined to be the target playback response data.

[0069] By traversing the first playback response data and the second playback response data respectively as described above, and obtaining the first keyword information corresponding to the first playback response data and the second keyword information corresponding to the second playback response data; detecting the corresponding preset keyword information in the first keyword information and the second keyword information respectively; in the case of detecting the corresponding preset keyword information, determining whether the information value of the corresponding preset keyword information includes the preset information; in the case of determining that the information value includes the preset information, determining the first playback response data and / or the second playback response data corresponding to the preset keyword information as the target playback response data, thereby realizing the detection of the target playback response data and efficiently acquiring the interface comparison return data.

[0070] In some embodiments, determining the interface test result according to the target playback response data includes the following steps:

[0071] Step 1: extracting reference information values ​​and measurement information values ​​corresponding to first playback response data and second playback response data in target playback response data.

[0072] In this embodiment, the benchmark information value corresponds to the value of the keyword information in the playback response data generated by the traffic playback of the traffic data slice of the interface to be tested in the benchmark server, and the measurement information value corresponds to the value of the keyword information in the playback response data generated by the traffic playback of the traffic data slice of the interface to be tested in the test server; in this embodiment, the playback response data can be represented by a dictionary type, the corresponding keyword information is key, and the corresponding value is value.

[0073] Step 2: compare the reference information value and the measured information value, and determine the test result based on the comparison result.

[0074] In this embodiment, the reference information value and the measured information value are compared, that is, the value values ​​are compared, and the test result is determined according to whether the two value values ​​are consistent.

[0075] Figure 3 is a flowchart of comparing playback response data in a preferred embodiment of the present application, such as Figure 3 As shown, the process includes the following steps:

[0076] Step S301, simultaneously read two JSON strings corresponding to the first playback response data and the second playback response data.

[0077] Step S302, convert the two JSON strings into two dictionary types.

[0078] Step S303, traverse the keys in the two dictionary types.

[0079] Step S304, determine whether the two keys are in the noise data, if yes, execute step S303, otherwise, execute step S305.

[0080] Step S305, obtaining the values ​​corresponding to the two keys.

[0081] Step S306, determine the types of the two values. If they are list types, execute step S307; if they are strings / numbers, execute step S308; if they are dictionary types, execute step S303.

[0082] Step S307, compare whether the lengths of the two lists are consistent, if yes, execute step S308, otherwise, execute step S312.

[0083] Step S308, compare whether the values ​​of the two lists are consistent, if yes, execute step S311, otherwise, execute step S312.

[0084] Step S309, determine whether the string is json, if yes, execute step S302, otherwise, execute step S310.

[0085] Step S310, compare whether the values ​​of the two character strings are consistent, if yes, execute step S311, otherwise, execute step S312.

[0086] Step S311, record the value is consistent, then execute step S303.

[0087] Step S312, record that value is inconsistent, then execute step S303.

[0088] Through the above steps S301 to S312, a specific comparison of the interface return data is achieved to obtain the interface test result. By performing an accuracy test on the playback response data returned by the flow data playback, the accuracy of the interface test is improved.

[0089] In some embodiments, the preset configuration parameters include at least one first configuration parameter, and sending the candidate traffic data slices to the preset reference server and the preset test server respectively, and performing traffic playback according to the preset configuration parameters includes the following steps:

[0090] Step 1: Perform at least one flow data screening in the flow data of the candidate flow data slice according to at least one first configuration parameter to obtain first flow playback data.

[0091] In this embodiment, the first configuration parameter includes one or more of noise data, traffic playback ratio and interface address information. According to the first configuration parameter, the traffic data of the candidate traffic data slices are screened to obtain relevant traffic data for traffic playback comparison on a preset benchmark server and a preset test server.

[0092] Step 2: replay the first traffic replay data in a preset reference server and a preset test server.

[0093] It should be noted that, in the specific implementation process, the step of screening the traffic data is performed in the preset benchmark server and the preset test server, that is, the preset benchmark server and the preset test server will replay the traffic data corresponding to the first configuration parameter in the traffic data of the input candidate traffic data segment according to the configured first configuration parameter, and the traffic data that does not match the first configuration parameter will not be replayed.

[0094] By performing at least one traffic data screening in the traffic data of the candidate traffic data shards according to at least one first configuration parameter, first traffic replay data is obtained; the first traffic replay data is replayed in a preset reference server and a preset test server, so as to select a specified traffic data shard and a specified traffic data for traffic replay, accurately replay the traffic data, and improve the accuracy of the interface test.

[0095] In some embodiments, the first configuration parameter includes noise data, and performing at least one traffic data screening on the traffic data of the candidate traffic data shards to obtain the first traffic playback data includes the following steps: based on the noise data, removing noise from the traffic data of the candidate traffic data shards to obtain the first traffic playback data.

[0096] In this embodiment, by configuring noise data, during the flow data playback process, the flow data belonging to noise data is selected to be filtered out, that is, when the flow data is noise data, flow playback is not performed, or, after the flow data of the candidate flow data fragments are played back, the playback response data generated by the corresponding noise data is eliminated and not returned.

[0097] In some embodiments, the first configuration parameter includes a traffic replay ratio, and performing at least one traffic data screening on the traffic data of the candidate traffic data shards to obtain the first traffic replay data includes the following steps: selecting the traffic data of the candidate traffic data shards according to the traffic replay ratio, and determining that the selected traffic data is the first traffic replay data.

[0098] In this embodiment, configuring the traffic playback ratio means selecting a corresponding number of candidate traffic data slices from the candidate traffic data slices for traffic playback, or selecting a set percentage of data traffic from the traffic data of each candidate traffic data slice for traffic playback.

[0099] In some embodiments, the first configuration parameter includes interface address information, and at least one traffic data screening is performed in the traffic data of the candidate traffic data segment to obtain the first traffic playback data, including the following steps: selecting the traffic data corresponding to the interface address information from the traffic data of the candidate traffic data segment, and determining that the first traffic playback data includes the selected traffic data corresponding to the interface address information, wherein the interface address information includes the domain name address information corresponding to the interface to be tested in the preset reference server and the preset test server.

[0100] In this embodiment, by making the interface to be tested correspond to the domain name address in the preset benchmark server and the preset test server, the traffic data corresponding to the domain name address associated with the interface to be tested in the preset benchmark server and the preset test server is selected for playback. For example, the traffic data generated by accessing the domain name address corresponding to the interface to be tested in the preset benchmark server and the preset test server can be selected for traffic data playback.

[0101] In some embodiments, the first configuration parameter includes noise data, traffic playback ratio, and interface address information, and performing at least one traffic data screening in the traffic data of the candidate traffic data slices to obtain the first traffic playback data includes the following steps:

[0102] Step 1: According to the noise data, the traffic data of the candidate traffic data segment is subjected to noise removal to obtain the second traffic playback data.

[0103] Step 2: Select the third flow playback data from the second flow playback data according to the flow playback ratio.

[0104] Step 3, select the fourth traffic replay data corresponding to the interface address information in the third traffic replay data, and determine that the first traffic replay data includes the fourth traffic replay data, wherein the interface address information includes the domain name address information corresponding to the interface to be tested in the preset reference server and the preset test server.

[0105] In this embodiment, the first configuration parameter is set to be multiple, and the number of times the traffic data of the candidate traffic data slice is screened corresponds to multiple times, so as to accurately screen out the playback traffic data and improve the accuracy of the interface test.

[0106] In some embodiments, the interface parameter includes target interface information, and selecting candidate traffic data slices from a plurality of traffic data slices at least according to the interface parameter includes the following steps:

[0107] Step 1: read the slice information of each of the multiple traffic data slices, wherein the slice information includes the interface information associated with the traffic data slice.

[0108] In this embodiment, a plurality of flow data slices are generated by the flow collection platform after collecting flow data, and each flow data slice corresponds to a slice name.

[0109] Step 2: Select the slice information whose interface information matches the target interface information.

[0110] In this embodiment, by inputting interface information, that is, the slice name of the corresponding traffic data slice, on the interface comparison platform, the interface comparison platform will display the traffic data slice corresponding to the interface information, so that the corresponding slice information can be selected.

[0111] Step 3: Determine the traffic data segment corresponding to the selected segment information as the candidate traffic data segment.

[0112] By reading the shard information of each of the multiple traffic data shards as described above, wherein the shard information includes the interface information associated with the traffic data shard, selecting the shard information whose interface information matches the target interface information, determining the traffic data shard corresponding to the selected shard information as the candidate traffic data shard, importing the traffic data shard into the interface comparison platform based on the interface information and filtering the traffic data for traffic playback.

[0113] In some embodiments, selecting candidate traffic data slices from a plurality of traffic data slices at least according to the interface parameters comprises the following steps:

[0114] Step 1: Obtain the traffic data shard corresponding to the selected shard information as the traffic data shard to be selected.

[0115] In this embodiment, the preliminary screening of the flow data slices is first completed according to the interface information.

[0116] Step 2, screening the selected traffic data shards to determine the screened traffic data shards as candidate traffic data shards, wherein the screening process at least includes filtering the selected traffic data shards, deduplicating the structures, and detecting that the traffic data is empty.

[0117] In this embodiment, after completing the preliminary screening of the traffic data shards, further filtering and screening is performed based on preset filtering conditions such as whether filtering conditions are configured, whether structural deduplication algorithms are configured, and whether the data of the traffic data shards is empty. Through multiple data deduplication algorithms, the effect of accurate traffic data playback is achieved.

[0118] Figure 4 is a flowchart of screening candidate traffic data slices according to a preferred embodiment of the present application, such as Figure 4 As shown, the process includes:

[0119] Step S401, importing traffic data slices.

[0120] Step S402, reading the traffic data of the traffic data slice.

[0121] Step S403, determine whether the interface to be tested is selected, if yes, execute step S404, otherwise, execute step S402.

[0122] Step S404, determine whether to configure the filtering condition, if yes, execute step S405, otherwise, execute step S406.

[0123] Step S405: Filtering and screening based on the interface condition filtering algorithm.

[0124] Step S406, determine whether the structure is deduplicated, if so, execute step S407, otherwise, execute step S408.

[0125] Step S407, filtering and screening based on a structure deduplication algorithm.

[0126] Step S408, writing the traffic data slice.

[0127] Step S409, determine whether the traffic data of the traffic data segment is empty, if so, execute step S402, otherwise, execute step S410.

[0128] Step S410, importing traffic data shards is completed.

[0129] Through the above steps S401 to S410, the flow data fragments are imported into the interface comparison platform, and through a variety of deduplication algorithms, the flow data is screened, the flow data is accurately played back, and the accuracy of the interface test is improved.

[0130] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0131] This embodiment also provides an interface testing device based on flow data, which is used to implement the above embodiments and preferred implementations, and will not be repeated for what has been described. As used below, the terms "module", "unit", "subunit", etc. can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0132] Figure 5 is a structural block diagram of an interface testing device based on flow data according to an embodiment of the present application, such as Figure 5 As shown, the device comprises:

[0133] The acquisition module 51 is used to receive a test request and acquire multiple traffic data slices corresponding to the test request, wherein the test request carries interface parameters of the interface to be tested.

[0134] The screening module 52 is coupled to the acquisition module 51 and is used to screen out candidate flow data slices from the multiple flow data slices at least according to the interface parameters.

[0135] The playback module 53 is coupled to the screening module 52 and is used to send the candidate traffic data segments to the preset reference server and the preset test server respectively, and perform traffic playback according to preset configuration parameters to obtain first playback response data and second playback response data.

[0136] The processing module 54 is coupled to the playback module 53 and is used to detect target playback response data in the first playback response data and the second playback response data, and determine the interface test result according to the target playback response data.

[0137] In some of the embodiments, the processing module 54 is used to traverse the first playback response data and the second playback response data, respectively, and obtain first keyword information corresponding to the first playback response data and second keyword information corresponding to the second playback response data; detect corresponding preset keyword information in the first keyword information and the second keyword information, respectively; in the case of detecting the corresponding preset keyword information, determine whether the information value of the corresponding preset keyword information includes preset information, wherein the preset information at least includes the information type; in the case of determining that the information value includes the preset information, determine that the first playback response data and / or the second playback response data corresponding to the preset keyword information are the target playback response data.

[0138] In some embodiments, the processing module 54 is used to extract the reference information value and the measurement information value corresponding to the first playback response data and the second playback response data in the target playback response data; compare the reference information value and the measurement information value, and determine the test result according to the comparison result.

[0139] In some embodiments, the preset configuration parameters include at least one first configuration parameter, and the playback module 53 is used to perform at least one traffic data screening in the traffic data of the candidate traffic data segment according to the at least one first configuration parameter to obtain first traffic playback data; and to perform traffic playback of the first traffic playback data in a preset benchmark server and a preset test server.

[0140] In some embodiments, the first configuration parameter includes noise data, and the playback module 53 is used to remove noise from the traffic data of the candidate traffic data segment according to the noise data to obtain first traffic playback data.

[0141] In some embodiments, the first configuration parameter includes a traffic playback ratio, and the playback module 53 is used to select traffic data of the candidate traffic data slices according to the traffic playback ratio, and determine the selected traffic data as the first traffic playback data.

[0142] In some embodiments, the first configuration parameter includes interface address information, and the playback module 53 is used to select traffic data corresponding to the interface address information from the traffic data of the candidate traffic data segment, and determine that the first traffic playback data includes the selected traffic data corresponding to the interface address information, wherein the interface address information includes domain name address information corresponding to the interface to be tested in a preset reference server and a preset test server.

[0143] In some embodiments, the first configuration parameter includes noise data, a traffic playback ratio and interface address information. The playback module 53 is used to remove noise from the traffic data of the candidate traffic data segment based on the noise data to obtain second traffic playback data; select third traffic playback data from the second traffic playback data according to the traffic playback ratio; select fourth traffic playback data corresponding to the interface address information from the third traffic playback data, and determine that the first traffic playback data includes the fourth traffic playback data, wherein the interface address information includes the domain name address information corresponding to the interface to be tested in the preset benchmark server and the preset test server.

[0144] In some embodiments, the interface parameters include target interface information, and the screening module 52 is used to read the slice information of each of the multiple traffic data slices, wherein the slice information includes the interface information associated with the traffic data slice; select the slice information whose interface information matches the target interface information; and determine that the traffic data slice corresponding to the selected slice information is a candidate traffic data slice.

[0145] In some of the embodiments, the screening module 52 is used to obtain the traffic data slices corresponding to the selected slice information as the traffic data slices to be selected; the selected traffic data slices are screened and processed, and the screened traffic data slices are determined to be candidate traffic data slices, wherein the screening process at least includes filtering the selected traffic data slices, deduplicating the structures, and detecting that the traffic data is empty.

[0146] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0147] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0148] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0149] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0150] S1, receiving a test request and obtaining multiple traffic data slices corresponding to the test request, wherein the test request carries interface parameters of the interface to be tested.

[0151] S2, selecting candidate flow data slices from the plurality of flow data slices at least according to the interface parameters.

[0152] S3, sending the candidate traffic data slices to a preset reference server and a preset test server respectively, and performing traffic playback according to preset configuration parameters to obtain first playback response data and second playback response data.

[0153] S4, detecting target playback response data in the first playback response data and the second playback response data, and determining an interface test result according to the target playback response data.

[0154] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0155] In addition, in combination with the interface testing method based on flow data in the above embodiments, the present application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the interface testing methods based on flow data in the above embodiments is implemented.

[0156] Those skilled in the art should understand that the technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0157] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. An interface testing method based on traffic data, characterized in that: include: Receive a test request, and obtain multiple traffic data slices corresponding to the test request, wherein the test request carries interface parameters of the interface to be tested; Filtering candidate traffic data slices from the multiple traffic data slices according to the interface parameters; The candidate traffic data slices are respectively sent to a preset reference server and a preset test server, and according to preset configuration parameters, traffic data are screened in the traffic data of the candidate traffic data slices to obtain first traffic playback data; wherein the preset configuration parameters include noise data, traffic playback ratio and interface address information; according to the noise data, the traffic data of the candidate traffic data slices are subjected to noise removal to obtain second traffic playback data; third traffic playback data are selected from the second traffic playback data according to the traffic playback ratio; fourth traffic playback data corresponding to the interface address information is selected from the third traffic playback data, and it is determined that the first traffic playback data includes the fourth traffic playback data, and the interface address information includes the domain name address information corresponding to the interface to be tested in the preset reference server and the preset test server; Replaying the first traffic playback data in a preset reference server and a preset test server to obtain first playback response data and second playback response data; The first playback response data and the second playback response data are traversed respectively, and first keyword information corresponding to the first playback response data and second keyword information corresponding to the second playback response data are obtained; corresponding preset keyword information is detected in the first keyword information and the second keyword information respectively; when the corresponding preset keyword information is detected, it is determined whether the information value of the corresponding preset keyword information includes preset information, wherein the preset information includes information type; when it is determined that the information value includes preset information, the first playback response data and / or the second playback response data corresponding to the preset keyword information are determined to be target playback response data, and an interface test result is determined according to the target playback response data.

2. The interface testing method based on flow data according to claim 1, characterized in that: Determining the interface test result according to the target playback response data includes: extracting a reference information value and a measurement information value respectively corresponding to the first playback response data and the second playback response data in the target playback response data; The reference information value and the measurement information value are compared, and the test result is determined according to the comparison result.

3. The interface testing method based on flow data according to claim 1, characterized in that: The interface parameter includes target interface information, and selecting candidate flow data slices from the plurality of flow data slices according to the interface parameter includes: Reading the shard information of each of the plurality of traffic data shards, wherein the shard information includes the interface information associated with the traffic data shard; Selecting the slice information whose interface information matches the target interface information; Determine that the traffic data segment corresponding to the selected segment information is the candidate traffic data segment.

4. The interface testing method based on flow data according to claim 3 is characterized in that: Screening out candidate traffic data slices from the plurality of traffic data slices according to the interface parameters comprises: The traffic data slice corresponding to the selected slice information is obtained as the traffic data slice to be selected; The candidate traffic data slices are screened and processed to determine that the screened traffic data slices are the candidate traffic data slices, wherein the screening process at least includes filtering the candidate traffic data slices, deduplicating structures, and detecting that traffic data is empty.

5. An interface testing device based on flow data, characterized in that: include: An acquisition module, used to receive a test request and acquire multiple traffic data slices corresponding to the test request, wherein the test request carries interface parameters of the interface to be tested; A screening module, used for screening candidate flow data slices from the plurality of flow data slices according to the interface parameters; A playback module, used to send the candidate traffic data slices to a preset reference server and a preset test server respectively, and perform traffic data screening in the traffic data of the candidate traffic data slices according to preset configuration parameters to obtain first traffic playback data; wherein the preset configuration parameters include noise data, traffic playback ratio and interface address information; according to the noise data, perform noise removal on the traffic data of the candidate traffic data slices to obtain second traffic playback data; select third traffic playback data from the second traffic playback data according to the traffic playback ratio; select fourth traffic playback data corresponding to the interface address information from the third traffic playback data, and determine that the first traffic playback data includes the fourth traffic playback data, and the interface address information includes the domain name address information corresponding to the interface to be tested in the preset reference server and the preset test server; perform traffic playback on the first traffic playback data in the preset reference server and the preset test server to obtain first playback response data and second playback response data; A processing module is used to traverse the first playback response data and the second playback response data respectively, and obtain first keyword information corresponding to the first playback response data and second keyword information corresponding to the second playback response data; detect corresponding preset keyword information in the first keyword information and the second keyword information respectively; in the case of detecting the corresponding preset keyword information, determine whether the information value of the corresponding preset keyword information includes preset information, wherein the preset information includes information type; in the case of determining that the information value includes preset information, determine that the first playback response data and / or the second playback response data corresponding to the preset keyword information are target playback response data, and determine the interface test result according to the target playback response data.

6. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the interface testing method based on flow data according to any one of claims 1 to 4.

7. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the interface testing method based on flow data according to any one of claims 1 to 4 when running.