Interface test strategy generation method and device, equipment and storage medium

By automatically extracting field attribute values ​​from the interface document to generate interface testing policies, the problem of low generation efficiency of interface testing policies for non-summer framework development applications is solved, and efficient and accurate generation of interface testing policies is achieved.

CN119149393APending Publication Date: 2024-12-17CHINA MERCHANTS BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411043459.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

In the prior art, for application interfaces developed based on non-summer frameworks, testers need to manually configure interface testing policies, resulting in low efficiency and high error rate.

Method used

By automatically extracting the attribute values ​​of each field attribute from the interface document and generating interface testing policies based on these attribute values, the generation efficiency and accuracy of interface testing policies are improved.

Benefits of technology

Automatic interface testing strategy generation is realized, improving efficiency and accuracy, and reducing the need for manual configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149393A_ABST
    Figure CN119149393A_ABST
Patent Text Reader

Abstract

The invention discloses an interface test strategy generation method and device, equipment and a storage medium, and relates to the technical field of testing, and the interface test strategy generation method comprises the steps: obtaining an interface document and a request message document in response to a test strategy generation request; based on a preset field attribute corresponding to each message field in the request message document, extracting an attribute value of each field attribute from the interface document; and generating an interface test strategy based on each field attribute and each attribute value. The generation efficiency of the interface test strategy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing technology, and in particular to a method, device, equipment and storage medium for generating an interface testing strategy. Background Art

[0002] During the automated testing process, the interface testing platform can generate different test cases based on the generation strategy of the single interface testing strategy to test the interface to be tested.

[0003] At present, for application interfaces developed based on the summer framework, the interface testing platform can directly obtain the generation strategy of the single interface testing strategy so that the interface testing platform can generate test cases based on the generation strategy; however, for application interfaces developed based on non-summer frameworks, testers are required to maintain the generation strategy of the single interface testing strategy on the interface testing platform according to the interface document of the application interface so that the interface testing platform can generate test cases based on the generation strategy. This method of manually determining the generation strategy of the single interface testing strategy to generate test cases has the problem of low efficiency.

[0004] Therefore, how to improve the efficiency of generating interface testing strategies is a problem that needs to be solved urgently. Summary of the invention

[0005] The main purpose of the present application is to provide a method, device, equipment and storage medium for generating an interface test strategy, aiming to improve the generation efficiency of the interface test strategy.

[0006] To achieve the above object, the present application provides a method for generating an interface test strategy, the method comprising:

[0007] Responding to the test strategy generation request, obtaining an interface document and a request message document;

[0008] Based on the preset field attributes corresponding to the respective message fields in the request message document, extracting the attribute values ​​of the respective field attributes from the interface document;

[0009] An interface test strategy is generated based on each of the field attributes and each of the attribute values.

[0010] In one embodiment, the step of extracting the attribute value of each field attribute from the interface document based on the preset field attribute corresponding to each message field in the request message document comprises:

[0011] Extracting each message field from the request message document;

[0012] Based on each of the message fields and the preset field attributes corresponding to each of the message fields, the attribute value of each of the field attributes is extracted from the interface document.

[0013] In one embodiment, the step of extracting the attribute value of each of the field attributes from the interface document based on each of the message fields and the preset field attributes corresponding to each of the message fields includes:

[0014] Determine a target row of a target message field in the interface document, wherein the target message field is any field in each of the message fields;

[0015] Determine a target column in the interface document corresponding to a preset target field attribute of the target message field;

[0016] The attribute value of the target field attribute is extracted from the interface document based on the target row and the target column.

[0017] In one embodiment, after the step of determining the target message field of the target line in the interface document, the method further comprises:

[0018] Compare the column name of the parameter column in the interface document with the target field attribute to obtain a comparison result;

[0019] When the comparison result is consistent, the step of determining the target column in the interface document corresponding to the preset target field attribute of the target message field is performed;

[0020] When the comparison result is inconsistent, it is determined that the preset default value corresponding to the target field attribute is the attribute value of the target field attribute.

