CN110569194A - interface testing method and device, electronic equipment and storage medium - Google Patents

interface testing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110569194A
CN110569194A CN201910848428.4A CN201910848428A CN110569194A CN 110569194 A CN110569194 A CN 110569194A CN 201910848428 A CN201910848428 A CN 201910848428A CN 110569194 A CN110569194 A CN 110569194A
Authority
CN
China
Prior art keywords
interface
test
test case
tested
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
CN201910848428.4A
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.)
Wuba Co Ltd
Original Assignee
Wuba 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 Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN201910848428.4A priority Critical patent/CN110569194A/en
Publication of CN110569194A publication Critical patent/CN110569194A/en
Pending legal-status Critical Current

Links

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/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The invention discloses an interface testing method, an interface testing device, electronic equipment and a storage medium, wherein a testing case set corresponding to a service function is obtained; analyzing each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case; then executing each test case on the corresponding interface to be tested to obtain an interface return value corresponding to the test parameter; and finally, determining whether the interface return value corresponding to the test case is correct or not by using the correct return value in the test case. According to the technical scheme, the test cases corresponding to all the interfaces are stored in advance, then a corresponding group of test cases are called according to the service function, the interfaces to be tested are analyzed according to the test cases, and the test cases are executed on the corresponding interfaces to be tested, so that the situation that the test cases need to be compiled for the interfaces in each interface test can be avoided, redundant test cases are reduced, and the storage space is saved.

Description

