Data processing method and device, electronic equipment and storage medium

By acquiring and parsing noise and response data from interface use cases, and automating the processing of interface call results, the problem of low data processing efficiency in existing technologies is solved, achieving efficient and accurate interface management.

CN116546278BActive Publication Date: 2026-05-12BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
Filing Date
2023-04-26
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In existing technologies, data processing efficiency is low when managing software interfaces, requiring manual data analysis of interface calls, which leads to inefficiency.

Method used

By acquiring noise data, actual response data, and expected response data of interface test cases, the system automatically parses and compares each field to determine the data processing result. It then uses preset types and sorting to process different types of fields, thus achieving automated data processing.

Benefits of technology

It improves the accuracy and efficiency of data processing, can automatically handle noise interference in interface calls, and ensures the accuracy of full-field parsing results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116546278B_ABST
    Figure CN116546278B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a data processing method and device, electronic equipment and storage medium. The method comprises: obtaining a preset interface use case; obtaining noise data corresponding to the interface use case; obtaining actual response data and expected response data corresponding to the interface use case; parsing each first field in the actual response data to obtain a first parsing result; parsing each second field in the expected response data to obtain a second parsing result; and determining a data processing result based on the first parsing result, the second parsing result and the noise data. The data processing result is obtained after comparing all field information of the actual response data and all field information of the expected response data and automatically reducing noise, and has high accuracy and high data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to data processing technology, and more particularly to data processing methods, apparatus, electronic devices and storage media. Background Technology

[0002] With the development of internet technology, software usage is becoming increasingly widespread, development cycles are shortening, and the number of interfaces involved in software is increasing. This makes the management of these interfaces increasingly important. Interfaces include those between the software system and other external systems, as well as those between various sub-modules within the system. Currently, interface management often requires manual data analysis of interface call results. This involves staff parsing validation fields in the interface call results and then comparing these fields to determine if expectations are met, resulting in low data processing efficiency. Summary of the Invention

[0003] This disclosure provides a data processing method, apparatus, electronic device, and storage medium to at least address the problem of low data processing efficiency in related technologies. The technical solution of this disclosure is as follows:

[0004] According to a first aspect of the present disclosure, a data processing method is provided, comprising:

[0005] Obtain the preset interface test cases;

[0006] Obtain noise data corresponding to the interface test cases;

[0007] Obtain the actual response data and expected response data corresponding to the interface use cases;

[0008] Each first field in the actual response data is parsed to obtain the first parsing result; each second field in the expected response data is parsed to obtain the second parsing result.

[0009] Based on the first analysis result, the second analysis result, and the noisy data, the data processing result is determined.

[0010] Optionally, each first field in the actual response data is parsed to obtain a first parsing result, including:

[0011] For each first field in the actual response data: if the field type of the first field is a first preset type, determine the field value corresponding to the first field; if the field type of the first field is a second preset type, sort the first element corresponding to the first field to determine the sorted first element; based on the field value corresponding to the first field and the sorted first element, obtain the first parsing result.

[0012] The second parsing result is obtained by parsing each second field in the expected response data, including:

[0013] For each second field in the expected response data: if the field type of the second field is a first preset type, determine the field value corresponding to the second field; if the field type of the second field is a second preset type, sort the second element corresponding to the second field to determine the sorted second element; based on the field value corresponding to the second field and the sorted second element, obtain the second parsing result;

[0014] The first preset type includes at least one of integer type, floating-point type, logical type and character type; the second preset type includes at least one of dictionary type and array type.

[0015] Optionally, noise data corresponding to the interface use case can be obtained, including:

[0016] Based on the request parameters carried by the interface test case, a request is sent to the normal interface that has passed the investigation to obtain the first response data and the second response data returned by the normal interface;

[0017] Based on the first and second response data, the noise data is determined.

[0018] Optionally, noise data is determined based on the first response data and the second response data, including:

[0019] Parse each third field in the first response data to obtain the third parsing result; parse each fourth field in the second response data to obtain the fourth parsing result;

[0020] The third and fourth analysis results are compared to identify noisy data.

[0021] Optionally, each third field in the first response data is parsed to determine the third parsing result, including:

[0022] For each third field in the first response data: if the field type of the third field is a first preset type, determine the field value corresponding to the third field; if the field type of the third field is a second preset type, sort the third element corresponding to the third field to determine the sorted third element; based on the field value corresponding to the third field and the sorted third element, obtain the third parsing result.

[0023] Parse each fourth field in the second response data to determine the fourth parsing result, including:

[0024] For each fourth field in the second response data: if the field type of the fourth field is the first preset type, determine the field value corresponding to the fourth field; if the field type of the fourth field is the second preset type, sort the fourth element corresponding to the fourth field to determine the sorted fourth element; based on the field value corresponding to the fourth field and the sorted fourth element, obtain the fourth parsing result.

[0025] The first preset type includes at least one of integer type, floating-point type, logical type and character type; the second preset type includes at least one of dictionary type and array type.

[0026] Optionally, obtain the actual response data and expected response data corresponding to the interface use case, including:

[0027] Based on the request parameters carried by the interface test case, a request is sent to the interface to be investigated to obtain the actual response data returned by the interface to be investigated;

[0028] Based on the request parameters, a request is sent to a normal interface that has passed the investigation to obtain the expected response data returned by the normal interface; or to obtain the expected response data carried by the interface use case.