[0021] In one embodiment, the step of generating an interface test strategy based on each of the field attributes and each of the attribute values ​​includes:

[0022] Determine the data format of the request message document and the field value of each of the message fields;

[0023] Based on the field values, the field attributes and the attribute values, an interface test strategy is generated according to the data format.

[0024] In one embodiment, the output format of the interface test strategy is a json document.

[0025] In one embodiment, the method further comprises:

[0026] In response to the column name configuration request, obtaining the column name of the parameter column in the interface document; and,

[0027] In response to the default value configuration request, the default value corresponding to each of the field attributes is obtained.

[0028] In addition, to achieve the above-mentioned purpose, the present application also provides a device for generating an interface test strategy, the device for generating an interface test strategy comprising:

[0029] An acquisition module, used to acquire an interface document and a request message document in response to a test strategy generation request;

[0030] An extraction module, configured to extract attribute values ​​of respective field attributes from the interface document based on respective preset field attributes corresponding to respective message fields in the request message document;

[0031] A strategy generation module is used to generate an interface test strategy based on each of the field attributes and each of the attribute values.

[0032] In addition, to achieve the above-mentioned purpose, the present application also provides a storage medium, which is a computer-readable storage medium, and the computer-readable storage medium stores a program for implementing the method for generating an interface test strategy. The program for implementing the method for generating an interface test strategy is executed by a processor to implement the steps of the method for generating an interface test strategy as described above.

[0033] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, including a computer program, which implements the steps of the above-mentioned method for generating an interface test strategy when executed by a processor.

[0034] The present application provides a method for generating an interface test strategy. The present application obtains an interface document and a request message document in response to a test strategy generation request, obtains attribute values ​​of each field attribute from the interface document based on preset field attributes corresponding to each message field in the request message document, and then generates an interface test strategy based on each field attribute and each attribute value, so that an interface test platform can generate an interface test case based on the interface test strategy.

[0035] In summary, compared to the traditional method for non-summer architecture application interfaces, which requires testers to manually configure interface testing strategies, this application can automatically extract the attribute values ​​of each field attribute from the interface document, and generate interface testing strategies based on field attributes and attribute values, thereby improving the efficiency of interface testing strategy generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0037] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0038] Figure 1 This is a flow chart of the first embodiment of the method for generating an interface test strategy of the present application;

[0039] Figure 2 A schematic diagram of a first user interface involved in an embodiment of a method for generating an interface test strategy of the present application;

[0040] Figure 3 A schematic diagram of a second user interface involved in an embodiment of a method for generating an interface test strategy of the present application;

[0041] Figure 4 A schematic diagram of a third user interface involved in an embodiment of a method for generating an interface test strategy of the present application;

[0042] Figure 5 A schematic diagram of a fourth user interface involved in an embodiment of a method for generating an interface test strategy of the present application;

[0043] Figure 6 A generation process of an interface test strategy involved in an embodiment of a method for generating an interface test strategy of the present application;

[0044] Figure 7 This is a schematic diagram of the module structure of the device for generating the interface test strategy of this application;

[0045] Figure 8 A schematic diagram of the device structure of the hardware operating environment involved in the method for generating an interface test strategy in an embodiment of the present application.

[0046] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0047] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

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

[0049] The main solution of the present application is: determine the estimated temperature of the test strategy system according to the current temperature of each IGBT tube in the test strategy system; if it is detected that the estimated temperature is greater than the first preset temperature threshold, increase the parameter value of the heat dissipation parameter of the heat dissipation device of the test strategy system to the maximum parameter value; after increasing the parameter value of the heat dissipation parameter to the maximum parameter value, if it is detected that the estimated temperature is greater than the second preset temperature threshold, reduce the coefficient value of the system power coefficient of the test strategy system to the target system power coefficient value, wherein the second preset temperature threshold is greater than the first preset temperature threshold.