interface testing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of software development technologies, and in particular, to an interface testing method and apparatus, an electronic device, and a storage medium.
background
the SCF Service is a Service provided under an SCF (Service Communication Framework). When the SCF client needs to acquire the service, the SCF client needs to remotely call an SCF service interface corresponding to the service function according to the service function of its specific requirement. Typically, different SCF services will involve different interfaces, and a plurality of different interfaces will also be involved in one SCF service.
in order to ensure the quality of the SCF service, a tester needs to test an interface related to the SCF service, and further determine the quality of the SCF service according to the result of the interface test, and for SCF services whose quality does not meet the requirements, the tester needs to readjust the SCF service or the interface related thereto. At present, the test mode of the SCF service interface is mainly as follows: firstly, an interface to be called by a SCF service to be tested is obtained, test cases of different calling interfaces are compiled aiming at different interfaces, the test cases are executed to obtain a return value of the calling interface, the return value is a test result of the interface, and finally, the test results of all the calling interfaces are integrated to judge the quality of the SCF service.
However, in the above manner, each time the SCF service interface test is performed, interface test cases need to be written for all involved interfaces, and if a plurality of SCFs are involved in a same interface, a plurality of same test cases may exist for the interface, which further causes a storage space to store a plurality of redundant test cases, thereby wasting storage resources of the storage space.
Disclosure of Invention
The invention provides an interface test method, an interface test device, electronic equipment and a storage medium, which are used for solving the problem that a redundant test case occupies a storage space in the conventional SCF service interface test.
in a first aspect, the present invention provides an interface testing method, including:
Acquiring a test case set corresponding to a service function, wherein the test case set comprises test cases respectively corresponding to interfaces realizing the same service function, and the test cases are used for testing the interfaces;
Analyzing each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case, wherein the test parameter is a parameter value set for the to-be-tested interface in a test stage;
Executing each test case on the corresponding interface to be tested to obtain an interface return value corresponding to the test parameter;
and determining whether the interface return value corresponding to each test case is correct or not by using the correct return value in each test case.
With reference to the first aspect, in an implementation manner of the first aspect, the step of analyzing each test case in the test case set to obtain an interface to be tested and a test parameter corresponding to each test case includes:
acquiring a compressed file packet corresponding to a test case, wherein the compressed file packet comprises an interface calling method and a parameter transmission method of the test case, and the test case comprises interface information and parameter information;
Determining a to-be-tested interface corresponding to the test case by using the interface calling method and the interface information;
and determining test parameters corresponding to the interface to be tested by using the parameter transmission method and the parameter information.
with reference to the first aspect, in an implementation manner of the first aspect, the step of executing each test case on the corresponding interface to be tested to obtain an interface return value corresponding to the test parameter includes:
Setting parameters of an interface to be tested as test parameters;
Sending a service request to an interface to be tested with test parameters, wherein the service request is used for indicating the interface to be tested to acquire data corresponding to the test parameters;
And taking the data as an interface return value.
with reference to the first aspect, in an implementation manner of the first aspect, after determining whether the interface return value corresponding to each test case is correct by using the correct return value in each test case, the method further includes:
acquiring the number of test cases which are successfully operated, wherein the interface return value of the test cases which are successfully operated is the same as the correct return value;
Calculating the successful operation proportion of all test cases in the test case set;
and analyzing the service quality by using the successful operation proportion.
With reference to the first aspect, in an implementation manner of the first aspect, the analyzing the quality of service with the successful operation ratio includes:
Comparing the successful operation proportion with a preset proportion value;
if the successful operation proportion is larger than or equal to the preset proportion value, determining that the service quality reaches an expected result;
And if the successful operation proportion is smaller than the preset proportion value, determining that the service quality does not reach the expected result.
with reference to the first aspect, in an implementation manner of the first aspect, before the obtaining the test case set corresponding to the service function, the method further includes:
compiling corresponding test cases for all interfaces related to all service functions;
And grouping all the test cases according to the service functions realized by the corresponding interfaces to generate different test case sets corresponding to different service functions.
With reference to the first aspect, in an implementation manner of the first aspect, after writing corresponding test cases for all interfaces related to all service functions, the method further includes:
Analyzing an interface calling method and a parameter transmission method required in the test case compiling process;
and storing the interface calling method and the parameter transferring method in a compressed file package corresponding to the test cases, wherein each test case corresponds to one compressed file package.
In a second aspect, the present invention provides an interface testing apparatus, including:
The system comprises a test case acquisition module, a service function acquisition module and a service function analysis module, wherein the test case acquisition module is used for acquiring a test case set corresponding to the service function, the test case set comprises test cases respectively corresponding to interfaces realizing the same service function, and the test cases are used for testing the interfaces;
The analysis module is used for analyzing each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case, wherein the test parameter is a parameter value set for the to-be-tested interface in a test stage;
the test case execution module is used for executing each test case on the corresponding interface to be tested to obtain an interface return value corresponding to the test parameter;
and the return value judging module is used for determining whether the interface return value corresponding to each test case is correct or not by using the correct return value in each test case.
With reference to the second aspect, in an implementation manner of the second aspect, the parsing module includes:
the file package obtaining unit is used for obtaining a compressed file package corresponding to the test case, the compressed file package comprises an interface calling method and a parameter transmission method of the test case, and the test case comprises interface information and parameter information;
the interface determining unit is used for determining an interface to be tested corresponding to the test case by using the interface calling method and the interface information;
and the parameter determining unit is used for determining the test parameters corresponding to the interface to be tested by using the parameter transmitting method and the parameter information.
with reference to the second aspect, in an implementation manner of the second aspect, the test case execution module includes:
The parameter setting unit is used for setting the parameters of the interface to be tested as testing parameters;
the device comprises a request sending unit, a service request sending unit and a test parameter setting unit, wherein the request sending unit is used for sending a service request to an interface to be tested with test parameters, and the service request is used for indicating the interface to be tested to acquire data corresponding to the test parameters; and taking the data as an interface return value.
with reference to the second aspect, in an implementation manner of the second aspect, the method further includes:
the test case quantity obtaining module is used for obtaining the quantity of the test cases which are successfully operated, and the interface return value of the test cases which are successfully operated is the same as the correct return value;
the calculation module is used for calculating the successful operation proportion of all test cases in the test case set;
and the proportion analysis module is used for analyzing the service quality by utilizing the successful operation proportion.
with reference to the second aspect, in an implementation manner of the second aspect, the proportion analysis module includes:
The comparison unit is used for comparing the successful operation proportion with a preset proportion value; if the successful operation proportion is larger than or equal to the preset proportion value, determining that the service quality reaches an expected result; and if the successful operation proportion is smaller than the preset proportion value, determining that the service quality does not reach the expected result.
With reference to the second aspect, in an implementation manner of the second aspect, the method further includes:
the test case compiling module is used for compiling corresponding test cases for all interfaces related to all service functions;
and the test case grouping module is used for grouping all the test cases according to the service functions realized by the corresponding interfaces to generate different test case sets corresponding to different service functions.
with reference to the second aspect, in an implementation manner of the second aspect, the method further includes:
the method analysis module is used for analyzing an interface calling method and a parameter transmission method required in the test case compiling process;
and the method storage module is used for storing the interface calling method and the parameter transferring method in the compressed file package corresponding to the test cases, and each test case corresponds to one compressed file package.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
a memory for storing program instructions;
a processor, configured to call and execute the program instructions in the memory to implement the interface testing method according to the first aspect.
in a fourth aspect, an embodiment of the present invention provides a storage medium, where a computer program is stored, and when at least one processor of an interface testing apparatus executes the computer program, the interface testing apparatus executes the interface testing method according to the first aspect.
According to the technical scheme, the interface testing method, the interface testing device, the electronic equipment and the storage medium are used for testing the interface related to the service. Firstly, acquiring a test case set corresponding to a service function, wherein the test case set comprises test cases respectively corresponding to a plurality of interfaces for realizing the same service function; analyzing each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case; then executing each test case on the corresponding interface to be tested to obtain an interface return value corresponding to the test parameter; and finally, determining whether the interface return value corresponding to the test case is correct or not by using the correct return value in the test case. According to the technical scheme, the test cases corresponding to all the interfaces are stored in advance, then a corresponding group of test cases are called according to the service function, the interfaces to be tested are analyzed according to the test cases, and the test cases are executed on the corresponding interfaces to be tested, so that the situation that the test cases need to be compiled for the interfaces in each interface test can be avoided, redundant test cases are reduced, and the storage space is saved.
Drawings
in order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without any inventive exercise.
fig. 1 is a flowchart of an interface testing method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a test case grouping situation according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a test case parsing process according to an embodiment of the present invention;
FIG. 4 is a block diagram of an interface testing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
At present, for a test mode of an SCF service interface, an interface to be called by an SCF service to be tested is obtained first, test cases of different calling interfaces are compiled for different interfaces, a test case is executed to obtain a return value of the calling interface, the return value is a test result of the interface, and finally, test results of all calling interfaces are integrated to judge the quality of the SCF service. However, in the current manner, each time the SCF service interface test is performed, interface test cases need to be written for all involved interfaces, and if a plurality of SCFs are involved in a same interface, a plurality of same test cases may exist for the interface, which further causes a storage space to store a plurality of redundant test cases, thereby wasting storage resources of the storage space. Therefore, the invention provides an interface test method, each interface can complete the test of a plurality of SCF service interfaces only by compiling the test case once, and the problem that the redundant test case occupies the storage space in the current SCF service interface test is solved.
fig. 1 is a flowchart of an interface testing method according to an embodiment of the present invention. As shown in fig. 1, the interface testing method provided in the embodiment of the present invention includes the following steps:
S101, a test case set corresponding to the service function is obtained, the test case set comprises test cases corresponding to all interfaces for realizing the same service function, and the test cases are used for testing the interfaces.
The SCF service is a service provided under the SCF framework, and can provide different kinds of services according to the needs of users, and the specific related service functions are also diversified. In the embodiment of the invention, corresponding test cases are compiled in advance for each interface, then the test cases are grouped according to different service functions, each test case is compiled once but can exist in a plurality of test case sets, then when the service function interface is tested, the test case sets of all the interfaces corresponding to the service function can be directly obtained, the test case needs to be rewritten once during each interface test, and the test case of one interface is also prevented from being repeatedly compiled.
in the embodiment of the present invention, before obtaining the test case set corresponding to the service function, the method further includes:
S201, writing corresponding test cases for all interfaces related to all service functions.
in the embodiment of the present invention, when writing test cases for all interfaces, all interfaces refer to all interfaces related to all service functions, which are different from each other, and if there are two service functions, the first service function relates to interface a and interface B, and the second service function relates to interface B and interface C, then at this time, all interfaces related to the two service functions are three, interface a, interface B, and interface C, and interface B appears in the two service functions, then writing of a test case for interface B is performed only once.
S202, grouping all the test cases according to the service functions realized by the corresponding interfaces, and generating different test case sets corresponding to different service functions.
fig. 2 is a schematic diagram of a test case grouping situation provided in an embodiment of the present invention. As shown in fig. 2, there are multiple test case sets corresponding to the SCF service, where there are mutually repeated test cases among the test case sets, where there are a test case a, a test case b, and a test case c in the test case set 1, a test case b and a test case c in the test case set 2, and a test case a and a test case d in the test case set 3. The test case sets 1, 2 and 3 respectively correspond to different service functions, all the test cases comprise test cases a, b, c and d, and each test case is written once and then can respectively belong to different test case sets.
in addition, after writing corresponding test cases for all interfaces related to all service functions in the embodiment of the present invention, the method further includes:
s301, an interface calling method and a parameter transferring method required in the process of compiling the test case are analyzed.
In the embodiment of the invention, when the test case is written, the specific interface calling method and the parameter transmission method are required to be used in the code to realize interface calling, and the specific embodying form is interface class and parameter class. Correspondingly, when the test is analyzed, the interface and the parameters also need to be restored in the reverse direction through the interface calling method and the parameter passing method. Therefore, in the process of writing the test case, the interface calling method and the parameter transmission method which are needed in writing are analyzed independently, and the subsequent analysis of the test case is facilitated.
S302, storing the interface calling method and the parameter transferring method in a compressed file package corresponding to the test cases, wherein each test case corresponds to one compressed file package.
when the test case is analyzed, the corresponding compressed file packet is loaded, an interface calling method and a parameter transmission method corresponding to the test case can be obtained, and then the test interface and the test parameters can be analyzed.
Before the interface test in the embodiment of the present invention is performed, all test cases need to be stored and managed, the test cases may be grouped according to service functions, and if the same test case has different versions, the test cases are also stored and grouped together, when the interface test is performed to select a test case set, the interface test apparatus may remind a tester that the test case has multiple versions, and the tester may select a proper version for testing according to a requirement, or the tester may preset which version of the test case is selected by each interface for the interface test, and a specific manner in the embodiment of the present invention is not limited.
s102, analyzing each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case, wherein the test parameter is a parameter value set for the to-be-tested interface in a test stage.
in the embodiment of the invention, in the stage of interface test, a corresponding test case set is selected according to a service function to be tested, and an interface corresponding to the service function does not need to be obtained first; and then, analyzing the test case to obtain the information of the interface to be tested. The technical scheme of the invention is different from the SCF service interface test at present in the greatest extent that the purpose of interface acquisition and interface test can be completed by directly acquiring the test case, so that the compiling of the interface test case only needs to be carried out once, and the redundant condition of the test case can be reduced.
Generally, the interfaces are called in the SCF service for the purpose of obtaining corresponding data from the interfaces. In order to enable the interface to accurately acquire data, parameters are generally set for the interface, in the embodiment of the invention, the test parameters of the test interface are analyzed from the test case, and the test parameters are used for indicating the type of the data acquired by the test interface. For example, what is realized by a certain interface to be tested is to return the corporate information of a certain company, the set test parameter is the name of the company, and then the data returned by the interface should be the corporate information of the company.
in the embodiment of the present invention, the step of analyzing each test case in the test case set to obtain the to-be-tested interface and the test parameters corresponding to each test case includes:
S401, obtaining a compressed file package corresponding to the test case. As in the above steps S301 to S02, the compressed file package corresponding to the test case includes an interface calling method and a parameter transferring method of the test case, where the test case includes interface information and parameter information.
s402, determining the to-be-tested interface corresponding to the test case by using the interface calling method and the interface information.
The interface calling method is that the interface class in the test case compiling code is obtained in the process of analyzing the test case, and the interface to be tested of the test case is required to be generated by reflecting the interface class and the interface information in the test case. The interface information in the embodiment of the invention can only reflect which interface to be tested is, the interface to be tested is only one piece of information, not an entity interface, and cannot directly acquire data through the information of the interface to be tested, and in the testing process, an interface calling method is also needed to carry out related calling on the interface to be tested, so that the interface information is changed into an executable entity of the interface to be tested.
And S403, determining test parameters corresponding to the interface to be tested by using the parameter transmission method and the parameter information.
As described in step S402, the parameter information in the embodiment of the present invention can only reflect what the parameter is, but only one piece of information, and is not an entity of the parameter, and when performing the interface test, the parameter information needs to be reflected by the parameter information to generate a parameter entity, and the parameter entity is transmitted to the interface to be tested.
in addition, in the embodiment of the present invention, after the parameter entity is generated, the parameter entity may be further used to generate an assertion entity, where the assertion entity is equivalent to a determination method, and the method may determine whether an interface return value of the interface to be tested meets an expected requirement, for example, calling the interface a to be tested may achieve obtaining of corporate information of a certain company, the test parameter may be a name of the company, and the assertion entity may determine whether corporate information to be confirmed returned by the interface a to be tested is the same as correct corporate information, and if not, it is determined that the return value of the interface a to be tested does not meet an expected requirement, and if the return value of the interface a to be tested is the same, it is determined that the return value of.
Fig. 3 is a schematic diagram of a test case parsing process according to an embodiment of the present invention. As shown in fig. 3, first, all test cases a, b, and c … … in the test case set are obtained, then, the compressed file package corresponding to each test case is obtained at the same time, the interface information of the test case is read, the interface class in the compressed file package is loaded at the same time, and an interface entity is generated by using the interface class and the interface information; then reading the parameter information, loading the parameter class in the compressed file package, and generating a parameter entity by using the parameter class and the parameter information; finally, generating an assertion entity; and traversing each test case in the same way to obtain an interface entity, a parameter entity and an assertion entity corresponding to each test case. The test case with the interface entity, the parameter entity and the assertion entity is only one test case which can be really executed in the test process.
S103, executing each test case on the corresponding interface to be tested, and obtaining an interface return value corresponding to the test parameter. The interface to be tested is the entity of the interface to be tested, the interface to be tested can know what information should be acquired according to the transmitted parameters, and the information is returned as an interface return value after being acquired. The specific steps may include:
Firstly, setting parameters of an interface to be tested as test parameters. And then sending a service request to the interface to be tested with the test parameters, wherein the service request is used for indicating the interface to be tested to acquire the data corresponding to the test parameters. And finally, taking the data as an interface return value. For example, if the interface a to be tested is used to obtain the personnel information of a certain company department N, the parameters of the interface a to be tested need to be set as the department N, then a service request is sent to the interface a to be tested to instruct the interface a to be tested to start obtaining data, and finally the interface a to be tested returns the obtained personnel name of the department N as an interface return value.
And S104, determining whether the interface return value corresponding to each test case is correct or not by using the correct return value in each test case. In the embodiment of the invention, the correct return value corresponding to the parameter information can be stored in the test case and is used for comparing with the interface return value, and the accuracy of the data acquired by the interface is tested. The content in step S104 may also be executed by using the assertion entity in the above embodiment, and it may also be determined whether the interface return value is correct.
in the embodiment of the present invention, after determining whether the interface return value corresponding to each test case is correct by using the correct return value in each test case, the method further includes:
S601, obtaining the number of the test cases which are successfully operated, wherein the interface return value of the test cases which are successfully operated is the same as the correct return value. The interface return value is the same as the correct return value, which indicates that the test case successfully runs on the interface to be tested, and the interface to be tested can accurately acquire information. Since there are many interfaces involved in a service function, it is not a success of a test case that the service function can be well implemented, and the operation conditions of the test cases on all interfaces need to be analyzed in general.
s602, calculating the successful operation proportion of all test cases in the test case set.
And S603, analyzing the service quality by using the successful operation proportion. Generally, a higher percentage of services are successfully run, and the quality of service is better. Specifically, in the embodiment of the present invention, the step of analyzing the service quality by using the successful operation ratio includes:
and S701, comparing the successful operation proportion with a preset proportion value.
S702, if the successful operation proportion is larger than or equal to the preset proportion value, determining that the service quality reaches an expected result.
and S703, if the successful operation proportion is smaller than the preset proportion value, determining that the service quality does not reach the expected result.
For the service which does not reach the expected result, the reason analysis is also needed, and the specific reasons for not reaching the expected result are as follows: the service function is changed, but the corresponding test case is not changed; or the test case is changed, but the corresponding service function is not changed in time; or, the test case itself lacks operation stability, which causes a problem that data acquisition error is easy to occur during operation. The service which does not reach the expected result is analyzed, so that the test case or the service function is optimized, the interface can accurately acquire data during formal operation, and the service quality is further ensured.
For the test result of each interface to be tested, the test result may also be displayed in the embodiment of the present invention, specifically, may be displayed in a WEB page list form, and may also be sent in an email form.
in addition, in the embodiment of the invention, the whole process of the interface test can be monitored, and when the return value of the interface is wrong, the alarm is sent out in time, so that the condition of the interface test can be mastered in real time.
the interface testing method provided by the embodiment of the invention can test the interfaces related to the service, pre-store the test cases corresponding to all the interfaces, call out a corresponding group of test cases according to the service function, analyze the interfaces to be tested according to the test cases, and execute the test cases on the corresponding interfaces to be tested, so that the problem that the interface test needs to be compiled with the test cases every time can be avoided, redundant test cases are reduced, and the storage space is saved.
Fig. 4 is a block diagram of an interface testing apparatus according to an embodiment of the present invention. As shown in fig. 4, an interface testing apparatus provided in an embodiment of the present invention includes: a test case obtaining module 41, configured to obtain a test case set corresponding to the service function, where the test case set includes test cases respectively corresponding to interfaces that implement the same service function, and the test cases are used to test the interfaces; the analysis module 42 is configured to analyze each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case, where the test parameter is a parameter value set for the to-be-tested interface in the test phase; the test case execution module 43 is configured to execute each test case on the corresponding interface to be tested, and obtain an interface return value corresponding to the test parameter; and the return value judging module 44 is configured to determine whether the interface return value corresponding to each test case is correct by using the correct return value in each test case.
Optionally, the parsing module includes: the file package obtaining unit is used for obtaining a compressed file package corresponding to the test case, the compressed file package comprises an interface calling method and a parameter transmission method of the test case, and the test case comprises interface information and parameter information; the interface determining unit is used for determining an interface to be tested corresponding to the test case by using the interface calling method and the interface information; and the parameter determining unit is used for determining the test parameters corresponding to the interface to be tested by using the parameter transmitting method and the parameter information.
Optionally, the test case execution module includes: the parameter setting unit is used for setting the parameters of the interface to be tested as testing parameters; the device comprises a request sending unit, a service request sending unit and a test parameter setting unit, wherein the request sending unit is used for sending a service request to an interface to be tested with test parameters, and the service request is used for indicating the interface to be tested to acquire data corresponding to the test parameters; and taking the data as an interface return value.
Optionally, the method further includes: the test case quantity obtaining module is used for obtaining the quantity of the test cases which are successfully operated, and the interface return value of the test cases which are successfully operated is the same as the correct return value; the calculation module is used for calculating the successful operation proportion of all test cases in the test case set; and the proportion analysis module is used for analyzing the service quality by utilizing the successful operation proportion.
Optionally, the proportion analysis module includes: the comparison unit is used for comparing the successful operation proportion with a preset proportion value; if the successful operation proportion is larger than or equal to the preset proportion value, determining that the service quality reaches an expected result; and if the successful operation proportion is smaller than the preset proportion value, determining that the service quality does not reach the expected result.
Optionally, the method further includes: the test case compiling module is used for compiling corresponding test cases for all interfaces related to all service functions; and the test case grouping module is used for grouping all the test cases according to the service functions realized by the corresponding interfaces to generate different test case sets corresponding to different service functions.
optionally, the method further includes: the method analysis module is used for analyzing an interface calling method and a parameter transmission method required in the test case compiling process; and the method storage module is used for storing the interface calling method and the parameter transferring method in the compressed file package corresponding to the test cases, and each test case corresponds to one compressed file package.
Fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 5, an electronic device provided in an embodiment of the present invention includes: a memory 51 for storing program instructions; the processor 52 is configured to call and execute the program instructions in the memory to implement the interface testing method according to the above embodiment.
In this embodiment, the processor 52 and the memory 51 may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present invention. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
The embodiment of the present invention further provides a storage medium, where a computer program is stored in the storage medium, and when at least one processor of the interface testing apparatus executes the computer program, the interface testing apparatus executes the interface testing method according to the above embodiment.
according to the technical scheme, the interface testing method, the interface testing device, the electronic equipment and the storage medium are used for testing the interface related to the service. Firstly, acquiring a test case set corresponding to a service function, wherein the test case set comprises test cases respectively corresponding to a plurality of interfaces for realizing the same service function; analyzing each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case; then executing each test case on the corresponding interface to be tested to obtain an interface return value corresponding to the test parameter; and finally, determining whether the interface return value corresponding to the test case is correct or not by using the correct return value in the test case. According to the technical scheme, the test cases corresponding to all the interfaces are stored in advance, then a corresponding group of test cases are called according to the service function, the interfaces to be tested are analyzed according to the test cases, and the test cases are executed on the corresponding interfaces to be tested, so that the situation that the test cases need to be compiled for the interfaces in each interface test can be avoided, redundant test cases are reduced, and the storage space is saved.
the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The same and similar parts in the various embodiments in this specification may be referred to each other. In particular, for the embodiments of the service construction apparatus and the service loading apparatus, since they are substantially similar to the embodiments of the method, the description is simple, and the relevant points can be referred to the description in the embodiments of the method.
The above-described embodiments of the present invention should not be construed as limiting the scope of the present invention.

