Method and apparatus for recommending interface parameters based on traffic data

By acquiring and processing traffic data in the production environment, and extracting interface parameter feature values ​​and rules, the problem of low interface test coverage is solved, and more efficient interface test parameter recommendation is achieved.

CN116048888BActive Publication Date: 2026-06-30GUANGZHOU PINWEI SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211356188.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-01
Publication Date
2026-06-30
Estimated Expiration
2042-11-01

AI Technical Summary

Technical Problem

In existing technologies, interface testing processes rely on testers' experience to configure interface parameters, resulting in low test coverage.

Method used

By acquiring traffic data of a specified interface in the production environment, flattening the data to extract fields and feature values, and recommending interface parameters based on feature value attributes and rules, these parameters are used to configure interface test cases.

Benefits of technology

It improved the test coverage of interface testing, reduced the time for interface test case design through refined parameter recommendations, and enhanced the diversity of parameter input.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116048888B_ABST
    Figure CN116048888B_ABST
Patent Text Reader

Abstract

The interface parameter recommendation method and apparatus based on traffic data provided in this application provide meaningful data for expanding the analysis sample and for subsequent more intelligent and accurate analysis. It can acquire several traffic data points generated when a specified interface is used in a production environment, and then flatten these traffic data points. This not only quickly removes redundant data from the traffic data but also obtains multiple fields and feature values ​​for each traffic data point. Next, this application can determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the multiple fields and feature values ​​of each traffic data point. This provides more refined field recommendations when configuring test cases for interface testing, facilitating parameter input for interface testing and improving test coverage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of interface testing technology, and in particular to a method and apparatus for recommending interface parameters based on traffic data. Background Technology

[0002] Currently, the conventional interface testing process mainly involves configuring specific interface parameters based on the characteristics of the actual business scenario, constructing specific interface test cases, triggering the execution of the corresponding interface test cases, and then using assertions and other methods to automatically analyze and judge the test results.

[0003] In the above interface testing process, when configuring specific interface parameters for the interface under test, it mainly relies on the testers to configure them based on their experience or test requirements. If the testers have little experience or the test requirements mention few items, the test coverage may be low due to the limited types of interface parameter configurations. Summary of the Invention

[0004] The purpose of this application is to at least address one of the aforementioned technical defects, particularly the technical defect in the prior art where testers rely on experience or testing requirements to configure interface parameters, which may result in low test coverage due to the limited variety of interface parameter configurations.

[0005] This application provides a method for recommending interface parameters based on traffic data, the method comprising:

[0006] Retrieve traffic data generated when a specified interface is used in a production environment;

[0007] After flattening several traffic data points, multiple fields and feature values ​​of each field are obtained for each traffic data point.

[0008] Based on multiple fields of each traffic data and the feature value of each field, the feature value attributes and rules corresponding to the interface parameters of the specified interface are determined, so as to make recommendations when configuring test cases for interface testing in the future.

[0009] Optionally, the step of flattening several traffic data points to obtain multiple fields for each traffic data point and feature values ​​for each field includes:

[0010] For each data point:

[0011] The traffic data is split into multiple fields according to the preset splitting rules, and the characteristic value of each field in the traffic data is determined.

[0012] Optionally, determining the feature value attributes and rules corresponding to the interface parameters of the specified interface based on multiple fields of each traffic data and the feature value of each field includes:

[0013] Based on the frequency of each field in all traffic data and the form in which the feature value of each field appears in all traffic data, the feature value attributes and rules corresponding to the interface parameters of the specified interface are determined.

[0014] Optionally, determining the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the frequency of each field of each traffic data in all traffic data and the form in which the feature values ​​of each field appear in all traffic data includes:

[0015] For each field of each traffic data: compare the number of times the field appears in all traffic data with a preset frequency threshold to obtain the comparison result;

[0016] In addition, the form in which the feature value of this field appears in all traffic data is determined according to the preset judgment rules, and the judgment result is obtained;

[0017] Based on the comparison and judgment results of each field of each traffic data, the feature value attributes and rules corresponding to the interface parameters of the specified interface are generated.

[0018] Optionally, the step of determining the form in which the feature value of the field appears in all traffic data according to a preset judgment rule to obtain the judgment result includes:

[0019] Determine whether the number of different feature values ​​corresponding to this field in all traffic data exceeds a preset threshold.

