Interface test case generation method and device, equipment and storage medium
By automatically identifying the target interface identification and description item information in the interface document, the interface test cases are automatically generated, which solves the problem of high repetition of writing interface test cases in the prior art and improves the writing efficiency.
Patent Information
- Application Number
- CN202311183988.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-13
- Publication Date
- 2025-03-14
AI Technical Summary
The existing interface test cases need to be written repeatedly every time an interface test task is received, resulting in a lot of manpower and material resources and inefficient writing.
By obtaining the test case template and pending interface documents, identifying the target interface identifier and obtaining matching description information, the interface test cases are automatically generated based on this information and the test case template.
It realizes automatic sorting of interface documents and automatically generating interface test cases, saving manpower and material resources, and improving the writing efficiency of interface test cases.
Smart Images

Figure CN119621533A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of interface testing technology, and in particular to a method, device, equipment and storage medium for generating an interface test case. Background Art
[0002] Currently, after receiving the interface documents, testers need to sort out the interface documents and manually write interface test cases based on the sorted interface documents. Often, the formats of these interface documents are consistent, but the process of manually writing interface test cases is repetitive.
[0003] However, in the process of implementing the present invention, it is found that there are at least the following problems in the prior art:
[0004] The existing interface test case writing requires repeated interface test case writing work based on the received interface document every time an interface test task is received, resulting in a large amount of manpower and material resources being consumed and low writing efficiency. Summary of the invention
[0005] The embodiment of the present invention provides a method, device, equipment and storage medium for generating interface test cases, so as to provide a new method for automatically combing interface documents and automatically generating interface test cases, saving manpower and material resources and improving the efficiency of writing interface test cases.
[0006] In a first aspect, an embodiment of the present invention provides a method for generating an interface test case, the method comprising:
[0007] Get test case templates and interface documents to be processed;
[0008] Identify a target interface identifier from the interface document to be processed, and obtain description item information matching the target interface identifier;
[0009] An interface test case is generated according to the target interface identifier, the descriptive item information and the test case template.
[0010] In a second aspect, an embodiment of the present invention further provides a device for generating an interface test case, the device comprising:
[0011] Template and document acquisition module, used to obtain test case templates and interface documents to be processed;
[0012] An information acquisition module, used to identify a target interface identifier from the interface document to be processed, and to acquire description item information matching the target interface identifier;
[0013] The test case generation module is used to generate an interface test case according to the target interface identifier, the descriptive item information and the test case template.
[0014] In a third aspect, an embodiment of the present invention provides an electronic device, the electronic device comprising:
[0015] one or more processors;
[0016] A memory for storing one or more programs;
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating interface test cases provided by any embodiment of the present invention.
[0018] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for generating an interface test case as provided in any embodiment of the present invention.
[0019] The embodiments of the above invention have the following advantages or beneficial effects:
[0020] The technical solution of the embodiment of the present invention obtains a test case template and an interface document to be processed; identifies a target interface identifier from the interface document to be processed, and obtains descriptive item information matching the target interface identifier; generates an interface test case according to the target interface identifier, the descriptive item information and the test case template, thereby solving the problem that the existing interface test case writing needs to be repeated according to the received interface document each time an interface test task is received, resulting in a large amount of manpower and material resources being consumed and low writing efficiency, and provides a new method for automatically combing interface documents and automatically generating interface test cases, saving manpower and material resources and improving the writing efficiency of interface test cases. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1a It is a flowchart of a method for generating an interface test case provided by an embodiment of the present invention;
[0022] Figure 1b A schematic diagram of a method for generating an interface test case provided by an embodiment of the present invention;
[0023] Figure 2 A flowchart of another method for generating interface test cases provided by an embodiment of the present invention;
[0024] Figure 3 A complete schematic flow chart of a method for generating an interface test case provided by an embodiment of the present invention;
[0025] Figure 4 It is a structural schematic diagram of a device for generating interface test cases provided by an embodiment of the present invention;
[0026] Figure 5 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0028] Figure 1a The flowchart of a method for generating an interface test case provided by an embodiment of the present invention is applicable to the case where an interface test case is automatically generated according to an interface document. The method can be executed by an interface test case generation device integrated in a server, and the device can be implemented by software and / or hardware. Figure 1a As shown, the method specifically comprises the following steps:
[0029] S110. Obtain test case templates and interface documents to be processed.
[0030] Among them, the interface document can refer to the interface document written by the front-end and back-end engineers to jointly define the interface in the development of projects such as the front-end and back-end separation development of the web (World Wide Web) project and the APP (Application) development. After that, the front-end and back-end engineers can carry out project development based on this interface document. In this embodiment, the interface document to be processed can be the interface document of a separate project. The interface document to be processed can typically support word and excel formats.
[0031] A test case can refer to a description of a test task for a specific software product, reflecting the test plan, technology and strategy. Its content can include test objectives, test environment, input data, test steps, expected results, test scripts, etc., and finally form a document. Simply put, a test case is a set of test inputs, execution conditions and expected results compiled for a special goal, used to verify whether a specific software requirement is met; test case templates can typically support Excel format.
[0032] In this embodiment, the tester may first input the test case template and the interface document to be processed into a program that can automatically generate interface test cases.
[0033] S120: Identify a target interface identifier from the interface document to be processed, and obtain description item information matching the target interface identifier.
[0034] The target interface identifier may refer to the name of the target interface.
[0035] The description item information may be description information of the target interface, for example, it may include the input parameter identifier of the target interface identifier, and the mandatory information and enumeration value information corresponding to each input parameter identifier. Among them, the input parameter identifier may refer to the field name of the parameter of the target interface, and each target interface identifier may match one or more input parameters, that is, each interface identifier may match one or more input parameter identifiers. The mandatory information may be information describing whether the input parameter must be filled in. The enumeration value information may be information describing the enumeration value of the input parameter. Enumeration type input parameters may have corresponding enumeration value information, and non-enumeration type input parameters may not have corresponding enumeration value information.
[0036] In this embodiment, the interface document to be processed can be an interface document of a separate project, that is, the interface document to be processed can contain a project name, and the number of target interface identifiers under the project name directory can be at least one, that is, the interface document to be processed can contain at least one interface name. Therefore, at least one target interface identifier can be identified from the interface document to be processed, and at least one input parameter identifier that matches each target interface identifier can be obtained from the interface document to be processed, as well as whether each input parameter is required and the enumeration value information.
[0037] Optionally, identifying the target interface identifier from the interface document to be processed and obtaining descriptive item information that matches the target interface identifier may include: identifying the target interface identifier from the interface document to be processed based on a preset start identifier and a preset end identifier; obtaining each input parameter identifier that matches the target interface identifier from the interface document to be processed based on a preset identification character; and reading whether the input parameter identifier is required and the enumeration value information corresponding to the input parameter identifier from the line where each input parameter identifier is located in the interface document to be processed.
[0038] The preset start identifier and the preset end identifier may refer to a pre-set character segment that can identify the target interface identifier. For example, the preset start identifier is com.xx and the preset end identifier is service. Then the information starting with com.xx and ending with service in the interface document to be processed is the target interface identifier. The preset identification words may refer to words used to identify the input parameter identifier, typically, the words "input parameter".
[0039] Specifically, the preset beginning identifier can be used as the beginning and the preset ending identifier can be used as the ending, and the target interface identifier can be identified from the document to be processed as the name of the target interface. Thus, according to the word "input parameter" and with the target interface identifier as the directory, each input parameter identifier matching the target interface identifier is obtained from the interface document to be processed, and further the mandatory information and enumeration value information of each input parameter identifier are read from the row where each input parameter identifier is located.
[0040] S130: Generate an interface test case according to the target interface identifier, description item information and test case template.
[0041] In this embodiment, the test case template is filled in to generate an interface test case according to the target interface identifier in the interface document to be processed, the input parameter identifiers of each target interface, and the mandatory or not information and enumeration value information of each input parameter identifier.
[0042] For example, Figure 1b A schematic diagram of a method for generating an interface test case provided in an embodiment of the present invention obtains the required project name, interface name (i.e., target interface identifier), required information, input parameter identifier, and enumeration value information from the interface document to be processed to generate a corresponding interface test case.
[0043] The technical solution of the embodiment of the present invention obtains a test case template and an interface document to be processed; identifies a target interface identifier from the interface document to be processed, and obtains descriptive item information matching the target interface identifier; generates an interface test case according to the target interface identifier, the descriptive item information and the test case template, thereby solving the problem that the existing interface test case writing needs to be repeated according to the received interface document each time an interface test task is received, resulting in a large amount of manpower and material resources being consumed and low writing efficiency, and provides a new method for automatically combing interface documents and automatically generating interface test cases, saving manpower and material resources and improving the writing efficiency of interface test cases.
[0044] Figure 2 This is a flowchart of another method for generating interface test cases provided by an embodiment of the present invention. Based on the above embodiment, this embodiment generates interface test cases according to the target interface identifier, description item information and test case template for refinement. Figure 2 As shown, the method specifically comprises the following steps:
[0045] S210, obtaining a test case template and an interface document to be processed; the test case template includes an interface identification column, an input parameter identification column, an input data column, and an expected test result column.
[0046] In this embodiment, the test case template can be an Excel table containing 4 columns to be filled, namely, an interface identification column, an input parameter identification column, an input data column, and an expected test result column. Exemplarily, Table 1 is an example of input parameters and their description information in a to-be-processed interface document; Table 2 is an interface test case generated according to Table 1 and the test case template, in which the interface name column is the interface identification column, and the input parameter column is the input parameter identification column.
[0047] Table 1
[0048]
[0049] Table 2
[0050]
[0051]
[0052] S220. Identify the target interface identifier from the interface document to be processed, and obtain descriptive item information matching the target interface identifier; the descriptive item information includes an input parameter identifier, and mandatory or not information and enumeration value information corresponding to each input parameter identifier.
[0053] S230. Fill the target interface identifier into the interface identifier column of the test case template.
[0054] In this embodiment, the interface document to be processed can be identified row by row or cell by cell. As shown in Table 1 and Table 2, after the target interface identifier 1 "com.xx...Service" is identified in Table 1, it is directly filled into the cell in the second row and first column under the interface identifier column in Table 2.
[0055] S240. Fill the current input parameter identifier into the input parameter identifier column of the test case template.
[0056] Continuing with the example in S230, after filling the target interface identifier 1 into the cell of the 1st row and the 1st column of Table 2, the input parameter identifier 1 "TemplateCode" matching the target interface identifier 1 in Table 1 is used as the current input parameter identifier and filled into the cell of the 2nd row and the 2nd column of Table 2.
[0057] S250. Fill in the input data column and the expected test result column according to the mandatory information and enumeration value information of the current input parameter identifier, and generate an interface test case.
[0058] In an optional implementation, filling in the input data column and the expected test result column according to the required information and enumeration value information of the current input parameter identifier can include: determining the current input parameter identifier; if the required information of the current input parameter identifier is yes, filling in the input data column in the test case template with yes, filling in the expected test result column with test passed, filling in the input data column of the next row with no, and filling in the expected test result column with required items as empty; and obtaining a judgment result on whether the enumeration value information of the current input parameter identifier has a value, and filling in the input data column and the expected test result column according to the judgment result; if the required information of the current input parameter identifier is no, directly obtaining the judgment result on whether the enumeration value information of the current input parameter identifier has a value, and filling in the input data column and the expected test result column according to the judgment result.
[0059] Based on the above implementation, filling in the input data column and the expected test result column according to the judgment result may include:
[0060] If the judgment result is that there is a value, the enumeration value can be obtained, and the input data column and the expected test result column can be filled in according to the enumeration value. Specifically, all enumeration values can be obtained from the enumeration value information of the current input parameter identifier according to the preset identification symbol; fill in the input data column and the expected test result column according to all enumeration values. Further, fill in the input data column and the expected test result column according to all enumeration values. Specifically, all enumeration values can be counted to obtain the number of enumeration values; according to the number of enumeration values, determine the number of additional rows to be filled in for the input data column and the expected test result column of the current input parameter identifier; fill each enumeration value in the input data column in turn according to the number of additional rows to be filled in, and fill in the expected test result column of each filled row as test passed.
[0061] If the judgment result is that there is no value, return to execute the operation of obtaining the current input parameter identifier until all input parameter identifiers are processed.
[0062] Among them, referring to Table 1, the enumeration value information can be in the format of "1: enable; 2: disable", the preset identification symbol is ":", "enable" and "disable" are the enumeration values, and the number of enumeration values is 2.
[0063] Exemplarily, the process of generating interface test cases is specifically described below with reference to Table 1 and Table 2:
[0064] 1) Obtain the interface name "com.xx……Service" from Table 1 according to the preset beginning mark and the preset ending mark, and fill it into the cell in the second row and the first column of Table 2.
[0065] 2) According to the words "input parameters" in Table 1, the input parameter identifiers are "TemplateCode", "Status", "creatTime" and "creatUser" respectively.
[0066] 3) The current input parameter identifier is "TemplateCode", and its corresponding mandatory information is "Yes", and the enumeration value information is empty. Then the input data column corresponding to "TemplateCode" in Table 2 can be filled in as "Yes", and the corresponding expected test result column can be filled in as "Test passed"; further, the input parameter column of the next row (i.e., the 3rd row, the 2nd column) is also filled in as "TemplateCode", the corresponding input data column is filled in as "No", and the expected test result column is filled in as "Required items are empty".
[0067] 4) The next current input parameter is identified as "Status", and its corresponding mandatory information is "Yes". The corresponding input data column of "Status" in Table 2 can be filled in as "Yes", and the corresponding expected test result column can be filled in as "Test passed"; further, the input parameter column of the next row (i.e., the 5th row and the 2nd column) is also filled in as "Status", and the corresponding input data column is filled in as "No", and the expected test result column is filled in as "Required items are empty". From Table 1, we know that "Status" has the corresponding enumeration value information "1: Enable; 2: Disable", and the number of enumeration values is 2, which are "Enable" and "Disable" respectively. Therefore, in Table 2, the 6th and 7th rows can be added to "Status", and specifically, "Enable" can be filled in the input data column of the 6th row, and "Test passed" can be filled in the expected test result column, and "Disable" can be filled in the input data column of the 7th row, and "Test passed" can be filled in the expected test result column.
[0068] 5) The next current input parameter identifier is "creatTime", and its corresponding mandatory information is "No", and the enumeration value information is empty, so it is not described in Table 2.
[0069] 6) The next current input parameter identifier is "creatUser", and its corresponding required information is "Yes", and the enumeration value information is empty. The same processing can be applied to "TemplateCode". Fill in "creatUser" in the input parameter column of row 8 of Table 2, fill in "Yes" in the input data column, and fill in "Test passed" in the expected test result column. Fill in "creatUser" in the input parameter column of row 9, fill in "No" in the input data column, and fill in "Required items are empty" in the expected test result column.
[0070] The technical solution of the embodiment of the present invention is to obtain a test case template and a pending interface document including an interface identification column, an input parameter identification column, an input data column and an expected test result column; identify a target interface identification from the pending interface document, and obtain an input parameter identification matching the target interface identification, as well as mandatory information and enumeration value information of each input parameter identification; fill the target interface identification into the interface identification column of the test case template; fill the current input parameter identification into the input parameter identification column of the test case template; fill the input data column and the expected test result column according to the mandatory information and enumeration value information of the current input parameter identification, and generate an interface test case. The problem that the existing interface test case writing needs to be repeated according to the received interface document each time an interface test task is received, resulting in a large amount of manpower and material resources being consumed and low writing efficiency is solved, and a new method for automatically combing interface documents and automatically generating interface test cases is provided, which saves manpower and material resources and improves the writing efficiency of interface test cases.
[0071] Figure 3A complete schematic flow chart of a method for generating an interface test case provided by an embodiment of the present invention.
[0072] 1) Before generating the interface test case, enter: project name, parameter column (column number in the interface document), required column (column number in the interface document), enumeration column (column number, format: 1: yes; 2: no).
[0073] 2) Import the interface document to be processed (note that the interface document must contain the required judgment conditions: the interface name starts with com.xx and ends with service; the values of the input parameter column and enumeration column are correct).
[0074] 3) Determine whether the interface name can be automatically identified: If so, write the interface name into the first cell of column A of the interface test case (matching rule: starting with com.xx and ending with service); if not, end the process.
[0075] 4) Determine whether the input parameters can be automatically identified: If so, write the input parameters into column B of the interface test case (matching rule: whether it contains the word "input parameters"); if not, end the process.
[0076] 5) Determine whether the input parameter is a required item: If so, enter "No" in column C of the test case document and "Required items are empty" in column D, enter "Yes" in column C of the next row and "Test passed" in column D, and then determine whether the enumeration column has a value; if not, directly determine whether the enumeration column has a value.
[0077] 6) Determine whether the enumeration column has a value: if not, loop to obtain other input parameters; if yes, obtain the enumeration value (acquisition method: loop to obtain the value after the colon, write it into column C, and write as many rows as there are (enumeration column format: 1: yes; 2: no)), and enter the enumeration value in column C of the interface test case, and enter the expected result "test passed" in column D.
[0078] 7) Determine whether the next line of input parameters has values: If there is a loop, determine whether the input parameters are required and whether there are enumeration values; if not, the interface test case ends.
[0079] 8) Output interface test cases: The interface test case format is a fixed format: the first column, i.e. column A: interface name; the second column, i.e. column B: input parameter name; the third column, i.e. column C: input data; the fourth column, i.e. column D: expected test results.
[0080] 9) Generate the next interface test case.
[0081] The following is an embodiment of the device for generating interface test cases provided in an embodiment of the present invention. The device and the method for generating interface test cases in the above-mentioned embodiment one belong to the same inventive concept. For details not described in detail in the embodiment of the device for generating interface test cases, reference can be made to the contents of the above-mentioned embodiments.
[0082] Figure 4 A schematic diagram of the structure of a device for generating interface test cases provided by an embodiment of the present invention, such as Figure 4 As shown, the device may include: a template and document acquisition module 410, an information acquisition module 420 and a test case generation module 430. Among them:
[0083] Template and document acquisition module 410, used to acquire test case templates and interface documents to be processed;
[0084] The information acquisition module 420 is used to identify the target interface identifier from the interface document to be processed, and obtain the description item information matching the target interface identifier;
[0085] The test case generation module 430 is used to generate an interface test case according to the target interface identifier, the descriptive item information and the test case template.
[0086] The technical solution of the embodiment of the present invention obtains a test case template and an interface document to be processed; identifies a target interface identifier from the interface document to be processed, and obtains descriptive item information matching the target interface identifier; generates an interface test case according to the target interface identifier, the descriptive item information and the test case template, thereby solving the problem that the existing interface test case writing needs to be repeated according to the received interface document each time an interface test task is received, resulting in a large amount of manpower and material resources being consumed and low writing efficiency, and provides a new method for automatically combing interface documents and automatically generating interface test cases, saving manpower and material resources and improving the writing efficiency of interface test cases.
[0087] In the above device, optionally, the description item information includes an input parameter identifier, and mandatory or not information and enumeration value information corresponding to each input parameter identifier;
[0088] Accordingly, the information acquisition module 420 may be specifically used for:
[0089] According to a preset beginning identifier and a preset ending identifier, identifying a target interface identifier from the interface document to be processed;
[0090] According to the preset identification words, obtaining each input parameter identifier matching the target interface identifier from the interface document to be processed;
[0091] From the row where each input parameter identifier is located in the interface document to be processed, read the mandatory information and enumeration value information corresponding to the input parameter identifier.
[0092] In the above device, optionally, the test case template includes an interface identification column, an input parameter identification column, an input data column, and an expected test result column;
[0093] Accordingly, the test case generation module 430 may specifically include:
[0094] An interface identification column filling submodule is used to fill the target interface identification into the interface identification column of the test case template;
[0095] An input parameter identification column filling submodule is used to fill the current input parameter identification into the input parameter identification column of the test case template;
[0096] The test case generation submodule is used to fill in the input data column and the expected test result column according to the mandatory information and enumeration value information of the current input parameter identifier to generate an interface test case.
[0097] In the above device, optionally, the test case generation submodule may specifically include:
[0098] A current input parameter identifier determining unit, used to determine the current input parameter identifier;
[0099] The input parameter identifier mandatory processing unit is used to fill in the input data column in the test case template with yes, fill in the expected test result column with test passed, fill in the input data column of the next row with no, and fill in the expected test result column with mandatory items as empty if the mandatory information of the current input parameter identifier is yes; and obtain the judgment result of whether the enumeration value information of the current input parameter identifier has a value, and fill in the input data column and the expected test result column according to the judgment result;
[0100] The input parameter identifier does not need to be filled in processing unit is used to obtain the judgment result of whether the enumeration value information of the current input parameter identifier has a value if the mandatory information of the current input parameter identifier is no, and fill in the input data column and the expected test result column according to the judgment result.
[0101] In the above device, optionally, the input parameter identifier does not need to be filled with the processing unit, and may specifically include:
[0102] There is an enumeration value processing subunit, which is used to obtain the enumeration value if the judgment result is that there is a value, and fill in the input data column and the expected test result column according to the enumeration value;
[0103] The no enumeration value processing subunit is used to return to execute the operation of obtaining the current input parameter identifier if the judgment result is that there is no value, until the processing of each input parameter identifier is completed.
[0104] In the above device, optionally, there is an enumeration value processing subunit, which may specifically include:
[0105] The enumeration value acquisition subunit is used to acquire all enumeration values from the enumeration value information of the current input parameter identifier according to a preset identifier symbol;
[0106] The column filling subunit is used to fill in the input data column and the expected test result column according to all the enumerated values.
[0107] In the above device, optionally, the column filling subunit can be specifically used for:
[0108] Count all the enumeration values and obtain the number of enumeration values;
[0109] Determine the number of rows to be added to the input data column and the expected test result column of the current input parameter identifier according to the number of enumerated values;
[0110] Each enumeration value is sequentially filled into the input data column according to the number of rows filled in, and the expected test result column of each filled-in row is filled in as test passed.
[0111] The interface test case generation device provided in the embodiment of the present invention can execute the interface test case generation method provided in the first embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the interface test case generation method.
[0112] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 5 A block diagram of an exemplary server 12 suitable for use in implementing embodiments of the present invention is shown. Figure 5 The server 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0113] like Figure 5 As shown, the server 12 is in the form of a general purpose computing device. The components of the server 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0114] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0115] The server 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the server 12, including volatile and non-volatile media, removable and non-removable media.
[0116] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The server 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0117] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0118] The server 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the server 12, and / or may communicate with any device that enables the server 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. In addition, the server 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the server 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the server 12, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0119] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing the steps of a method for generating an interface test case provided in the first embodiment of the present invention, which may include:
[0120] Get test case templates and interface documents to be processed;
[0121] Identify a target interface identifier from the interface document to be processed, and obtain description item information matching the target interface identifier;
[0122] An interface test case is generated according to the target interface identifier, the descriptive item information and the test case template.
[0123] Of course, those skilled in the art can understand that the processor can also implement the technical solution of the method for generating interface test cases provided by any embodiment of the present invention.
[0124] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps of a method for generating an interface test case provided in the above embodiment of the present invention are implemented. The method may include:
[0125] Get test case templates and interface documents to be processed;
[0126] Identify a target interface identifier from the interface document to be processed, and obtain description item information matching the target interface identifier;
[0127] An interface test case is generated according to the target interface identifier, the descriptive item information and the test case template.
[0128] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: 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 document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0129] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0130] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0131] Computer program code for performing the operations of the present invention 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).
[0132] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0133] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A method for generating an interface test case, characterized in that: The method comprises: Get test case templates and interface documents to be processed; Identify a target interface identifier from the interface document to be processed, and obtain description item information matching the target interface identifier; An interface test case is generated according to the target interface identifier, the descriptive item information and the test case template.
2. The method according to claim 1, characterized in that The description item information includes an input parameter identifier, and mandatory or not information and enumeration value information corresponding to each input parameter identifier; Identifying a target interface identifier from the interface document to be processed, and acquiring description item information matching the target interface identifier, including: According to a preset beginning identifier and a preset ending identifier, identifying a target interface identifier from the interface document to be processed; According to the preset identification words, obtaining each input parameter identifier matching the target interface identifier from the interface document to be processed; From the row where each input parameter identifier is located in the interface document to be processed, read the mandatory information and enumeration value information corresponding to the input parameter identifier.
3. The method according to claim 2, characterized in that The test case template includes an interface identification column, an input parameter identification column, an input data column, and an expected test result column; Generate an interface test case according to the target interface identifier, the description item information and the test case template, including: Fill the target interface identifier into the interface identifier column of the test case template; Fill the current input parameter identifier into the input parameter identifier column of the test case template; According to the mandatory or not information and the enumeration value information of the current input parameter identifier, fill in the input data column and the expected test result column to generate an interface test case.
4. The method according to claim 3, characterized in that Fill in the input data column and the expected test result column according to the mandatory information and enumeration value information of the current input parameter identifier, including: Determine the current input parameter identifier; If the mandatory information of the current input parameter identifier is yes, fill in the input data column in the test case template with yes, fill in the expected test result column with test passed, fill in the input data column of the next row with no, and fill in the expected test result column with mandatory items as empty; and obtain the judgment result of whether the enumeration value information of the current input parameter identifier has a value, and fill in the input data column and the expected test result column according to the judgment result; If the mandatory information of the current input parameter identifier is no, directly obtain the judgment result of whether the enumeration value information of the current input parameter identifier has a value, and fill in the input data column and the expected test result column according to the judgment result.
5. The method according to claim 4, characterized in that Filling in the input data column and the expected test result column according to the judgment result includes: If the judgment result is that there is a value, then the enumeration value is obtained, and the input data column and the expected test result column are filled in according to the enumeration value; If the judgment result is that there is no value, return to execute the operation of obtaining the current input parameter identifier until all the input parameter identifiers are processed.
6. The method according to claim 5, characterized in that Obtaining an enumeration value, and filling in the input data column and the expected test result column according to the enumeration value, including: According to the preset identification symbol, all enumeration values are obtained from the enumeration value information of the current input parameter identification; Fill in the input data column and the expected test result column according to all the enumeration values.
7. The method according to claim 6, characterized in that Filling in the input data column and the expected test result column according to all the enumerated values includes: Count all the enumeration values and obtain the number of enumeration values; According to the number of enumerated values, determine the number of rows to be added to the input data column and the expected test result column of the current input parameter identifier; Each enumeration value is sequentially filled into the input data column according to the number of rows filled in, and the expected test result column of each filled-in row is filled in as test passed.
8. A device for generating interface test cases, characterized in that: include: Template and document acquisition module, used to obtain test case templates and interface documents to be processed; An information acquisition module, used to identify a target interface identifier from the interface document to be processed, and to acquire description item information matching the target interface identifier; The test case generation module is used to generate an interface test case according to the target interface identifier, the descriptive item information and the test case template.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for generating interface test cases as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for generating an interface test case as described in any one of claims 1 to 7 is implemented.