Claims (16)

1. An interface testing method, comprising:
Acquiring a test case set corresponding to a service function, wherein the test case set comprises test cases respectively corresponding to interfaces realizing the same service function, and the test cases are used for testing the interfaces;
Analyzing each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case, wherein the test parameter is a parameter value set for the to-be-tested interface in a test stage;
Executing each test case on the corresponding interface to be tested to obtain an interface return value corresponding to the test parameter;
and determining whether the interface return value corresponding to each test case is correct or not by using the correct return value in each test case.
2. the method according to claim 1, wherein the step of analyzing each test case in the test case set to obtain the interface to be tested and the test parameters corresponding to each test case comprises:
Acquiring a compressed file packet corresponding to a test case, wherein the compressed file packet comprises an interface calling method and a parameter transmission method of the test case, and the test case comprises interface information and parameter information;
determining a to-be-tested interface corresponding to the test case by using the interface calling method and the interface information;
and determining test parameters corresponding to the interface to be tested by using the parameter transmission method and the parameter information.
3. The method of claim 1, wherein the step of executing each test case on the corresponding interface to be tested to obtain the interface return value corresponding to the test parameter comprises:
Setting parameters of an interface to be tested as test parameters;
Sending a service request to an interface to be tested with test parameters, wherein the service request is used for indicating the interface to be tested to acquire data corresponding to the test parameters;
and taking the data as an interface return value.
4. the method according to any one of claims 1 to 3, wherein after determining whether the interface return value corresponding to each test case is correct by using the correct return value in each test case, the method further comprises:
Acquiring the number of test cases which are successfully operated, wherein the interface return value of the test cases which are successfully operated is the same as the correct return value;
calculating the successful operation proportion of all test cases in the test case set;
And analyzing the service quality by using the successful operation proportion.
5. The method of claim 4, wherein the step of analyzing the quality of service using the successful run rate comprises:
comparing the successful operation proportion with a preset proportion value;
If the successful operation proportion is larger than or equal to the preset proportion value, determining that the service quality reaches an expected result;
and if the successful operation proportion is smaller than the preset proportion value, determining that the service quality does not reach the expected result.
6. The method of claim 1, wherein before obtaining the set of test cases corresponding to the service function, the method further comprises:
compiling corresponding test cases for all interfaces related to all service functions;
And grouping all the test cases according to the service functions realized by the corresponding interfaces to generate different test case sets corresponding to different service functions.
7. the method according to claim 6, wherein after writing the corresponding test cases for all interfaces involved in all service functions, further comprising:
Analyzing an interface calling method and a parameter transmission method required in the test case compiling process;
and storing the interface calling method and the parameter transferring method in a compressed file package corresponding to the test cases, wherein each test case corresponds to one compressed file package.
8. An interface testing apparatus, comprising:
The system comprises a test case acquisition module, a service function acquisition module and a service function analysis module, wherein the test case acquisition module is used for acquiring a test case set corresponding to the service function, the test case set comprises test cases respectively corresponding to interfaces realizing the same service function, and the test cases are used for testing the interfaces;
The analysis module is used for analyzing each test case in the test case set to obtain a to-be-tested interface and a test parameter corresponding to each test case, wherein the test parameter is a parameter value set for the to-be-tested interface in a test stage;
the test case execution module is used for executing each test case on the corresponding interface to be tested to obtain an interface return value corresponding to the test parameter;
And the return value judging module is used for determining whether the interface return value corresponding to each test case is correct or not by using the correct return value in each test case.
9. the apparatus of claim 8, wherein the parsing module comprises:
the file package obtaining unit is used for obtaining a compressed file package corresponding to the test case, the compressed file package comprises an interface calling method and a parameter transmission method of the test case, and the test case comprises interface information and parameter information;
The interface determining unit is used for determining an interface to be tested corresponding to the test case by using the interface calling method and the interface information;
and the parameter determining unit is used for determining the test parameters corresponding to the interface to be tested by using the parameter transmitting method and the parameter information.
10. the apparatus of claim 8, wherein the test case execution module comprises:
the parameter setting unit is used for setting the parameters of the interface to be tested as testing parameters;
The device comprises a request sending unit, a service request sending unit and a test parameter setting unit, wherein the request sending unit is used for sending a service request to an interface to be tested with test parameters, and the service request is used for indicating the interface to be tested to acquire data corresponding to the test parameters; and taking the data as an interface return value.
11. the apparatus of any one of claims 8-10, further comprising:
the test case quantity obtaining module is used for obtaining the quantity of the test cases which are successfully operated, and the interface return value of the test cases which are successfully operated is the same as the correct return value;
The calculation module is used for calculating the successful operation proportion of all test cases in the test case set;
and the proportion analysis module is used for analyzing the service quality by utilizing the successful operation proportion.
12. the apparatus of claim 11, wherein the scale analysis module comprises:
The comparison unit is used for comparing the successful operation proportion with a preset proportion value; if the successful operation proportion is larger than or equal to the preset proportion value, determining that the service quality reaches an expected result; and if the successful operation proportion is smaller than the preset proportion value, determining that the service quality does not reach the expected result.
13. The apparatus of claim 8, further comprising:
The test case compiling module is used for compiling corresponding test cases for all interfaces related to all service functions;
and the test case grouping module is used for grouping all the test cases according to the service functions realized by the corresponding interfaces to generate different test case sets corresponding to different service functions.
14. The apparatus of claim 13, further comprising:
The method analysis module is used for analyzing an interface calling method and a parameter transmission method required in the test case compiling process;
And the method storage module is used for storing the interface calling method and the parameter transferring method in the compressed file package corresponding to the test cases, and each test case corresponds to one compressed file package.
15. An electronic device, comprising:
A memory for storing program instructions;
a processor for calling and executing program instructions in said memory to implement the interface test method of any one of claims 1 to 7.
16. A storage medium having a computer program stored therein, wherein the computer program, when executed by at least one processor of an interface test apparatus, causes the interface test apparatus to perform the interface test method of any one of claims 1-7.
CN201910848428.4A 2019-09-09 2019-09-09 interface testing method and device, electronic equipment and storage medium Pending CN110569194A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910848428.4A CN110569194A (en) 2019-09-09 2019-09-09 interface testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910848428.4A CN110569194A (en) 2019-09-09 2019-09-09 interface testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110569194A true CN110569194A (en) 2019-12-13

