CN116166533A - Interface testing method, device, terminal equipment and storage medium - Google Patents

Interface testing method, device, terminal equipment and storage medium Download PDF

Info

Publication number
CN116166533A
CN116166533A CN202211646693.2A CN202211646693A CN116166533A CN 116166533 A CN116166533 A CN 116166533A CN 202211646693 A CN202211646693 A CN 202211646693A CN 116166533 A CN116166533 A CN 116166533A
Authority
CN
China
Prior art keywords
test
interface
result
test case
case
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
CN202211646693.2A
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.)
Shenzhen Farben Information Technology Co ltd
Original Assignee
Shenzhen Farben Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Farben Information Technology Co ltd filed Critical Shenzhen Farben Information Technology Co ltd
Priority to CN202211646693.2A priority Critical patent/CN116166533A/en
Publication of CN116166533A publication Critical patent/CN116166533A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The application discloses an interface testing method, an interface testing device, terminal equipment and a storage medium, wherein the interface testing method comprises the following steps: reading a preset test case at a preset time point to obtain a corresponding expected result, wherein the test case is created based on a preset presentation layer state transition interface and a test template; operating the test case to obtain a corresponding response result; verifying the response result and the expected result to obtain a test result of the test case; and generating a corresponding test report according to the test result. By adopting data driving test, namely automatically reading and running the test cases at a preset time point, obtaining the test results of the test cases and generating a test report, the technical problem of low interface test efficiency can be solved, and the interface test efficiency is improved.

Description

Interface testing method, device, terminal equipment and storage medium
Technical Field
The present disclosure relates to the field of software testing technologies, and in particular, to an interface testing method, an apparatus, a terminal device, and a storage medium.
Background
Interface testing (testing of interfaces between system components) is mainly used to detect interaction points between external systems and systems (including subsystems).
The existing interface test method is that test is carried out in a manual mode, namely test cases are required to be written manually by a tester, when the interfaces are more involved, tens or even hundreds of test cases are required to be written manually by the tester, so that the writing efficiency of the test cases is lower, and the interface test efficiency is lower.
Accordingly, a solution for improving the testing efficiency of the interface is needed.
Disclosure of Invention
The main purpose of the application is to provide an interface testing method, an interface testing device, terminal equipment and a storage medium, which aim to solve the technical problem of low interface testing efficiency and improve the interface testing efficiency.
In order to achieve the above object, the present application provides an interface testing method, which includes:
reading a preset test case at a preset time point to obtain a corresponding expected result, wherein the test case is created based on a preset presentation layer state transition interface and a test template;
operating the test case to obtain a corresponding response result;
matching the response result with the expected result to obtain a test result of the test case;
and generating a corresponding test report according to the test result.
Optionally, before the step of reading the preset test case at the preset time point to obtain the corresponding expected result, the method further includes:
obtaining a target entry parameter value;
and filling information into the test template based on the target entry parameter value to obtain the test case, wherein the test template is generated according to the presentation layer state transition interface.
Optionally, before the step of obtaining the test case, the step of filling information into the preset test template based on the target parameter value further includes:
acquiring an interface address of the presentation layer state transition interface;
analyzing the interface address to obtain a corresponding interface entry;
and performing field configuration on the interface input parameters to generate a corresponding test template.
Optionally, the step of obtaining the target entry parameter value includes:
acquiring the value range of the interface input parameter;
and generating different target input parameters according to the value range.
Optionally, the test case includes a plurality of fields, and after the step of obtaining the test case, the method further includes:
and when receiving the operation request of the field, modifying the field according to the positioning mapping relation of the field.
Optionally, the step of matching the response result with the expected result to obtain a test result of the test case includes:
extracting a plurality of data to be matched from the response result;
detecting whether the expected result is matched with the data to be matched;
and if each piece of data to be matched and the expected result are normal, the representation layer state transition interface is indicated to be in a normal state.
Optionally, after the step of reading the preset test case at the preset time point, the method further includes:
obtaining a test method and a target server of the performance layer state transition interface;
the step of operating the test case and obtaining the corresponding response result comprises the following steps:
and sending a test request to the target server through the test method so as to receive a corresponding response result.
The embodiment of the application also provides an interface testing device, which comprises:
the system comprises a case reading module, a test case processing module and a test template processing module, wherein the case reading module is used for reading a preset test case at a preset time point to obtain a corresponding expected result, and the test case is created based on a preset presentation layer state transition interface and the test template;
the case operation module is used for operating the test case to obtain a corresponding response result;
the result verification module is used for matching the response result with the expected result to obtain a test result of the test case;
and the report generating module is used for generating a corresponding test report according to the test result.
The embodiment of the application also provides a terminal device, which comprises a memory, a processor and an interface test program stored on the memory and capable of running on the processor, wherein the interface test program realizes the steps of the interface test method when being executed by the processor.
The embodiments of the present application also provide a computer-readable storage medium having stored thereon an interface test program which, when executed by a processor, implements the steps of the interface test method as described above.
The interface testing method, the device, the terminal equipment and the storage medium provided by the embodiment of the application obtain the corresponding expected result by reading the preset test case at the preset time point, wherein the test case is created based on the preset presentation layer state transition interface and the test template; operating the test case to obtain a corresponding response result; matching the response result with the expected result to obtain a test result of the test case; and generating a corresponding test report according to the test result. By adopting data driving test, namely automatically reading and running the test cases at a preset time point, obtaining the test results of the test cases and generating a test report, the technical problem of low interface test efficiency can be solved, and the interface test efficiency is improved. Based on the scheme of the application, a test template based on the performance layer state transfer interface is constructed from the test rule of the performance layer state transfer interface, the effectiveness of the interface test method provided by the application is verified on the test template, and finally the efficiency of the interface test by the method is obviously improved.
Drawings
FIG. 1 is a schematic diagram of functional modules of a terminal device to which an interface test device of the present application belongs;
FIG. 2 is a flow chart of a first exemplary embodiment of an interface testing method of the present application;
FIG. 3 is a flow chart of a second exemplary embodiment of an interface testing method of the present application;
FIG. 4 is a flow chart of a third exemplary embodiment of an interface testing method of the present application;
fig. 5 is a flowchart of a fourth exemplary embodiment of the interface testing method of the present application.
The realization, functional characteristics and advantages of the present application will be further described with reference to the embodiments, referring to the attached drawings.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The main solutions of the embodiments of the present application are: reading a preset test case at a preset time point to obtain a corresponding expected result, wherein the test case is created based on a preset presentation layer state transition interface and a test template; operating the test case to obtain a corresponding response result; matching the response result with the expected result to obtain a test result of the test case; and generating a corresponding test report according to the test result. By adopting data driving test, namely automatically reading and running the test cases at a preset time point, obtaining the test results of the test cases and generating a test report, the technical problem of low interface test efficiency can be solved, and the interface test efficiency is improved. Based on the scheme of the application, a test template based on the performance layer state transfer interface is constructed from the test rule of the performance layer state transfer interface, the effectiveness of the interface test method provided by the application is verified on the test template, and finally the efficiency of the interface test by the method is obviously improved.
Technical terms related to embodiments of the present application:
restful l, representat i ona l State Transfer, represent layer resource state transitions. Here, the "presentation layer" refers to the "presentation layer" of the "resource", so that in popular terms, it is: the resource makes state transitions in the network in some form of behavior.
A resource is a way to look at a server, i.e., a server is considered to be made up of many discrete resources. Each resource is a naming abstraction on the server. Because a resource is an abstract concept, it can represent not only a file in a server file system, a table in a database, etc. concrete things, how abstract the resource is designed can be how abstract, as long as imagination allows and the client application developer can understand. Similar to object-oriented designs, resources are organized with nouns as cores, with nouns being the first focus. A resource may be identified by one or more URIs. The URI is both the name of the resource and the address of the resource on the Web. A client application interested in a resource may interact with it through the URI of the resource.
And (3) expressing resources: a representation of a resource is a description of the state of the resource at a particular time. The transfer (exchange) between client-server side is possible. The representation of the resource may have various formats, such as HTML/XML/JSON/plain text/picture/video/audio, etc. The presentation format of the resource may be determined by a negotiation mechanism. The representation of the request-response direction is typically in a different format.
State transition: transfer (transfer) between the client and server represents a representation of the state of the resource. The purpose of operating the resource is indirectly realized through transferring and expressing the operating resource.
Implementation of restful l: i.e. the HTTP protocol, four verbs representing the manner of operation: GET, POST, PUT, DELETE. They correspond to four basic operations: GET is used to acquire resources, POST is used to create resources, PUT is used to update resources, DELETE is used to DELETE resources. REST style advocates URL address to use unified style design, each word from front to back uses slash separation, does not use question mark key value to carry request parameter, but uses data to be sent to server as part of URL address to ensure consistency of whole style.
JSON (JavaScr ipt Object Notat ion) is a lightweight data exchange format that allows people to easily read and write, while also facilitating parsing and generation by the machine. JSON is suitable for the scene of data interaction, such as data interaction between the website foreground and the background.
The URL is a uniform resource locator, a compact representation of the location and access method of resources available on the internet, is the address of a standard resource on the internet. Each file on the internet has a unique URL that contains information indicating the location of the file and how the browser should handle it (from hundred degrees). Colloquially referred to as a web site.
According to the embodiment of the application, the conventional interface test method is considered to test in a manual mode, namely, test cases are required to be manually written by a tester, when the input of the interface is more, tens or even hundreds of test cases are required to be manually written by the tester, so that the efficiency of writing the test cases is lower, and the efficiency of testing the interface is lower.
In order to enable each system or application software to efficiently and accurately test whether a self-provided presentation layer state transition interface meets the standard, the application constructs an automatic test method of the presentation layer transition interface (Restfu l), and the automatic test method of the presentation layer transition interface realizes the management of test cases in a mode of configuration files.
Specifically, referring to fig. 1, fig. 1 is a schematic diagram of functional modules of a terminal device to which the interface testing apparatus of the present application belongs. The interface testing device can be a device which is independent of the terminal equipment and can carry out picture processing and network model training, and can be carried on the terminal equipment in a form of hardware or software. The terminal equipment can be an intelligent mobile terminal with a data processing function such as a mobile phone and a tablet personal computer, and can also be a fixed terminal equipment or a server with a data processing function.
In this embodiment, the terminal device to which the interface testing apparatus belongs at least includes an output module 110, a processor 120, a memory 130, and a communication module 140.
The memory 130 stores an operating system and an interface test program, and the interface test device can read a preset test case at a preset time point to obtain a corresponding expected result, and create the obtained test case based on a preset presentation layer state transition interface and a test template; the running test case, the corresponding response result obtained; matching the response result with the expected result to obtain a test result of the test case; according to the test result, the generated corresponding test report and other information are stored in the memory 130; the output module 110 may be a display screen or the like. The communication module 140 may include a WI F I module, a mobile communication module, a bluetooth module, and the like, and communicates with an external device or a server through the communication module 140.
Wherein the interface test program in the memory 130, when executed by the processor, performs the steps of:
reading a preset test case at a preset time point to obtain a corresponding expected result, wherein the test case is created based on a preset presentation layer state transition interface and a test template;
operating the test case to obtain a corresponding response result;
matching the response result with the expected result to obtain a test result of the test case;
and generating a corresponding test report according to the test result.
Further, the interface test program in the memory 130, when executed by the processor, further performs the steps of:
obtaining a target entry parameter value;
and filling information into the test template based on the target entry parameter value to obtain the test case, wherein the test template is generated according to the presentation layer state transition interface.
Further, the interface test program in the memory 130, when executed by the processor, further performs the steps of:
acquiring an interface address of the presentation layer state transition interface;
analyzing the interface address to obtain a corresponding interface entry;
and performing field configuration on the interface input parameters to generate a corresponding test template.
Further, the interface test program in the memory 130, when executed by the processor, further performs the steps of:
acquiring the value range of the interface input parameter;
and generating different target input parameters according to the value range.
Further, the interface test program in the memory 130, when executed by the processor, further performs the steps of:
and when receiving the operation request of the field, modifying the field according to the positioning mapping relation of the field.
Further, the interface test program in the memory 130, when executed by the processor, further performs the steps of:
extracting a plurality of data to be matched from the response result;
detecting whether the expected result is matched with the data to be matched;
and if each piece of data to be matched and the expected result are normal, the representation layer state transition interface is indicated to be in a normal state.
Further, the interface test program in the memory 130, when executed by the processor, further performs the steps of:
obtaining a test method and a target server of the performance layer state transition interface;
further, the interface test program in the memory 130, when executed by the processor, further performs the steps of:
and sending a test request to the target server through the test method so as to receive a corresponding response result.
According to the scheme, the corresponding expected result is obtained by reading the preset test case at the preset time point, wherein the test case is created based on the preset presentation layer state transition interface and the test template; operating the test case to obtain a corresponding response result; matching the response result with the expected result to obtain a test result of the test case; and generating a corresponding test report according to the test result. By adopting data driving test, namely automatically reading and running the test cases at a preset time point, obtaining the test results of the test cases and generating a test report, the technical problem of low interface test efficiency can be solved, and the interface test efficiency is improved. Based on the scheme of the application, a test template based on the performance layer state transfer interface is constructed from the test rule of the performance layer state transfer interface, the effectiveness of the interface test method provided by the application is verified on the test template, and finally the efficiency of the interface test by the method is obviously improved.
Based on the above terminal device architecture, but not limited to the above architecture, the method embodiments of the present application are presented.
Referring to fig. 2, fig. 2 is a flowchart of a first exemplary embodiment of the interface testing method of the present application. The interface testing method comprises the following steps:
step S210, reading a preset test case at a preset time point to obtain a corresponding expected result, wherein the test case is created based on a preset presentation layer state transition interface and a test template;
the execution main body of the method of the embodiment may be an interface testing device, or may be an interface testing terminal device or a server, and the embodiment uses the interface testing device as an example, where the interface testing device may be integrated on a terminal device such as a smart phone, a tablet computer, etc. with a data processing function.
The embodiment mainly realizes the test of the representation layer state transition interface, in particular to the test of the representation layer state transition interface, and improves the test efficiency of the representation layer state transition interface.
In order to enable each system or application software to efficiently and accurately test whether the state transition interface of the expression layer accords with the standard, the embodiment of the application constructs an automatic test method of the state transition interface (Restfu l) of the expression layer, and the automatic test method of the state transition interface of the expression layer realizes the management of test cases by editing configuration files.
Specifically, the configuration file includes a plurality of test cases, each of which corresponds to a presentation layer state transition interface. The interface testing method comprises the steps of receiving an interface testing request sent by a user to conduct interface testing, obtaining different testing cases from a configuration file through a testing tool, and reading the testing cases to obtain interface information of an interface to be tested, wherein the interface information comprises, but is not limited to, an interface name, an interface type, a request protocol, a request path, a request protocol, an input parameter, an expected result and the like of the interface. Among them, JSON format is preferable for the expected result.
Step S220, the test cases are operated, and corresponding response results are obtained;
specifically, the response result can be obtained by running the test cases through the test tool, and the response is automatically verified according to the expected result. In addition, when receiving the interface test request of the user, the interface information of each interface to be tested in the test case is read through the test tool, and the interface information of each interface to be tested can be respectively stored into the corresponding interface information unit.
Step S230, matching the response result with the expected result to obtain a test result of the test case;
specifically, in this embodiment, the expected result is an expected test effect of the performance layer state transition interface to be tested by the user, and is obtained by editing the test case in advance by the user. The information editing of the test case can be input by a user through a user interaction interface. And matching the expected result input by the user with the response result output in practice, so as to obtain the test result of the representation layer transition interface. And (5) verification.
And step S240, generating a corresponding test report according to the test result.
Specifically, the existence form of the test report includes, but is not limited to, data, forms, files, and the like. The present embodiment is preferable to form pages, where one form page corresponds to one test case, and the interface is transferred to the same performance layer. Therefore, the test cases are copied to form pages by the user and modified into different test cases (such as test cases with various boundary values entering the test parameters), so that analysis work after the test is not needed to be analyzed by a tester after the test is finished, and the test efficiency is improved.
According to the scheme, the corresponding expected result is obtained by reading the preset test case at the preset time point, wherein the test case is created based on the preset presentation layer state transition interface and the test template; operating the test case to obtain a corresponding response result; matching the response result with the expected result to obtain a test result of the test case; and generating a corresponding test report according to the test result. By adopting data driving test, namely automatically reading and running the test cases at a preset time point, obtaining the test results of the test cases and generating a test report, the technical problem of low interface test efficiency can be solved, and the interface test efficiency is improved.
Referring to fig. 3, fig. 3 is a flowchart of a second exemplary embodiment of the interface testing method of the present application. Based on the embodiment shown in fig. 2, step S210, before the preset test case is read at the preset time point and the corresponding expected result is obtained, further includes:
step S310, obtaining a target entry parameter value;
specifically, since the management of the test cases is realized by means of the configuration files, when the test cases need to be maintained, the user edits the configuration files, namely, the target entry parameter values in the test cases are modified, so that huge test codes do not need to be maintained.
Further, step S310, obtaining the target entry parameter value includes:
step S311, obtaining the value range of the interface input parameter;
specifically, the value range of each input parameter value of the interface to be tested is read from the structured interface data of the interface to be tested, n test cases are generated according to the value range of each input parameter value, and n is an integer greater than 1. The actual value of each input parameter included in each test case is different from the value of each input parameter in at least one or more input parameter values.
Step S312, different target input parameters are generated according to the value range.
Specifically, the test case includes a set of target input parameter values of all interface input parameters of the interface to be tested, and the test case generated by the test tool is different from the input parameter value corresponding to each input parameter value, where the different input parameter values in the test case and each interface input parameter value are determined according to the value range of each interface input parameter. And respectively replacing the value examples of each input parameter in the automatic test case template by n test cases to generate n automatic test cases. Each automated test case corresponds to an expected result. The expected results are used to automate the expected results obtained after testing the cases.
And step S320, filling information into the test template based on the target entry parameter value to obtain the test case, wherein the test template is generated and obtained according to the performance layer state transition interface.
Specifically, the target input parameter values of the interfaces to be tested are respectively filled into the corresponding positions of the corresponding test templates of the interfaces to be tested, so that the target interface test cases can be generated and fed back to the user.
In addition, the corresponding interface prompt information can be screened out according to different interface information by using a preset interface engine, so that the number of times of switching or checking the reference information of the item (configuration file) in filling is reduced, the writing time is shortened, and the writing efficiency is improved. After filling, generating a target interface test case with complete information and feeding back the test case to a user, so that the user fills out corresponding operation steps according to actual requirements to link to corresponding configuration files in the project. For example, a user uploads a configuration file of a certain item to be tested, triggers an operation of requesting an interface test case, reads all interface information of the test item from the configuration file carried in the request, stores each interface information into a corresponding interface information unit, and each interface information unit includes corresponding interface information.
After an automatic test case is generated, whether the test case is the last test case corresponding to the interface to be tested is detected. If the test case is not the last test case corresponding to the interface to be tested, continuously generating an automatic test case corresponding to the next test case; if the test case is the last test case corresponding to the interface to be tested, starting the execution process of the automatic test case.
In this embodiment, in order to ensure the correctness of the interface test case filling, a preset checking mechanism is embedded. The preset checking mechanism is used for monitoring whether the filled target parameter value is wrong or not, ensuring the correctness of the generated interface test case, triggering the preset checking mechanism to send out early warning and error logs when the filled target parameter value is wrong, and sending the error logs to a user.
Further, step S320, performing information filling on a preset test template based on the target parameter value, and before obtaining the test case, further includes:
step S300, obtaining the interface address of the expression layer state transition interface;
specifically, an address (URL) representing the layer transition interface is automatically input into a configuration file of the interface address through manual operation or a test tool, then the test tool accepts a create test case command, and a configuration file path of the interface address is obtained according to the create test case command. The method comprises the steps that a test case command is created and obtained through command line input; the configuration file is preferably an excl file, and in other embodiments, may be a file such as TXT, DOC, etc.
Step S301, analyzing the interface address to obtain a corresponding interface entry;
specifically, the interface entry is a state of transition of the presentation layer and each attribute of the interface, and the interface entry includes, but is not limited to, an interface name, an interface type, a request protocol, a request path, a request protocol, an entry, an expected result, and the like. Among them, JSON format is preferable for the expected result. The interface input parameters of the interface are automatically analyzed through the test tool which is sequentially connected with the test interface.
Step S302, performing field configuration on the interface input parameters to generate a corresponding test template.
Specifically, according to the test template of the excl file type, an initial version of the test case is automatically created. Wherein the entry is expressed in JASON format, so that various complex entries can be represented. The test cases are stored in the excl file, so that the user can read and modify the test cases conveniently.
In this embodiment, each target input parameter value is respectively filled into a corresponding position in the interface test case to be tested, and a target interface test case is generated and fed back to the user. The corresponding interface information can be screened out according to the interface information contained in different interface information units by using a preset interface engine, so that the number of times of switching or checking the reference information of the project (configuration file) in filling is reduced, the writing time is shortened, the writing efficiency is improved, the target interface test case with complete information is generated after filling and fed back to the user, and the user fills out the corresponding operation steps according to actual requirements to link to the corresponding configuration file in the project.
Further, the test case includes a plurality of fields, and step S320, after performing information filling on a preset test template based on the target parameter value to obtain the test case, further includes:
step S330, when the operation request of the field is received, the field is modified according to the positioning mapping relation of the field.
Specifically, the field is a named cell in the excl file, and the positioning mapping relation is used for positioning the field received by the testing tool when the user modifies the excl file. The field of the test case corresponds to the named cell of the excl file, that is, when the user adds rows and columns in the excl file, the field positioning is based on the named cell, x and y coordinates based on the cell are not needed, and the tool is not affected to read the field value.
According to the scheme, the interface address of the presentation layer state transition interface is obtained; analyzing the interface address to obtain a corresponding interface entry; performing field configuration aiming at the interface input parameters to generate a corresponding test template; acquiring the value range of the interface input parameter; generating different target input parameter values according to the value range; and filling information into the test template based on the target entry parameter value to obtain the test case, wherein the test template is generated according to the presentation layer state transition interface. The comprehensive and comprehensive interface test can be improved by correspondingly obtaining the configuration template according to the state transition interface of the presentation layer, generating test cases based on the configuration template and randomly generating different target parameter values.
Referring to fig. 4, fig. 4 is a flowchart of a third exemplary embodiment of the interface testing method of the present application. Based on the embodiment shown in fig. 2, step S230, matching the response result with the expected result, to obtain a test result of the test case, includes:
step S410, extracting a plurality of data to be matched from the response result;
specifically, since the response result includes a large amount of interface response information, and the expected result of the user only needs to verify a certain part of information, the efficiency of the interface test can be improved by extracting the data to be matched from the response result.
Step S420, detecting whether the expected result matches the data to be matched;
specifically, the use case editing information input by the user is matched with the pre-stored use case expected information, when one or more test results exist, a test report is generated and fed back to the user through the user interaction interface, and the user can select the use case expected information from the test results as a target input parameter value of the interface to be tested. When the test result exists, the interface state is judged to be qualified, and all interfaces with qualified states can be stored in a preset storage path, so that qualified target input parameter values can be obtained. The target entry parameter includes the operation steps of the test case of the interface to be tested, and the interface information (for example, interface name, interface type or entry parameter, etc.) of each interface that is verified to be acceptable.
Step S430, if each data to be matched and the expected result are normal, the performance layer state transition interface is indicated to be in a normal state.
Specifically, when the expected data errors filled into the interface test cases to be tested are monitored, a preset checking mechanism is triggered to send out early warning and generate early warning information, interface information corresponding to the target data is obtained from the interface test cases to be tested according to the early warning information, and error logs are generated based on the interface information and fed back to the user.
According to the scheme, the method specifically comprises the steps of extracting a plurality of data to be matched from the response result; detecting whether the expected result is matched with the data to be matched; and if each piece of data to be matched and the expected result are normal, the representation layer state transition interface is indicated to be in a normal state. By matching the expected result with the data to be matched, the accuracy of the interface test can be improved.
Referring to fig. 5, fig. 5 is a flowchart of a fourth exemplary embodiment of the interface testing method of the present application. Based on the embodiment shown in fig. 2, step S210 further includes, after the reading of the preset test case at the preset time point:
step S510, obtaining a test method and a target server of the performance layer state transition interface;
specifically, when the test JOB trigger time is reached, the tool reads interface information in the test cases one by one, sends a request to the server, and then collects a response result.
Further, in step S220, the step of running the test case and obtaining the corresponding response result includes: step S520, sending a test request to the target server by the test method, so as to receive a corresponding response result.
Specifically, comparing the response result with the expected result to obtain a test case test result; and summarizing test case test results to generate a test report.
According to the scheme, the method comprises the steps of obtaining a testing method and a target server of the performance layer state transition interface; the step of operating the test case and obtaining the corresponding response result comprises the following steps: and sending a test request to the target server through the test method so as to receive a corresponding response result. By reading the test cases to obtain the corresponding test methods and the target server, the safety of interface test can be improved.
In addition, the embodiment of the application also provides an interface testing device, which comprises:
the system comprises a case reading module, a test case processing module and a test template processing module, wherein the case reading module is used for reading a preset test case at a preset time point to obtain a corresponding expected result, and the test case is created based on a preset presentation layer state transition interface and the test template;
the case operation module is used for operating the test case to obtain a corresponding response result;
the result verification module is used for matching the response result with the expected result to obtain a test result of the test case;
and the report generating module is used for generating a corresponding test report according to the test result.
The principle and implementation process of the interface test are implemented in this embodiment, please refer to the above embodiments, and are not repeated here.
In addition, the embodiment of the application also provides a terminal device, which comprises a memory, a processor and an interface test program stored on the memory and capable of running on the processor, wherein the interface test program realizes the steps of the interface test method when being executed by the processor.
Because the interface test program is executed by the processor and adopts all the technical schemes of all the embodiments, the interface test program at least has all the beneficial effects brought by all the technical schemes of all the embodiments and is not described in detail herein.
In addition, the embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores an interface test program, and the interface test program realizes the steps of the interface test method when being executed by a processor.
Because the interface test program is executed by the processor and adopts all the technical schemes of all the embodiments, the interface test program at least has all the beneficial effects brought by all the technical schemes of all the embodiments and is not described in detail herein.
Compared with the prior art, the interface testing method, the device, the terminal equipment and the storage medium provided by the embodiment of the application obtain the corresponding expected result by reading the preset test case at the preset time point, wherein the test case is created based on the preset presentation layer state transition interface and the test template; operating the test case to obtain a corresponding response result; matching the response result with the expected result to obtain a test result of the test case; and generating a corresponding test report according to the test result. By adopting data driving test, namely automatically reading and running the test cases at a preset time point, obtaining the test results of the test cases and generating a test report, the technical problem of low interface test efficiency can be solved, and the interface test efficiency is improved. Based on the scheme of the application, a test template based on the performance layer state transfer interface is constructed from the test rule of the performance layer state transfer interface, the effectiveness of the interface test method provided by the application is verified on the test template, and finally the efficiency of the interface test by the method is obviously improved.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as above, including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to perform the method of each embodiment of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (10)

1. An interface testing method is characterized by comprising the following steps:
reading a preset test case at a preset time point to obtain a corresponding expected result, wherein the test case is created based on a preset presentation layer state transition interface and a test template;
operating the test case to obtain a corresponding response result;
matching the response result with the expected result to obtain a test result of the test case;
and generating a corresponding test report according to the test result.
2. The interface testing method according to claim 1, wherein before the step of reading the preset test case at the preset time point to obtain the corresponding expected result, the method further comprises:
obtaining a target entry parameter value;
and filling information into the test template based on the target entry parameter value to obtain the test case, wherein the test template is generated according to the presentation layer state transition interface.
3. The interface testing method according to claim 2, wherein before the step of filling the preset test template with information based on the target parameter value to obtain the test case, the method further comprises:
acquiring an interface address of the presentation layer state transition interface;
analyzing the interface address to obtain a corresponding interface entry;
and performing field configuration on the interface input parameters to generate a corresponding test template.
4. The interface test method of claim 3, wherein the step of obtaining the target entry parameter value comprises:
acquiring the value range of the interface input parameter;
and generating different target input parameters according to the value range.
5. The interface testing method according to claim 2, wherein the test case includes a plurality of fields, and the step of filling the preset test template with information based on the target parameter value, after obtaining the test case, further includes:
and when receiving the operation request of the field, modifying the field according to the positioning mapping relation of the field.
6. The interface test method of claim 1, wherein the step of matching the response result with the expected result to obtain a test result of the test case comprises:
extracting a plurality of data to be matched from the response result;
detecting whether the expected result is matched with the data to be matched;
and if each piece of data to be matched and the expected result are normal, the representation layer state transition interface is indicated to be in a normal state.
7. The interface test method according to claim 1, wherein after the step of reading the preset test case at the preset time point, further comprising:
obtaining a test method and a target server of the performance layer state transition interface;
the step of operating the test case and obtaining the corresponding response result comprises the following steps:
and sending a test request to the target server through the test method so as to receive a corresponding response result.
8. An interface testing device, characterized in that the interface testing device comprises:
the system comprises a case reading module, a test case processing module and a test template processing module, wherein the case reading module is used for reading a preset test case at a preset time point to obtain a corresponding expected result, and the test case is created based on a preset presentation layer state transition interface and the test template;
the case operation module is used for operating the test case to obtain a corresponding response result;
the result verification module is used for matching the response result with the expected result to obtain a test result of the test case;
and the report generating module is used for generating a corresponding test report according to the test result.
9. A terminal device, characterized in that it comprises a memory, a processor and an interface test program stored on the memory and executable on the processor, which when executed by the processor realizes the steps of the interface test method according to any of claims 1-7.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon an interface test program, which when executed by a processor, implements the steps of the interface test method according to any of claims 1-7.
CN202211646693.2A 2022-12-21 2022-12-21 Interface testing method, device, terminal equipment and storage medium Pending CN116166533A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211646693.2A CN116166533A (en) 2022-12-21 2022-12-21 Interface testing method, device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211646693.2A CN116166533A (en) 2022-12-21 2022-12-21 Interface testing method, device, terminal equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116166533A true CN116166533A (en) 2023-05-26

Family

ID=86421073

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211646693.2A Pending CN116166533A (en) 2022-12-21 2022-12-21 Interface testing method, device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116166533A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117347755A (en) * 2023-09-27 2024-01-05 广州致远仪器有限公司 Test method, system, equipment and storage medium based on state machine

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117347755A (en) * 2023-09-27 2024-01-05 广州致远仪器有限公司 Test method, system, equipment and storage medium based on state machine

Similar Documents

Publication Publication Date Title
US11822919B2 (en) Auto-generation of API documentation via implementation-neutral analysis of API traffic
US10613971B1 (en) Autonomous testing of web-based applications
CN108319547B (en) Test case generation method, device and system
US8745641B1 (en) Automatic verification and anomaly detection in a representational state transfer (REST) application programming interface
CN109902016B (en) Web test method and test platform
CN111178027A (en) Report generation system and method based on online creation template and online specified data
CN109376291B (en) Website fingerprint information scanning method and device based on web crawler
CN110287109B (en) Protocol interface testing method and device, computer equipment and storage medium thereof
CN105099811A (en) Interface testing method and device
US20160292143A1 (en) System and method for automated online wizard generation
CN107085549B (en) Method and device for generating fault information
CN110647471A (en) Interface test case generation method, electronic device and storage medium
CN114138244A (en) Method and device for automatically generating model files, storage medium and electronic equipment
CN116166533A (en) Interface testing method, device, terminal equipment and storage medium
CN113296653B (en) Simulation interaction model construction method, interaction method and related equipment
CN110365776B (en) Picture batch downloading method and device, electronic equipment and storage medium
CN112367220B (en) Interface testing method and device, storage medium and electronic equipment
CN111309371A (en) Query method and device
CN111158973A (en) Web application dynamic evolution monitoring method
CN110874278A (en) Embedding method of external system, workflow system, device and storage medium
CN107797917B (en) Performance test script generation method and device
CN115033481A (en) Method and device for automatic test code generation based on browser access and computer equipment
CN114490892A (en) Data transmission method and device based on datax
CN115033436A (en) Page testing method and device, electronic equipment and storage medium
CN113485927A (en) Test data generation method, device, equipment and storage medium

Legal Events

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