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

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

Info

Publication number
CN113704123A
CN113704123A CN202111016967.5A CN202111016967A CN113704123A CN 113704123 A CN113704123 A CN 113704123A CN 202111016967 A CN202111016967 A CN 202111016967A CN 113704123 A CN113704123 A CN 113704123A
Authority
CN
China
Prior art keywords
interface
data
resource data
service
interface resource
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.)
Granted
Application number
CN202111016967.5A
Other languages
Chinese (zh)
Other versions
CN113704123B (en
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.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202111016967.5A priority Critical patent/CN113704123B/en
Publication of CN113704123A publication Critical patent/CN113704123A/en
Application granted granted Critical
Publication of CN113704123B publication Critical patent/CN113704123B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • 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/3692Test management for test results analysis

Abstract

The invention relates to the technical field of interface testing, and discloses an interface testing method, which comprises the following steps: acquiring business process data corresponding to a target interface to be tested; acquiring interface resource data of an interface required to be called in each service step in the service flow; generating an interface process test case based on the interface resource data and the business process data; and executing the interface process test case to complete the test of all the interfaces in the business process corresponding to the target interface. Therefore, the interface test method and the interface test system can test the interface from the aspect of the performance of the interface in the whole business process, so that the accuracy of the interface test result can be improved. The invention also relates to the technical field of block chains.

Description

Interface test method, device, equipment and storage medium
Technical Field
The present invention relates to the field of interface testing technologies, and in particular, to an interface testing method and apparatus, a computer device, and a storage medium.
Background
In a test task of a computer system, it is an important ring to test functions of various interfaces in the computer system. When testing an interface in a computer system, it is usually implemented by generating a test case for a single interface, and the test case of the single interface will call the single interface, so as to test whether the single interface functions normally. However, in the process of actual computer system operation, the completion of a complete computer process usually needs to be completed by the cooperation of multiple interfaces, and each interface often has some data association or function cooperation, so according to the current interface test mode, the normal test of a single interface sometimes does not mean that the computer process in which the interface is located can also run normally. Therefore, the current interface testing method can only test the function of a single interface in a split manner, but cannot test the performance of the interface in a complete computer flow, and the accuracy of the testing result still has a space for further improvement.
Disclosure of Invention
The invention aims to solve the technical problems that the conventional interface testing method can only test the function of a single interface in a split manner, cannot test the performance of the interface in a complete computer flow, and has lower accuracy of a testing result.
In order to solve the above technical problem, a first aspect of the present invention discloses an interface testing method, including:
acquiring business process data corresponding to a target interface to be tested, wherein the business process data records each business step in a complete business process, an execution sequence of each business step in the whole business process and an interface required to be called when each business step is executed;
acquiring interface resource data of an interface required to be called in each service step in the service flow;
generating an interface process test case based on the interface resource data and the service process data, wherein the interface process test case is used for sequentially calling interfaces corresponding to all the service steps according to the execution sequence of all the service steps in the whole service process;
and executing the interface process test case to complete the test of all the interfaces in the business process corresponding to the target interface.
A second aspect of the present invention discloses an interface testing apparatus, including:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring business process data corresponding to a target interface to be tested, and the business process data records each business step in a complete business process, an execution sequence of each business step in the whole business process and an interface required to be called when each business step is executed;
the acquisition module is further configured to acquire interface resource data of an interface that needs to be called in each service step in the service flow;
the generating module is used for generating an interface flow test case based on the interface resource data and the business flow data, wherein the interface flow test case is used for sequentially calling the interfaces corresponding to all the business steps according to the execution sequence of all the business steps in the whole business flow;
and the execution module is used for executing the interface process test case so as to complete the test of all the interfaces in the business process corresponding to the target interface.
A third aspect of the present invention discloses a computer apparatus, comprising:
a memory storing executable program code;
a processor coupled to the memory;
the processor calls the executable program code stored in the memory to execute part or all of the steps in the interface testing method disclosed by the first aspect of the invention.
In a fourth aspect, the present invention discloses a computer storage medium, which stores computer instructions, and when the computer instructions are called, the computer instructions are used to execute part or all of the steps in the interface testing method disclosed in the first aspect of the present invention.
In the embodiment of the invention, the business process data corresponding to the target interface to be tested is acquired, the interface resource data of the interface required to be called in each business step in the business process is acquired, the interface process test case is generated based on the interface resource data and the business process data, and finally the interface process test case is executed to complete the test of all the interfaces in the business process corresponding to the target interface, so that all the interfaces in the business process where the target interface to be tested is located can be tested when the interfaces are tested, the condition that the function of a single interface is tested in a split manner in the existing interface test method is avoided, the interface can be tested from the aspect of the representation of the interface in the whole business process, and the accuracy of the interface test result can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flow chart illustrating an interface testing method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of an interface testing apparatus according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer storage medium according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," and the like in the description and claims of the present invention and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, article, or article that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or article.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The invention discloses an interface test method, a device, computer equipment and a storage medium, which are used for acquiring service process data corresponding to a target interface to be tested, acquiring interface resource data of an interface required to be called in each service step in a service process, generating an interface process test case based on the interface resource data and the service process data, and finally executing the interface process test case to finish the test of all interfaces in the service process corresponding to the target interface, thereby realizing the interface test, all the interfaces in the business process where the target interface to be tested is located are tested, the condition that the function of a single interface is tested in a split manner in the existing interface testing method is avoided, the interface test can be performed from the aspect of the expression of the interface in the whole business process, so that the accuracy of the interface test result can be improved. The following are detailed below.
Example one
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating an interface testing method according to an embodiment of the present invention. As shown in fig. 1, the interface test method may include the following operations:
101. and acquiring business process data corresponding to a target interface to be tested, wherein the business process data records each business step in a complete business process, the execution sequence of each business step in the whole business process and an interface required to be called when each business step is executed.
In the step 101, the service flow data may be preset by a tester according to an actual service flow in the computer system, and a flow table may be set for each service flow, where each service step in the corresponding service flow, an execution sequence of each service step, and an interface that needs to be called by each service step may be recorded in the flow table. By querying the process tables, the data in the process table containing the target interface can be obtained and used as the business process data corresponding to the target interface. Wherein, the flow chart can be shown as the following table:
Figure BDA0003240212560000041
it can be seen that the business process a needs to complete the matching of the account opening interface, the account transferring interface and the account recoiling interface, specifically, the account opening interface is called to open a new account, then the account transferring interface is called to transfer the amount of money from the account transferring interface to the new account, and finally the account recoiling interface is called to recove the transferred amount of money to the account transferring interface. When the target interface to be tested is an account opening interface, the acquired business process data may be the process data of the business process a.
102. And acquiring interface resource data of an interface required to be called in each service step in the service flow.
In the step 102, as shown in the above table, when the target interface to be tested is the billing interface, the business process a further includes a roll-in account interface and a recollecting account interface, so that the roll-in account interface and the recollecting account interface can be determined as the process-related interfaces. At this time, interface resource data corresponding to the account opening interface, the transfer-to account interface and the recoiling account interface can be obtained. The process of testing the interface can be understood as the process of requesting the interface, and the interface is tested by initiating a request to the interface and then judging whether the data returned by the interface meets expectations or not. To initiate a request to an interface, some necessary data is usually needed, such as a request path of the interface, a request parameter of the interface, a request mode of the interface, and the like, and the data may be interface resource data. In the interface resource data, a field may be set for each type of data, and then the type of data is stored in the field. The specific interface resource data acquisition process is described in detail later.
103. And generating an interface process test case based on the interface resource data and the service process data, wherein the interface process test case is used for sequentially calling the interfaces corresponding to the service steps according to the execution sequence of the service steps in the whole service process.
In step 103, after the interface resource data is obtained, an interface flow test case may be generated according to the interface resource data generation and the business flow data. The interface process test case may include an interface case corresponding to each interface in the service process, where the interface case corresponding to each interface is used to call the interface to test whether the function of the interface is normal (one interface case may be understood as a program for calling the interface to perform a test task), and then the interface cases corresponding to each interface are sequentially called according to the sequence in the service process, so as to complete the test of the entire service process. If the interface process test case of the business process a in the table above, the interface use cases corresponding to the account opening interface, the transferred account interface and the account recoiling interface are called in sequence.
104. And executing the interface process test case to complete the test of all the interfaces in the business process corresponding to the target interface.
In step 104, the interface process test case may be understood as a program for calling all interfaces in the business process in sequence to perform the test task. The interface process test case can contain the test target, test environment, input data, expected result, test script and other contents of the interface, so that when the interface process test case is executed, the service process in practical application can be simulated, the interfaces in the service process are called in sequence, and whether the function of the whole service process is normally operated or not is tested.
It can be seen that, by implementing the interface testing method described in fig. 1, the service flow data corresponding to the target interface to be tested is obtained, the interface resource data of the interface required to be called in each service step in the service flow is obtained, an interface flow testing case is generated based on the interface resource data and the service flow data, and finally the interface flow testing case is executed to complete the testing of all the interfaces in the service flow corresponding to the target interface, so that all the interfaces in the service flow where the target interface to be tested is located can be tested when the interfaces are tested, the situation that the functions of a single interface are tested in a split manner in the existing interface testing method is avoided, the interfaces can be tested from the aspect of the representation of the interfaces in the whole service flow, and the accuracy of the interface testing result can be improved.
In an optional embodiment, the interface process test case comprises an interface process test positive case and an interface process test negative case;
generating an interface process test case based on the interface resource data and the business process data comprises:
judging whether the interface resource data meet a preset data rule or not;
when the interface resource data are judged to accord with the data rules, calling a positive case generation method in a preset interface test tool to process the interface resource data and the business process data so as to generate an interface process test positive case;
and when the interface resource data are judged to be not in accordance with the data rules, calling a counter-case generation method in a preset interface test tool to process the interface resource data and the business process data so as to generate an interface process test counter-case. In this alternative embodiment, each data in the interface resource data generally corresponds to a field for indicating the meaning of the field, and then different data rules may be preset for different fields according to the actual application. For example, the interface resource data of the open account interface may be as shown in the following table:
Figure BDA0003240212560000061
Figure BDA0003240212560000071
when the account opening interface is called, an account number and a password of a new account are generally required to be created, so the account number and the password of the new account are generally required to be included in a request parameter field of interface resource data of the account opening interface. However, the computer system usually has a certain requirement on the format of the account number and the password of the new account, for example, the password must have 6 digits or the password must have 8 digits, and at this time, the data rule of the request parameter field may be set to require that the password must have 6 digits or 8 digits. When the data rule of the request parameter field is that the request password must be 6 digits, the interface resource data of the account opening interface conforms to the data rule, an interface flow test positive case is generated, and when the data rule of the request parameter field is that the request password must be 8 digits, the interface resource data of the account opening interface does not conform to the data rule, an interface flow test negative case is generated. The interface process test positive case is a test case which expects the interface to be able to normally feed back data, and is used for testing whether the interface can normally perform under a correct request. The interface flow test counter case is a test case that an expected interface cannot normally feed back data, and is used for testing whether the output interface can automatically resist under an incorrect request, and the fault tolerance and reliability of the output interface can be checked. The difference between the positive case and the negative case is the expectation after the interface is called, the expectation of the positive case is that the interface can work normally, the test of the positive case is passed, the expectation of the negative case is that the interface can not work normally, and the test of the negative case is passed only when the interface can not work normally. Postman is a common interface testing tool, which can provide functions (for example, a function of newly creating a Collection, and when a Collection is newly created, whether the newly created Collection is a positive case or a negative case) for generating a positive case (that is, a positive interface case) or a negative case (that is, a negative interface case) of a single interface (for example, a function of newly creating a Collection, and when a Collection is newly created, whether the newly created Collection is a positive case or a negative case is set, and if a positive case needs to be generated, the newly created Collection is set as a positive case, and when a negative case needs to be generated, the newly created Collection is set as a negative case, and when a newly created Collection is a negative case generation method). Usually, only interface resource data (e.g., a request path of an interface, a request parameter of an interface, a request mode of an interface, etc.) of a single interface needs to be input, so that a positive case or a negative case of the single interface can be generated. When the interface flow testing positive case needs to be generated, the function of generating the positive case of a single interface in the Postman tool can be called for many times to generate the positive case corresponding to each interface, and then the execution sequence of the positive case corresponding to each interface is determined according to the sequence of each business step in the business flow data, so that the final interface flow testing positive case is formed. When the interface flow testing counter case needs to be generated, the function of generating the counter case of a single interface in the Postman tool can be called for many times to generate the counter case corresponding to each interface, and then the execution sequence of the counter case corresponding to each interface is determined according to the sequence of each service step in the service flow data, so that the final interface flow testing counter case is formed. And generating a testing positive case and a testing negative case according to whether the interface resource data accord with a preset data rule or not, so that the testing content of the interface can be enriched, the testing effect of the interface is improved, and the accuracy of a final testing result is improved. Different data rules preset in different fields can be expressed as, for example, requiring that the value of the data is within a certain range, requiring that the value of the data must be one of several enumerated values, and the like. For example, the request parameter field of the interface resource data for the load interface typically includes the amount of money to be transferred, and in this case, the data rule of the request parameter field may be set to require that the amount of money to be transferred be in the range of 1-99999.
Therefore, when the optional embodiment is implemented, the interface testing is performed by generating the testing positive case and the testing negative case according to whether the interface resource data meet the preset data rule, so that the testing content of the interface can be enriched, the testing effect of the interface can be improved, and the accuracy of the final testing result can be improved.
In an optional embodiment, the acquiring interface resource data of an interface required to be called in each service step in the service flow includes:
acquiring original interface resource data of an interface required to be called in each service step in the service flow according to a preset data acquisition mode;
judging whether the original interface resource data is matched with a preset data template;
when the original interface resource data is judged not to be matched with the data template, executing preset data expansion operation on the original interface resource data to obtain interface resource data of an interface required to be called in each service step in the service flow;
and when the original interface resource data is judged to be matched with the data template, determining the original interface resource data as the interface resource data of the interface required to be called in each service step in the service flow.
In this optional embodiment, in generating the interface flow test case capable of calling the interface, it is generally required that the interface resource data is complete enough, for example, for the transfer-to-account interface, the interface resource data corresponding to the transfer-to-account interface must include data of the sum of money transfer-out account, the sum of money transfer-in account, and the sum of money transfer, and if one of the data is missing, the interface flow test case cannot be normally generated. However, the method is limited to the manner of acquiring the original interface resource data (described later), and sufficient data cannot be guaranteed in the acquired original interface resource data. Therefore, the original interface resource data can be matched with a preset data template so as to judge whether the data in the original interface resource data are complete, if so, the original interface resource data are directly used as the corresponding interface resource data, and if not, the original interface resource data are expanded (the specific expansion process is described later), so that the corresponding interface resource data are obtained. Specifically, all fields corresponding to necessary data may be preset in the preset data template, the process of matching the original interface resource data with the data template may be a process of comparing the fields in the original interface resource data with the fields in the data template, if the fields of the two are completely the same, it may be determined that the two are matched, and if the fields of the two are not completely the same, it may be determined that the two are not matched.
It can be seen that, in implementing the optional embodiment, the original interface resource data corresponding to the target interface and the process-related interface is obtained first, and then whether the original interface resource data is complete is judged based on the preset data template, if so, the original interface resource data is directly used as the corresponding interface resource data, and if not, the original interface resource data is subjected to data expansion to obtain the corresponding interface resource data, so that the complete interface resource data can be obtained, the smooth generation of an interface process test case is favorably ensured, and the stability of the interface test is improved.
In an optional embodiment, the performing a preset data expansion operation on the original interface resource data to obtain interface resource data of an interface required to be called in each service step in the service flow includes:
comparing the field in the original interface resource data with the field in the data template to obtain an extended field corresponding to the original interface resource data;
acquiring extended data corresponding to the extended field according to a preset data acquisition mode;
and adding the expansion field and the expansion data corresponding to the expansion field into the original interface resource data to obtain interface resource data of an interface required to be called in each service step in the service flow.
In this alternative embodiment, after comparing the field in the original interface resource data with the field in the data template, the field that exists in the data template but does not exist in the original interface resource data (i.e. the field missing in the original interface resource data) may be directly used as the extension field. And then acquiring expansion data corresponding to the expansion field, and adding the expansion field and the expansion data into the original interface resource data, so that the data is completely supplemented to obtain the corresponding interface resource data. If the original interface resource data corresponding to the transferred account interface lacks data of the amount of transferred account, a field of the amount of transferred account can be used as an expansion field, then an amount value is obtained as expansion data, and finally the expansion field and the expansion data are added to the original interface resource data, so that the data is completely supplemented, and the corresponding interface resource data is obtained.
It can be seen that, by implementing the optional embodiment, the field in the original interface resource data is compared with the field in the data template to obtain the extended field, then the extended data corresponding to the extended field is obtained, and finally the extended field and the extended data are added to the original interface resource data, so that the original interface resource data can be extended to obtain the corresponding interface resource data.
In an optional embodiment, the obtaining the extended data corresponding to the extended field according to a preset data obtaining manner includes:
finding out a target data record containing the extension field from a preset data pool, wherein the data pool contains a plurality of data records;
judging whether the data in the target data record and the original interface resource data have an association relation or not;
and when judging that the data in the target data record has an association relation with the original interface resource data, determining the data corresponding to the expansion field in the target data record as the expansion data corresponding to the expansion field.
In this alternative embodiment, the data pool may store various data records in the computer system, which are used to record data changes in the computer system, such as transfer flow records, new account records, account information modification records, and the like. Corresponding fields exist in each data record, and for example, one transfer journal record generally comprises three fields of money transfer-out account, money transfer-in account and transfer amount. If the extended field is the transfer amount, then all transfer streamers may be targeted data records, since the transfer streamers will typically include a field for the transfer amount. However, there are usually a plurality of target data records in the data pool, so that the target data records may be screened, from which the target data records having an association relationship with the original interface resource data are screened, and then the data of the extension field in the target data records having an association relationship is used as the extension data corresponding to the extension field. Specifically, whether the target data record and the original interface resource data have the same data or not can be judged to judge whether the target data record and the original interface resource data have the association relationship or not. The content of the account amount transferred-to account field in the original interface resource data is user1, and the content of the account amount transferred-to account field in the target data record is also user1, which indicates that a relationship exists between the target data record and the original interface resource data, that is, the target data record is a transfer record which is related to a user1 and actually transfers money once and successfully, so that the transfer amount in the target data record is usually effective, and the transfer amount in the target data record can be used as the transfer amount in the original interface resource data and filled in an extended field of the original interface resource data.
Therefore, when the optional embodiment is implemented, the target data record is found out from the data pool, and then the data corresponding to the expansion field in the target data record having the association relation with the original interface resource data is determined as the expansion data corresponding to the expansion field, so that the appropriate data can be found from the past data record to be used as the expansion data to be filled into the expansion field, and the stable performance of the test can be ensured.
In an optional embodiment, the obtaining the extended data corresponding to the extended field according to a preset data obtaining manner includes:
acquiring a data rule corresponding to the extension field set by a user;
randomly generating target data which accords with the data rule based on a preset data generation program;
and determining the target data as the extended data corresponding to the extended field.
In this optional embodiment, the data rule corresponding to each field may be preset in the data template, so that the data rule corresponding to the extended field may be acquired from the data template. If the determined extension field is the transfer amount field and the data rule obtained from the data template for the transfer amount field is used to limit the data in the transfer amount field to be within the value range of 1-99999, the data generation program randomly generates a value (e.g., 1000) within the value range of 1-99999 and then uses the value as the data (i.e., the extension data) in the transfer amount field.
It can be seen that, when the optional embodiment is implemented, the data rule corresponding to the extension field is first obtained, then the target data meeting the data rule is randomly generated by using the data generation program, and finally the target data is determined as the extension data corresponding to the extension field, so that the target data meeting the data rule of the extension field can be automatically generated to be used as the extension data and filled into the extension field, which is beneficial to ensuring the stable performance of the test.
In an optional embodiment, the obtaining, according to a preset data obtaining manner, original interface resource data of an interface that needs to be called in each service step in the service flow includes:
acquiring an interface document uploaded by a user, and analyzing the interface document to obtain original interface resource data of an interface required to be called in each service step in the service flow, or,
acquiring original interface resource data of an interface required to be called in each service step in the service flow from the swagger tool, or,
and acquiring original interface resource data of an interface required to be called in each service step in the service flow from the YAPI tool.
In this optional embodiment, both the swagger tool and the YAPI tool are interface management platforms, and may directly obtain the original interface resource data corresponding to the target interface and the process-related interface from the interface management platform. The interface testing method in the embodiment of the invention supports the butt joint with the swagger tool and the YAPI tool, thereby being capable of adapting to more practical application scenes. The original interface resource data can also be obtained by directly analyzing the interface document. Specifically, the ocr technology may be used to parse the text content in the interface document, for example, identify the keywords (e.g., request path, request mode, request parameters) in the interface document, and then extract effective information from the interface document as the original interface resource data according to the location of the identified keywords in the interface document. The interface document is a document which is written by a tester in advance and records relevant parameters of a specific interface.
Therefore, by implementing the optional embodiment, the original interface resource data is acquired by analyzing the interface document, and butting with the swagger tool or the YAPI tool, so that various ways for acquiring the original interface resource data can be provided, and the interface test method can better adapt to different application scenarios.
Optionally, it is also possible: and uploading the interface test information of the interface test method to a block chain.
Specifically, the interface test information is obtained by operating the interface test method, and is used to record interface test conditions, such as the obtained service flow data, the determined flow-related interface, the obtained interface resource data, and the like. Uploading the interface test information to the blockchain can ensure the safety and the fair transparency to the user. The user can download the interface test information from the blockchain to verify whether the interface test information of the interface test method is tampered. The blockchain referred to in this example is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm, and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
Example two
Referring to fig. 2, fig. 2 is a schematic structural diagram of an interface testing apparatus according to an embodiment of the present invention. As shown in fig. 2, the interface test apparatus may include:
an obtaining module 201, configured to obtain service flow data corresponding to a target interface to be tested, where the service flow data records each service step in a complete service flow, an execution sequence of each service step in the whole service flow, and an interface to be called when each service step is executed;
the obtaining module 201 is further configured to obtain interface resource data of an interface that needs to be called in each service step in the service flow;
a generating module 202, configured to generate an interface flow test case based on the interface resource data and the service flow data, where the interface flow test case is used to sequentially call an interface corresponding to each service step according to an execution sequence of each service step in the entire service flow;
the execution module 203 is configured to execute the interface process test case to complete testing of all interfaces in the service process corresponding to the target interface.
For the specific description of the interface testing apparatus, reference may be made to the specific description of the interface testing method, and details are not repeated here to avoid repetition.
EXAMPLE III
Referring to fig. 3, fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention. As shown in fig. 3, the computer apparatus may include:
a memory 301 storing executable program code;
a processor 302 connected to the memory 301;
the processor 302 calls the executable program code stored in the memory 301 to execute the steps of the interface testing method disclosed in the embodiment of the present invention.
Example four
Referring to fig. 4, an embodiment of the present invention discloses a computer storage medium 401, where the computer storage medium 401 stores computer instructions, and the computer instructions are used to execute steps in an interface testing method disclosed in an embodiment of the present invention when being called.
The above-described embodiments of the apparatus are merely illustrative, and the modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above detailed description of the embodiments, those skilled in the art will clearly understand that the embodiments may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. Based on such understanding, the above technical solutions may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, where the storage medium includes a Read-Only Memory (ROM), a Random Access Memory (RAM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc-Read-Only Memory (CD-ROM), or other disk memories, CD-ROMs, or other magnetic disks, A tape memory, or any other medium readable by a computer that can be used to carry or store data.
Finally, it should be noted that: the interface testing method, apparatus, computer device and storage medium disclosed in the embodiments of the present invention are only preferred embodiments of the present invention, and are only used for illustrating the technical solutions of the present invention, rather than limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art; the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. An interface testing method, the method comprising:
acquiring business process data corresponding to a target interface to be tested, wherein the business process data records each business step in a complete business process, an execution sequence of each business step in the whole business process and an interface required to be called when each business step is executed;
acquiring interface resource data of an interface required to be called in each service step in the service flow;
generating an interface process test case based on the interface resource data and the service process data, wherein the interface process test case is used for sequentially calling interfaces corresponding to all the service steps according to the execution sequence of all the service steps in the whole service process;
and executing the interface process test case to complete the test of all the interfaces in the business process corresponding to the target interface.
2. The interface testing method of claim 1, wherein the interface process testing cases comprise an interface process testing positive case and an interface process testing negative case;
generating an interface process test case based on the interface resource data and the business process data comprises:
judging whether the interface resource data meet a preset data rule or not;
when the interface resource data are judged to accord with the data rules, calling a positive case generation method in a preset interface test tool to process the interface resource data and the business process data so as to generate an interface process test positive case;
and when the interface resource data are judged to be not in accordance with the data rules, calling a counter-case generation method in a preset interface test tool to process the interface resource data and the business process data so as to generate an interface process test counter-case.
3. The interface testing method according to claim 1 or 2, wherein the acquiring interface resource data of the interface required to be called in each service step in the service flow includes:
acquiring original interface resource data of an interface required to be called in each service step in the service flow according to a preset data acquisition mode;
judging whether the original interface resource data is matched with a preset data template;
when the original interface resource data is judged not to be matched with the data template, executing preset data expansion operation on the original interface resource data to obtain interface resource data of an interface required to be called in each service step in the service flow;
and when the original interface resource data is judged to be matched with the data template, determining the original interface resource data as the interface resource data of the interface required to be called in each service step in the service flow.
4. The interface testing method according to claim 3, wherein the performing a preset data expansion operation on the original interface resource data to obtain interface resource data of an interface required to be called in each service step in the service flow comprises:
comparing the field in the original interface resource data with the field in the data template to obtain an extended field corresponding to the original interface resource data;
acquiring extended data corresponding to the extended field according to a preset data acquisition mode;
and adding the expansion field and the expansion data corresponding to the expansion field into the original interface resource data to obtain interface resource data of an interface required to be called in each service step in the service flow.
5. The interface testing method according to claim 4, wherein the obtaining the extended data corresponding to the extended field according to a preset data obtaining manner includes:
finding out a target data record containing the extension field from a preset data pool, wherein the data pool contains a plurality of data records;
judging whether the data in the target data record and the original interface resource data have an association relation or not;
and when judging that the data in the target data record has an association relation with the original interface resource data, determining the data corresponding to the expansion field in the target data record as the expansion data corresponding to the expansion field.
6. The interface testing method according to claim 4, wherein the obtaining the extended data corresponding to the extended field according to a preset data obtaining manner includes:
acquiring a data rule corresponding to the extension field set by a user;
randomly generating target data which accords with the data rule based on a preset data generation program;
and determining the target data as the extended data corresponding to the extended field.
7. The interface testing method according to any one of claims 1 to 6, wherein the obtaining, according to a preset data obtaining manner, original interface resource data of an interface that needs to be called in each service step in the service flow includes:
acquiring an interface document uploaded by a user, and analyzing the interface document to obtain original interface resource data of an interface required to be called in each service step in the service flow, or,
acquiring original interface resource data of an interface required to be called in each service step in the service flow from the swagger tool, or,
and acquiring original interface resource data of an interface required to be called in each service step in the service flow from the YAPI tool.
8. An interface testing apparatus, the apparatus comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring business process data corresponding to a target interface to be tested, and the business process data records each business step in a complete business process, an execution sequence of each business step in the whole business process and an interface required to be called when each business step is executed;
the acquisition module is further configured to acquire interface resource data of an interface that needs to be called in each service step in the service flow;
the generating module is used for generating an interface flow test case based on the interface resource data and the business flow data, wherein the interface flow test case is used for sequentially calling the interfaces corresponding to all the business steps according to the execution sequence of all the business steps in the whole business flow;
and the execution module is used for executing the interface process test case so as to complete the test of all the interfaces in the business process corresponding to the target interface.
9. A computer device, characterized in that the computer device comprises:
a memory storing executable program code;
a processor coupled to the memory;
the processor calls the executable program code stored in the memory to execute the interface test method according to any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the interface testing method according to any one of claims 1 to 7.
CN202111016967.5A 2021-08-31 2021-08-31 Interface testing method, device, equipment and storage medium Active CN113704123B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111016967.5A CN113704123B (en) 2021-08-31 2021-08-31 Interface testing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111016967.5A CN113704123B (en) 2021-08-31 2021-08-31 Interface testing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113704123A true CN113704123A (en) 2021-11-26
CN113704123B CN113704123B (en) 2024-04-23

Family

ID=78658418

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111016967.5A Active CN113704123B (en) 2021-08-31 2021-08-31 Interface testing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113704123B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114218114A (en) * 2021-12-22 2022-03-22 四川启睿克科技有限公司 Full-automatic test data generation method based on interface flow arrangement

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104281523A (en) * 2014-10-27 2015-01-14 中国建设银行股份有限公司 Demand testability analysis method and system
CN105955890A (en) * 2016-05-13 2016-09-21 中国建设银行股份有限公司 Method and device for generating function test case
CN109002391A (en) * 2018-06-28 2018-12-14 西南电子技术研究所(中国电子科技集团公司第十研究所) The method of automatic detection embedded software interface testing data
CN110287101A (en) * 2019-05-22 2019-09-27 深圳壹账通智能科技有限公司 User interface automated testing method, device, computer equipment and storage medium
CN110309052A (en) * 2019-05-22 2019-10-08 梁俊杰 A kind of data verification method and relevant device
WO2020119434A1 (en) * 2018-12-15 2020-06-18 深圳壹账通智能科技有限公司 Method and apparatus for interface data processing, method and apparatus for automated testing, device, and medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104281523A (en) * 2014-10-27 2015-01-14 中国建设银行股份有限公司 Demand testability analysis method and system
CN105955890A (en) * 2016-05-13 2016-09-21 中国建设银行股份有限公司 Method and device for generating function test case
CN109002391A (en) * 2018-06-28 2018-12-14 西南电子技术研究所(中国电子科技集团公司第十研究所) The method of automatic detection embedded software interface testing data
WO2020119434A1 (en) * 2018-12-15 2020-06-18 深圳壹账通智能科技有限公司 Method and apparatus for interface data processing, method and apparatus for automated testing, device, and medium
CN110287101A (en) * 2019-05-22 2019-09-27 深圳壹账通智能科技有限公司 User interface automated testing method, device, computer equipment and storage medium
CN110309052A (en) * 2019-05-22 2019-10-08 梁俊杰 A kind of data verification method and relevant device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114218114A (en) * 2021-12-22 2022-03-22 四川启睿克科技有限公司 Full-automatic test data generation method based on interface flow arrangement
CN114218114B (en) * 2021-12-22 2024-04-12 四川启睿克科技有限公司 Full-automatic test data generation method based on interface flow arrangement

Also Published As

Publication number Publication date
CN113704123B (en) 2024-04-23

Similar Documents

Publication Publication Date Title
CN111177005B (en) Service application testing method, device, server and storage medium
CN107145437B (en) Java annotation test method and device
CN111290742A (en) Parameter verification method and device, electronic equipment and readable storage medium
CN111931172A (en) Financial system business process abnormity early warning method and device
CN111679968A (en) Interface calling abnormity detection method and device, computer equipment and storage medium
CN115563002A (en) Data importing method and device, storage medium and computer equipment
CN112256672B (en) Database change approval method and device
CN113704123A (en) Interface test method, device, equipment and storage medium
CN107357721B (en) Method and device for testing system
CN112561690A (en) Method, system, equipment and storage medium for testing credit card staging service interface
CN111222942B (en) Data processing method and device, readable medium and electronic equipment
CN112433936A (en) Test method, test device and storage medium
CN117495544A (en) Sandbox-based wind control evaluation method, sandbox-based wind control evaluation system, sandbox-based wind control evaluation terminal and storage medium
CN112651716A (en) Data processing method, device and storage medium
CN109684205B (en) System testing method, device, electronic equipment and storage medium
CN116431522A (en) Automatic test method and system for low-code object storage gateway
CN114090462B (en) Software repeated defect identification method and device, computer equipment and storage medium
CN114661671A (en) File processing method and device, computer readable storage medium and electronic equipment
CN113342647A (en) Test data generation method and device
CN112965745A (en) System access method, device, equipment and computer readable medium
CN112559012A (en) System upgrading and testing method and device, computer equipment and readable storage medium
Wilson UNIX test tools and benchmarks: methods and tools to design, develop, and execute functional, structural, reliability, and regression tests
CN110716855B (en) Processor instruction set testing method and device
CN112363933A (en) Automatic verification method and device for word paragraph table, computer equipment and storage medium
CN116542768A (en) Method for processing batch transaction, electronic device, storage medium and program product

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
GR01 Patent grant