[0020] If it does not exceed, then the enumeration value corresponding to the feature value of the field is determined according to the different feature values ​​of the field in all traffic data;

[0021] If the number exceeds the limit, determine whether the feature value corresponding to this field in all traffic data is an array type;

[0022] If so, then mark the type of the feature value of that field as an array type;

[0023] If not, determine whether the feature value corresponding to this field in all traffic data is a numeric type;

[0024] If so, determine the first attribute feature of the field in all traffic data under the numeric type;

[0025] Otherwise, determine that the feature value corresponding to the field in all traffic data is of type text, and determine the second attribute feature of the feature value corresponding to the field in all traffic data under the text type.

[0026] This application also provides an interface parameter recommendation device based on traffic data, including:

[0027] The data acquisition module is used to acquire traffic data generated when a specified interface is used in the production environment.

[0028] The feature extraction module is used to flatten several traffic data points to obtain multiple fields for each traffic data point and the feature value of each field.

[0029] The interface parameter recommendation module is used to determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on multiple fields of each traffic data and the feature value of each field, so as to make recommendations when configuring test cases for interface testing in the future.

[0030] Optionally, the feature extraction module includes:

[0031] The data splitting module is used to split each traffic data into multiple fields according to preset splitting rules and determine the feature value of each field in the traffic data.

[0032] Optionally, the interface parameter recommendation module includes:

[0033] The feature value attribute and rule determination module is used to determine the feature value attribute and rule corresponding to the interface parameter of the specified interface based on the number of times each field of each traffic data appears in all traffic data and the form in which the feature value of each field appears in all traffic data.

[0034] Optionally, the feature value attribute and rule determination module includes:

[0035] The frequency comparison module is used to compare the number of times each field appears in all traffic data with a preset frequency threshold for each field of each traffic data to obtain the comparison result.

[0036] The form judgment module is used to determine the form in which the feature value of the field appears in all traffic data according to preset judgment rules, and obtain the judgment result;

[0037] The result generation module is used to generate the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the comparison and judgment results of each field of each traffic data.

[0038] Optionally, the form determination module includes:

[0039] The first judgment module is used to determine whether the number of different feature values ​​corresponding to the field in all traffic data exceeds a preset number threshold.

[0040] The first determining module is used to determine the enumeration value corresponding to the feature value of the field based on the different feature values ​​of the field in all traffic data if the value does not exceed the specified value.

[0041] The second judgment module is used to determine whether the type of the feature value corresponding to the field in all traffic data is an array type if the value exceeds the limit.

[0042] The type marking module is used to mark the type of the characteristic value of the field as an array type if it is true;

[0043] The third judgment module is used to determine whether the type of the feature value corresponding to the field in all traffic data is numeric if the condition is not met.

[0044] The second determining module is used to determine, if so, the first attribute feature of the field in all traffic data under the numeric type;

[0045] The third determining module is used to otherwise determine that the type of the feature value corresponding to the field in all traffic data is text type, and to determine the second attribute feature of the feature value corresponding to the field in all traffic data under the text type.

[0046] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:

[0047] The interface parameter recommendation method and apparatus based on traffic data provided in this application provide meaningful data for expanding the analysis sample and for subsequent more intelligent and accurate analysis. It can acquire several traffic data points generated when a specified interface is used in a production environment, and then flatten these traffic data points. This not only quickly removes redundant data from the traffic data but also obtains multiple fields and feature values ​​for each traffic data point. Next, this application can determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the multiple fields and feature values ​​of each traffic data point. This provides more refined field recommendations when configuring test cases for interface testing, facilitating parameter input for interface testing and improving test coverage. Attached Figure Description

[0048] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0049] Figure 1A flowchart illustrating an interface parameter recommendation method based on traffic data, provided for an embodiment of this application;

[0050] Figure 2 A flowchart illustrating the rules for determining field feature value attributes provided in this application embodiment;

[0051] Figure 3 This is a schematic diagram of an interface parameter recommendation device based on traffic data, provided in an embodiment of this application. Detailed Implementation

[0052] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0053] Currently, the conventional interface testing process mainly involves configuring specific interface parameters based on the characteristics of the actual business scenario, constructing specific interface test cases, triggering the execution of the corresponding interface test cases, and then using assertions and other methods to automatically analyze and judge the test results.

[0054] In the aforementioned interface testing process, configuring specific interface parameters for the interface under test mainly relies on testers' experience or testing requirements. If the testers have limited experience, or if the testing requirements specify few parameters, the limited variety of interface parameter configurations may lead to low test coverage. Based on this, this application proposes the following technical solution, as detailed below:

[0055] In one embodiment, such as Figure 1 As shown, Figure 1 This application provides a flowchart illustrating an interface parameter recommendation method based on traffic data, as shown in the embodiments of this application. The application provides an interface parameter recommendation method based on traffic data, which may include:

[0056] S110: Obtain some traffic data generated when the specified interface is used in the production environment.

[0057] In this step, in order to provide more refined field recommendations and improve test coverage, this application can obtain traffic data generated during testing and extract and calculate the feature values ​​corresponding to the test parameters in the traffic data, thereby realizing attribute recommendations for traffic fields.

[0058] Specifically, before acquiring the traffic data generated during testing, a designated interface can be identified. This designated interface refers to the interface whose feature attributes are of interest. In this application, the designated interface can be determined manually or using automatic matching rules; no restriction is placed here. Once the designated interface is identified, this application can monitor the traffic data generated by this designated interface during testing in the test environment. Furthermore, to expand the analysis sample and provide meaningful data for subsequent more intelligent and accurate analysis, this application can acquire several traffic data points generated by the designated interface during use in the production environment and use these traffic data points to extract the feature values ​​corresponding to the test parameters.

[0059] Understandably, software development environments are divided into testing, production, and development environments. The development environment, a server specifically developed by programmers, has a more flexible configuration and typically features all error reporting and testing tools enabled for ease of development and debugging; it is the most basic environment. The testing environment is generally a clone of the production environment configuration and serves as a transitional environment between development and production. The production environment, where services are officially provided, typically disables error reporting but enables error logging; it is the most crucial environment. This application retrieves traffic data generated when a specified interface is used in the production environment. This traffic data consists of transmission data generated during user interactions with the online service, such as input parameters and tokens when a user sends a request to the online service, and output parameters and return values ​​returned by the online service in response to the user's request.

[0060] S120: After flattening several traffic data, multiple fields and feature values ​​of each traffic data are obtained.

[0061] In this step, after obtaining several traffic data generated when the specified interface is used in the production environment through S110, this application can flatten the several traffic data to obtain multiple fields of each traffic data and the feature value of each field.

[0062] It is understood that the traffic data retrieved in this application may contain some unnecessary or repetitive information. In order to remove such unnecessary or repetitive information and simplify the traffic data, this application can flatten each traffic data to obtain multiple fields of each traffic data and the feature value of each field.

