CN114116519A - Interface test method and device, electronic equipment and storage medium - Google Patents

Interface test method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114116519A
CN114116519A CN202111488040.1A CN202111488040A CN114116519A CN 114116519 A CN114116519 A CN 114116519A CN 202111488040 A CN202111488040 A CN 202111488040A CN 114116519 A CN114116519 A CN 114116519A
Authority
CN
China
Prior art keywords
test
interface
tested
parameter
request parameter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111488040.1A
Other languages
Chinese (zh)
Inventor
翟宏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
ICBC Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC, ICBC Technology Co Ltd filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202111488040.1A priority Critical patent/CN114116519A/en
Publication of CN114116519A publication Critical patent/CN114116519A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The present disclosure provides an interface testing method, which can be applied to the technical field of computers, the financial field or other fields. The method comprises the following steps: acquiring an interface design table of an interface to be tested, wherein at least one request parameter is configured in the interface design table; analyzing the interface design table to obtain the field type and the field length of each request parameter; for each request parameter, selecting a parameter expansion method corresponding to the field type of the request parameter, and expanding the request parameter based on the field length of the request parameter to obtain a plurality of parameters to be tested; combining the parameters to be tested of at least one request parameter to obtain a plurality of test cases; and testing the interface to be tested by using a plurality of test cases. In addition, the disclosure also provides an interface testing device, an electronic device and a readable storage medium.

Description