[0050] At present, for application interfaces developed based on the summer framework, the interface testing platform can directly obtain the generation strategy of the single interface testing strategy, so that the interface testing platform can generate test cases based on the generation strategy; but for application interfaces developed based on non-summer frameworks, there are two commonly used methods. The first is that the tester maintains the generation strategy of the single interface testing strategy on the interface testing platform according to the interface document of the application interface, so that the interface testing platform can generate test cases based on the generation strategy. The second method is to import the swagger document file generated by the application into the interface testing platform, and the interface testing platform obtains the strategy information of important fields, but this method still requires the tester to manually supplement the information to obtain a complete test strategy. In other words, for application interfaces developed based on non-summer frameworks, the above two commonly used methods of generating test strategies require manual configuration, which has the problems of low efficiency and high error rate.

[0051] Compared with the traditional method for non-summer architecture application interfaces, which requires testers to manually configure interface testing strategies, this application can automatically extract the attribute values ​​of each field attribute from the interface document, and generate interface testing strategies based on the field attributes and attribute values, thereby improving the efficiency and accuracy of interface testing strategy generation.

[0052] It should be noted that the execution subject of the method in each embodiment of the energy storage system configuration method of the present application may be a test strategy system, or a computing service device with data processing, network communication and program running functions, such as a tablet computer, a personal computer, a mobile phone, etc., or a device for generating an interface test strategy that can realize the above functions, etc., and this embodiment does not specifically limit this. The following takes the test strategy system as an example of the execution subject to illustrate this embodiment and the following embodiments.

[0053] Based on this, the present application proposes a method for generating an interface test strategy in the first embodiment, please refer to Figure 1 The method for generating the interface test strategy includes steps S10 to S30:

[0054] Step S10, in response to the test strategy generation request, obtaining an interface document and a request message document;

[0055] It should be noted that the test strategy system includes a user interface, which includes an input part. Figure 2 , the input part includes an input box for inputting an interface document and a request message document, and an input box for inputting an interface name and an output result (i.e., an interface test strategy) saving path, wherein the interface document and the request message document are required items, and the interface name and the output result saving path are optional items. When the user does not manually fill in the interface name, the test strategy system can automatically identify the interface name according to the interface document input by the user, and fill it into the input box of the interface name, and when the number of interface names is multiple, multiple interfaces are distinguished by line breaks. When the user does not manually select the output result saving path, the test strategy system saves the output result to a preset folder by default. In the actual application process, the user can click the "Select File" button of the user interface to select the interface document and the request message document of the interface to be generated for the test strategy to the corresponding input box, and click the "OK" button to trigger the test strategy generation request. And the interface document input into the corresponding input box of the user interface can be a word document or an excel document, and the request message document can be in .xlsx or .xls format. It should be understood that the interface corresponding to the interface document and the request message document input each time is the same.

[0056] In response to a test strategy generation request triggered by a user based on a user interface, an interface document and a request message document input by the user at that time are obtained.

[0057] Step S20, based on the preset field attributes corresponding to the respective message fields in the request message document, extracting the attribute values ​​of the respective field attributes from the interface document;

[0058] It should be noted that users can pre-define at least one field attribute corresponding to each message field. For example, field attributes include but are not limited to the Chinese name of the parameter, the English name of the parameter, the field type, whether the field is not empty, parameter length limit, parameter precision limit, parameter enumeration, and whether to enable field checking, etc.

[0059] Based on the preset field attributes corresponding to each message field in the request message document input by the user, the attribute values ​​of each field attribute are obtained from the interface document. For example, when the field attribute is whether the field is not empty, the attribute value corresponding to the field attribute is empty or not empty.

[0060] In this embodiment, the step S20 may include:

[0061] Step S201, extracting each message field from the request message document;

[0062] Step S202: based on each of the message fields and the preset field attributes corresponding to each of the message fields, extract the attribute value of each of the field attributes from the interface document.

[0063] Each message field is extracted from the request message document input by the user at that time, and based on each message field and the preset field attribute corresponding to each message field, the attribute value of each field attribute is obtained from the interface document.

[0064] In a specific implementation, the step S202 may include:

[0065] Step S2021, determining a target row of a target message field in the interface document, wherein the target message field is any field in the message fields;

[0066] It should be noted that any field in each message field in the request message document is referred to as a target message field. The message field is represented by a data item identifier.

[0067] Determine the parameter line of the target message field in the interface document (hereinafter referred to as the target line for distinction).

[0068] Step S2022, determining a target column in the interface document corresponding to a preset target field attribute of the target message field;

[0069] Determine the parameter column (hereinafter referred to as the target column for distinction) in the interface document corresponding to the preset field attribute (hereinafter referred to as the target field attribute for distinction).

[0070] In this embodiment, the method for generating the interface test strategy further includes:

[0071] Step A10, in response to the column name configuration request, obtaining the column name of the parameter column in the interface document;

[0072] It should be noted that the user interface also includes an advanced settings section, see Figure 3, the advanced settings section includes an input box for setting the column name of each parameter column in the interface document. The column name of the parameter column is the same as the field attribute corresponding to each preset message field, that is, one field attribute is the column name of one parameter column. Moreover, the user can also enter the start position and end position of the interface document in the input box for setting the column name of each parameter column in the interface document. The start position and end position are used to limit the scope of attribute value search to achieve accurate search. In actual applications, the user enters the column name of the parameter column in the interface document in the advanced settings section of the user interface, that is, establishes a mapping relationship between the parameter column and the field attribute, and then clicks the "OK" button to trigger the column name configuration request. In addition, it is worth emphasizing that when setting the parameter column name, the configuration information entered by the user is entered in json format and saved in json format.

[0073] In response to a column name configuration request triggered by the user based on the user interface, the column name of the parameter column in the interface document is obtained and saved to a preset location in json format, so as to determine the parameter column of the field attribute in the interface document when determining the attribute value based on the field attribute in the interface document.

[0074] Step S2023: extracting the attribute value of the target field attribute from the interface document based on the target row and the target column.

[0075] After determining the target row of the target message field in the interface document and the target column of the target field attribute in the interface document, the attribute value of the target field attribute is obtained from the interface document based on the target row and the target column.

[0076] In this embodiment, the method for generating the interface test strategy of the present application further includes:

[0077] Step B10, in response to the default value configuration request, obtaining the default value corresponding to each of the field attributes.

[0078] It should be noted that the user interface also includes a default value setting section, see Figure 4 , the default value setting part includes an input box for setting the default value of each field attribute. In actual applications, after the user enters the default value of each field attribute, click the "OK" button to trigger the default value configuration request. In addition, it is worth emphasizing that when setting the default value, the configuration information entered by the user is entered in json format and saved in json format. The requirements for setting default values ​​include that if the default value is a number, it is in numeric format; if the default value is a string, it is in string format; if the default value is a Boolean value, it is in Boolean format; the true and false of is_define and not_null must not be quoted, all nulls cannot be quoted, and the triggered default value is "null" in string form.

[0079] In response to the default value configuration request triggered by the user based on the user interface, the default value corresponding to each field attribute is obtained, so that when the attribute value of the field attribute obtained from the interface document is empty, or a field attribute cannot be found in the interface document, the preset default value of the field attribute is used as the attribute value of the field attribute.

[0080] In this embodiment, after step S2021, the method further includes:

[0081] Step C10, comparing the column name of the parameter column in the interface document with the target field attribute to obtain a comparison result;

[0082] Compare the column names of the parameter columns in the interface document with the target field attributes to obtain a comparison result. Specifically, when the column names of the parameter columns in the interface document are the same as the target field attributes, the comparison result is determined to be consistent. When the column names of the parameter columns in the interface document are different from the target field attributes, the comparison result is determined to be inconsistent.

[0083] Step C20, when the comparison result is consistent, executing the step of determining the target column in the interface document corresponding to the preset target field attribute of the target message field;

[0084] When the comparison result is consistent, the target column of the target field attribute in the interface document is determined, that is, the parameter column corresponding to the column name that is consistent with the target field attribute is determined as the target column.

[0085] Step C30, when the comparison result is inconsistent, determining that the preset default value corresponding to the target field attribute is the attribute value of the target field attribute.

[0086] When the comparison result is inconsistent, the preset default value corresponding to the target field attribute is determined as the attribute value of the target field attribute. That is, when the column name identical to the target field attribute cannot be found in the interface document, the preset default value corresponding to the target field attribute is used as the attribute value of the target field attribute to ensure the integrity of the interface testing strategy.

[0087] Step S30: Generate an interface test strategy based on each of the field attributes and each of the attribute values.

[0088] After determining the preset field attributes corresponding to the respective message fields in the request message document and the attribute values ​​of the respective field attributes, an interface test strategy is generated based on the respective field attributes and the respective attribute values.

[0089] It should be noted that after obtaining the interface test strategy, the interface test strategy is input into the AItest platform (ie the above-mentioned interface test platform) so that the interface test platform can generate interface test cases based on the interface test strategy.

[0090] In this way, compared with the traditional method for non-summer architecture application interfaces, which requires testers to manually configure interface testing strategies, the embodiments of the present application can automatically extract the attribute values ​​of each field attribute from the interface document, and generate interface testing strategies based on the field attributes and attribute values, thereby improving the efficiency of interface testing strategy generation, and automated configuration can improve the accuracy of interface testing strategies.

[0091] Based on the first embodiment of the present application, in the second embodiment of the present application, the same or similar contents as those in the above-mentioned embodiment 1 can be referred to the above introduction, and will not be repeated in the following. On this basis, the step S30 may include:

[0092] Step S301, determining the data format of the request message document and the field value of each message field;

[0093] The data format of the request message document is determined based on the data content in the request message document, and the field value of each message field is extracted. Specifically, a request message document includes at least one message field, and one message field corresponds to one field value.

[0094] Step S302: Generate an interface test strategy in accordance with the data format based on each of the field values, each of the field attributes and each of the attribute values.

[0095] Based on the field values ​​of each message field, at least one preset field attribute corresponding to each message field, and the attribute values ​​of each field attribute, an interface test strategy is generated according to the data format of the request message document.

[0096] In this embodiment, the output format of the interface test strategy is a json document.

[0097] It should be noted that the user interface also includes an output part, see Figure 5 The output part is the output box of the interface test strategy. When the test strategy system generates the interface test strategy, the json document is displayed in the output box for the user to view, and the output json document is automatically saved to the pre-selected output result save path or the default path, and is stored with the interface name.json as the file name.

[0098] Exemplarily, the data content in the request message document is:

[0099] "body":{

[0100] "invoiceCode":"044002309111",

[0101] "invoiceNo":"03580582",

[0102] "invoiceDate":"2023-09-06",

[0103] "totalAmount":"351.95",

[0104] "checkCode":"341366",

[0105] "source":"O",

[0106] "bbkNum":"100"

[0107] }

[0108] That is to say, the request message document has 7 message fields, namely "invoiceCode", "invoiceNo", "invoiceDate", "totalAmount", "checkCode", "source" and "bbkNum", and the corresponding field values ​​of each message field are "044002309111", "03580582", "2023-09-06", "351.95", "341366", "0" and "100". The interface test strategy generated based on the request message document and the interface document is expressed as:

[0109] "body":{

[0110] "invoiceCode":{

[0111] "DEC_DGT":0,

[0112] "DEFAULT":"044002309111",

[0113] "ENUM_LIST":[],

[0114] "FLD_DES":null,

[0115] "FLD_FORMAT":null,

[0116] "FLD_LEN":"12",

[0117] "FLD_NAM":"invoiceCode",

[0118] "FLD_TYP":"str",

[0119] "IS_DEFINED":true,

[0120] "NOT_NULL":false

[0121] },

[0122] "invoiceNo":{

[0123] "DEC_DGT":0,

[0124] "DEFAULT":"03580582",

[0125] "ENUM_LIST":[],

[0126] "FLD_DES":null,

[0127] "FLD_FORMAT":null,

[0128] "FLD_LEN":"20",

[0129] "FLD_NAM":"invoiceNo",

[0130] "FLD_TYP":"str",

[0131] "IS_DEFINED":true,

[0132] "NOT_NULL":true

[0133] },

[0134] "invoiceDate":{

[0135] "DEC_DGT":0,

[0136] "DEFAULT":"2023-09-06",

[0137] "ENUM_LIST":[],

[0138] "FLD_DES":null,

[0139] "FLD_FORMAT":"YYYY-MM-DD",

[0140] "FLD_LEN":"10",

[0141] "FLD_NAM":"invoiceDate",

[0142] "FLD_TYP":"str",

[0143] "IS_DEFINED":true,

[0144] "NOT_NULL":true

[0145] },

[0146] "totalAmount":{

[0147] "DEC_DGT":0,

[0148] "DEFAULT":"351.95",

[0149] "ENUM_LIST":[],

[0150] "FLD_DES":null,

[0151] "FLD_FORMAT":null,

[0152] "FLD_LEN":"10",

[0153] "FLD_NAM":"totalAmount",

[0154] "FLD_TYP":"str",

[0155] "IS_DEFINED":true,

[0156] "NOT_NULL":true

[0157] },

[0158] "checkCode":{

[0159] "DEC_DGT":0,

[0160] "DEFAULT":"341366",

[0161] "ENUM_LIST":[],

[0162] "FLD_DES":null,

[0163] "FLD_FORMAT":null,

[0164] "FLD_LEN":"6",

[0165] "FLD_NAM":"checkCode","FLD_TYP":"str",

[0166] "IS_DEFINED":true,

[0167] "NOT_NULL":true

[0168] },

[0169] "source":{

[0170] "DEC_DGT":0,

[0171] "DEFAULT":"O",

[0172] "ENUM_LIST":[],

[0173] "FLD_DES":null,

[0174] "FLD_FORMAT":null,

[0175] "FLD_LEN":"1",

[0176] "FLD_NAM":"source","FLD_TYP":"str",

[0177] "IS_DEFINED":true,

[0178] "NOT_NULL":true

[0179] },

[0180] "bbkNum":{

[0181] "DEC_DGT":0,

[0182] "DEFAULT":"100",

[0183] "ENUM_LIST":[],

[0184] "FLD_DES":null,

[0185] "FLD_FORMAT":null,

[0186] "FLD_LEN":"3",

[0187] "FLD_NAM":"bbkNum",

[0188] "FLD_TYP":"str",

[0189] "IS_DEFINED":true,

[0190] "NOT_NULL":false

[0191] }

[0192] }

[0193] Taking the message field "invoiceCode" as an example, the field value corresponding to the message field is written into the key value corresponding to "DEFAULT". The preset field attributes corresponding to the message field include "DEC_DGT", "ENUM_LIST", "FLD_DES", "FLD_FORMAT", "FLD_LEN", "FLD_NAM", "FLD_TYP", "IS_DEFINED" and "NOT_NULL". The attribute values ​​of each field attribute are extracted from the interface document. When the attribute value of a field attribute does not exist in the interface document, the default value is used as the attribute value. The attribute values ​​of each field attribute are: 0, [], null, null, "12", "invoiceCode", "str", true and false. After determining the field attributes and attribute values ​​corresponding to each message field, the above interface test strategy can be obtained, and the generation format of the interface test strategy is the same as the data format of the request message document, which can be understood as the order of each message field in the document is the same.

[0194] For example, refer to Figure 6 , Figure 6 The present invention is a flow chart of the generation process of the interface test strategy. First, the test strategy system monitors whether a test strategy generation request triggered by a user is received; when a test strategy generation request is received, the interface document and the request message document input by the user are obtained; the preset field attributes corresponding to each message field in the request message document are determined, and the attribute values ​​of each field attribute are extracted from the interface document; then the data format of the request message document and the field value of each message field are determined; based on the field value of each message field, each field attribute and the attribute value of each field attribute, a json document is generated according to the data format of the request message document, namely, the interface test strategy; the json document is output to the user interface and saved, so that the json document can be subsequently input to the interface test platform, and a test case is generated using the json document as a test case template.