[0029] Optionally, based on the first analysis result, the second analysis result, and the noisy data, the data processing result is determined, including:

[0030] Compare the first and second analysis results to determine the comparison result;

[0031] Based on the noise data and comparison results, the data processing results are determined.

[0032] According to a second aspect of the present disclosure, a data processing apparatus is provided, comprising:

[0033] The test case acquisition module is configured to acquire preset interface test cases;

[0034] The noise data determination module is configured to obtain noise data corresponding to the interface use cases;

[0035] The response data determination module is configured to obtain the actual response data and expected response data corresponding to the interface use case.

[0036] The parsing result determination module is configured to parse each first field in the actual response data to obtain a first parsing result; and to parse each second field in the expected response data to obtain a second parsing result.

[0037] The test result determination module is configured to determine the data processing result based on the first analysis result, the second analysis result, and the noise data.

[0038] Optionally, the parsing result determination module includes:

[0039] The first parsing processing unit is configured to, for each first field in the actual response data: if the field type of the first field is a first preset type, determine the field value corresponding to the first field; if the field type of the first field is a second preset type, sort the first element corresponding to the first field to determine the sorted first element; and obtain the first parsing result based on the field value corresponding to the first field and the sorted first element.

[0040] The second parsing processing unit is configured to, for each second field in the expected response data: if the field type of the second field is a first preset type, determine the field value corresponding to the second field; if the field type of the second field is a second preset type, sort the second element corresponding to the second field to determine the sorted second element; and obtain the second parsing result based on the field value corresponding to the second field and the sorted second element.

[0041] The first preset type includes at least one of integer type, floating-point type, logical type and character type; the second preset type includes at least one of dictionary type and array type.

[0042] Optionally, the noise data determination module includes:

[0043] The first data acquisition unit is configured to send a request to a normal interface that has passed the investigation based on the request parameters carried by the interface use case, and obtain the first response data and the second response data returned by the normal interface.

[0044] The noise data determination unit is configured to determine noise data based on the first response data and the second response data.

[0045] Optionally, the noise data determination unit includes:

[0046] The parsing processing subunit is configured to parse each third field in the first response data to obtain a third parsing result; and to parse each fourth field in the second response data to obtain a fourth parsing result.

[0047] The data determination sub-unit is configured to compare the third and fourth analysis results to determine the noisy data.

[0048] Optionally, the parsing processing subunit is further configured to, for each third field in the first response data: if the field type of the third field is a first preset type, determine the field value corresponding to the third field; if the field type of the third field is a second preset type, sort the third element corresponding to the third field to determine the sorted third element; and obtain the third parsing result based on the field value corresponding to the third field and the sorted third element.

[0049] For each fourth field in the second response data: if the field type of the fourth field is the first preset type, determine the field value corresponding to the fourth field; if the field type of the fourth field is the second preset type, sort the fourth element corresponding to the fourth field to determine the sorted fourth element; based on the field value corresponding to the fourth field and the sorted fourth element, obtain the fourth parsing result.

[0050] The first preset type includes at least one of integer type, floating-point type, logical type and character type; the second preset type includes at least one of dictionary type and array type.

[0051] Optionally, the response data determination module includes:

[0052] The second data acquisition unit is configured to send a request to the interface to be investigated based on the request parameters carried by the interface use case, and obtain the actual response data returned by the interface to be investigated.

[0053] The third data acquisition unit is configured to initiate a request to a normal interface that has passed the investigation based on the request parameters, and obtain the expected response data returned by the normal interface; or obtain the expected response data carried by the interface use case.

[0054] Optionally, the test result determination module includes:

[0055] The comparison processing unit is configured to compare the first parsing result and the second parsing result to determine the comparison result;

[0056] The result determination unit is configured to determine the data processing result based on the noise data and the comparison results.

[0057] According to a third aspect of the present disclosure, an electronic device is provided, comprising:

[0058] processor;

[0059] Memory used to store the processor's executable instructions;

[0060] The processor is configured to execute the instructions to implement the data processing method described above.

[0061] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform the data processing method described above.

[0062] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program or computer instructions, characterized in that the computer program or computer instructions, when executed by a processor, implement the data processing method described above.

[0063] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:

[0064] This disclosure, after obtaining a preset interface test case, acquires the noise data corresponding to the interface test case. This noise data is used to indicate inherent interference data during the testing process. Then, it acquires the actual response data and expected response data corresponding to the interface test case. The actual response data indicates the data processing result of the interface to be investigated, and the expected response data indicates the standard data processing result, providing reference data for the actual response data. Further, each first field in the actual response data is parsed to obtain a first parsing result, and each second field in the expected response data is parsed to obtain a second parsing result. That is, the first parsing result is the full-field parsing result of the actual response data, accurately reflecting all field information of the actual response data; the second parsing result is the full-field parsing result of the expected response data, accurately reflecting all field information of the expected response data. Then, based on the first parsing result, the second parsing result, and the noise data, the data processing result is determined. This data processing result is obtained by comparing all field information of the actual response data and all field information of the expected response data, and by automatic noise reduction, resulting in high accuracy and high data processing efficiency.

[0065] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0066] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0067] Figure 1 This is a flowchart illustrating a data processing method according to an exemplary embodiment. Figure 1 ;

[0068] Figure 2 This is a flowchart illustrating a data processing method according to an exemplary embodiment. Figure 2 ;