Interface test method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technology and the field of finance, and more particularly, to an interface testing method, an interface testing apparatus, an electronic device, a readable storage medium, and a computer program product.
Background
The interface test is a test for testing interfaces between components of the system, and is mainly used for testing interfaces between the system and other external systems and interfaces between modules in the system. The admission test is a pre-test action performed before the test is carried out to ensure the quality of the tested object before the formal test, and the admission test can enter the formal test link after the pre-test reaches a certain quality standard.
In implementing the disclosed concept, the inventors found that there are at least the following problems in the related art: the existing access test technology has a large number of steps which can be completed manually, but a large number of manual operations inevitably affect project efficiency and prolong project period, and a manual link can bring unnecessary errors caused by human negligence; in addition, the existing access testing technology also has the problems of various flow steps, low efficiency and the like.
Disclosure of Invention
In view of the above, the present disclosure provides an interface testing method, an interface testing apparatus, an electronic device, a readable storage medium, and a computer program product.
One aspect of the present disclosure provides an interface testing method, including:
acquiring an interface design table of an interface to be tested, wherein at least one request parameter is configured in the interface design table;
analyzing an interface design table to obtain the field type and the field length of each request parameter;
for each request parameter, selecting a parameter expansion method corresponding to the field type of the request parameter, and expanding the request parameter based on the field length of the request parameter to obtain a plurality of parameters to be tested;
combining the parameters to be tested of at least one request parameter to obtain a plurality of test cases; and
and testing the interface to be tested by using a plurality of test cases.
According to an embodiment of the present disclosure, the combining the parameters to be tested of the at least one request parameter to obtain a plurality of test cases includes:
respectively selecting one parameter to be tested from the multiple parameters to be tested of each request, and combining to obtain the test case; and
and traversing all the combination modes to obtain a plurality of test cases.
According to the embodiment of the disclosure, the interface design table is also configured with response parameters;
the method further comprises the following steps:
analyzing the interface design table to obtain a return value of the response parameter and a return result corresponding to the return value;
determining a first test result of the plurality of test cases based on the return value and the return result of the response parameter;
determining a second test result of the interface to be tested based on the plurality of first test results; and
and generating a test report based on the second test result.
According to an embodiment of the present disclosure, the determining a first test result of the plurality of test cases based on the return value and the return result of the response parameter includes:
for each test case, obtaining a test output value obtained by testing the interface to be tested by using the test case;
determining a target return value equal to the test output value; and
and determining that the target return result corresponding to the target return value is the first test result of the test case.
According to an embodiment of the present disclosure, the determining a second test result of the interface to be tested based on the plurality of first test results includes:
determining the number of first test results which characterize the passing test in the plurality of first test results to obtain a first number;
determining the number of a plurality of test cases to obtain a second number;
obtaining the test passing rate of the interface to be tested by calculating the ratio of the first quantity to the second quantity; and
and determining the test result of the interface to be tested based on the comparison result of the predicted passing rate and the preset threshold value.
According to an embodiment of the present disclosure, the method further includes:
acquiring an interface design template;
and responding to the input operation of the user, and filling the input information carried in the input operation into the interface design template to obtain an interface design table.
In another aspect of the present disclosure, an interface testing apparatus is provided, including:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring an interface design table of an interface to be tested, and at least one request parameter is configured in the interface design table;
the first analysis module is used for analyzing the interface design table to obtain the field type and the field length of each request parameter;
the first processing module is used for selecting a parameter expansion method corresponding to the field type of the request parameter for each request parameter, and expanding the request parameter based on the field length of the request parameter to obtain a plurality of parameters to be tested;
the second processing module is used for combining the parameters to be tested of the at least one request parameter to obtain a plurality of test cases; and
and the test module is used for testing the interface to be tested by using a plurality of test cases.
Another aspect of the present disclosure provides an electronic device including: one or more processors; memory to store one or more instructions, wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement a method as described above.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing the method as described above when executed.
Another aspect of the disclosure provides a computer program product comprising computer executable instructions for implementing the method as described above when executed.
According to the embodiment of the disclosure, by means of methods such as parameter expansion and parameter combination, a plurality of test cases can be generated based on an interface design table, and the generated test cases are utilized for access test, so that a large number of manual operation links in the flow of the access test are converted into automatic operation and completed in the background, and therefore the technical problems of low test efficiency, long project flow and uncontrollable quality of the access test in the related technology are at least partially overcome, and the technical effects of improving project efficiency, shortening project period and reducing manual operation errors are achieved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
figure 1 schematically illustrates a flow diagram of an admission test according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates an exemplary system architecture to which the interface test method may be applied, according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a flow chart of an interface testing method according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow diagram for obtaining a plurality of test cases according to an embodiment of the disclosure;
FIG. 5 schematically illustrates a flow diagram for generating a test report in response to a configuration parameter according to an embodiment of the present disclosure;
FIG. 6 schematically shows a flow chart for determining a first test result according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates a flow chart for determining a second test result for an interface to be tested according to an embodiment of the present disclosure;
FIG. 8 schematically illustrates a flow chart of test result collection according to an embodiment of the present disclosure;
FIG. 9 schematically shows a flow chart for obtaining an interface design table according to an embodiment of the disclosure;
FIG. 10 schematically illustrates a block diagram of an interface test apparatus according to an embodiment of the present disclosure;
fig. 11 schematically shows a block diagram of an electronic device adapted to implement the interface test method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
The admission test technology in the related technology is mainly manual, a developer needs to carry out formal test lifting action before formal test, the tester prepares an admission test case set for the developer according to the test lifting content, the developer carries out self test according to the content of the admission test case set, and after the self test reaches a certain test standard (formulated according to the standards of various companies, for example, the passing rate of the admission test case reaches more than 95%, defects cannot leave serious level, and the like), the tester can formally enter a test link. Therefore, the access testing technology in the related technology has the technical problems of low automation degree, low development efficiency, complex operation and the like.
In view of the above, embodiments of the present disclosure provide an interface testing method, an interface testing apparatus, an electronic device, a readable storage medium, and a computer program product. The method comprises the steps of converting a large number of manual operation links in the process into automatic operation and completing the automatic operation through a background, so that a whole set of platform for completing the access test without human intervention and sense in the whole process is formed.
It should be noted that the interface testing method and the interface testing apparatus determined by the embodiments of the present disclosure may be used in any fields other than the computer field and the financial field. In the technical scheme of the disclosure, the acquisition, storage, application and the like of the personal information of the related user all accord with the regulations of related laws and regulations, necessary security measures are taken, and the customs of the public order is not violated.
Fig. 1 schematically shows a flow chart of a non-inductive admission test according to an embodiment of the present disclosure.
As shown in fig. 1, the non-inductive admission test according to the embodiment of the present disclosure is based on an interface test, and forms a system automation process from interface design to test case automation generation, automatic execution, result collection and determination, and sending of a test report. In the development and design stage, a developer carries out interface design to form an interface design document and sends the interface design document to a tester; a tester utilizes a non-inductive access test platform based on interface test to automatically generate a test case and a test assembly line; in addition, the developer submits the development code to an admission test stage to generate a test version number; the tester utilizes the platform to automatically trigger a test assembly line in the admission test stage, collects test results, judges the results of the admission test stage and generates a test report; if the test report passes, entering a test stage to carry out formal test, and if the result does not pass, returning to a development design stage to inform a developer to carry out code correction.
Fig. 2 schematically illustrates an exemplary system architecture 200 to which the interface test method may be applied, according to an embodiment of the disclosure. It should be noted that fig. 2 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 2, the system architecture 200 according to this embodiment may include terminal devices 201, 202, 203, a network 204 and a server 205.
The network 204 serves as a medium for providing communication links between the terminal devices 201, 202, 203 and the server 205. Network 204 may include various connection types, such as wired and/or wireless communication links, and so forth. The network 204 is also configured with data interfaces of the terminal devices 201, 202, 203 and the server 205, and users can use the terminal devices 201, 202, 203 to interact with the server 205 through the corresponding data interfaces in the network 204 to receive or send messages and the like. The terminal devices 201, 202, 203 may be various electronic devices to be accessed to the server 205 including, but not limited to, smart phones, tablets, laptop portable computers, desktop computers, and the like. The server 205 may be a server providing various services, for example, a background management server providing support for a user to perform interface test on the terminal devices 201, 202, and 203, and the background management server may perform test and analysis on the received test cases and feed back the test results to the user through a visual interface.
It should be noted that the interface testing method provided by the embodiment of the present disclosure may be generally executed by the server 205. Accordingly, the interface testing apparatus provided by the embodiments of the present disclosure may be generally disposed in the server 205. The interface testing method provided by the embodiment of the present disclosure may also be performed by a server or a server cluster different from the server 205 and capable of communicating with the terminal devices 201, 202, 203 and/or the server 205. Accordingly, the interface testing apparatus provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 205 and capable of communicating with the terminal devices 201, 202, 203 and/or the server 205. Alternatively, the interface testing method provided by the embodiment of the present disclosure may also be executed by the terminal device 201, 202, or 203, or may also be executed by another terminal device different from the terminal device 201, 202, or 203. Accordingly, the interface testing apparatus provided by the embodiment of the present disclosure may also be disposed in the terminal device 201, 202, or 203, or disposed in another terminal device different from the terminal device 201, 202, or 203.
For example, the interface design table may be originally stored in any one of the terminal devices 201, 202, or 203 (e.g., the terminal device 201, but not limited thereto), or stored on an external storage device and may be imported into the terminal device 201. Then, the terminal device 201 may locally execute the interface testing method provided by the embodiment of the present disclosure, or send the interface design table to another terminal device, a server, or a server cluster, and execute the interface testing method provided by the embodiment of the present disclosure by another terminal device, a server, or a server cluster that receives the interface design table.
It should be understood that the number of terminal devices, networks, and servers in fig. 2 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 3 schematically shows a flow chart of an interface testing method according to an embodiment of the present disclosure.
As shown in fig. 3, the method includes operations S301 to S305.
In operation S301, an interface design table of an interface to be tested is obtained, where at least one request parameter is configured in the interface design table.
Downloading an interface design table through a related platform, managing related interfaces to be tested through the table based on the design table, wherein parameters of an interface path, an environment IP, request data and response data are key information and need to be indispensable items, and then automatically generating test cases according to the parameters, wherein the related interface design table can be shown as table 1:
table 1: interface design table
Figure BDA0003397355290000081
In operation S302, the interface design table is parsed to obtain a field type and a field length of each request parameter.
According to the interface design table, reading parameters in the table, such as field type, field length, response information, etc., and analyzing the read parameters, for example, analyzing field type and field content, where the analyzed parameters are shown in table 2:
table 2: analytic table after parameter
Parameter(s) Type of field Length of field Response message
type int 4 success
coment string 5 success
In operation S303, for each request parameter, a parameter expansion method corresponding to the field type of the request parameter is selected, and the request parameter is expanded based on the field length of the request parameter, so as to obtain a plurality of parameters to be tested.
Based on int type field, randomly generating value, and performing expansion, wherein the randomly generating value algorithm is determined by formula (1) and formula (2):
ri=mod(a*ri-1+b,base) (1)
p=+/-(ri|base) (2)
wherein a is a number which is generated again each time and is not repeated, so that a random number in the range of [0, 10] is introduced; b, in order to guarantee the accuracy of the algorithm result, selecting a base number, and if the generated result is not as expected, replacing the base number for trying, such as a value 219; r is an initial factor which can be manually selected or randomly generated, ri is a factor generated at this time, and ri-1 is a factor generated at the last time; base, randomly generating the range of the number, and generating data according to the range, wherein the value is generally the maximum value of a reasonable range; p, the random number generated each time, in order to guarantee that the parameter may have a negative number condition, the value of the positive and negative range is taken.
In operation S304, parameters to be tested of the at least one request parameter are combined to obtain a plurality of test cases.
And carrying out different full permutation and combination on the randomly generated numerical values. And accessing the test frame to generate a use case, wherein the test frame can generate a test use case set by using an open-source test frame such as a robot frame.
In operation S305, the interface to be tested is tested using a plurality of test cases.
According to the embodiment of the disclosure, by means of methods such as parameter expansion and parameter combination, a plurality of test cases can be generated based on an interface design table, and the generated test cases are utilized for access test, so that a large number of manual operation links in the flow of the access test are converted into automatic operation and completed in the background, and therefore the technical problems of low test efficiency, long project flow and uncontrollable quality of the access test in the related technology are at least partially overcome, and the technical effects of improving project efficiency, shortening project period and reducing manual operation errors are achieved.
FIG. 4 schematically shows a flowchart for obtaining a plurality of test cases according to an embodiment of the present disclosure.
As shown in fig. 4, operations S401 to S402 are included.
In operation S401, a to-be-tested parameter is selected from the to-be-tested parameters of each request, and the parameters are combined to obtain a test case.
In operation S402, all combination modes are traversed to obtain a plurality of test cases.
The parameter expansion is performed according to different field types, the int type is expanded by an equivalence class division method and a boundary value division method, and the string type is expanded by a random method (for example, a reference character string random generation algorithm), for example, type: 0000, 9999, 5000, 2500, 7500, less than minimum, greater than maximum; chinese characters, letters, special characters, null (content: aaaa, basdf, qaaaa). Fuzzy test matching (use case Fuzzing) is performed on the use cases, for example, a character type parameter and an int type parameter can be combined with each other, an int type parameter and a text type parameter can be combined with each other, or multiple types such as int, string and text can be combined with each other.
The multiple test cases obtained by the method can enrich the test dimensionality and improve the test quality and accuracy; meanwhile, a large amount of labor can be saved and the testing efficiency can be improved through the process of automatically acquiring the plurality of test cases.
According to the embodiment of the disclosure, the interface design table is further configured with a response parameter.
FIG. 5 schematically illustrates a flow diagram for generating a test report in response to configuration parameters, according to an embodiment of the disclosure.
As shown in fig. 5, operations S501 to S504 are included.
In operation S501, the interface design table is parsed to obtain a return value of the response parameter and a return result corresponding to the return value.
According to the interface design table, the parameter name, the parameter type, the field length, the response data information and the like in the table are read, and the interface design table is analyzed according to the information to obtain a corresponding return result (for example, parameter 1type int 4/parameter 2content string 5).
In operation S502, a first test result of the plurality of test cases is determined based on the return value and the return result of the response parameter.
In operation S503, a second test result of the interface to be tested is determined based on the plurality of first test results.
In operation S504, a test report is generated based on the second test result.
The first test result may be collected by using a function of automatically collecting a result by a robot frame, and a style of the collected result is as follows: pass or first test result N: do not pass.
FIG. 6 schematically shows a flow chart for determining a first test result according to an embodiment of the present disclosure.
As shown in fig. 6, the determining of the first test result of the plurality of test cases based on the return value and the return result of the response parameter includes operations S601 to S603.
In operation S601, for each test case, a test output value obtained by testing the interface to be tested using the test case is obtained.
At operation 602, a target return value equal to the test output value is determined.
In operation 603, it is determined that the target return result corresponding to the target return value is the first test result of the test case.
FIG. 7 schematically shows a flow chart for determining a second test result of an interface to be tested according to an embodiment of the present disclosure.
As shown in fig. 7, the determining the second test result of the interface to be tested based on the plurality of first test results includes operations S701 to S704.
Operation S701 determines a number of first test results characterizing a passing test among the plurality of first test results, to obtain a first number.
Operation S702 determines the number of the plurality of test cases to obtain a second number.
Operation S703 is performed to obtain a test passing rate of the interface to be tested by calculating a ratio of the first number to the second number.
In operation S704, a test result of the interface to be tested is determined based on a comparison result of the predicted passing rate and a preset threshold.
The interface test obtains a result by reading a test result file of the robot frame, and then judges whether the result meets an admission standard; firstly, calculating the number of use cases; secondly, calculating the number of passed use cases; then, calculating the passing rate according to the two quantities; and finally, judging through unified standard judgment to obtain a test result of the interface to be tested.
FIG. 8 schematically shows a flow chart of test result collection according to an embodiment of the disclosure.
The flow of the above-described test results obtained based on the automatically generated test pipeline is further described with reference to fig. 8.
As shown in fig. 8, obtaining the test result based on the automatically generated test pipeline includes several steps of automatically generating the test pipeline, submitting and generating a version number for a code, triggering an admission test, collecting a result, and the like; wherein the assembly line adopts a Jenkins assembly line, and the test frame adopts a Robot Framework; compiling the submitted codes by the Jenkins pipeline, and then obtaining a version number through version release; and the version number is subjected to parameter analysis, parameter expansion and case Fuzzing through a test frame to obtain an automatic test case set, and the automatic case set is input to an access test stage to obtain a test result and collect the test result.
FIG. 9 schematically shows a flow chart for obtaining an interface design table according to an embodiment of the disclosure.
As shown in fig. 9, operations S901 to S902 are included.
In operation S901, an interface design template is acquired.
In operation S902, in response to the input operation of the user, the input information carried in the input operation is filled in the interface design template to obtain the interface design table.
The interface design module can be obtained by the access test platform based on the interface test in fig. 1; based on the interface design module, the relevant interfaces to be tested are managed through documents, wherein parameters such as interface paths, environment IP, request data and response data are key information and need to be indispensable items, and test cases are automatically generated according to the parameters subsequently, so that the automation degree of testing is greatly improved, and meanwhile, a unified interface design template can ensure the standardization of a testing process and is convenient for subsequent relevant personnel to maintain.
It should be noted that, unless explicitly stated that there is an execution sequence between different operations or there is an execution sequence between different operations in technical implementation, the execution sequence between multiple operations may not be sequential, or multiple operations may be executed simultaneously in the flowchart in this disclosure.
FIG. 10 schematically illustrates a block diagram of an interface test apparatus according to an embodiment of the disclosure.
As shown in fig. 10, the interface testing apparatus 1000 includes a first obtaining module 1010, a first parsing module 1020, a first processing module 1030, a second processing module 1040, and a testing module 1050.
The first obtaining module 1010 is configured to obtain an interface design table of an interface to be tested, where the interface design table is configured with at least one request parameter.
The first parsing module 1020 is configured to parse the interface design table to obtain a field type and a field length of each request parameter.
The first processing module 1030 is configured to select, for each request parameter, a parameter expansion method corresponding to a field type of the request parameter, and expand the request parameter based on the field length of the request parameter to obtain a plurality of parameters to be tested.
The second processing module 1040 is configured to combine parameters to be tested of the at least one request parameter to obtain a plurality of test cases.
The testing module 1050 is configured to test the interface to be tested using a plurality of test cases.
According to the embodiment of the disclosure, by means of methods such as parameter expansion and parameter combination, a plurality of test cases can be generated based on an interface design table, and the generated test cases are utilized for access test, so that a large number of manual operation links in the flow of the access test are converted into automatic operation and completed in the background, and therefore the technical problems of low test efficiency, long project flow and uncontrollable quality of the access test in the related technology are at least partially overcome, and the technical effects of improving project efficiency, shortening project period and reducing manual operation errors are achieved.
According to an embodiment of the present disclosure, the second processing module includes a first processing unit and a second processing unit.
And the first processing unit is used for selecting one parameter to be tested from the multiple parameters to be tested of each request respectively and combining the parameters to be tested to obtain a test case.
And the second processing unit is used for traversing all the combination modes to obtain a plurality of test cases.
According to the embodiment of the disclosure, the interface design table is also configured with a response parameter.
According to an embodiment of the present disclosure, the interface testing apparatus 1000 further includes a second parsing module, a first determining module, a second determining module, and a generating module.
And the second analysis module is used for analyzing the interface design table to obtain a return value of the response parameter and a return result corresponding to the return value.
And the first determining module is used for determining a first test result of the plurality of test cases based on the return value and the return result of the response parameter.
And the second determining module is used for determining a second test result of the interface to be tested based on the plurality of first test results.
And the generating module is used for generating a test report based on the second test result.
According to an embodiment of the present disclosure, the first determination module includes a first determination unit, a second determination unit, and a third determination unit.
The first determining unit is used for acquiring a test output value obtained by testing the interface to be tested by using the test case for each test case.
A second determination unit for determining a target return value equal to the test output value.
And the third determining unit is used for determining that the target return result corresponding to the target return value is the first test result of the test case.
According to an embodiment of the present disclosure, the second determination module includes a fourth determination unit, a fifth determination unit, a sixth determination unit, and a seventh determination unit.
And the fourth determining unit is used for determining the number of the first test results which characterize the passing test in the plurality of first test results to obtain the first number.
And the fifth determining unit is used for determining the number of the plurality of test cases to obtain a second number.
And the sixth determining unit is used for obtaining the test passing rate of the interface to be tested by calculating the ratio of the first quantity to the second quantity.
And the seventh determining unit is used for determining the test result of the interface to be tested based on the comparison result of the predicted passing rate and the preset threshold value.
According to an embodiment of the present disclosure, the interface testing apparatus 1000 further includes a second obtaining module and a third processing module.
And the second acquisition module is used for acquiring the interface design template.
And the third processing module is used for responding to the input operation of the user and filling the input information carried in the input operation into the interface design template to obtain the interface design table.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any plurality of the first obtaining module 1010, the first parsing module 1020, the first processing module 1030, the second processing module 1040 and the testing module 1050 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the first obtaining module 1010, the first parsing module 1020, the first processing module 1030, the second processing module 1040 and the testing module 1050 may be at least partially implemented as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementations of software, hardware and firmware, or implemented by a suitable combination of any several of them. Alternatively, at least one of the first obtaining module 1010, the first parsing module 1020, the first processing module 1030, the second processing module 1040 and the testing module 1050 may be at least partially implemented as a computer program module, which when executed, may perform a corresponding function.
It should be noted that the interface testing apparatus portion in the embodiment of the present disclosure corresponds to the interface testing method portion in the embodiment of the present disclosure, and the description of the interface testing apparatus portion specifically refers to the interface testing method portion, which is not described herein again.
The interface testing device provided by the embodiment of the disclosure can reduce excessive investment of testing personnel before formal testing, and after related flow technologies are configured, the noninductive investment is achieved; meanwhile, the interface testing device provided by the embodiment of the disclosure improves project testing quality, and avoids the problem of testing quality caused by manual negligence; in addition, by adopting the interface testing device provided by the embodiment of the disclosure, self-testing behaviors are reduced for developers, so that more energy can be put into code development, and meanwhile, the quality problem caused by unfamiliarity of the developers to testing work is avoided.
Fig. 11 schematically shows a block diagram of an electronic device adapted to implement the interface test method according to an embodiment of the present disclosure. The electronic device shown in fig. 11 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 11, a computer electronic device 1100 according to an embodiment of the present disclosure includes a processor 1101, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. The processor 1101 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 1101 may also include on-board memory for caching purposes. The processor 1101 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flows according to the embodiments of the present disclosure.
In the RAM1103, various programs and data necessary for the operation of the electronic device 1100 are stored. The processor 1101, the ROM 1102, and the RAM1103 are connected to each other by a bus 1104. The processor 1101 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 1102 and/or the RAM 1103. It is noted that the programs may also be stored in one or more memories other than the ROM 1102 and RAM 1103. The processor 1101 may also perform various operations of the method flows according to the embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 1100 may also include input/output (I/O) interface 505, input/output (I/O) interface 505 also being connected to bus 1104, according to an embodiment of the present disclosure. Electronic device 1100 may also include one or more of the following components connected to I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output portion 1107 including a signal output unit such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a network interface card such as a LAN card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the removable medium 1111. The computer program, when executed by the processor 1101, performs the above-described functions defined in the system of the embodiment of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 1102 and/or the RAM1103 and/or one or more memories other than the ROM 1102 and the RAM1103 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method provided by the embodiments of the present disclosure, when the computer program product is run on an electronic device, the program code being adapted to cause the electronic device to carry out the interface testing method provided by the embodiments of the present disclosure.
The computer program, when executed by the processor 1101, performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted in the form of a signal on a network medium, distributed, downloaded and installed via the communication part 1109, and/or installed from the removable medium 1111. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. An interface testing method, comprising:
acquiring an interface design table of an interface to be tested, wherein at least one request parameter is configured in the interface design table;
analyzing the interface design table to obtain the field type and the field length of each request parameter;
for each request parameter, selecting a parameter expansion method corresponding to the field type of the request parameter, and expanding the request parameter based on the field length of the request parameter to obtain a plurality of parameters to be tested;
combining the parameters to be tested of at least one request parameter to obtain a plurality of test cases; and
and testing the interface to be tested by using a plurality of test cases.
2. The method of claim 1, wherein said combining parameters to be tested of at least one of said requested parameters to obtain a plurality of test cases comprises:
respectively selecting one parameter to be tested from the multiple parameters to be tested of each request, and combining to obtain the test case; and
and traversing all the combination modes to obtain the plurality of test cases.
3. The method of claim 1, wherein the interface design table is further configured with a response parameter;
the method further comprises the following steps:
analyzing the interface design table to obtain a return value of the response parameter and a return result corresponding to the return value;
determining a first test result of the plurality of test cases based on the return value and the return result of the response parameter;
determining a second test result of the interface to be tested based on a plurality of the first test results; and
and generating a test report based on the second test result.
4. The method of claim 3, wherein said determining a first test result for a plurality of said test cases based on a returned value and a returned result of said response parameter comprises:
for each test case, obtaining a test output value obtained by testing the interface to be tested by using the test case;
determining a target return value equal to the test output value; and
and determining that the target return result corresponding to the target return value is the first test result of the test case.
5. The method of claim 3, wherein said determining a second test result for the interface under test based on the plurality of first test results comprises:
determining the number of first test results which characterize passing the test in the plurality of first test results to obtain a first number;
determining the number of the plurality of test cases to obtain a second number;
obtaining the test passing rate of the interface to be tested by calculating the ratio of the first quantity to the second quantity; and
and determining the test result of the interface to be tested based on the comparison result of the predicted passing rate and a preset threshold value.
6. The method of claim 1, further comprising:
acquiring an interface design template;
and responding to the input operation of a user, and filling the input information carried in the input operation into the interface design template to obtain the interface design table.
7. An interface test apparatus comprising:
the system comprises a first acquisition module, a second acquisition module and a third acquisition module, wherein the first acquisition module is used for acquiring an interface design table of an interface to be tested, and at least one request parameter is configured in the interface design table;
the first analysis module is used for analyzing the interface design table to obtain the field type and the field length of each request parameter;
the first processing module is used for selecting a parameter expansion method corresponding to the field type of the request parameter for each request parameter, and expanding the request parameter based on the field length of the request parameter to obtain a plurality of parameters to be tested;
the second processing module is used for combining the parameters to be tested of at least one request parameter to obtain a plurality of test cases; and
and the test module is used for testing the interface to be tested by using a plurality of test cases.
8. An electronic device, comprising:
one or more processors;
a memory to store one or more instructions that,
wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 6.
10. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 6 when executed.
CN202111488040.1A 2021-12-07 2021-12-07 Interface test method and device, electronic equipment and storage medium Pending CN114116519A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111488040.1A CN114116519A (en) 2021-12-07 2021-12-07 Interface test method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111488040.1A CN114116519A (en) 2021-12-07 2021-12-07 Interface test method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114116519A true CN114116519A (en) 2022-03-01