[0195] In this way, the embodiment of the present application generates a json document based on the data format of the request message document, the field attributes corresponding to each message field, and the attribute values ​​of each field attribute, and outputs the json document to the user interface and saves it to a preset path. The json document is then input into the interface testing platform so that the interface testing platform can generate test cases using the json document as a test case template, thereby realizing the automatic generation of interface testing strategies and improving the generation efficiency of interface testing strategies.

[0196] The present application also provides a device for generating an interface test strategy. Figure 7 , the interface test strategy generation device includes:

[0197] An acquisition module 10, configured to acquire an interface document and a request message document in response to a test strategy generation request;

[0198] An extraction module 20, configured to extract attribute values ​​of respective field attributes from the interface document based on respective preset field attributes corresponding to respective message fields in the request message document;

[0199] The strategy generation module 30 is used to generate an interface test strategy based on each of the field attributes and each of the attribute values.

[0200] Optionally, the extraction module 20 is further used for:

[0201] Extracting each message field from the request message document;

[0202] Based on each of the message fields and the preset field attributes corresponding to each of the message fields, the attribute value of each of the field attributes is extracted from the interface document.

[0203] Optionally, the extraction module 20 is further used for:

[0204] Determine a target row of a target message field in the interface document, wherein the target message field is any field in each of the message fields;

[0205] Determine a target column in the interface document corresponding to a preset target field attribute of the target message field;

[0206] The attribute value of the target field attribute is extracted from the interface document based on the target row and the target column.

[0207] Optionally, the interface test strategy generating device further includes:

[0208] A comparison module, used for comparing the column name of the parameter column in the interface document with the target field attribute to obtain a comparison result;

[0209] The extraction module 20 is further configured to, when the comparison result is consistent, execute the step of determining the target column in the interface document corresponding to the preset target field attribute of the target message field;

[0210] The default configuration module is used to determine that the preset default value corresponding to the target field attribute is the attribute value of the target field attribute when the comparison result is inconsistent.

[0211] Optionally, the strategy generation module 30 is further used for:

[0212] Determine the data format of the request message document and the field value of each of the message fields;

[0213] Based on the field values, the field attributes and the attribute values, an interface test strategy is generated according to the data format.

[0214] Optionally, the output format of the interface test strategy is a json document.

[0215] Optionally, the acquisition module 10 further includes:

[0216] In response to the column name configuration request, obtaining the column name of the parameter column in the interface document; and,

[0217] In response to the default value configuration request, the default value corresponding to each of the field attributes is obtained.

[0218] The device for generating an interface test strategy provided in the embodiment of the present application adopts the method for generating an interface test strategy in the above embodiment, and can solve the technical problem of how to improve the efficiency of generating an interface test strategy. Compared with the prior art, the beneficial effects of the device for generating an interface test strategy provided in the embodiment of the present application are the same as the beneficial effects of the method for generating an interface test strategy provided in the above embodiment, and other technical features in the device for generating an interface test strategy are the same as the features disclosed in the method of the above embodiment, and are not described in detail here.

[0219] The present application provides a device for generating an interface test strategy, the device for generating an interface test strategy comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method for generating an interface test strategy in the above-mentioned embodiment one.

[0220] Reference below Figure 8 , which shows a schematic diagram of the structure of a device for generating an interface test strategy suitable for implementing an embodiment of the present application. The device for generating an interface test strategy in the embodiment of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8The interface test strategy generation device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0221] like Figure 8 As shown, the interface test strategy generation device may include a processing device 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the interface test strategy generation device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the device for generating the interface test strategy to communicate wirelessly or wired with other devices to exchange data. Although the figure shows a device for generating the interface test strategy with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems may be implemented or have instead.

[0222] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0223] The device for generating the interface test strategy provided by the present application adopts the method for generating the interface test strategy in the above-mentioned embodiment, and can solve the technical problem of how to improve the efficiency of generating the interface test strategy. Compared with the prior art, the beneficial effects of the device for generating the interface test strategy provided by the present application are the same as the beneficial effects of the method for generating the interface test strategy provided by the above-mentioned embodiment, and the other technical features in the device for generating the interface test strategy are the same as the features disclosed in the method of the previous embodiment, and will not be repeated here.

[0224] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0225] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0226] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the method for generating an interface test strategy in the above-mentioned embodiment.

[0227] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.

[0228] The computer-readable storage medium may be included in the device for generating the interface test strategy; or may exist independently without being assembled into the device for generating the interface test strategy.

[0229] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the interface test strategy generation device, the interface test strategy generation device: responds to the test strategy generation request, obtains the interface document and the request message document; based on the preset field attributes corresponding to each message field in the request message document, extracts the attribute value of each field attribute from the interface document; generates the interface test strategy based on each field attribute and each attribute value.

[0230] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0231] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0232] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0233] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned method for generating interface test strategies, and can solve the technical problem of improving the efficiency of generating interface test strategies. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the method for generating interface test strategies provided by the above-mentioned embodiments, and will not be described in detail here.

[0234] An embodiment of the present application provides a computer program product, including a computer program, which implements the steps of the method for generating an interface test strategy as described above when the computer program is executed by a processor.

[0235] The computer program product provided by the present application can solve the technical problem of how to improve the heat dissipation efficiency of the test strategy system. Compared with the prior art, the beneficial effects of the computer program product provided by the embodiment of the present application are the same as the beneficial effects of the method for generating the interface test strategy provided by the above embodiment, which will not be repeated here.

[0236] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.

Claims

1. A method for generating an interface test strategy, It is characterized in that The method for generating the interface test strategy includes: Responding to the test strategy generation request, obtaining an interface document and a request message document; Based on the preset field attributes corresponding to the respective message fields in the request message document, extracting the attribute values ​​of the respective field attributes from the interface document; An interface test strategy is generated based on each of the field attributes and each of the attribute values.

2. The method according to claim 1, It is characterized in that The step of extracting the attribute value of each field attribute from the interface document based on the preset field attributes corresponding to each message field in the request message document comprises: Extracting each message field from the request message document; Based on each of the message fields and the preset field attributes corresponding to each of the message fields, the attribute value of each of the field attributes is extracted from the interface document.

3. The method according to claim 2, It is characterized in that The step of extracting the attribute value of each of the field attributes from the interface document based on each of the message fields and the preset field attributes corresponding to each of the message fields comprises: Determine a target row of a target message field in the interface document, wherein the target message field is any field in each of the message fields; Determine a target column in the interface document corresponding to a preset target field attribute of the target message field; The attribute value of the target field attribute is extracted from the interface document based on the target row and the target column.

4. The method according to claim 3, It is characterized in that After the step of determining the target line of the target message field in the interface document, the method further comprises: Compare the column name of the parameter column in the interface document with the target field attribute to obtain a comparison result; When the comparison result is consistent, the step of determining the target column in the interface document corresponding to the preset target field attribute of the target message field is performed; When the comparison result is inconsistent, it is determined that the preset default value corresponding to the target field attribute is the attribute value of the target field attribute.

5. The method according to claim 1, It is characterized in that The step of generating an interface test strategy based on each of the field attributes and each of the attribute values ​​comprises: Determine the data format of the request message document and the field value of each of the message fields; Based on the field values, the field attributes and the attribute values, an interface test strategy is generated according to the data format.

6. The method according to claim 5, It is characterized in that The output format of the interface test strategy is a json document.

7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: In response to the column name configuration request, obtaining the column name of the parameter column in the interface document; and, In response to the default value configuration request, the default value corresponding to each of the field attributes is obtained.

8. A device for generating an interface test strategy, It is characterized in that The interface test strategy generation device comprises: An acquisition module, used to acquire an interface document and a request message document in response to a test strategy generation request; An extraction module, configured to extract attribute values ​​of respective field attributes from the interface document based on respective preset field attributes corresponding to respective message fields in the request message document; A strategy generation module is used to generate an interface test strategy based on each of the field attributes and each of the attribute values.

9. A device for generating an interface test strategy, It is characterized in that The interface test strategy generation device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the interface test strategy generation method according to any one of claims 1 to 7.

10. A storage medium, It is characterized in that The storage medium is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for generating an interface test strategy according to any one of claims 1 to 7 are implemented.