[0063] Furthermore, the traffic data retrieved from the specified interface in this application refers to a JSON string containing multiple fields. A JSON object is an unordered collection of name / value pairs. An object begins with "{" and ends with "}", with each name followed by a colon (:). Name / value pairs are separated by commas. For example, a JSON string can contain one object or multiple objects. If multiple objects are present, they are separated by commas, i.e., {}, {}, thus forming a sequence of objects. To distinguish the beginning and end, square brackets [] are needed for transmission, resulting in the transmission format [{}, {}]. Next is the way object properties are represented. Properties must be enclosed in quotation marks. Properties and values ​​are separated by colons (:), and properties are separated by commas (,). If the value of a property is an array, it is enclosed in square brackets ([]. The actual data format passed may be: (1) {"property1": value1, "property2": value2}. If the value is a string, it also needs to be enclosed in quotation marks ("); (2) {"property1": value1, "property2": [value1, value2]}, where property2 is an array containing value1 and value2; (3) {"property1": value1, "property2": {"propertya": valuea, "propertyb": [valueb, valuec]}}, where property2 is an object, which contains propertya and propertyb. Propertyb is an array containing valueb and valuec.

[0064] As can be seen from the above, the traffic data directly retrieved by this application contains a lot of unnecessary redundancy, such as redundant definitions and duplicate fields. To remove this redundancy, this application can flatten the JSON string, thus obtaining multiple fields for each traffic data and the feature value of each field. Existing flattening tools or custom flattening tools can be used for flattening; no restrictions are placed here.

[0065] S130: Based on multiple fields of each traffic data and the feature value of each field, determine the feature value attributes and rules corresponding to the interface parameters of the specified interface, so as to make recommendations when configuring test cases for interface testing in the future.

[0066] In this step, after flattening several traffic data through S120 to obtain multiple fields and feature values ​​of each traffic data, this application can determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the multiple fields and feature values ​​of each traffic data, so as to make recommendations when configuring test cases for interface testing in the future.

[0067] For example, when configuring test cases for interface testing, one typically considers how to design test cases from aspects such as functionality, business logic, exception testing, and security. For instance, this includes considerations such as whether the function works correctly, whether the function is implemented according to the interface documentation, normal scenarios, abnormal scenarios, whether it depends on business logic (e.g., whether login was successful), keyword parameters, empty parameters, too many or too few parameters, error parameters, covering all required parameters, combining optional parameters, whether parameters are present, absent, or null, the order, number, and type of parameters, the value of parameter types, the range of input values, the length of parameter strings, parameters containing special characters, keyword data, empty data, inconsistent lengths, error data, cookies, headers, unique identifiers, etc.

[0068] Once this application obtains traffic data from the production environment and acquires multiple fields and feature values ​​for each traffic data point, it can determine the attribute characteristics and feature value rules of each field by identifying the commonalities and differences between the fields and feature values ​​of each traffic data point. This allows it to obtain the feature value attributes and rules corresponding to the interface parameters of a specified interface. When configuring test cases for interface testing, these feature value attributes and rules can be recommended based on the design principles of the test cases, thereby facilitating diverse parameter input for interface testing and improving test coverage.

[0069] For example, when designing interface test cases, it's necessary to consider that some interfaces require preconditions to successfully retrieve data, such as requiring a login token. In this case, the feature value attributes and rules obtained in this application can be used to determine whether the interface needs to meet the preconditions. Similarly, when determining whether certain interfaces need to carry default value parameters, the feature value attributes and rules obtained in this application can also be used to determine whether the interface needs to carry default value parameters and the specific values ​​of those default value parameters. Furthermore, when determining whether certain interface parameters are required, the feature value attributes and rules obtained in this application can also be used to determine whether the interface parameter is required. This approach can reduce the design time of interface test cases and increase the parameter diversity of interface test cases, thereby effectively improving test coverage.

[0070] In the above embodiments, to expand the analysis sample and provide meaningful data for subsequent more intelligent and accurate analysis, several traffic data points generated when a specified interface is used in the production environment can be obtained. Then, these traffic data points are flattened. This not only quickly removes redundant data from the traffic data but also obtains multiple fields and feature values ​​for each traffic data point. Next, this application can determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the multiple fields and feature values ​​of each traffic data point. This allows for more refined field recommendations when configuring test cases for interface testing, facilitating parameter input for interface testing and improving test coverage.

[0071] In one embodiment, the process of flattening several traffic data points in step S120 to obtain multiple fields for each traffic data point and feature values ​​for each field may include:

[0072] For each data point of traffic: the traffic data is split into multiple fields according to the preset splitting rules, and the feature value of each field in the traffic data is determined.

[0073] In this embodiment, when flattening each traffic data, the traffic data can be split into multiple fields according to a preset splitting rule, and the feature value corresponding to each field in the traffic data can be determined. In this way, multiple fields corresponding to each traffic data and the feature value of each field can be obtained.

[0074] The splitting rules in this application can be custom-defined, such as specifying any symbol as a delimiter to split the traffic data. As a concrete example, the traffic data in this application can be a JSON string, where an object begins with "{" and ends with "}", each "name" is followed by a ":", and "name / value" pairs are separated by ",". Therefore, this application can choose appropriate symbols as delimiters to split the JSON string into multiple fields and the corresponding feature values ​​for each field.

[0075] In one embodiment, determining the feature value attributes and rules corresponding to the interface parameters of the specified interface in S130 based on multiple fields of each traffic data and the feature value of each field may include:

[0076] S131: Determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the number of times each field of each traffic data appears in all traffic data and the form in which the feature value of each field appears in all traffic data.

[0077] In this embodiment, when determining the feature value attributes and rules corresponding to the interface parameters of a specified interface, the commonalities and differences between the fields and feature values ​​of each traffic data can be statistically analyzed based on the number of times each field of each traffic data appears in all traffic data and the form in which the feature value of each field appears in all traffic data, thereby determining the feature value attributes and rules corresponding to the interface parameters of the specified interface.

[0078] In this application, the feature value of each field may appear in all traffic data in the form of numbers, text, arrays, enumeration values, etc., and no restrictions are imposed here.

[0079] In one embodiment, determining the feature value attributes and rules corresponding to the interface parameters of the specified interface in S131 based on the frequency of each field of each traffic data in all traffic data and the form in which the feature value of each field appears in all traffic data may include:

[0080] S1310: For each field of each traffic data: compare the number of times the field appears in all traffic data with a preset number threshold to obtain the comparison result.

[0081] S1311: And, according to the preset judgment rules, determine the form in which the feature value of the field appears in all traffic data, and obtain the judgment result.

[0082] S1312: Generate the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the comparison and judgment results of each field of each traffic data.

[0083] In this embodiment, when determining the feature value attributes and rules corresponding to the interface parameters of a specified interface based on the number of times each field of each traffic data appears in all traffic data and the form in which the feature value of each field appears in all traffic data, the number of times each field of each traffic data appears in all traffic data can be compared with a preset number threshold to obtain the comparison result. The form in which the feature value of the field appears in all traffic data can be determined according to the preset judgment rule to obtain the judgment result. Then, the feature value attributes and rules corresponding to the interface parameters of the specified interface can be generated based on the comparison result and judgment result of each field of each traffic data.

[0084] For example, when this application obtains the number of times each field in each traffic data appears in all traffic data, it can compare the number of times each field appears with a preset frequency threshold to determine whether the number of times the field appears is higher than the preset frequency threshold. If it is higher than the preset frequency threshold, it indicates that the feature value corresponding to the field is a required field. If it is lower than the preset frequency threshold, it indicates that the feature value corresponding to the field is a non-required field. When the form in which the feature value of each field in each traffic data appears in all traffic data is obtained, the specific appearance form of the feature value of the field can be determined according to the preset judgment rules, so as to further determine the attribute and rules of the feature value.

[0085] In one embodiment, such as Figure 2 As shown, Figure 2 The flowchart of the judgment rule for the field feature value attribute provided in the embodiment of this application; S1311, judging the form in which the feature value of the field appears in all traffic data according to the preset judgment rule, and obtaining the judgment result, may include:

[0086] S311: Determine whether the number of different feature values ​​corresponding to this field in all traffic data exceeds the preset number threshold.

[0087] S312: If it does not exceed, then determine the enumeration value corresponding to the feature value of the field based on the different feature values ​​of the field in all traffic data.

[0088] S313: If the number of occurrences exceeds the limit, determine whether the characteristic value corresponding to this field in all traffic data is an array type.

[0089] S314: If so, mark the type of the characteristic value of the field as an array type.

[0090] S315: If not, determine whether the feature value corresponding to this field in all traffic data is of numeric type.

[0091] S316: If so, determine the first attribute feature of the field in all traffic data under the numeric type.

[0092] S317: Otherwise, determine that the type of the feature value corresponding to the field in all traffic data is text type, and determine the second attribute feature of the feature value corresponding to the field in all traffic data under the text type.

[0093] In this embodiment, as Figure 2As shown, when determining the form in which the feature value of each field appears in all traffic data, we can first determine whether the feature value of the field is an enumeration value. If it is an enumeration value, we can check for missing enumeration values. If it is not an enumeration value, we can determine whether the type of the feature value is an array type. If it is an array type, it can be automatically expanded. If it is not an array type, we can further determine whether the type of the feature value is a number type or a text type. For number type features, we can check its maximum value, minimum value, positive number, negative number, integer, whether it contains spaces, etc. For text type features, we can check its maximum length, whether it contains mixed uppercase and lowercase, whether it contains special characters, etc. In this way, we can obtain the attributes and rules of the feature value of each field, and determine the corresponding recommendation method based on the attributes and rules of the feature value of each field.

[0094] In one specific implementation, for each field in each traffic data, this application can first determine whether the number of different feature values ​​corresponding to the field in all traffic data exceeds a preset threshold. If it does not exceed the threshold, it indicates that the feature value of the field is an enumeration value. At this time, the enumeration value corresponding to the feature value of the field can be determined based on the different feature values ​​corresponding to the field in all traffic data. For example, for the warehouse field, if the interface is only used for a few specific warehouses, the corresponding warehouse enumeration value can be obtained after identifying the feature value of the field. If it exceeds the threshold, it then determines whether the type of the feature value corresponding to the field in all traffic data is an array type. If it is an array type, since numeric parameters can automatically expand, no recommended use cases are needed. If it is not an array type, it then determines whether the type of the feature value corresponding to the field in all traffic data is a numeric type. For example, whether the feature value contains only numbers, decimal points, or spaces. If so, it indicates that the type of the feature value is a numeric type. For numeric feature values, it can be determined whether the key contains characters such as id / ip. If the feature value is "contains" (e.g., orders, timestamps), it means the feature value is purely numeric and its magnitude is not important; no recommendations are needed for this type of feature value. If it does not contain characters like "id" or "ip," then the feature value is further checked to see if it is empty or if the minimum value is greater than 0 and the maximum value has more than 10 digits. If so, this type of feature value is also not recommended; otherwise, all mismatched attributes are recommended. Furthermore, if the feature value type is not numeric, then it is text. For text-type feature values, we can first check if the feature value contains "url." If it does, only the maximum length, empty, null, and "url" attributes are recorded, and other attributes are not recorded. If it does not contain "url," then we further check if it contains a separator. If it does, the separator is converted to an enumeration value. If it does not contain "url," then we check if it contains special characters. If it does, special character attributes are recommended; otherwise, we check if it contains mixed case. If it does, mixed case attributes are recommended; otherwise, maximum length, empty, and null attributes are recommended. For special character attributes, maximum length, empty, and null attributes can also be recommended.

[0095] The interface parameter recommendation device based on traffic data provided in the embodiments of this application is described below. The interface parameter recommendation device based on traffic data described below and the interface parameter recommendation method based on traffic data described above can be referred to in correspondence.

[0096] In one embodiment, such as Figure 3 As shown, Figure 3This application provides a schematic diagram of an interface parameter recommendation device based on traffic data, as shown in an embodiment of the present application. The present application also provides an interface parameter recommendation device based on traffic data, which may include a data acquisition module 210, a feature value extraction module 220, and an interface parameter recommendation module 230, specifically including the following:

[0097] The data acquisition module 210 is used to acquire a number of traffic data generated when a specified interface is used in the production environment.

[0098] The feature extraction module 220 is used to flatten several traffic data to obtain multiple fields of each traffic data and the feature value of each field.

[0099] The interface parameter recommendation module 230 is used to determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on multiple fields of each traffic data and the feature value of each field, so as to make recommendations when configuring test cases for interface testing in the future.

[0100] In the above embodiments, to expand the analysis sample and provide meaningful data for subsequent more intelligent and accurate analysis, several traffic data points generated when a specified interface is used in the production environment can be obtained. Then, these traffic data points are flattened. This not only quickly removes redundant data from the traffic data but also obtains multiple fields and feature values ​​for each traffic data point. Next, this application can determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the multiple fields and feature values ​​of each traffic data point. This allows for more refined field recommendations when configuring test cases for interface testing, facilitating parameter input for interface testing and improving test coverage.

[0101] In one embodiment, the feature extraction module includes:

[0102] The data splitting module is used to split each traffic data into multiple fields according to preset splitting rules and determine the feature value of each field in the traffic data.

[0103] In one embodiment, the interface parameter recommendation module includes:

[0104] The feature value attribute and rule determination module is used to determine the feature value attribute and rule corresponding to the interface parameter of the specified interface based on the number of times each field of each traffic data appears in all traffic data and the form in which the feature value of each field appears in all traffic data.

[0105] In one embodiment, the feature value attribute and rule determination module includes:

[0106] The frequency comparison module is used to compare the number of times each field appears in all traffic data with a preset frequency threshold for each field in each traffic data to obtain the comparison result.

[0107] The form judgment module is used to determine the form in which the feature value of the field appears in all traffic data according to preset judgment rules, and obtain the judgment result.

[0108] The result generation module is used to generate the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the comparison and judgment results of each field of each traffic data.

[0109] In one embodiment, the form determination module includes:

[0110] The first judgment module is used to determine whether the number of different feature values ​​corresponding to the field in all traffic data exceeds a preset number threshold.

[0111] The first determining module is used to determine the enumerated value corresponding to the feature value of the field based on the different feature values ​​of the field in all traffic data if the value does not exceed a certain limit.

[0112] The second judgment module is used to determine whether the type of the feature value corresponding to the field in all traffic data is an array type if the value exceeds the limit.

[0113] The type marking module is used to mark the type of the characteristic value of the field as an array type if it is true.

[0114] The third judgment module is used to determine whether the type of the feature value corresponding to the field in all traffic data is numeric if the condition is not met.

[0115] The second determining module is used to determine, if so, the first attribute feature of the field in all traffic data under the numeric type.

[0116] The third determining module is used to otherwise determine that the type of the feature value corresponding to the field in all traffic data is text type, and to determine the second attribute feature of the feature value corresponding to the field in all traffic data under the text type.

[0117] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0118] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0119] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for recommending interface parameters based on traffic data, characterized in that, The method includes: Retrieve traffic data generated when a specified interface is used in a production environment; After flattening several traffic data points, multiple fields and feature values ​​of each field are obtained for each traffic data point. Based on multiple fields of each traffic data and the feature value of each field, determine the feature value attributes and rules corresponding to the interface parameters of the specified interface, so as to make recommendations when configuring test cases for interface testing in the future; The step of determining the feature value attributes and rules corresponding to the interface parameters of the specified interface based on multiple fields of each traffic data and the feature value of each field includes: For each field of each traffic data: compare the number of times the field appears in all traffic data with a preset frequency threshold to obtain the comparison result; And, according to preset judgment rules, determine the form in which the feature value of this field appears in all traffic data, and obtain the judgment result, including: Determine whether the number of different feature values ​​corresponding to this field in all traffic data exceeds a preset threshold. If it does not exceed, then the enumeration value corresponding to the feature value of the field is determined according to the different feature values ​​of the field in all traffic data; If the number exceeds the limit, determine whether the feature value corresponding to this field in all traffic data is an array type; If so, then mark the type of the feature value of that field as an array type; If not, determine whether the feature value corresponding to this field in all traffic data is of numeric type; If so, determine the first attribute feature of the field in all traffic data under the numeric type; Otherwise, determine that the feature value corresponding to this field in all traffic data is of type text, and determine the second attribute feature of the feature value corresponding to this field in all traffic data under the text type; Based on the comparison and judgment results of each field of each traffic data, the feature value attributes and rules corresponding to the interface parameters of the specified interface are generated.