Family

ID=80367640

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111488040.1A Pending CN114116519A (en) 2021-12-07 2021-12-07 Interface test method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114116519A (en)

Similar Documents

Publication Publication Date Title
CN109828903B (en) Automatic testing method and device, computer device and storage medium
CN109302522B (en) Test method, test device, computer system, and computer medium
US10120783B2 (en) Determining test case efficiency
US20130117855A1 (en) Apparatus for automatically inspecting security of applications and method thereof
CN110532185B (en) Test method, test device, electronic equipment and computer readable storage medium
CN110196809B (en) Interface testing method and device
CN112799940A (en) Regression testing method, device, computer system and computer readable storage medium
US10558557B2 (en) Computer system testing
CN113535577B (en) Application testing method and device based on knowledge graph, electronic equipment and medium
CN111930629A (en) Page testing method and device, electronic equipment and storage medium
CN115470152A (en) Test code generation method, test code generation device, and storage medium
CN114791885A (en) Interface test method, device, equipment and medium
CN113238940B (en) Interface test result comparison method, device, equipment and storage medium
CN115599683A (en) Automatic testing method, device, equipment and storage medium
CN111679977B (en) Method, equipment and storage medium for testing exact project unit based on Jest
CN114116519A (en) Interface test method and device, electronic equipment and storage medium
CN115080433A (en) Testing method and device based on flow playback
CN113032256A (en) Automatic test method, device, computer system and readable storage medium
CN111858377A (en) Quality evaluation method and device for test script, electronic device and storage medium
CN111026631A (en) Automatic interface detection method and device and server
CN114201410A (en) Method, device, equipment and medium for monitoring executed degree of test case
CN114064484A (en) Interface testing method and device, electronic equipment and readable storage medium
CN114896151A (en) Information processing method and device, electronic equipment and computer readable storage medium
CN114817036A (en) Decision tree testing method and device, electronic equipment and storage medium
CN113377377A (en) Static code analysis method, analysis device, electronic device and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination