CN115269431A - 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
CN115269431A
CN115269431A CN202210960219.0A CN202210960219A CN115269431A CN 115269431 A CN115269431 A CN 115269431A CN 202210960219 A CN202210960219 A CN 202210960219A CN 115269431 A CN115269431 A CN 115269431A
Authority
CN
China
Prior art keywords
interface
test case
data
configuration file
document data
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
CN202210960219.0A
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.)
Shuguang Information Industry Henan Co ltd
Original Assignee
Dawning Information Industry Beijing Co Ltd
Dawning Information Industry 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 Dawning Information Industry Beijing Co Ltd, Dawning Information Industry Co Ltd filed Critical Dawning Information Industry Beijing Co Ltd
Priority to CN202210960219.0A priority Critical patent/CN115269431A/en
Publication of CN115269431A publication Critical patent/CN115269431A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • 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/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • 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/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses an interface testing method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring initial interface document data, and determining target interface document data according to the initial interface document data; generating an interface test case according to the target interface document data and generating an interface configuration file corresponding to the interface test case; and driving and executing the interface test case according to the interface configuration file to obtain an interface test result. By operating the technical scheme provided by the embodiment of the invention, omission can be avoided when the interface test case is compiled manually according to the document data, and the efficiency and comprehensiveness of generating the interface test case are improved; the interface test case is driven and executed by the interface configuration file, so that the test case can be driven and executed by managing the interface configuration file without frequently changing codes in the interface test case during interface test, and the usability and the interface test efficiency of the interface test case are improved.

Description

Interface test method and device electronic device 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, an electronic device, and a storage medium.
Background
The interface test is a test for testing the interface between the system components and is an important component of software test. The interface test is used for detecting interaction points between an external system and the system and between each internal subsystem, and mainly checking the exchange, transmission and control management processes of data, mutual logic dependency relationship between systems and the like.
At present, in the process of realizing interface testing, a large number of test cases need to be written manually according to interface documents, a large amount of time is consumed, and omission of test case generation may be caused.
Disclosure of Invention
The invention provides an interface testing method, an interface testing device, electronic equipment and a storage medium, which are used for improving the efficiency and comprehensiveness of test case generation and improving the interface testing efficiency.
According to an aspect of the present invention, there is provided an interface testing method, including:
acquiring initial interface document data, and determining target interface document data according to the initial interface document data;
generating an interface test case according to the target interface document data and generating an interface configuration file corresponding to the interface test case;
and driving and executing the interface test case according to the interface configuration file to obtain an interface test result.
The executing the interface test case according to the interface configuration file driver comprises:
calling a target code related to a first expression in the interface test case through the first expression of the interface configuration file; wherein the first expression comprises a calling expression;
and generating at least one piece of first test data of the interface test case according to the target code, and driving and executing the interface test case according to the first test data.
The advantages of such an arrangement are: the target code in the interface test case is called through the first expression to generate first test data, a large amount of repeated or similar test data does not need to be configured in the interface configuration file, and the flexibility of the interface configuration file for driving the execution of the interface test case is improved; the data volume in the interface configuration file is reduced, so that the compactness of the interface configuration file is improved.
Optionally, the driving and executing the interface test case according to the interface configuration file includes:
generating at least two pieces of second test data of the interface test case through a second expression of the interface configuration file, and driving and executing the interface test case according to the second test data; wherein the second expression comprises a conditional expression.
The advantages of such an arrangement are: and a plurality of pieces of second test data are generated through a single second expression, so that the plurality of pieces of test data do not need to be completely displayed in the interface configuration file, the data volume in the interface configuration file is reduced, and the simplicity degree of the interface configuration file is improved.
Optionally, the driving and executing the interface test case according to the interface configuration file includes:
configuring an assertion parameter of the interface test case through a third expression of the interface configuration file, and executing the interface test case according to the assertion parameter drive; wherein the third expression comprises an assertion expression.
The advantages of such an arrangement are: the assertion parameters of the interface test case are configured through the third expression, and the problem that in the prior art, the assertion parameters are only configured in the codes of the interface test case, and if the assertion parameters are changed, the codes need to be changed, so that the change efficiency is reduced is solved. The flexibility of the assertion data change is improved.
Optionally, the interface test case is driven and executed according to the interface configuration file, the method comprises the following steps:
responding to the debugging operation of the interface test case, and driving and executing the interface test case according to the interface configuration file;
acquiring the execution data of the interface test case, and updating the interface configuration file according to the execution data;
and driving and executing the interface test case according to the updated interface configuration file.
The advantages of such an arrangement are: the interface configuration file is updated by executing the data, the file content of the simpler interface configuration file generated directly according to the target interface document data is enriched, a more accurate interface test result is obtained when the interface test case is driven to be executed according to the updated interface configuration file, and the accuracy of the interface test is improved.
Optionally, the method further includes:
obtaining an interface library through data packaging operation of the target interface document data;
and calling a target interface from the interface library according to an interface calling request sent in the execution process of the interface test case.
The advantages of such an arrangement are: the data packaging operation of the data of the target interface document is adopted, so that the interfaces are uniformly packaged automatically, and the omission of the generation of the interfaces is avoided; when the data of the target interface document is changed, the interface can be updated correspondingly in time, and the updating efficiency is improved.
Meanwhile, when the interface is required to be called in the execution process of the interface test case, the target interface can be called directly by sending an interface calling request without temporarily generating a corresponding interface, so that the interface calling efficiency is improved; and the repeated packaging of the same interface caused by temporary packaging during each calling is avoided, and the effectiveness of interface packaging is improved.
Optionally, after the target interface is called from the interface library, the method further includes:
acquiring calling data of the target interface;
judging the calling state of the target interface according to the calling data;
and determining the return data of the target interface according to the calling state.
The advantages of such an arrangement are: by determining the return data of the target interface according to the calling state, the calling data are prevented from being returned, so that the problem that whether the returned data are effective or not is judged manually according to the returned data subsequently to reduce the testing efficiency of the interface is avoided, and the effectiveness of the returned data is improved.
According to another aspect of the present invention, there is provided an interface testing apparatus, the apparatus including:
the document data determining module is used for acquiring initial interface document data and determining target interface document data according to the initial interface document data;
the case file generating module is used for generating an interface test case according to the target interface document data and generating an interface configuration file corresponding to the interface test case;
and the test case execution module is used for driving and executing the interface test case according to the interface configuration file to obtain an interface test result.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the interface testing method according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the interface testing method according to any one of the embodiments of the present invention when the computer instructions are executed.
According to the technical scheme of the embodiment of the invention, the full amount of interface test cases are automatically generated according to the initial interface document data, so that omission is avoided when the interface test cases are manually compiled according to the document data, and the efficiency and the comprehensiveness of generating the interface test cases are improved; the interface configuration files corresponding to the whole amount of interface test cases are automatically generated through the initial interface document data, and the correlation between the interface configuration files and the interface test cases is improved, so that the effectiveness and the efficiency of generating the interface configuration files are improved. And the interface test case and the interface configuration file are automatically generated according to the initial interface document data, and when the initial interface document data is changed, the interface test case and the interface configuration file can be timely and correspondingly updated, so that the updating efficiency is improved.
The interface test case is driven and executed through the interface configuration file, so that the test case can be driven and executed through managing the interface configuration file, the codes in the interface test case do not need to be frequently changed during testing, and the usability and the interface test efficiency of the interface test case are improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
Fig. 1 is a flowchart of an interface testing method according to an embodiment of the present invention;
fig. 2 is a flowchart of a first interface testing method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a second interface testing method according to a second embodiment of the present invention;
fig. 4 is a flowchart of a third interface testing method according to the second embodiment of the present invention;
fig. 5 is a flowchart of an interface testing method according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of an interface testing apparatus according to a fourth embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device for implementing an embodiment of the 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.
It should be noted that the terms "first," "second," "object," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or described herein. Moreover, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of an interface testing method according to an embodiment of the present invention, where this embodiment is applicable to a case where an interface test case is executed through an interface configuration file driver, and the method may be executed by an interface testing apparatus according to an embodiment of the present invention, where the apparatus may be implemented in a software and/or hardware manner. Referring to fig. 1, the interface testing method provided in this embodiment includes:
step 110, obtaining initial interface document data, and determining target interface document data according to the initial interface document data.
The initial document data is original interface document data, and includes all data related to an interface, for example, RAP interface document data, which is not limited in this embodiment. The initial interface document data may be obtained by sending a data obtaining request to the initial interface document to obtain corresponding types of data, such as data of the full or recently updated initial interface document.
The target interface document data is interface document data in a target format, the target interface document data is determined according to the initial interface document data, and the target interface document data can be obtained by converting the original format of the initial interface document data into the target format through analyzing the initial interface document data. Illustratively, the initial interface document data in json format is converted into interface document data in yaml format, resulting in target interface document data.
And 120, generating an interface test case according to the target interface document data, and generating an interface configuration file corresponding to the interface test case.
The interface test case and the interface configuration file are generated through the target interface document data, so that the data required by generating the interface test case and the data required by generating the interface configuration file are respectively acquired by identifying the target interface document data, then the interface test case is generated according to the data required by generating the interface test case, and the interface configuration file is generated according to the data required by generating the interface configuration file.
Optionally, when the interface test case is generated again after the data of the initial interface document is updated, the generated interface test case may be optionally covered or skipped.
And step 130, driving and executing the interface test case according to the interface configuration file to obtain an interface test result.
And executing the interface test case through the interface configuration file drive, namely reading input data from the interface configuration file, and inputting the data into the interface test case in a parameter form for interface test, wherein the interface configuration file and the interface test case are independent.
Different interface test case execution modes can be realized by adding the expression in the interface configuration file. Illustratively, by adding the expression for variable replacement in the interface configuration file, the variable in the interface test case can be replaced, and the variable replacement efficiency is improved. For example, the variable is a user ID, the user ID in the test case is ID1, and if it needs to be changed to ID2, a change expression may be added to the interface configuration file, so that when the interface test case is driven to be executed according to the interface configuration file, the user ID in the interface test case is automatically replaced with ID2. It should be noted that, if there is a situation that the variable replacement of the interface test case cannot be performed according to the interface configuration file, the code in the interface test case may be directly changed to achieve the purpose of variable replacement.
After the interface test result is obtained, the interface test report can be generated according to the test process, so that the relevant data in the test process can be acquired according to the test report in the follow-up process, and the relevant data can be subjected to follow-up processing.
In this embodiment, optionally, the driving and executing the interface test case according to the interface configuration file includes:
responding to the debugging operation of the interface test case, and driving and executing the interface test case according to the interface configuration file;
acquiring the execution data of the interface test case, and updating the interface configuration file according to the execution data;
and driving and executing the interface test case according to the updated interface configuration file.
The interface test case can be debugged by responding to the debugging operation of the interface test case, namely, the interface test case is executed according to the generated initial interface configuration file, and correct parameters are filled in the execution process so that the interface test case can be successfully operated.
The execution data of the interface test case may be obtained, and may be return data after the interface is obtained, where the return data may include data automatically generated in the interface test case execution process, such as an assertion expression.
And adding part of data in the returned data, such as the generated detailed assertion expression, into the interface configuration file, and replacing original simpler initial data in the interface configuration file with complex data to update the interface configuration file.
And driving and executing the interface test case according to the updated interface configuration file and the test requirement to obtain a corresponding interface test result.
The advantages of such an arrangement are: the interface configuration file is updated by executing the data, the file content of the simpler interface configuration file which is directly generated according to the target interface document data is enriched, so that a more accurate interface test result can be obtained when the interface test case is driven to be executed according to the updated interface configuration file in the follow-up process, and the accuracy of the interface test is improved.
According to the technical scheme provided by the embodiment, the full amount of interface test cases are automatically generated according to the initial interface document data, omission is avoided when the interface test cases are manually compiled according to the document data, and the efficiency and the comprehensiveness of the generation of the interface test cases are improved; the interface configuration files corresponding to the whole amount of interface test cases are automatically generated through the initial interface document data, and the correlation between the interface configuration files and the interface test cases is improved, so that the effectiveness and the efficiency of generating the interface configuration files are improved. And the interface test case and the interface configuration file are automatically generated according to the initial interface document data, and when the initial interface document data is changed, the interface test case and the interface configuration file can be timely and correspondingly updated, so that the updating efficiency is improved.
The interface test case is driven and executed through the interface configuration file, so that the test case can be driven and executed through managing the interface configuration file, the codes in the interface test case do not need to be frequently changed during testing, and the usability and the interface test efficiency of the interface test case are improved.
Example two
Fig. 2 is a flowchart of a first interface test method according to a second embodiment of the present invention, and this embodiment further embodies a process of executing an interface test case by an interface configuration file driver on the basis of the foregoing embodiment. As shown in fig. 2, the method includes:
step 210, obtaining initial interface document data, and determining target interface document data according to the initial interface document data.
Step 220, generating an interface test case according to the target interface document data, and generating an interface configuration file corresponding to the interface test case.
Step 230, calling a target code related to the first expression in the interface test case through the first expression of the interface configuration file; wherein the first expression comprises a calling expression.
The calling expression is located in the interface configuration file and used for calling a target code in the interface test case, the target code is a code related to the calling expression, and illustratively, if the calling expression is an expression of a code calling a mobile phone number generation method, the called target code is a code generated by a mobile phone number in the interface test case, wherein the code generated by the mobile phone number in the interface test case can be added to a specified position in the interface test case in advance.
Step 240, generating at least one piece of first test data of the interface test case according to the target code, and executing the interface test case according to the first test data driver to obtain an interface test result.
Generating at least one piece of first test data of the interface test case according to the target code may be at least one piece of test variable data required for generating the interface test case according to the called target code.
And in the actual interface test process, driving and executing the interface test case according to the generated first test data.
The benefit of this arrangement is: the target code in the interface test case is called through the first expression to generate first test data, a large amount of repeated or similar test data does not need to be configured in the interface configuration file, and the flexibility of the interface configuration file for driving the execution of the interface test case is improved; the data volume in the interface configuration file is reduced, so that the compactness of the interface configuration file is improved.
Fig. 3 is a flowchart of a second interface testing method according to a second embodiment of the present invention, and this embodiment further embodies a process of driving an interface test case by an interface configuration file to execute an interface test case on the basis of the foregoing embodiment, so as to obtain an interface test result. As shown in fig. 3, the method includes:
step 310, acquiring initial interface document data, and determining target interface document data according to the initial interface document data.
And 320, generating an interface test case according to the target interface document data, and generating an interface configuration file corresponding to the interface test case.
Step 330, generating at least two pieces of second test data of the interface test case through a second expression of the interface configuration file, and executing the interface test case according to the second test data drive to obtain an interface test result; wherein the second expression comprises a conditional expression.
The conditional expression is located in the interface configuration file, and is used for performing multiple conditional intersections according to the conditional content in a single expression to generate multiple pieces of test data, for example, if the conditional expression is [ [ [ ' name ', in ', [ ' tom ', ' joe ' ] ], [ ' age ', ' in ', [7,8] ] ], then four pieces of test data can be generated according to the conditional expression respectively: name: tom age7, name: tom age8, name: joe age7, and name: joe age8.
And in the actual interface test process, driving and executing the interface test case according to the generated second test data.
The benefit of this arrangement is: and a plurality of pieces of second test data are generated through a single second expression, so that the plurality of pieces of test data do not need to be completely displayed in the interface configuration file, the data volume in the interface configuration file is reduced, and the simplicity degree of the interface configuration file is improved.
Fig. 4 is a flowchart of a third interface testing method according to the second embodiment of the present invention, and this embodiment further embodies a process of executing an interface test case by an interface configuration file driver to obtain an interface test result on the basis of the above embodiment. As shown in fig. 4, the method includes:
step 410, obtain initial interface document data, and determine target interface document data according to the initial interface document data.
Step 420, generating an interface test case according to the target interface document data, and generating an interface configuration file corresponding to the interface test case.
Step 430, configuring the assertion parameters of the interface test case through the third expression of the interface configuration file, and driving and executing the interface test case according to the assertion parameters to obtain an interface test result; wherein the third expression comprises an assertion expression.
The assertion expression is located in the interface configuration file, is used for configuring assertion parameters used in the interface test case, and can support all assertions contained in an assertpy library. And modifying corresponding assertion parameters by modifying the assertion expression, and driving and executing the interface test case according to the determined assertion parameters in the actual interface test process.
The benefit of this arrangement is: the assertion parameters of the interface test case are configured through the third expression, and the problem that in the prior art, the assertion parameters are only configured in the codes of the interface test case, and if the assertion parameters are changed, the codes need to be changed, so that the change efficiency is reduced is solved. The flexibility of asserting data changes is improved.
EXAMPLE III
Fig. 5 is a flowchart of an interface testing method according to a third embodiment of the present invention, and this embodiment further embodies the interface testing process based on the foregoing embodiment. As shown in fig. 5, the method includes:
step 510, obtain initial interface document data.
Step 520, determining the target interface document data according to the initial interface document data.
Step 530, generating an interface test case according to the target interface document data.
And 540, generating an interface configuration file corresponding to the interface test case according to the target interface document data.
And 550, executing the interface test case according to the interface configuration file driver to obtain an interface test result.
And step 560, obtaining an interface library through data encapsulation operation on the target interface document data.
The data packaging operation of the target interface document data may be performed after the target interface document data is determined, and may be to acquire interface data related to an interface in the target interface document data and package the interface data. The interface data may be all interface data or interface data of an interface related to the interface test case, which is not limited in this embodiment. And storing each interface obtained by packaging to obtain an interface library.
Optionally, when the interface is packaged again after the initial interface document data is updated, the packaged interface may be selected to be covered or skipped.
Step 570, calling the target interface from the interface library according to the interface calling request sent in the execution process of the interface test case.
If an interface calling request is sent out in the execution process of the interface test case, a target interface associated with the interface calling request is called from an interface library according to the interface calling request, and driving and executing the interface test case through the interface configuration file according to the called target interface to obtain an interface test result.
In this embodiment, optionally, after the invoking the target interface from the interface library, the method further includes:
acquiring calling data of the target interface;
judging the calling state of the target interface according to the calling data;
and determining the return data of the target interface according to the calling state.
The calling data of the target interface may include a calling result, where the calling result is data obtained when the target interface is called, for example, character string data. The call data may also include a call code for indicating the call state of the call, such as call success or call failure.
The determination of the calling state of the target interface according to the calling data may be performed according to a calling code, for example, if the obtained calling code is a, it is determined that the calling state is a calling failure.
The return data of the target interface is the data which is actually returned to the calling party after the target interface is called; and determining the return data of the target interface according to the calling state, wherein if the calling state is calling success, the calling result is used as interface return data, and if the calling state is calling failure, only the calling state is returned, the calling result is not returned, and the like.
The advantages of such an arrangement are: by determining the return data of the target interface according to the calling state, the calling data are prevented from being returned, so that the problem that whether the returned data are effective or not is judged manually in the follow-up process according to the returned data, the testing efficiency of the interface is reduced is solved, and the effectiveness of the returned data is improved.
According to the embodiment of the invention, the interfaces are automatically and uniformly packaged through data packaging operation of the target interface document data, so that interface generation omission is avoided; and when the target interface document data is changed, the interface can be updated correspondingly in time, and the updating efficiency is improved.
Meanwhile, when the interface is required to be called in the execution process of the interface test case, the target interface can be called directly by sending an interface calling request without temporarily generating a corresponding interface, so that the interface calling efficiency is improved; and the repeated packaging of the same interface caused by temporary packaging during each calling is avoided, and the effectiveness of interface packaging is improved.
Example four
Fig. 6 is a schematic structural diagram of an interface testing apparatus according to a fourth embodiment of the present invention. The device can be realized by hardware and/or software, can execute the interface test method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. As shown in fig. 6, the apparatus includes:
a document data determining module 610, configured to obtain initial interface document data and determine target interface document data according to the initial interface document data;
a use case file generating module 620, configured to generate an interface test case according to the target interface document data, and generate an interface configuration file corresponding to the interface test case;
the test case execution module 630 is configured to execute the interface test case according to the interface configuration file driver, so as to obtain an interface test result.
On the basis of the above technical solutions, optionally, the test case execution module includes:
the target code calling unit is used for calling a target code related to a first expression in the interface test case through the first expression of the interface configuration file; wherein, the first expression comprises a calling expression;
and the first test case execution unit is used for generating at least one piece of first test data of the interface test case according to the target code and driving and executing the interface test case according to the first test data.
On the basis of the above technical solutions, optionally, the test case execution module includes:
the second test case execution unit is used for generating at least two pieces of second test data of the interface test case through a second expression of the interface configuration file and driving and executing the interface test case according to the second test data; wherein the second expression comprises a conditional expression.
On the basis of the above technical solutions, optionally, the test case execution module includes:
the third test case execution unit is used for configuring the assertion parameters of the interface test case through the third expression of the interface configuration file and executing the interface test case according to the assertion parameter drive; wherein the third expression comprises an assertion expression.
On the basis of the above technical solutions, optionally, the test case execution module includes:
the fourth test case execution unit is used for responding to the debugging operation of the interface test case and driving and executing the interface test case according to the interface configuration file;
the configuration file updating unit is used for acquiring the execution data of the interface test case and updating the interface configuration file according to the execution data;
and the fifth test case execution unit is used for driving and executing the interface test case according to the updated interface configuration file.
On the basis of the above technical solutions, optionally, the apparatus further includes:
the data packaging module is used for obtaining an interface database through data packaging operation on the target interface document data;
and the target interface calling module is used for calling a target interface from the interface library according to an interface calling request sent in the execution process of the interface test case.
On the basis of the above technical solutions, optionally, the apparatus further includes:
the calling data acquisition module is used for acquiring calling data of the target interface after the target interface calling module;
the calling state judging module is used for judging the calling state of the target interface according to the calling data;
and the return data determining module is used for determining the return data of the target interface according to the calling state.
EXAMPLE five
FIG. 7 illustrates a schematic diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 7, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 can perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from a storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the various methods and processes described above, such as the interface test method.
In some embodiments, the interface testing method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the interface testing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the interface test method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the Internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above, reordering, adding or deleting steps, may be used. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired result of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. An interface testing method, comprising:
acquiring initial interface document data, and determining target interface document data according to the initial interface document data;
generating an interface test case according to the target interface document data and generating an interface configuration file corresponding to the interface test case;
and driving and executing the interface test case according to the interface configuration file to obtain an interface test result.
2. The method of claim 1, wherein the executing the interface test case according to the interface configuration file driver comprises:
calling a target code related to a first expression in the interface test case through the first expression of the interface configuration file; wherein the first expression comprises a calling expression;
and generating at least one piece of first test data of the interface test case according to the target code, and driving and executing the interface test case according to the first test data.
3. The method of claim 1, wherein the executing the interface test case according to the interface configuration file driver comprises:
generating at least two pieces of second test data of the interface test case through a second expression of the interface configuration file, and driving and executing the interface test case according to the second test data; wherein the second expression comprises a conditional expression.
4. The method of claim 1, wherein the executing the interface test case according to the interface configuration file driver comprises:
configuring an assertion parameter of the interface test case through a third expression of the interface configuration file, and executing the interface test case according to the assertion parameter drive; wherein the third expression comprises a predicate expression.
5. The method of claim 1, wherein the executing the interface test case according to the interface configuration file driver comprises:
responding to the debugging operation of the interface test case, and driving and executing the interface test case according to the interface configuration file;
acquiring the execution data of the interface test case, and updating the interface configuration file according to the execution data;
and driving and executing the interface test case according to the updated interface configuration file.
6. The method according to any one of claims 1-5, further comprising:
obtaining an interface library through data packaging operation of the target interface document data;
and calling a target interface from the interface library according to an interface calling request sent in the execution process of the interface test case.
7. The method of claim 6, further comprising, after said invoking a target interface from the interface library:
acquiring calling data of the target interface;
judging the calling state of the target interface according to the calling data;
and determining the return data of the target interface according to the calling state.
8. An interface testing apparatus, comprising:
the document data determining module is used for acquiring initial interface document data and determining target interface document data according to the initial interface document data;
the case file generating module is used for generating an interface test case according to the target interface document data and generating an interface configuration file corresponding to the interface test case;
and the test case execution module is used for driving and executing the interface test case according to the interface configuration file to obtain an interface test result.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the interface testing method of any one of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to perform the interface testing method of any one of claims 1-7 when executed.
CN202210960219.0A 2022-08-11 2022-08-11 Interface testing method and device, electronic equipment and storage medium Pending CN115269431A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210960219.0A CN115269431A (en) 2022-08-11 2022-08-11 Interface testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210960219.0A CN115269431A (en) 2022-08-11 2022-08-11 Interface testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115269431A true CN115269431A (en) 2022-11-01

Family

ID=83750100

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210960219.0A Pending CN115269431A (en) 2022-08-11 2022-08-11 Interface testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115269431A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115809201A (en) * 2022-12-23 2023-03-17 广州市保伦电子有限公司 Interface test control method, device, equipment and medium based on two-dimensional table

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115809201A (en) * 2022-12-23 2023-03-17 广州市保伦电子有限公司 Interface test control method, device, equipment and medium based on two-dimensional table
CN115809201B (en) * 2022-12-23 2023-10-20 广东保伦电子股份有限公司 Interface test control method, device, equipment and medium based on two-dimensional table

Similar Documents

Publication Publication Date Title
CN116303013A (en) Source code analysis method, device, electronic equipment and storage medium
CN115576828A (en) Test case generation method, device, equipment and storage medium
CN115269431A (en) Interface testing method and device, electronic equipment and storage medium
CN115309730A (en) Data auditing method and device, electronic equipment and storage medium
CN115454971A (en) Data migration method and device, electronic equipment and storage medium
CN115659347A (en) Safety testing method and device, electronic equipment and storage medium
CN115168358A (en) Database access method and device, electronic equipment and storage medium
CN115757097A (en) Test case generation method and device, electronic equipment and storage medium
CN114741294A (en) Page debugging method, device, equipment and storage medium
CN114218313A (en) Data management method, device, electronic equipment, storage medium and product
CN115098405B (en) Software product evaluation method and device, electronic equipment and storage medium
CN113835893B (en) Data processing method, device, equipment, storage medium and program product
CN113760765B (en) Code testing method and device, electronic equipment and storage medium
CN114816758B (en) Resource allocation method and device
CN115374010A (en) Function testing method, device, equipment and storage medium
CN115629690A (en) Method, device, equipment and storage medium for generating FIO working file
CN115983222A (en) EasyExcel-based file data reading method, device, equipment and medium
CN116974940A (en) Interface testing method, device, equipment and storage medium
CN115543748A (en) Signal testing method, device, equipment and storage medium
CN115312114A (en) Method, apparatus, device and medium for testing RAM
CN116756061A (en) External equipment adaptation method, device, equipment and storage medium
CN117609064A (en) Unit test method and device, electronic equipment and storage medium
CN117075861A (en) Method, device, equipment and medium for constructing backlight module
CN117632734A (en) Performance test method of database, electronic equipment and storage medium
CN114676786A (en) Marking template generation method, data marking method and device

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20240511

Address after: Room 168, 1st Floor, Building 10, No.1 Courtyard, Longxing Jiayuan, southeast corner of the intersection of Longhu Inner Ring Road and Longzhiyuan East Ninth Street, Zhengdong New District, Zhengzhou City, Henan Province, 450017

Applicant after: Shuguang Information Industry (Henan) Co.,Ltd.

Country or region after: China

Address before: 300450 floors 1-3, No. 15, Haitai Huake street, Huayuan Industrial Zone (outside the ring), Binhai New Area, Tianjin

Applicant before: DAWNING INFORMATION INDUSTRY Co.,Ltd.

Country or region before: China

Applicant before: Dawning Information Industry (Beijing) Co.,Ltd.