[0069] Figure 3 This is an architecture diagram illustrating a data processing method according to an exemplary embodiment;

[0070] Figure 4 This is a block diagram illustrating a data processing apparatus according to an exemplary embodiment;

[0071] Figure 5 This is a block diagram illustrating a terminal according to an exemplary embodiment. Detailed Implementation

[0072] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0073] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0074] It should be noted that all user information and data involved in this disclosure are information and data authorized by the user or fully authorized by all parties.

[0075] Figure 1 This is a flowchart illustrating a data processing method according to an exemplary embodiment. This data processing method can be used in a server, which can 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, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The data processing method may include the following steps.

[0076] In step S11, a preset interface use case is obtained.

[0077] An interface use case is a descriptive document used to describe the business logic in the interface call process.

[0078] Specifically, interface test cases are configured in advance. When managing the interface to be investigated, the interface test cases corresponding to the interface to be investigated are selected from the configured interface test cases, thereby obtaining the preset interface test cases.

[0079] In step S12, noise data corresponding to the interface use case is obtained.

[0080] Among them, noise data is used to indicate the inherent interference data in the data processing process. The presence of noise data will interfere with the data processing results and affect the accuracy of the data processing results.

[0081] In some embodiments, the interface use case may carry noise data. Therefore, the noise data in the interface use case is extracted to obtain the noise data corresponding to the interface use case.

[0082] In some embodiments, the interface use case can be obtained through the data processing results of a normal interface, i.e., step S12 includes:

[0083] In step S121, based on the request parameters carried by the interface use case, a request is sent to the normal interface that has passed the investigation to obtain the first response data and the second response data returned by the normal interface.

[0084] Interface test cases often carry request parameters. These parameters allow you to send requests to the relevant interface, enabling the corresponding function / service / program to process the request and return a result. The request parameters carried by interface test cases include, but are not limited to, the interface address, interface name, and business data. The interface address can be the address of the server hosting the interface; the interface name is used to distinguish the interface and serves as its identifier; and the business data is the data input to the interface. In other words, the interface address and interface name accurately identify the target interface, allowing you to send business data to it, and the target interface receives the business data and returns a processing result.

[0085] A normal interface is an interface that has been investigated and passed the investigation. Furthermore, a normal interface can be an interface that has been investigated, passed the investigation, and has the same function as the interface to be investigated.

[0086] Specifically, the request parameters carried by the interface use case are extracted to determine the target interface, which is the normal interface that has passed the investigation. A request is then sent to the normal interface. After receiving the request, the normal interface processes the request and obtains the request processing results, namely the first response data and the second response data.

[0087] In one possible implementation, the request parameters in the interface use case are extracted, and a first request is made to the normal interface based on the request parameters to obtain the first response data returned by the normal interface. Then, a second request is made to the normal interface to obtain the second response data returned by the normal interface.

[0088] In one possible implementation, request parameters are extracted from the interface use case, and a request is sent to the normal interface based on the request parameters. The request carries a relevant identifier, which is used to indicate that the interface processes the request twice. Thus, after receiving the request, the normal interface obtains the first response data and the second response data, and returns the first response data and the second response data.

[0089] In step S122, noise data is determined based on the first response data and the second response data.

[0090] Specifically, after obtaining the first and second response data, the first and second response data are compared to identify noisy data. By sending a request to the normal interface, the first and second response data returned by the normal interface are obtained. Since the normal interface is an interface that has been checked and has no problems, the response data of this interface is accurate and stable. Therefore, by comparing the first and second response data, the noisy data existing in the test process can be accurately identified.

[0091] In some embodiments, step S122 includes:

[0092] In step S1221, each third field in the first response data is parsed to obtain a third parsing result; each fourth field in the second response data is parsed to obtain a fourth parsing result.

[0093] In step S1222, the third and fourth analysis results are compared to determine the noise data.

[0094] In this context, each field in the first response data is designated as the third field, and each field in the second response data is designated as the fourth field.

[0095] Specifically, after obtaining the first response data, each third field in the first response data is parsed to obtain a third parsing result. Similarly, each fourth field in the second response data is parsed to obtain a fourth parsing result. In other words, the third parsing result is the complete parsing result of the first response data, accurately reflecting all field information. The fourth parsing result is the complete parsing result of the second response data, accurately reflecting all field information. By comparing the third and fourth parsing results, noisy data can be accurately identified.

[0096] In some embodiments, when parsing the first response data, all fields in the first response data are parsed, that is, for each third field in the first response data: if the field type of the third field is a first preset type, the field value corresponding to the third field is determined; if the field type of the third field is a second preset type, the third element corresponding to the third field is sorted to determine the sorted third element; based on the field value corresponding to the third field and the sorted third element, a third parsing result is obtained. The first preset type includes at least one of integer type, floating-point type, logical type, and character type; the second preset type includes at least one of dictionary type and array type.

[0097] The first preset type is the basic data type, including integer types such as byte (byte type, used to represent integers), short (short integer type, used to represent integers), int (integer type, used to represent integers), and long (long integer type, used to represent integers), floating-point types such as float (single-precision floating-point number) and double (double-precision floating-point number), logical types such as boolean (boolean type), and character types such as char (string type).

[0098] The second preset type includes at least one of dictionary type and array type. Dictionary type is a key-value type, where keys must be unique, and values ​​can be of any type. Dictionary types are delimited by {}, and internal elements are key:value pairs separated by commas. For example, d = {"name":"A","length":"B","width":"C"} means that dictionary d stores information about item A, with three items: name, length, and width. "Name", "length", and "width" are the keys, and "A", "B", and "C" are the values. Array type is used to store multiple data of the same type. Array type is represented by []. For example, array = [10,20,34] means that 10, 20, and 34 are all elements in the array.

[0099] When parsing the third field in the first response data, if the field type of the third field is the first preset type, the field value of the third field is unique. Therefore, no further processing is needed, and the field value can be directly used for subsequent comparison to obtain the field value of the third field. If the field type of the third field is the second preset type, that is, the third field is a dictionary or array type, there may be multiple third elements in the field. Therefore, the third elements corresponding to the third field are sorted. The sorting rule can be a pre-defined rule, such as ascending or descending. After sorting according to the set sorting rule, the ordered third elements are obtained, which is the sorted third element. Then, based on the determined field value and the sorted third element, the third parsing result is determined.

[0100] In one possible implementation, there is a sequential judgment order between the first preset type and the second preset type. That is, first, it is judged whether the third field is the first preset type. If it is the first preset type, no processing is performed and the parsing of the field is terminated. If it is not the first preset type, it is further determined whether the third field is a dictionary type. If it is a dictionary type, the keys and values ​​are sorted, and the elements are taken in order according to the sorted third element. If it is not a dictionary type, it is an array type. The array elements are sorted, and the elements are taken in order according to the sorted third element.

[0101] Specifically, in the third field of the first response data, a current parsing field is selected sequentially. If the current parsing field is of a first preset type, parsing of the current parsing field is terminated, and the next current parsing field is selected sequentially. If the current parsing field is of dictionary type, the keys and values ​​corresponding to the current parsing field are sorted, and then the sorted third elements are retrieved sequentially, and the next current parsing field is selected sequentially. If the current parsing field is of array type, the third elements in the array of current parsing fields are sorted, and then the sorted third elements are retrieved sequentially, and the next current parsing field is selected sequentially. If there is no next current parsing field, the third parsing result is obtained based on the field value of the third field of the first preset type and the sorted third elements retrieved sequentially.

[0102] For example, the first response data includes three fields: field 1, field 2, and field 3. Field 1, located at the first position, is parsed to determine if it is a first preset type. If it is, its value, such as A, is retrieved. Next, field 2, located at the second position, is parsed to determine if it is a first preset type. If it is not, it is further determined if it is a dictionary type. If it is, the keys and values ​​within field 2 are sorted, and the third element after sorting, such as b, c, d, is retrieved sequentially. Next, the third field 3 is parsed to determine if it is the first preset type. If it is not, the field 3 is further determined to be a dictionary type. If it is not a dictionary type, then it is an array type. The array elements of field 3, i.e., the third element, are sorted. The sorted elements, such as 10, 20, and 34, are taken in sequence. The extracted field values ​​and the sorted third element are then sorted according to the field order of field 1, field 2, and field 3 to obtain the third parsing result, such as A, b, c, d, 10, 20, 34.

[0103] In some embodiments, when parsing the second response data, all fields in the second response data are parsed, that is, for each fourth field in the second response data: if the field type of the fourth field is a first preset type, the field value corresponding to the fourth field is determined; if the field type of the fourth field is a second preset type, the fourth element corresponding to the fourth field is sorted to determine the sorted fourth element; based on the field value corresponding to the fourth field and the sorted fourth element, the fourth parsing result is obtained.

[0104] When parsing the fourth field in the second response data, if the field type of the fourth field is the first preset type, the field value of the fourth field is unique. Therefore, no further processing is needed, and this field value can be directly used for subsequent comparison to obtain the field value of the fourth field. If the field type of the fourth field is the second preset type, that is, the fourth field is a dictionary or array type, there may be multiple fourth elements in the field. Therefore, the fourth elements corresponding to the fourth field are sorted. The sorting rule can be a pre-defined rule, such as ascending or descending. After sorting according to the set sorting rule, the fourth elements are obtained in sequence, which is the sorted fourth element. Then, based on the determined field value and the sorted fourth element, the fourth parsing result is determined.

[0105] In one possible implementation, it is determined whether the fourth field is a first preset type. If it is, no processing is performed, and the parsing of the field is terminated. If it is not a first preset type, it is further determined whether the fourth field is a dictionary type. If it is a dictionary type, the keys and values ​​are sorted, and elements are taken sequentially according to the sorted fourth element. If it is not a dictionary type, it is an array type, the array elements are sorted, and elements are taken sequentially according to the sorted fourth element.

[0106] Specifically, in the fourth field of the second response data, a current parsing field is selected sequentially. If the current parsing field is of a first preset type, parsing of the current parsing field is terminated, and the next current parsing field is selected sequentially. If the current parsing field is of dictionary type, the keys and values ​​corresponding to the current parsing field are sorted, and then the sorted fourth elements are retrieved sequentially, and the next current parsing field is selected sequentially. If the current parsing field is of array type, the fourth elements in the array of current parsing fields are sorted, and then the sorted fourth elements are retrieved sequentially, and the next current parsing field is selected sequentially. If there is no next current parsing field, the fourth parsing result is obtained based on the field value of the fourth field of the first preset type and the sorted fourth elements retrieved sequentially.

[0107] After obtaining the third and fourth parsing results, the data in the third and fourth parsing results are compared. Based on the differences between the third and fourth parsing results, noisy data is identified. For example, if the timestamp in the third parsing result differs from the timestamp in the fourth parsing result, the timestamp is identified as noisy data. After obtaining the noisy data, it is stored and used to update the interface noise file.

[0108] In step S13, the actual response data and expected response data corresponding to the interface use case are obtained.

[0109] In this step, the actual response data is used to indicate the request processing result of the interface to be investigated, the expected response data is used to indicate the standard request processing result, and the expected response data provides reference data for the actual response data.

[0110] In some embodiments, step S13 includes:

[0111] In step S131, based on the request parameters carried by the interface use case, a request is sent to the interface to be investigated to obtain the actual response data returned by the interface to be investigated.

[0112] In step S132, based on the request parameters, a request is sent to the normal interface that has passed the investigation to obtain the expected response data returned by the normal interface.

[0113] In this step, after obtaining the interface test cases, the request parameters of the interface test cases are extracted. These request parameters include not only the interface name and address of the interface to be investigated, but also the interface name and address of the normal interface. Based on these request parameters, business data is sent to the interface to be investigated. Upon receiving the business data, the interface to be investigated processes it to determine the actual response data and returns the actual response data to the server. Further, business data is sent to the normal interface. Upon receiving the business data, the normal interface processes it to determine the expected response data and returns the expected response data to the server.

[0114] In this embodiment, providing a reference environment for the interface to be investigated through the normal interface facilitates the real-time and accurate acquisition of the expected response data. For interfaces with variable expected results, the normal interface can provide relatively accurate reference data, which is beneficial for accurate verification of the interface to be investigated.

[0115] In some embodiments, step S13 includes:

[0116] In step S131, based on the request parameters carried by the interface use case, a request is sent to the interface to be investigated to obtain the actual response data returned by the interface to be investigated.

[0117] In step S133, the expected response data carried by the interface use case is obtained.

[0118] In this embodiment, the interface use case carries request parameters related to the interface to be investigated. These request parameters determine the interface name and address of the interface to be investigated, allowing business data to be sent to that interface. Upon receiving the business data, the interface to be investigated processes it, determines the actual response data, and returns the actual response data to the server. Furthermore, the interface use case also carries expected response data, which can be extracted from the interface use case. When the expected response data is relatively fixed, directly writing it into the interface use case allows for quick, convenient, and accurate determination of the expected response data.

[0119] In step S14, each first field in the actual response data is parsed to obtain a first parsing result; each second field in the expected response data is parsed to obtain a second parsing result.

[0120] In this context, each field in the actual response data is designated as the first field, and each field in the expected response data is designated as the second field.

[0121] Specifically, after obtaining the actual response data, each first field in the actual response data is parsed to obtain the first parsing result, and each second field in the expected response data is parsed to obtain the second parsing result. In other words, the first parsing result is the full field parsing result of the actual response data, which can accurately reflect all field information of the actual response data, and the second parsing result is the full field parsing result of the expected response data, which can accurately reflect all field information of the expected response data.

[0122] In some embodiments, step S14 includes:

[0123] In step S141, for each first field in the actual response data: if the field type of the first field is a first preset type, determine the field value corresponding to the first field; if the field type of the first field is a second preset type, sort the first element corresponding to the first field to determine the sorted first element; based on the field value corresponding to the first field and the sorted first element, obtain the first parsing result. The first preset type includes at least one of integer type, floating-point type, logical type, and character type; the second preset type includes at least one of dictionary type and array type.

[0124] When parsing the first field in the actual response data, if the field type of the first field is a first preset type, the field value of the first field is unique. Therefore, no further processing is needed, and this field value can be directly used for subsequent comparison to obtain the field value of the first field. If the field type of the first field is a second preset type, i.e., the first field is a dictionary or array type, there may be multiple first elements in the field. Therefore, the first elements corresponding to the first field are sorted. The sorting rule can be a pre-defined rule, such as ascending or descending. After sorting according to the set sorting rule, the first elements in the order they are obtained are obtained, i.e., the sorted first elements. Then, based on the determined field value and the sorted first elements, the first parsing result is determined.

[0125] In one possible implementation, there is a sequential judgment order between the first preset type and the second preset type. That is, first, it is judged whether the first field is the first preset type. If it is the first preset type, no processing is performed and the parsing of the field is terminated. If it is not the first preset type, it is further determined whether the first field is a dictionary type. If it is a dictionary type, the keys and values ​​are sorted, and the elements are taken in order according to the first element after sorting. If it is not a dictionary type, it is an array type. The array elements are sorted, and the elements are taken in order according to the first element after sorting.

[0126] Specifically, in the first field of the actual response data, a current parsing field is selected sequentially. If the current parsing field is of a first preset type, parsing of the current parsing field is terminated, and the next current parsing field is selected sequentially. If the current parsing field is of dictionary type, the keys and values ​​corresponding to the current parsing field are sorted, and then the first element of the sorted sequence is retrieved sequentially, and the next current parsing field is selected sequentially. If the current parsing field is of array type, the first element in the array of current parsing fields is sorted, and then the first element of the sorted sequence is retrieved sequentially, and the next current parsing field is selected sequentially. If there is no next current parsing field, the first parsing result is obtained based on the field value of the first field of the first preset type and the first element of the sorted sequence.

[0127] In step S142, for each second field in the expected response data: if the field type of the second field is a first preset type, determine the field value corresponding to the second field; if the field type of the second field is a second preset type, sort the second element corresponding to the second field to determine the sorted second element; based on the field value corresponding to the second field and the sorted second element, obtain the second parsing result.

[0128] When parsing the second field in the expected response data, if the field type of the second field is the first preset type, the field value of the second field is unique. Therefore, no further processing is needed, and the field value can be directly used for subsequent comparison to obtain the field value of the second field. If the field type of the second field is the second preset type, that is, the second field is a dictionary or array type, there may be multiple second elements in the field. Therefore, the second elements corresponding to the second field are sorted. The sorting rule can be a pre-defined rule, such as ascending or descending. After sorting according to the set sorting rule, the ordered second elements are obtained, which are the sorted second elements. Then, based on the determined field value and the sorted second elements, the second parsing result is determined.

[0129] In one possible implementation, there is a sequential judgment order between the first preset type and the second preset type. That is, first, it is determined whether the second field is the first preset type. If it is the first preset type, no processing is performed, and the parsing of the field is terminated. If it is not the first preset type, it is further determined whether the second field is a dictionary type. If it is a dictionary type, the keys and values ​​are sorted, and the elements are taken sequentially according to the sorted second element. If it is not a dictionary type, it is an array type. The array elements are sorted, and the elements are taken sequentially according to the sorted second element.

[0130] Specifically, in the second field of the expected response data, a current parsing field is selected sequentially. If the current parsing field is of a first preset type, parsing of the current parsing field is terminated, and the next current parsing field is selected sequentially. If the current parsing field is of dictionary type, the keys and values ​​corresponding to the current parsing field are sorted, and then the sorted second elements are retrieved sequentially, and the next current parsing field is selected sequentially. If the current parsing field is of array type, the second elements in the array of current parsing fields are sorted, and then the sorted second elements are retrieved sequentially, and the next current parsing field is selected sequentially. If there is no next current parsing field, the second parsing result is obtained based on the field value of the second field of the first preset type and the sorted second elements retrieved sequentially.

[0131] In step S15, the data processing result is determined based on the first analysis result, the second analysis result, and the noise data.

[0132] Specifically, noise data can be obtained from the stored interface noise file. After obtaining the first parsing result, the second parsing result, and the noise data, the data processing result is determined based on the first parsing result, the second parsing result, and the noise data. This interface test data is the result of reducing noise interference and full-field assertion, and has high accuracy.

[0133] In some embodiments, step S15 includes:

[0134] In step S151, the first analysis result and the second analysis result are compared to determine the comparison result.

[0135] In step S152, the data processing result is determined based on the noise data and the comparison results.

[0136] Specifically, after obtaining the first and second analysis results, the first and second analysis results are compared to determine the comparison result. Then, the comparison result is sorted according to the noise data. If the comparison result contains noise data, the noise data in the comparison result is deleted to obtain the comparison result.

[0137] In some embodiments, noise data is removed from the first parsing result to obtain first noise-processed data, and noise data is removed from the second parsing result to obtain second noise-processed data. The first noise-processed data and the second noise-processed data are compared to determine the data processing result.

[0138] In one possible implementation, the first and second response data are obtained using a basic processing module, such as... Figure 2S1: As shown in the basic processing module, the request parameters are extracted from the interface use case. Then, request 1 is sent to the normal interface, and the first response data (response 1) is obtained. Request 2 is then sent to the normal interface, and the second response data (response 2) is obtained. In other words, as shown in the module... Figure 3 As shown, the basic processing module is mainly used to make traffic requests and obtain responses.

[0139] Furthermore, the data processing module is used to parse the response data, and the noise processing module is used to obtain noise data and update the noise file. For example... Figure 2 As shown in S2 (Noise Processing Module) and S3 (Data Processing Module), after receiving responses 1 and 2, the data processing module parses the JSON (JavaScript Object Notation, a lightweight data exchange format) strings of responses 1 and 2. For example, in response 1, it selects the current parsing field and determines if it is a basic type (the first preset type). If it is, parsing of the current field ends, and the next current parsing field is obtained. If it is not a basic type, it further determines if the current parsing field is a dictionary type. If it is a dictionary type, the keys and values ​​are sorted, and elements are retrieved sequentially to obtain the next current parsing field. If it is not a dictionary type, it is an array type, and the array elements are sorted, and elements are retrieved sequentially to obtain the next current parsing field, thus obtaining the third parsing result. Similarly, the data processing module parses response 2 to obtain the fourth parsing result. The third and fourth parsing results are compared to obtain the noise field, which is then used to update the interface noise file. In other words, as shown in the diagram... Figure 3 As shown, the noise processing module is mainly used to compare response data to obtain noise files, such as using DIFF (a computer term used to compare text files) to obtain noise files. The data processing module includes basic type processing submodules, dictionary type processing submodules, and array type processing submodules for parsing and processing fields of different types.

[0140] Furthermore, the response comparison module is used to assert the actual response data and the expected response data. For example... Figure 2 The response comparison module shown extracts request parameters from the interface test case, then sends a request to the interface to be investigated, obtains the actual response data returned by the interface, extracts the expected response data from the interface test case, and uses the data processing module to process the actual response data to obtain a first parsing result. The data processing module also processes the expected response data to obtain a second parsing result. The first and second parsing results are compared with the noise data in the noise file to obtain the data processing result. Finally, S5 is used to execute the report and output the data processing result. In other words, as shown... Figure 3As shown, the response comparison module is mainly used to compare the interface response, i.e., the actual response data, with the expected response data, and output the obtained data processing results (report). Through the coordinated operation of the basic processing module, noise processing module, data processing module, and response comparison module, automatic noise reduction and full-field assertions are achieved, realizing automated assertions and improving data processing efficiency.

[0141] In the above embodiments, after obtaining the preset interface test cases, noise data corresponding to the interface test cases is obtained. This noise data is used to indicate inherent interference data during the testing process. Then, the actual response data and expected response data corresponding to the interface test cases are obtained. The actual response data is used to indicate the request processing result of the interface to be investigated, and the expected response data is used to indicate the standard request processing result. The expected response data provides reference data for the actual response data. Further, each first field in the actual response data is parsed to obtain a first parsing result, and each second field in the expected response data is parsed to obtain a second parsing result. That is, the first parsing result is the full-field parsing result of the actual response data, which can accurately reflect all field information of the actual response data. The second parsing result is the full-field parsing result of the expected response data, which can accurately reflect all field information of the expected response data. Then, based on the first parsing result, the second parsing result, and the noise data, the data processing result is determined. This data processing result is obtained by comparing all field information of the actual response data and all field information of the expected response data, and by automatic noise reduction. It has high accuracy, a high degree of automation, and effectively improves testing efficiency.

[0142] Figure 4 This is a block diagram illustrating a data processing apparatus according to an exemplary embodiment. The apparatus includes a test case acquisition module 41, a noise data determination module 42, a response data determination module 43, a parsing result determination module 44, and a test result determination module 45.

[0143] Test case acquisition module 41 is configured to acquire preset interface test cases;

[0144] The noise data determination module 42 is configured to obtain noise data corresponding to the interface use case.

[0145] The response data determination module 43 is configured to obtain the actual response data and expected response data corresponding to the interface use case.

[0146] The parsing result determination module 44 is configured to parse each first field in the actual response data to obtain a first parsing result; and to parse each second field in the expected response data to obtain a second parsing result.

[0147] The test result determination module 45 is configured to determine the data processing result based on the first analysis result, the second analysis result, and the noise data.

[0148] In an exemplary embodiment of this disclosure, the parsing result determination module includes:

[0149] The first parsing processing unit is configured to, for each first field in the actual response data: if the field type of the first field is a first preset type, determine the field value corresponding to the first field; if the field type of the first field is a second preset type, sort the first element corresponding to the first field to determine the sorted first element; and obtain the first parsing result based on the field value corresponding to the first field and the sorted first element.

[0150] The second parsing processing unit is configured to, for each second field in the expected response data: if the field type of the second field is a first preset type, determine the field value corresponding to the second field; if the field type of the second field is a second preset type, sort the second element corresponding to the second field to determine the sorted second element; and obtain the second parsing result based on the field value corresponding to the second field and the sorted second element.

[0151] The first preset type includes at least one of integer type, floating-point type, logical type and character type; the second preset type includes at least one of dictionary type and array type.

[0152] In an exemplary embodiment of this disclosure, the noise data determination module includes:

[0153] The first data acquisition unit is configured to send a request to a normal interface that has passed the investigation based on the request parameters carried by the interface use case, and obtain the first response data and the second response data returned by the normal interface.

[0154] The noise data determination unit is configured to determine noise data based on the first response data and the second response data.

[0155] In an exemplary embodiment of this disclosure, the noise data determination unit includes:

[0156] The parsing processing subunit is configured to parse each third field in the first response data to obtain a third parsing result; and to parse each fourth field in the second response data to obtain a fourth parsing result.

[0157] The data determination sub-unit is configured to compare the third and fourth analysis results to determine the noisy data.

[0158] In an exemplary embodiment of this disclosure, the parsing processing subunit is further configured to, for each third field in the first response data: determine the field value corresponding to the third field if the field type of the third field is a first preset type; sort the third element corresponding to the third field if the field type of the third field is a second preset type, and determine the sorted third element; and obtain a third parsing result based on the field value corresponding to the third field and the sorted third element.

[0159] For each fourth field in the second response data: if the field type of the fourth field is the first preset type, determine the field value corresponding to the fourth field; if the field type of the fourth field is the second preset type, sort the fourth element corresponding to the fourth field to determine the sorted fourth element; based on the field value corresponding to the fourth field and the sorted fourth element, obtain the fourth parsing result.

[0160] The first preset type includes at least one of integer type, floating-point type, logical type and character type; the second preset type includes at least one of dictionary type and array type.

[0161] In an exemplary embodiment of this disclosure, the response data determination module includes:

[0162] The second data acquisition unit is configured to send a request to the interface to be investigated based on the request parameters carried by the interface use case, and obtain the actual response data returned by the interface to be investigated.

[0163] The third data acquisition unit is configured to initiate a request to a normal interface that has passed the investigation based on the request parameters, and obtain the expected response data returned by the normal interface; or obtain the expected response data carried by the interface use case.

[0164] In an exemplary embodiment of this disclosure, the test result determination module includes:

[0165] The comparison processing unit is configured to compare the first parsing result and the second parsing result to determine the comparison result;

[0166] The result determination unit is configured to determine the data processing result based on the noise data and the comparison results.

[0167] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0168] Figure 5 This is a schematic diagram illustrating the structure of an electronic device according to an exemplary embodiment. (Refer to...) Figure 5The electronic device 500 includes a processing component 522, which further includes one or more processors, and memory resources represented by memory 532 for storing instructions, such as application programs, that can be executed by the processing component 522. The application programs stored in memory 532 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 522 is configured to execute instructions to perform the implementation method of the aforementioned interface test.

[0169] Electronic device 500 may also include a power supply component 526 configured to perform power management of electronic device 500, a wired or wireless network interface 550 configured to connect electronic device 500 to a network, and an input / output (I / O) interface 558. Electronic device 500 may operate on an operating system stored in memory 532, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or similar.

[0170] In an exemplary embodiment, a storage medium including instructions is also provided, which, when executed by a processor of an electronic device, enables the electronic device to perform the data processing method as described in any of the above method embodiments. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device.

[0171] In an exemplary embodiment, a computer program product is also provided, comprising readable program code executable by a processor of an electronic device to perform the data processing method described above applied to the electronic device. Optionally, the program code may be stored in a storage medium of the electronic device, which may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device. Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0172] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A data processing method, characterized in that, include: Obtain the preset interface test cases; Obtain the noise data corresponding to the interface use case; Obtain the actual response data and expected response data corresponding to the interface use case; Each first field in the actual response data is parsed to obtain a first parsing result; Each second field in the expected response data is parsed to obtain a second parsing result; Based on the first analysis result, the second analysis result, and the noise data, the data processing result is determined; Based on the request parameters carried by the interface use case, a request is sent to the normal interface that has passed the investigation, and the first response data and the second response data returned by the normal interface are obtained. The noise data is determined based on the first response data and the second response data.

2. The method according to claim 1, characterized in that, The step of parsing each first field in the actual response data to obtain a first parsing result includes: For each first field in the actual response data: if the field type of the first field is a first preset type, determine the field value corresponding to the first field; if the field type of the first field is a second preset type, sort the first element corresponding to the first field to determine the sorted first element; based on the field value corresponding to the first field and the sorted first element, obtain the first parsing result. The step of parsing each second field in the expected response data to obtain a second parsing result includes: For each second field in the expected response data: if the field type of the second field is the first preset type, determine the field value corresponding to the second field; if the field type of the second field is the second preset type, sort the second element corresponding to the second field to determine the sorted second element; based on the field value corresponding to the second field and the sorted second element, obtain the second parsing result; The first preset type includes at least one of integer type, floating-point type, logical type and character type; the second preset type includes at least one of dictionary type and array type.

3. The method according to claim 2, characterized in that, The step of determining the noise data based on the first response data and the second response data includes: Each third field in the first response data is parsed to obtain a third parsing result; each fourth field in the second response data is parsed to obtain a fourth parsing result. The third and fourth analysis results are compared to determine the noise data.

4. The method according to claim 3, characterized in that, The step of parsing each third field in the first response data to determine the third parsing result includes: For each third field in the first response data: if the field type of the third field is a first preset type, determine the field value corresponding to the third field; if the field type of the third field is a second preset type, sort the third element corresponding to the third field to determine the sorted third element; based on the field value corresponding to the third field and the sorted third element, obtain the third parsing result; The step of parsing each fourth field in the second response data to determine the fourth parsing result includes: For each fourth field in the second response data: if the field type of the fourth field is the first preset type, determine the field value corresponding to the fourth field; if the field type of the fourth field is the second preset type, sort the fourth element corresponding to the fourth field to determine the sorted fourth element; based on the field value corresponding to the fourth field and the sorted fourth element, obtain the fourth parsing result; The first preset type includes at least one of integer type, floating-point type, logical type and character type; the second preset type includes at least one of dictionary type and array type.

5. The method according to claim 1, characterized in that, The step of obtaining the actual response data and expected response data corresponding to the interface use case includes: Based on the request parameters carried by the interface use case, a request is sent to the interface to be investigated to obtain the actual response data returned by the interface to be investigated; Based on the request parameters, a request is sent to a normal interface that has passed the investigation to obtain the expected response data returned by the normal interface; or the expected response data carried by the interface use case is obtained.

6. The method according to claim 1, characterized in that, The step of determining the data processing result based on the first analysis result, the second analysis result, and the noise data includes: The first analysis result and the second analysis result are compared to determine the comparison result; Based on the noise data and the comparison results, the data processing result is determined.

7. A data processing apparatus, characterized in that, include: The test case acquisition module is configured to acquire preset interface test cases; The noise data determination module is configured to acquire noise data corresponding to the interface use case; The response data determination module is configured to obtain the actual response data and expected response data corresponding to the interface use case. The parsing result determination module is configured to parse each first field in the actual response data to obtain a first parsing result; Each second field in the expected response data is parsed to obtain a second parsing result; The test result determination module is configured to determine the data processing result based on the first parsing result, the second parsing result, and the noise data; The noise data determination module includes: The first data acquisition unit is configured to initiate a request to a normal interface that has passed the investigation based on the request parameters carried by the interface use case, and to obtain the first response data and the second response data returned by the normal interface. The noise data determination unit is configured to determine the noise data based on the first response data and the second response data.

8. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the data processing method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the data processing method as described in any one of claims 1 to 6.