Interface test case generation method and interface testing method
By obtaining the interface data of the interface to be tested and determining its preset plug-ins, the problem of high maintenance cost of interface test cases in the prior art is solved, and the automation and efficient coverage of interface testing is achieved.
Patent Information
- Application Number
- CN202010861567.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-25
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2040-08-25
AI Technical Summary
In the prior art, data maintenance costs for generating interface test cases are high, and data drivers and keywords need to be re-written to adapt to different interfaces.
By obtaining the interface data of the interface to be tested, it determines its corresponding preset plug-in, and uses the plug-in to generate interface test cases based on the interface data. This method only requires maintaining the interface once and preset plug-ins once, so that test cases for different interfaces can be automatically generated.
It reduces the data maintenance cost of interface tests, improves the coverage and efficiency of interface tests, and can automatically generate test cases for different interfaces.
Smart Images

Figure CN114116433B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of interface testing, and in particular to an interface test case generation method and an interface testing method. Background Art
[0002] In recent years, due to the rapid development of the Internet, the number of interfaces used in software has increased dramatically. Moreover, with the diversification of business, the Internet of Things, cloud native, virtual desktops, etc. have all seen the use of interfaces with different business logics. The quality requirements of software on interfaces are also increasing, including the robustness, security, repairability of abnormal scenarios, and bottom-line guarantees of interfaces. The demand of testers for test cases of interfaces is also increasing.
[0003] In the prior art, interface test cases are automatically generated by manually inputting keywords using a data-driven test framework. Each interface test case is automatically generated by manually inputting keywords as a template, and then filling in different values and checkpoints in a data-driven form. For the generation of interface test cases for different interfaces, data drivers and keywords need to be rewritten, and the data maintenance cost of generating interface test cases is high.
[0004] Therefore the prior art still needs to be improved. Summary of the invention
[0005] In view of the above-mentioned deficiencies in the prior art, the present invention provides an interface test case generation method and an interface testing method, aiming to overcome the problem of high maintenance cost of generating interface test case data in the prior art.
[0006] The technical solution provided by the present invention is as follows:
[0007] A method for generating an interface test case, wherein the method comprises:
[0008] Obtain the interface to be tested, and determine the preset plug-in corresponding to the interface to be tested;
[0009] The interface data of the interface to be tested is obtained, and the preset plug-in is controlled to generate an interface test case corresponding to the interface to be tested based on the interface data.
[0010] The interface test case generation method, wherein the step of obtaining the interface to be tested and determining the preset plug-in corresponding to the interface to be tested specifically comprises:
[0011] Obtaining an interface to be tested, and determining a test point corresponding to the interface to be tested;
[0012] A preset plug-in corresponding to the interface to be tested is determined according to the test point.
[0013] The interface test case generation method, wherein the obtaining of interface data of the interface to be tested and controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data specifically comprises:
[0014] Acquire interface data of the interface to be tested, and determine a test field corresponding to the interface to be tested according to the interface data;
[0015] The preset plug-in is controlled to generate an interface test case corresponding to the interface to be tested based on the test field.
[0016] The interface test case generation method, wherein the controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the test field specifically includes:
[0017] Obtaining a change function of the preset plug-in;
[0018] The test field is changed through the change function to generate an interface test case corresponding to the interface to be tested.
[0019] The interface test case generation method, wherein before the controlling the preset plug-in to generate the interface test case corresponding to the interface to be tested based on the interface data, the method further includes:
[0020] Determine a test interface set corresponding to the preset plug-in;
[0021] If the interface to be tested is included in the test interface set, executing the step of controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data;
[0022] If the interface to be tested is not included in the test interface set, the preset plug-in is abandoned.
[0023] The interface test case generation method, wherein the test point is a plurality of test points, and the step of determining the preset plug-in corresponding to the interface to be tested according to the test point specifically comprises:
[0024] For each of the plurality of test points, a preset plug-in corresponding to the interface to be tested is determined according to the test point, wherein the preset plug-ins corresponding to the respective test points in the plurality of test points are different from each other.
[0025] The interface test case generation method, wherein the obtaining of interface data of the interface to be tested and controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data specifically comprises:
[0026] Get the interface data of the interface to be tested;
[0027] For a preset plug-in corresponding to each test point, the preset plug-in is controlled to generate an interface test case corresponding to the interface to be tested based on the interface data.
[0028] An interface testing method, wherein the method is used to execute the interface test case, the method comprising:
[0029] Obtain all interface test cases of the interface to be tested, perform interface testing according to all the interface test cases, and receive the return value of each interface test case;
[0030] Obtaining the expected value of the interface to be tested, and determining the test result of each interface test case according to the expected value and the return value of each interface test case;
[0031] Generate an interface test report for the interface to be tested based on the test results of all interface test cases.
[0032] A computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the interface test case generation method and / or the steps in the interface testing method.
[0033] A terminal device, comprising: a processor, a memory and a communication bus; the memory stores a computer-readable program executable by the processor;
[0034] The communication bus realizes the connection and communication between the processor and the memory;
[0035] When the terminal device executes the computer-readable program, the interface test case generation method and / or the steps in the interface testing method are implemented.
[0036] Beneficial effects: The present invention discloses an interface test case generation method and an interface testing method, the interface test case generation method comprising: obtaining an interface to be tested, determining a preset plug-in corresponding to the interface to be tested; obtaining interface data of the interface to be tested, and controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data. Through the interface test case generation method, the present invention only needs to maintain the interface once and the preset plug-in once, can automatically generate interface test cases for different interfaces through different plug-ins, and can use the interface test cases to perform interface testing, thereby reducing the data maintenance cost of the interface test, while improving the interface test coverage and interface test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of the interface test case generation method provided by this embodiment;
[0038] Figure 2 is a schematic diagram of inputting the interface library provided in this embodiment;
[0039] Figure 3 is a flow chart of the interface testing method provided in this embodiment;
[0040] Figure 4 is a process diagram of performing interface testing on multiple interfaces to be tested provided by this embodiment;
[0041] Figure 5 is a process diagram of generating an interface test report provided in this embodiment;
[0042] Figure 6 It is a structural principle diagram of a terminal device provided in this embodiment. DETAILED DESCRIPTION
[0043] The present invention provides an interface test case generation method and an interface test method. To make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail below. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0044] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.
[0045] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with the meanings in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as herein.
[0046] The present invention is described in detail below with reference to specific embodiments.
[0047] like Figure 1 As shown, this embodiment provides a method for generating an interface test case, the method comprising:
[0048] S100: Acquire an interface to be tested, and determine a preset plug-in corresponding to the interface to be tested.
[0049] Specifically, the interface to be tested is determined by the interface test requirements provided by the entry script. For example, the interface test requirements can be to generate only interface test cases based on the interface to be tested; or it can be to generate interface test cases based on the interface to be tested, and perform interface testing through the interface test cases to generate a test report for the interface to be tested. According to the interface test requirements, the interface to be tested and the preset plug-in that need to be used can be determined. The interface to be tested can be one or more. The preset plug-in is a pre-designed plug-in and is used to change the interface data to obtain an interface test case. This embodiment generates an interface test case through an interface to be tested, and describes in detail the method for generating an interface test case.
[0050] In this embodiment, the obtaining of the interface to be tested and determining at least one preset plug-in corresponding to the interface to be tested according to the interface to be tested are specifically:
[0051] S101, obtaining an interface to be tested, and determining a test point corresponding to the interface to be tested;
[0052] S102: Determine a preset plug-in corresponding to the interface to be tested according to the test point.
[0053] Specifically, the test point refers to the need to verify through interface testing whether the interface to be tested can realize the interface function. A test point is used to verify an interface function of the interface to be tested. The test point is determined by the interface test requirements provided by the entry script. The interface test requirements include the interface to be tested and the test points corresponding to the interface to be tested. Each interface to be tested can have one test point or multiple test points. The test point and the preset plug-in are in a one-to-one correspondence, so that the preset plug-in corresponding to the interface to be tested can be determined according to the test point corresponding to the interface to be tested in the interface test requirements.
[0054] In one implementation of the present embodiment, before obtaining the interface to be tested, an interface library composed of different interfaces can be obtained by entering interface data of different interfaces, and different plug-ins are designed according to different test points. When designing the preset plug-in, different preset plug-ins are obtained by entering the interface range, change function, etc. applicable to the preset plug-in, thereby obtaining a plug-in library composed of different plug-ins.
[0055] In a specific implementation of this embodiment, the preset plug-in is a fuzzing plug-in, and different fuzzing plug-ins can be designed according to different test points, and the interface data of the interface to be tested is fuzzed, so as to automatically generate interface test cases corresponding to different test points. After the interface to be tested and the test points corresponding to the interface to be tested are determined according to the interface test requirements, the interface to be tested is called through the interface library, and then the fuzzing plug-in to be called is determined in the plug-in library according to the test points of the interface to be tested, and the interface data of the interface to be tested is fuzzed through the fuzzing plug-in, so as to obtain different interface test cases.
[0056] In a specific implementation of this embodiment, Figure 2 As shown, for the entry of the interface in the interface library, the user can obtain the interface data of the interface to be tested according to the interface document, and the interface data includes the original test field name and re-match field of the interface, and create a new interface script according to the entry format of the interface library to complete the entry of the interface. For example, the interface script can be:
[0057]
[0058]
[0059] According to the above script format, the interface data of the interface to be tested in the interface document can be entered into the interface script. The interface script can be imported into the interface library by copying it to the file directory of the interface library to obtain an interface named login_api_info.py, and then different interfaces can be entered to generate an interface library.
[0060] Further, the design of the preset plug-in is completed according to the test point and the preset plug-in is entered. For example, if the test point is to verify whether the interface to be tested responds normally to field names of different cases, the original test field name in the interface to be tested is "content-type". The preset plug-in is used to change the case of the original test field name to obtain interface test cases such as Content-type, cOntent-type and "coNTtent-Type", and then the interface test is performed to determine whether the interface to be tested can respond normally to Content-type, cOntent-type, and coNTtent-Type, thereby realizing the interface function verification through the interface test case generated by the preset plug-in.
[0061] For the design of fuzzing plug-ins, the script of fuzzing plug-ins can be added according to the format of plug-in library. By entering the interface range applicable to the preset plug-in, it can be determined which interfaces the preset plug-in can generate test cases for. By entering the change function of the preset plug-in for different test points, the original test field name of the interface to be tested can be changed differently to obtain interface test cases generated for different test points, thereby realizing the automatic generation of interface test cases for different interfaces for different test points, and each interface only needs to be maintained once when entering the interface data, and each test point only needs to be maintained once when entering the preset plug-in, thereby improving the generation efficiency of interface test cases. For example, the script of the fuzzing plug-in can be:
[0062]
[0063] According to the script of the above fuzzing plug-in, a fuzzing plug-in can be obtained: field_name_upper_lower_fuzzing.py. Through the fields such as fuzzing_type in the fuzzing plug-in script, the interface type applicable to the fuzzing plug-in can be determined. Through the fuzzing function field in the fuzzing plug-in script, the fuzzing change of the interface applicable to the fuzzing plug-in can be realized to obtain the interface test case in which the original test field name changes in uppercase and lowercase.
[0064] In an implementation of this embodiment, if the test point is a plurality of test points, determining the preset plug-in corresponding to the interface to be tested according to the test point specifically includes:
[0065] S1021. For each test point among the plurality of test points, determine a preset plug-in corresponding to the interface to be tested according to the test point, wherein the preset plug-ins corresponding to the respective test points among the plurality of test points are different from each other.
[0066] Specifically, when multiple test points are determined according to the interface test requirements, the test points and the preset plug-ins are in a one-to-one correspondence, and the preset plug-ins corresponding to each test point are different, then multiple preset plug-ins corresponding to the multiple test points can be determined according to the multiple test points. In an implementation of this embodiment, according to the interface test requirements, it can be determined that the preset plug-ins corresponding to the interface to be tested are all plug-ins in the plug-in library.
[0067] S200: Acquire interface data of the interface to be tested, and control the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data.
[0068] Specifically, the interface data of the interface to be tested includes the URL (Uniform Resource Identifier) of the interface and a test field, and the test field includes the field name, field type and the value range of the field. Optionally, the interface data may also include a re-match field, and the re-match field includes the expected value corresponding to the interface to be tested, which is used to overwrite the default expected value set by the preset plug-in. The test field can be changed differently by the preset plug-in to obtain different interface test cases. Accordingly, the interface data of the interface to be tested is obtained, and the preset plug-in is controlled to generate the interface test case corresponding to the interface to be tested based on the interface data as follows:
[0069] S201, obtaining interface data of an interface to be tested, and determining a test field corresponding to the interface to be tested according to the interface data;
[0070] S202: Control the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the test field.
[0071] Specifically, the test field refers to a field of the interface to be tested used to generate different interface test cases. After acquiring the interface data, the interface data is imported into the fuzzing plug-in, and fuzzing changes are performed on the test field to generate an interface test case corresponding to the test field.
[0072] For example, for the interface named login_api_info.py, it includes an original test field named "content-type". When the preset plug-in is taken out from the fuzzing plug-in library according to the test point: field_name_upper_lower_fuzzing.py, according to the description of the plug-in, it can be judged that the plug-in is applicable to the interface, and then the interface data of the interface to be tested is imported into the plug-in. For the original test field name "content-type", the fuzzing plug-in can generate multiple field names with different uppercase and lowercase letters: Content-Type, cOntent-type, coNTtent-Type, and each newly generated field name is a new interface test case. Accordingly, the control of the preset plug-in to generate the interface test case corresponding to the interface to be tested based on the test field specifically includes:
[0073] S2021. Obtain a change function of the preset plug-in;
[0074] S2022, changing the test field through the change function to generate an interface test case corresponding to the interface to be tested. Specifically, when the preset plug-in is a fuzzing plug-in, the test field in the interface data is fuzzed according to the fuzzing function field of the fuzzing plug-in to obtain different interface test cases.
[0075] It is worth noting that when calling a preset plug-in, since different plug-ins may use different interface ranges, it is also necessary to determine whether the interface to be tested matches the preset plug-in when calling the preset plug-in. Accordingly, the first test field is processed in turn by the at least one preset plug-in to generate an interface test case corresponding to the interface to be tested as follows:
[0076] M10. Determine the test interface set corresponding to the preset plug-in;
[0077] M20. If the interface to be tested is included in the test interface set, executing the step of controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data;
[0078] M30. If the interface to be tested is not included in the test interface set, abandon the preset plug-in.
[0079] Specifically, when the plug-in is entered, the test interface set applicable to the plug-in is determined through the fuzzing_type field, that is, the interface range applicable to the plug-in. The test interface set may include only one interface or multiple interfaces. If the interface to be tested is included in the test interface set, it means that the preset plug-in and the interface to be tested match, so that the interface data is imported into the preset plug-in to generate an interface test case. If the interface to be tested is not included in the test interface set, it means that the preset plug-in and the test requirements do not match, and the preset plug-in is discarded.
[0080] In an implementation of this embodiment, when the test point is a plurality of test points, the obtaining of interface data of the interface to be tested and the controlling of the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data specifically include:
[0081] N10. Obtain interface data of the interface to be tested;
[0082] N20. For each preset plug-in corresponding to a test point, control the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data.
[0083] In one implementation of this embodiment, when multiple test points are determined according to the interface test requirements and multiple preset plug-ins in the plug-in library need to be used, the preset plug-in to be called can be selected according to each test point by manual selection, and the selected preset plug-ins can be called in sequence in the selected order. After each call of the plug-in, the plug-in is directly used to generate an interface test case based on the test field.
[0084] In one implementation of this embodiment, when the interface test requires calling all plug-ins in the plug-in library, then after completing the call of the previous plug-in and generating the interface test case, it is determined whether there are any uncalled plug-ins in the plug-in library. If there are any uncalled plug-ins, then the uncalled plug-ins continue to be called until the calls to all plug-ins in the plug-in library are completed.
[0085] Based on the above interface test case generation method, this embodiment also provides an interface testing method, such as Figure 3 As shown, for executing the above interface test case, the method includes:
[0086] S300, obtaining all interface test cases of the interface to be tested, performing interface testing according to all the interface test cases, and receiving a return value of each interface test case;
[0087] S400, obtaining the expected value of the interface to be tested, and determining the test result of each interface test case according to the expected value and the return value of each interface test case;
[0088] S500: Generate an interface test report for the interface to be tested according to the test results of all interface test cases.
[0089] Specifically, the interface test requirements are determined through the entry script. The interface test requirements can be to fuzz a certain plug-in for a specified interface and perform interface testing, or to fuzz all interfaces with all plug-ins and perform interface testing. The re-match field refers to the expected value pre-set in the interface data, and the return value refers to the feedback result sent by the cloud according to the interface response result corresponding to the interface test case.
[0090] When the interface test requires fuzzing all interfaces with all plugins and performing interface tests, the system entry script can be:
[0091] python fuzzing_test.py --fuzzing_all_plugin --fuzzing_all_api.
[0092] Furthermore, the interface to be tested is taken out from the specific file directory where the interface data is stored, and then the fuzzing plug-in corresponding to the interface to be tested is taken out from the fuzzing plug-in library, so as to import the interface data of the interface to be tested into the fuzzing plug-in to generate an interface test case, and then the interface test is directly executed, and the return value of the interface test case returned by the cloud is obtained; the result of the interface test can be judged by the default expected value set by the fuzzing plug-in, thereby obtaining the test results of different interface test cases.
[0093] In an implementation of this embodiment, when the interface data includes a re-match field, the re-match field may overwrite the default expected value set by the fuzzing plug-in, so that the expected value of the interface to be tested is determined according to the re-match field.
[0094] Correspondingly, the obtaining of the expected value of the interface to be tested and determining the test result of the interface test case according to the expected value and the return value of the interface test case specifically includes:
[0095] S401, obtaining the expected value of the interface to be tested, and determining whether the expected value is the same as the return value of each interface test case;
[0096] S402: If the expected value is the same as the return value of the interface test case, the first mark is used as the test result of the interface test case;
[0097] S403: If the expected value is the same as the return value of the interface test case, the second mark is used as the test result of the interface test case.
[0098] Specifically, according to the interface test cases generated by the above-mentioned fuzzing plug-in, the interface tests are initiated one by one, and the return value of each interface test case is checked, and whether the interface test case passes is determined according to the return value. For example, for the above-mentioned interface test case: Content-Type, after the interface test is completed, the return value corresponding to the test case is received, and the expected value of the interface test is determined according to the re_match field of the interface, and whether the return value and the expected value are the same or match is determined according to the expected value. If they match, the interface test case is marked as passed. After the interface test case is generated, the interface test is performed on the interface test case, and the return value of the interface test case is compared with the expected value of the interface to be tested. If the return value is the same as the expected value, the first mark "True" is used as the test result of the interface test case, otherwise the second mark "False" is used as the test result of the interface test case, and the marking result of the interface test case is saved.
[0099] After completing the interface test of all interface test cases of an interface, continue to take out the next interface from the interface library, select the fuzzing plug-in whose interface requirements match the next interface from the target plug-in, and generate the interface test case of the next interface for interface testing. The specific execution process is shown in the figure Figure 4 After completing the interface test of all interfaces, the marks of all interface test cases are summarized, and the test report corresponding to each interface is generated according to the marks by recording the interface test environment and other information. In actual application, a report file in a specific format, such as an HTML report, can be generated according to the marking results and placed in a specified directory to read the report from the specified directory. The specific execution flow chart is as follows Figure 5 shown.
[0100] Through the above-mentioned interface test case generation method, the present invention only needs to maintain the interface once and the fuzzing plug-in once, automatically generates interface test cases for different interfaces, and can use the interface test cases to perform interface testing, thereby greatly improving the interface test coverage and test efficiency.
[0101] The present invention also provides a terminal device, such as Figure 6 As shown, it includes at least one processor (processor) 20; display screen 21; and memory (memory) 22, and may also include a communications interface (Communications Interface) 23 and a bus 24. Among them, the processor 20, the display screen 21, the memory 22 and the communication interface 23 can communicate with each other through the bus 24. The display screen 21 is configured to display a preset user guide interface in the initial setting mode. The communication interface 23 can transmit information. The processor 20 can call the logic instructions in the memory 22 to execute the method in the above embodiment.
[0102] In addition, the logic instructions in the memory 22 can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.
[0103] The memory 22 is a computer-readable storage medium that can be configured to store software programs, computer executable programs, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions or modules stored in the memory 22, that is, implementing the methods in the above embodiments.
[0104] The memory 22 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 22 may include a high-speed random access memory and may also include a non-volatile memory. For example, a variety of media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, may also be a transient storage medium.
[0105] In addition, the specific process of loading and executing the plurality of instructions in the storage medium and the processor in the mobile terminal has been described in detail in the method above, and will not be described one by one here.
[0106] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for generating interface test cases, It is characterized in that The method comprises: Obtain the interface to be tested, and determine the preset plug-in corresponding to the interface to be tested; Acquire interface data of the interface to be tested, and control the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data; Before obtaining the interface to be tested, the method further includes: By entering the interface data of different interfaces, an interface library composed of different interfaces is obtained; According to different test points, preset plug-ins with different applicable interface ranges and change functions are designed, and a plug-in library composed of different plug-ins is obtained by entering the different preset plug-ins; The interface range to which the preset plug-in applies, used to determine the test cases for which interfaces the preset plug-in can generate; The obtaining of the interface to be tested and determining the preset plug-in corresponding to the interface to be tested specifically includes: Obtaining an interface to be tested, and determining a test point corresponding to the interface to be tested; Determine a preset plug-in corresponding to the interface to be tested according to the test point; The step of determining the preset plug-in corresponding to the interface to be tested according to the test point includes: According to the test point of the interface to be tested, the preset plug-in to be called is determined in the plug-in library.
2. According to the interface test case generation method of claim 1, It is characterized in that The step of obtaining interface data of the interface to be tested and controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data specifically includes: Acquire interface data of the interface to be tested, and determine a test field corresponding to the interface to be tested according to the interface data; The preset plug-in is controlled to generate an interface test case corresponding to the interface to be tested based on the test field.
3. According to the interface test case generation method of claim 2, It is characterized in that The controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the test field specifically includes: Obtaining a change function of the preset plug-in; The test field is changed through the change function to generate an interface test case corresponding to the interface to be tested.
4. The method for generating interface test cases according to any one of claims 1 to 3, It is characterized in that Before controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data, the method further includes: Determine a test interface set corresponding to the preset plug-in; If the interface to be tested is included in the test interface set, executing the step of controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data; If the interface to be tested is not included in the test interface set, the preset plug-in is abandoned.
5. According to the interface test case generation method of claim 1, It is characterized in that The test points are several test points, and determining the preset plug-in corresponding to the interface to be tested according to the test points specifically includes: For each of the plurality of test points, a preset plug-in corresponding to the interface to be tested is determined according to the test point, wherein the preset plug-ins corresponding to the respective test points in the plurality of test points are different from each other.
6. According to the interface test case generation method of claim 5, It is characterized in that The step of obtaining interface data of the interface to be tested and controlling the preset plug-in to generate an interface test case corresponding to the interface to be tested based on the interface data specifically includes: Get the interface data of the interface to be tested; For a preset plug-in corresponding to each test point, the preset plug-in is controlled to generate an interface test case corresponding to the interface to be tested based on the interface data.
7. An interface testing method, It is characterized in that Used to execute the interface test case as claimed in any one of claims 1 to 6, the method comprising: Obtain all interface test cases of the interface to be tested, perform interface testing according to all the interface test cases, and receive the return value of each interface test case; Obtaining the expected value of the interface to be tested, and determining the test result of each interface test case according to the expected value and the return value of each interface test case; Generate an interface test report for the interface to be tested based on the test results of all interface test cases.
8. A computer-readable storage medium, in, The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the interface test case generation method as described in any one of claims 1 to 6, and / or the steps in the interface testing method as described in claim 7.
9. A terminal device, in, include: Processor, memory and communication bus; The memory stores a computer-readable program executable by the processor; The communication bus realizes the connection and communication between the processor and the memory; When the terminal device executes the computer-readable program, the interface test case generation method according to any one of claims 1 to 6 and / or the steps in the interface testing method according to claim 7 are implemented.
Citation Information
Patent Citations
Interface test method and apparatus and computer device
CN109189666A