2. The interface parameter recommendation method based on traffic data according to claim 1, characterized in that, The process of flattening several traffic data points to obtain multiple fields for each traffic data point and feature values ​​for each field includes: For each data point: The traffic data is split into multiple fields according to the preset splitting rules, and the characteristic value of each field in the traffic data is determined.

3. An interface parameter recommendation device based on traffic data, characterized in that, include: The data acquisition module is used to acquire traffic data generated when a specified interface is used in the production environment. The feature extraction module is used to flatten several traffic data points to obtain multiple fields for each traffic data point and the feature value of each field. The interface parameter recommendation module is used to determine the feature value attributes and rules corresponding to the interface parameters of the specified interface based on multiple fields of each traffic data and the feature value of each field, so as to make recommendations when configuring test cases for interface testing in the future. The interface parameter recommendation module determines the feature value attributes and rules corresponding to the interface parameters of the specified interface based on multiple fields of each traffic data and the feature value of each field, including: The frequency comparison module is used to compare the number of times each field appears in all traffic data with a preset frequency threshold for each field of each traffic data to obtain the comparison result. The form judgment module is used to determine the form in which the feature value of the field appears in all traffic data according to preset judgment rules, and obtain the judgment result, including: The first judgment module is used to determine whether the number of different feature values ​​corresponding to the field in all traffic data exceeds a preset number threshold. The first determining module is used to determine the enumeration value corresponding to the feature value of the field based on the different feature values ​​of the field in all traffic data if the value does not exceed the specified value. The second judgment module is used to determine whether the type of the feature value corresponding to the field in all traffic data is an array type if the value exceeds the limit. The type marking module is used to mark the type of the characteristic value of the field as an array type if it is true; The third judgment module is used to determine whether the type of the feature value corresponding to the field in all traffic data is numeric if the condition is not met. The second determining module is used to determine, if so, the first attribute feature of the field in all traffic data under the numeric type; The third determining module is used to otherwise determine that the type of the feature value corresponding to the field in all traffic data is text type, and to determine the second attribute feature of the feature value corresponding to the field in all traffic data under the text type. The result generation module is used to generate the feature value attributes and rules corresponding to the interface parameters of the specified interface based on the comparison and judgment results of each field of each traffic data.

4. The interface parameter recommendation device based on traffic data according to claim 3, characterized in that, The feature value extraction module includes: The data splitting module is used to split each traffic data into multiple fields according to preset splitting rules and determine the feature value of each field in the traffic data.

Citation Information

Patent Citations

  • Test case generation method and device, computer equipment and storage medium

    CN112559364A