Family

ID=68778511

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910848428.4A Pending CN110569194A (en) 2019-09-09 2019-09-09 interface testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110569194A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111008147A (en) * 2019-12-20 2020-04-14 广州品唯软件有限公司 Application program testing method, terminal and computer readable storage medium
CN111625473A (en) * 2020-07-01 2020-09-04 北京字节跳动网络技术有限公司 Interface test case generation method and device, storage medium and electronic equipment
CN112181845A (en) * 2020-10-13 2021-01-05 湖南快乐阳光互动娱乐传媒有限公司 Interface testing method and device
CN112199300A (en) * 2020-11-13 2021-01-08 新华三大数据技术有限公司 Interface testing method and device, electronic equipment and storage medium
CN113515439A (en) * 2020-04-10 2021-10-19 中国电信股份有限公司 Background interface data access security test method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102694701A (en) * 2012-06-13 2012-09-26 青岛海信传媒网络技术有限公司 Testing method and system based on message
US20150007149A1 (en) * 2011-08-08 2015-01-01 Ca, Inc. Automating functionality test cases
CN104850476A (en) * 2015-06-03 2015-08-19 东方网力科技股份有限公司 Cross-platform interface automated testing method and cross-platform interface automated testing system
CN106874188A (en) * 2016-12-30 2017-06-20 北京五八信息技术有限公司 Software interface test approach and device
CN109582579A (en) * 2018-11-30 2019-04-05 腾讯音乐娱乐科技(深圳)有限公司 Applied program testing method, device, electronic equipment and storage medium
JP2019101801A (en) * 2017-12-04 2019-06-24 株式会社日立製作所 Interface aggregation device and interface management method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150007149A1 (en) * 2011-08-08 2015-01-01 Ca, Inc. Automating functionality test cases
CN102694701A (en) * 2012-06-13 2012-09-26 青岛海信传媒网络技术有限公司 Testing method and system based on message
CN104850476A (en) * 2015-06-03 2015-08-19 东方网力科技股份有限公司 Cross-platform interface automated testing method and cross-platform interface automated testing system
CN106874188A (en) * 2016-12-30 2017-06-20 北京五八信息技术有限公司 Software interface test approach and device
JP2019101801A (en) * 2017-12-04 2019-06-24 株式会社日立製作所 Interface aggregation device and interface management method
CN109582579A (en) * 2018-11-30 2019-04-05 腾讯音乐娱乐科技(深圳)有限公司 Applied program testing method, device, electronic equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
WEIXIN_34179968: "接口测试用例设计", 《CSDN HTTPS://BLOG.CSDN.NET/WEIXIN_34179968/ARTICLE/DETAILS/91664706?》 *
何舒: "API接口自动化测试系统设计及实现", 《中国优秀硕士学位论文全文数据库 (信息科技辑)》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111008147A (en) * 2019-12-20 2020-04-14 广州品唯软件有限公司 Application program testing method, terminal and computer readable storage medium
CN111008147B (en) * 2019-12-20 2023-12-26 广州品唯软件有限公司 Application program testing method, terminal and computer readable storage medium
CN113515439A (en) * 2020-04-10 2021-10-19 中国电信股份有限公司 Background interface data access security test method and device
CN113515439B (en) * 2020-04-10 2023-09-29 中国电信股份有限公司 Method and device for testing security of background interface data access
CN111625473A (en) * 2020-07-01 2020-09-04 北京字节跳动网络技术有限公司 Interface test case generation method and device, storage medium and electronic equipment
CN111625473B (en) * 2020-07-01 2023-08-22 北京字节跳动网络技术有限公司 Interface test case generation method and device, storage medium and electronic equipment
CN112181845A (en) * 2020-10-13 2021-01-05 湖南快乐阳光互动娱乐传媒有限公司 Interface testing method and device
CN112199300A (en) * 2020-11-13 2021-01-08 新华三大数据技术有限公司 Interface testing method and device, electronic equipment and storage medium
CN112199300B (en) * 2020-11-13 2022-08-19 新华三大数据技术有限公司 Interface testing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110569194A (en) interface testing method and device, electronic equipment and storage medium
CN111651366B (en) SDK test method, device, equipment and storage medium
CN111124919A (en) User interface testing method, device, equipment and storage medium
CN112199300B (en) Interface testing method and device, electronic equipment and storage medium
CN108089985B (en) Method, device and equipment for verifying interface return parameters and readable storage medium
CN110297767B (en) Automatic execution method, device, equipment and storage medium for test cases
CN109977012B (en) Joint debugging test method, device, equipment and computer readable storage medium of system
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN112988578A (en) Automatic testing method and device
CN111694735A (en) Page performance testing method and device, electronic equipment and storage medium
CN112019404A (en) Method and device for automatically testing FC-AE-1553 communication protocol chip
CN110971478B (en) Pressure measurement method and device for cloud platform service performance and computing equipment
US20210026756A1 (en) Deriving software application dependency trees for white-box testing
CN110888800A (en) Service interaction function test method, device, storage medium and test system
CN115599683A (en) Automatic testing method, device, equipment and storage medium
CN115684882A (en) Test method, system, medium and computing device for system-on-chip
CN112131127B (en) Interface testing method, device and system and electronic equipment
CN110737598A (en) Method and device for testing page content based on page component characteristics
KR100775102B1 (en) Quality test result estimate system of platform based application on embedded device and method thereof
CN117192343B (en) Chip testing method based on auxiliary system, electronic equipment and medium
CN111881021A (en) Interface test method, device and system
CN116991735A (en) Front-end component change testing system, method, device, equipment and storage medium
CN115296766A (en) Clock synchronization method, device, equipment and readable storage medium
CN116107899A (en) MOCK interface management method, device, terminal equipment and storage medium
CN116257431A (en) Device testing method, device, electronic device and 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