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

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

Info

Publication number
CN114090454B
CN114090454B CN202111431830.6A CN202111431830A CN114090454B CN 114090454 B CN114090454 B CN 114090454B CN 202111431830 A CN202111431830 A CN 202111431830A CN 114090454 B CN114090454 B CN 114090454B
Authority
CN
China
Prior art keywords
interface
tested
script
automatic
extractor
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.)
Active
Application number
CN202111431830.6A
Other languages
Chinese (zh)
Other versions
CN114090454A (en
Inventor
石永奎
黄岗
周圣强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OP Retail Suzhou Technology Co Ltd
Original Assignee
OP Retail Suzhou 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 OP Retail Suzhou Technology Co Ltd filed Critical OP Retail Suzhou Technology Co Ltd
Priority to CN202111431830.6A priority Critical patent/CN114090454B/en
Publication of CN114090454A publication Critical patent/CN114090454A/en
Application granted granted Critical
Publication of CN114090454B publication Critical patent/CN114090454B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4488Object-oriented
    • G06F9/449Object-oriented method invocation or resolution

Landscapes

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

Abstract

The invention discloses an automatic interface testing method, device, equipment and storage medium, wherein the method comprises the following steps: determining a newly added interface of a product as an interface to be tested, and adding interface information of the interface to be tested into an automatic script, wherein the automatic script is used for realizing product testing and can realize calling of the interface to be tested based on the interface information when the automatic script is operated; adding an assertion to the interface to be tested in the automation script, wherein the assertion can judge whether the corresponding function is successfully realized after the interface to be tested is called; and running the automation script to obtain a corresponding running result so as to realize the automatic test of the interface to be tested and the product to which the interface to be tested belongs. Therefore, when the new interface is added to the product, the test of the new interface is automatically realized, so that the human resources can be effectively saved, and the test efficiency is improved.

Description

Interface automatic testing method, device, equipment and storage medium
Technical Field
The present invention relates to the field of interface testing technologies, and in particular, to an interface automated testing method, apparatus, device, and storage medium.
Background
Currently, most software companies have own testing parts, and corresponding software testers manually test new interfaces of products when versions of the products are iterated, so that the testing efficiency is low, and human resources are wasted.
Disclosure of Invention
The invention aims to provide an interface automatic testing method, device, equipment and storage medium, which can effectively save human resources and improve testing efficiency.
In order to achieve the above purpose, the invention provides the following technical scheme:
an interface automation test method comprises the following steps:
determining a newly added interface of a product as an interface to be tested, and adding interface information of the interface to be tested into an automatic script; the automatic script is used for realizing product testing, and calling of the interface to be tested can be realized based on the interface information when the automatic script is operated;
adding an assertion to the interface to be tested in the automation script, wherein the assertion can judge whether the corresponding function is successfully realized after calling the interface to be tested;
and running the automation script to obtain a corresponding running result so as to realize the automatic test of the interface to be tested and the product to which the interface to be tested belongs.
Preferably, after the adding the interface information of the interface to be tested to the automation script, the method further includes:
and adding an extractor for the interface to be tested in the automatic script, wherein the extractor can extract a valid field in the obtained response data after calling the interface to be tested so that the assertion can judge whether the corresponding function is successfully realized based on the valid field.
Preferably, before adding an extractor to the interface to be tested in the automation script, the method further includes:
and judging whether response data are returned after the interface to be tested is called, if so, executing the step of adding an extractor for the interface to be tested in the automatic script, and otherwise, determining that the extractor does not need to be added for the interface to be tested in the automatic script.
Preferably, adding an extractor to the interface to be tested in the automation script includes:
adding a json extractor, a regular extractor or a beanshall post processor to the interface to be tested in the automation script.
Preferably, after adding an extractor to the interface to be tested in the automation script, the method further includes:
and adding a logic controller for the interface to be tested in the automation script, wherein the logic controller can control to continuously execute corresponding business logic based on the effective field.
Preferably, before the running the automation script to obtain the corresponding running result, the method further includes:
and judging whether the current time is a preset test time point, if so, executing the step of running the automation script to obtain a corresponding running result, otherwise, waiting to the preset test time point and executing the step of running the automation script to obtain a corresponding running result.
Preferably, adding the interface information of the interface to be tested to an automation script includes:
interface information corresponding to the interface to be tested is set in the automatic script, an interface address and corresponding request parameters of the interface to be tested are set in the interface information, and a corresponding interface request is set for the interface to be tested in the interface information.
An interface automated testing apparatus, comprising:
a request addition module to: determining a newly added interface of a product as an interface to be tested, and adding interface information of the interface to be tested into an automatic script; the automatic script is used for realizing product testing, and calling of the interface to be tested can be realized based on the interface information when the automatic script is operated;
an assertion addition module to: adding an assertion to the interface to be tested in the automation script, wherein the assertion can judge whether the corresponding function is successfully realized after the interface to be tested is called;
a test module to: running the automation script to obtain corresponding running results so as to realize the automatic test of the interface to be tested and the product to which the interface to be tested belongs
An interface automated test equipment comprising:
a memory for storing a computer program;
a processor for implementing the steps of the interface automation test method as described in any one of the above when the computer program is executed.
A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the interface automation test method according to any one of the preceding claims.
The invention provides an interface automatic test method, a device, equipment and a storage medium, wherein the method comprises the following steps: determining that a newly added interface of a product is an interface to be tested, and adding interface information of the interface to be tested into an automatic script, wherein the automatic script is used for realizing product testing, and calling of the interface to be tested can be realized based on the interface information when the automatic script is operated; adding an assertion to the interface to be tested in the automation script, wherein the assertion can judge whether the corresponding function is successfully realized after the interface to be tested is called; and running the automation script to obtain a corresponding running result so as to realize the automatic test of the interface to be tested and the product to which the interface to be tested belongs. According to the method and the device, after any interface is newly added to a product, interface information and corresponding assertion of the any interface are added to the automation script, and then the automation script is operated, so that calling of the any interface is realized based on the interface information, and whether corresponding functions of the any interface are successfully realized is determined, and therefore, automatic testing of the corresponding interface is realized. Therefore, when the new interface is added to the product, the test of the new interface is automatically realized, so that the manpower resource can be effectively saved, and the test efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of an interface automation test method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an interface automation test apparatus according to an embodiment of the present invention.
Detailed Description
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 obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Referring to fig. 1, a flowchart of an interface automation testing method according to an embodiment of the present invention is shown, where the method includes:
s11: determining a newly added interface of the product as an interface to be tested, and adding interface information of the interface to be tested into the automatic script; the automatic script is used for realizing product testing, and calling of the interface to be tested can be realized based on the interface information when the automatic script is operated.
It should be noted that, the product in the embodiment of the present application is a software product, when the version of the product is iterated, a corresponding interface may need to be newly added, and the interface newly added to the product needs to implement a corresponding test to determine whether the function of the interface can be normally implemented, so that when the interface is newly added to the product, the newly added interface can be used as an interface to be tested, and then, an automatic test on the interface to be tested is implemented. In addition, the product and the automation script can be set to have one-to-one correspondence, so that when the automation test is realized on any product and the interface thereof, the automatic test method of the interface is realized aiming at the automation script corresponding to the any product; when the corresponding product does not comprise any interface, the automatic script can be blank or only comprise a universal part (such as the beginning, the end and the like) of a code used for testing any interface, and further after the product has an additional interface, the code used for testing the additional interface is automatically added into the automatic script according to the interface automatic testing method provided by the embodiment of the application, so that the automatic script is operated to realize the test of the code contained in the automatic script corresponding to all the interfaces, namely after the additional interface of the product is added, the additional interface and other interfaces contained in the product are required to be tested, so that the additional interface can realize functions, and meanwhile, other interfaces of the product can also realize functions after the additional interface of the product.
In order to realize the automatic test of the newly added interface of the product, interface information corresponding to the interface to be tested needs to be added to the automatic script at first, so that the calling of the interface to be tested can be realized based on the interface information when the automatic script runs, and then whether the function to be realized by the interface to be tested can be successfully realized is determined based on the calling condition of the interface to be tested, and the calling of the interface to be tested is completed. In addition, the embodiment of the application can be realized based on a meter, namely, the meter tool and each component contained in the meter tool are utilized to realize the automatic interface test; therefore, before the interface automatic test is realized, the corresponding configuration of the jmeter can be realized in the equipment for realizing the interface test, which may include configuring a jdk environment, installing the jmeter in the configured jdk environment, and configuring an environment variable corresponding to the jmeter in the configured jdf environment, so that the jmeter can run in the equipment for realizing the interface test, and then running the jmeter in the equipment for realizing the interface test, so as to realize the interface automatic test method provided in the embodiment of the present application by using the jmeter, thereby further improving the automation degree of the interface test; the jmeter tool is a testing tool developed based on java language, and is internally provided with abundant components to compile automatic testing scripts, and can compile automatic scripts according to the service logic of a product, and the automatic scripts can be realized both in conventional scripts and in service scripts, and can be independently operated and generate a testing report after being compiled, so that the labor is greatly saved, and the working efficiency is improved.
S12: and adding an assertion to the interface to be tested in the automation script, wherein the assertion can judge whether the corresponding function is successfully realized after calling the interface to be tested.
After the addition of the interface information corresponding to the interface to be tested to the automatic script is realized, the corresponding assertion can be added after the interface information of the interface to be tested; when the automatic script runs, the corresponding interface is called based on the interface information, then whether the function of the interface is successfully realized after the interface is called is judged by using the corresponding assertion, if the function can be successfully realized, the test of the interface is determined to be passed, otherwise, the test of the interface is not passed, and therefore the automatic test of the interface is realized. In addition, the assertion can set forward assertion or backward assertion, the forward assertion is to judge whether the response data returned by the interface or the state of the interface request is the same as the expected value, the backward assertion is to directly ignore the correctness of the interface request corresponding to the interface, and the request is displayed to be successful in a report even if the result of the interface request is different from the expected value of the assertion. It should be noted that the data information added in the automation script is all implemented in the form of code.
S13: and running the automation script to obtain a corresponding running result so as to realize the automatic test of the interface to be tested and the affiliated product.
After the addition of the corresponding data information of the newly added interface of the product into the automation script is completed, the automation script can be operated to obtain a corresponding operation result, and the operation result comprises information of whether the test of the interface to be tested passes or not, so that the test of the newly added interface and other interfaces corresponding to the code in the automation script is realized, and the purpose of automatically testing the interface is achieved.
According to the method and the device, after any interface is newly added to a product, interface information and corresponding assertion of the any interface are added to the automation script, and then the automation script is operated, so that calling of the any interface is realized based on the interface information, and whether corresponding functions of the any interface are successfully realized is determined, and therefore, automatic testing of the corresponding interface is realized. Therefore, when the new interface is added to the product, the test of the new interface is automatically realized, so that the manpower resource can be effectively saved, and the test efficiency is improved.
The method for automatically testing an interface provided by the embodiment of the present invention may further include, after adding the interface information of the interface to be tested to the automation script:
and adding an extractor for the interface to be tested in the automatic script, wherein the extractor can extract the effective field in the obtained response data after calling the interface to be tested so as to enable the assertion to judge whether the corresponding function is successfully realized based on the effective field.
Before adding an extractor for the interface to be tested in the automation script, the method may further include:
and judging whether response data are returned after the interface to be tested is called, if so, executing the step of adding an extractor for the interface to be tested in the automatic script, and otherwise, determining that the extractor does not need to be added for the interface to be tested in the automatic script.
Adding an extractor for an interface to be tested in an automation script may include:
adding a json extractor, a regular extractor or a benshall post processor to the interface to be tested in an automation script.
It should be noted that, after the interface information, the assertion, the extractor and the logic controller are correspondingly set for a single interface, the interface information, the assertion, the extractor and the logic controller are used for realizing automatic testing for the single interface; based on that, the assertion set in the embodiment of the present application may determine the correctness of the interface request only based on whether the corresponding function is implemented when the interface to be tested is called, or may determine the correctness of the interface request and the accuracy of the response data by judging whether the response data returned by the interface to be tested is the expected response data; when the interface to be tested returns response data, a corresponding extractor can be added to the interface to be tested in the automatic test script, the extractor can extract an effective field contained in the response data after the interface to be tested is called to return the response data, so that the assertion can determine the correctness of the interface request and the accuracy of the response data based on whether the effective field is consistent with an expected field, and when the interface to be tested does not return the response data (only one response code can be provided) or other interfaces do not need to use the response data returned by the interface to be tested, the corresponding extractor can not be arranged, so that the corresponding resource waste is avoided; thereby further improving the automation of the interface test. The valid field may be all fields of the response data, or may be a specific field in the preset response data, and of course, other settings performed according to actual needs are also within the scope of the present invention.
In addition, the extractor added to the interface to be tested may be a json extractor or a regular extractor (implemented based on a regular expression) or a beanshall post processor to extract a valid field in the response data of the interface to be tested (single interface). The json extractor is used for processing data in the json format returned by the interface, the regular extractor is used for extracting data (the data types comprise the json format and the html format) by using a regular expression, the beanshall post processor is used for processing an array returned by the interface by using a beanshall language, and the required field value is analyzed and then output. Therefore, the specific implementation mode of the extractor can be selected based on actual needs, and the automatic test of the interface is more flexible.
The method for automatically testing the interface provided by the embodiment of the invention can further comprise the following steps after the extractor is added to the interface to be tested in the automatic script:
and adding a logic controller for the interface to be tested in the automation script, wherein the logic controller can control to continuously execute corresponding business logic based on the effective field.
It should be noted that, in the embodiment of the present application, a logic Controller (if Controller) may also be added to the automation script, and the logic Controller automatically executes subsequent service logic according to different effective field values returned by the interface, so as to automatically generate automation scripts in different service scenes, and meet requirements of different service scenes. Therefore, the interface script has higher integrity by adding the logic Controller if Controller and the extractor, if any interface reports an error, the subsequent interface reports an error or stops running the automation script, and the automation running result is a failure.
Before the automated script is run to obtain the corresponding running result, the method for automatically testing the interface provided by the embodiment of the invention may further include:
and judging whether the current time is a preset test time point, if so, executing the step of running the automation script to obtain a corresponding running result, and otherwise, waiting to the preset test time point and executing the automation script to obtain a corresponding running result.
In order to avoid frequent running of the automation scripts, at least one time point for running the automation scripts to realize automatic interface testing can be preset, namely a testing time point, which can also be called a time node; and if the current time is the test time point, running the automatic script to realize the corresponding test, otherwise, waiting until the arrival time reaches any test time point, and then running the automatic script to realize the corresponding test. Determining whether the current time is a test time point, namely determining whether point inspection research and development are needed currently; in addition, when the current point inspection research and development are determined to be needed, the automatic script is operated to obtain a corresponding operation result, whether the interface to be tested affects the functions of other interfaces is judged based on the operation result, and the operation of the automatic script is stopped when the judgment result of the other interfaces is incorrect, a corresponding error code is output, and corresponding prompt information can be output aiming at the error code to prompt a corresponding solution.
The interface automatic testing method provided by the embodiment of the invention adds the interface information of the interface to be tested into the automatic script, and can include the following steps:
interface information corresponding to the interface to be tested is set in the automatic script, an interface address and corresponding request parameters of the interface to be tested are set in the interface information, and a corresponding interface request is set for the interface to be tested in the interface information.
It should be noted that the interface information in the embodiment of the present application may be an HTTP Request, and therefore, the adding of the interface information of the interface to be tested in the embodiment of the present application may specifically include: adding an HTTP Request of an interface to be tested in an automatic script, filling an interface address of the interface to be tested and Request parameters (information of an interface Request) of the interface to be tested in the HTTP Request, and selecting a get Request or a post Request according to the interface type of the interface to be tested to complete the addition of the single interface Request of the interface to be tested; therefore, the corresponding interface can be quickly and conveniently called based on the information.
In a specific implementation manner, the interface automation test method provided in the embodiment of the present invention specifically includes the following steps:
1. configuring the jdk environment, installing the meter, and configuring the environment variables.
2. Running a jmeter, inputting interface information according to an actual service logic scene, adding a jmeter logic controller to generate an interface automation script, wherein the content of the interface automation script comprises:
1) Adding an HTTP Request, filling in an interface address and Request parameters, selecting a get Request or a post Request according to the interface type, and completing the addition of a single-interface Request; meanwhile, after the single interface request, assertion can be added to judge the correctness of the interface request and the accuracy of data by using the assertion, if the interface request and the data are correct, the subsequent service logic is continuously executed, otherwise, the script operation is stopped;
2) Adding a json extractor or a regular extractor or a beanshall post processor to extract a valid field of response data of an interface (single interface); if the interface does not have any response data or other interfaces do not use the response data of the interface, a json extractor or a regular extractor or a beanshall post processor is not needed to extract corresponding valid fields, so that an extractor is not needed to be set;
3) And adding an if Controller to automatically execute subsequent service logic according to different effective field values returned by the interface, thereby generating automatic scripts of different service logic scenes.
3. And judging whether point detection research and development exist or not through the time node, if so, running the automation script, and otherwise, running the automation script when waiting until the point detection research and development exist.
Step 2 is illustrated: add HTTP Request (interface information); based on the interface response, adding assertion, taking the interface for creating data and the assertion as response assertion as examples, returning id of the created data after the interface is called, calling the interface for obtaining list data to display the id in a list, and further using the id as assertion, so that the accuracy of the data can be verified and the id can be used as the interface accuracy assertion for obtaining the list; adding a total field value of response data extracted by an Extractor, wherein json Extractor is taken as an example for judgment; if an if Controller is added to judge the value of the total, if a store is provided with a store length interface, the total =1 is returned, if the store is not provided with the store length, the total =0 is returned, test reports which are produced into different logics are run according to different scripts of field parameters, for example, when the total value is equal to 0, the page logic indicates that the store is not provided with the store length, the script automatically calls the interface for setting the store length, the store length is set for the store and then the logic of the tour store is walked, when the total value is equal to 1, the store length is set for the store, the logic of the tour store is directly walked, and for example, when a user walks the tour, if the default total pass is opened, the current score is returned by the interface, the service logic is unqualified and unsuitable for the modified point inspection state, the score calculation logic is total score-deducted, if the default total score is closed, the total score is returned by the interface is 0, the service logic is qualified, unqualified and unsuitable for the score of each inspection point.
When the interface is newly added to a product, a set of complete interface automation script is compiled by using the jmeter tool and each component inside the jmeter tool, the script can set corresponding assertion to judge the correctness of the interface according to the request of each interface, and also contains service logic corresponding to the product, so that the product interface is newly added or is adjusted every time, and only the script needs to be adjusted to operate, whether the whole set of flow is complete or not can be judged, a test report is output, and the regression test of company manpower is saved. Specifically, interface information is input based on a jmeter tool, a logic controller is added to enable a script to conform to an actual scene, correctness of an assertion judging interface is added, an extractor is added to enable the whole parameterization of the script to more conform to an operation result of manual operation, and after point inspection research and development exist, the script is operated to quickly judge whether the original interface, service logic and the like are influenced in the point inspection research and development process according to the correctness of the assertion.
An embodiment of the present invention further provides an interface automation testing apparatus, as shown in fig. 2, which may specifically include:
a request adding module 11, configured to: determining a newly added interface of the product as an interface to be tested, and adding interface information of the interface to be tested into the automatic script; the automatic script is used for realizing product testing, and calling of the interface to be tested can be realized based on the interface information when the automatic script is operated;
an assertion addition module 12 for: adding an assertion to the interface to be tested in the automation script, wherein the assertion can judge whether the corresponding function is successfully realized after the interface to be tested is called;
a test module 13 for: and running the automation script to obtain a corresponding running result so as to realize the automatic test of the interface to be tested and the affiliated product.
The interface automation testing device provided by the embodiment of the invention can further comprise:
an extractor addition module to: after the interface information of the interface to be tested is added into the automatic script, an extractor is added to the interface to be tested in the automatic script, and the extractor can extract an effective field in the obtained response data after calling the interface to be tested so as to enable the assertion to judge whether the corresponding function is successfully realized or not based on the effective field.
The interface automation test device provided by the embodiment of the invention can also comprise:
a return judgment module for: before adding an extractor for the interface to be tested in the automatic script, judging whether response data is returned after calling the interface to be tested, if so, executing the step of adding the extractor for the interface to be tested in the automatic script, otherwise, determining that the extractor does not need to be added for the interface to be tested in the automatic script.
In the interface automation test apparatus provided in the embodiment of the present invention, the extractor addition module may specifically include:
an extractor adding unit to: adding a json extractor, a regular extractor or a benshall post processor to the interface to be tested in an automation script.
The interface automation test device provided by the embodiment of the invention can also comprise:
a controller addition module to: and after the extractor is added to the interface to be tested in the automation script, a logic controller is added to the interface to be tested in the automation script, and the logic controller can control to continuously execute corresponding business logic based on the valid field.
The interface automation testing device provided by the embodiment of the invention can further comprise:
a time determination module configured to: before the automatic script is operated to obtain a corresponding operation result, judging whether the current time is a preset test time point, if so, executing the step of operating the automatic script to obtain a corresponding operation result, otherwise, waiting to the preset test time point and executing the automatic script to obtain a corresponding operation result.
In an interface automation testing apparatus provided in an embodiment of the present invention, the request adding module may include:
a request addition unit configured to: interface information corresponding to the interface to be tested is set in the automation script, an interface address and corresponding request parameters of the interface to be tested are set in the interface information, and a corresponding interface request is set for the interface to be tested in the interface information.
An embodiment of the present invention further provides an interface automation test device, which may include:
a memory for storing a computer program;
a processor for implementing the steps of the interface automation test method as described in any one of the above when the computer program is executed.
The embodiment of the invention also provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when being executed by a processor, the computer program can realize the steps of any one of the above interface automatic testing methods.
It should be noted that, for the description of the relevant parts in the interface automation test apparatus, the device and the storage medium provided in the embodiment of the present invention, reference is made to the detailed description of the corresponding parts in the interface automation test method provided in the embodiment of the present invention, and details are not repeated here. In addition, parts of the technical solutions provided in the embodiments of the present invention that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail, so as to avoid redundant description.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (6)

1. An automated interface testing method, comprising:
determining a newly added interface of a product as an interface to be tested, and adding interface information of the interface to be tested into an automatic script; the automatic script is used for realizing product testing, and calling of the interface to be tested can be realized based on the interface information when the automatic script is operated;
adding an extractor for the interface to be tested in the automatic script, wherein the extractor can extract a valid field in the obtained response data after calling the interface to be tested so as to judge whether the corresponding function is successfully realized based on the valid field;
before adding an extractor for the interface to be tested in the automation script, the method further comprises the following steps:
judging whether response data are returned after the to-be-tested interface is called, if so, executing the step of adding an extractor for the to-be-tested interface in the automatic script, and otherwise, determining that the extractor does not need to be added for the to-be-tested interface in the automatic script;
adding an assertion to the interface to be tested in the automation script, wherein the assertion can judge whether the corresponding function is successfully realized after the interface to be tested is called;
running the automation script to obtain a corresponding running result so as to realize the automatic test of the interface to be tested and the product to which the interface to be tested belongs;
after adding an extractor for the interface to be tested in the automation script, the method further comprises the following steps:
adding a logic controller for the interface to be tested in the automation script, wherein the logic controller can continuously execute corresponding business logic based on the effective field control;
before the automation script is run to obtain a corresponding running result, the method further comprises the following steps:
and judging whether the current time is a preset test time point, if so, executing the step of running the automation script to obtain a corresponding running result, otherwise, waiting to the preset test time point and executing the step of running the automation script to obtain the corresponding running result.
2. The method of claim 1, wherein adding an extractor to the interface under test in the automation script comprises:
and adding a json extractor, a regular extractor or a beanshall post processor to the interface to be tested in the automation script.
3. The method of claim 1, wherein adding interface information of the interface to be tested to an automation script comprises:
interface information corresponding to the interface to be tested is set in the automatic script, an interface address and corresponding request parameters of the interface to be tested are set in the interface information, and a corresponding interface request is set for the interface to be tested in the interface information.
4. An automated interface testing device, comprising:
a request addition module to: determining a newly added interface of a product as an interface to be tested, and adding interface information of the interface to be tested into an automatic script; the automatic script is used for realizing product testing, and calling of the interface to be tested can be realized based on the interface information when the automatic script is operated;
an assertion addition module to: adding an assertion to the interface to be tested in the automation script, wherein the assertion can judge whether the corresponding function is successfully realized after the interface to be tested is called;
a test module to: running the automation script to obtain a corresponding running result so as to realize the automatic test of the interface to be tested and the product to which the interface to be tested belongs;
an extractor addition module to: after the interface information of the interface to be tested is added into the automatic script, an extractor is added to the interface to be tested in the automatic script, and the extractor can extract an effective field in the obtained response data after calling the interface to be tested so as to enable the assertion to judge whether the corresponding function is successfully realized or not based on the effective field;
a return judgment module for: before adding an extractor for the interface to be tested in the automatic script, judging whether response data is returned after calling the interface to be tested, if so, executing the step of adding the extractor for the interface to be tested in the automatic script, otherwise, determining that the extractor does not need to be added for the interface to be tested in the automatic script;
a controller addition module to: after an extractor is added to the interface to be tested in the automation script, a logic controller is added to the interface to be tested in the automation script, and the logic controller can continue to execute corresponding business logic based on effective field control;
a time determination module configured to: before the automatic script is operated to obtain a corresponding operation result, judging whether the current time is a preset test time point, if so, executing the step of operating the automatic script to obtain the corresponding operation result, otherwise, waiting to the preset test time point and executing the automatic script to obtain the corresponding operation result.
5. An interface automation test device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the method for automated testing of an interface according to any of claims 1 to 3 when executing said computer program.
6. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method for automated testing of an interface according to any one of claims 1 to 3.
CN202111431830.6A 2021-11-29 2021-11-29 Interface automation test method, device, equipment and storage medium Active CN114090454B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111431830.6A CN114090454B (en) 2021-11-29 2021-11-29 Interface automation test method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111431830.6A CN114090454B (en) 2021-11-29 2021-11-29 Interface automation test method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114090454A CN114090454A (en) 2022-02-25
CN114090454B true CN114090454B (en) 2023-01-24

Family

ID=80305461

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111431830.6A Active CN114090454B (en) 2021-11-29 2021-11-29 Interface automation test method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114090454B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109597761A (en) * 2018-12-03 2019-04-09 四川长虹电器股份有限公司 A kind of automatic interface testing method based on Jmeter
WO2019153472A1 (en) * 2018-02-07 2019-08-15 平安科技(深圳)有限公司 Automated interface testing method, device, equipment, and storage medium
CN112817867A (en) * 2021-02-25 2021-05-18 平安消费金融有限公司 Interface test script generation method and device, computer equipment and medium
CN112905459A (en) * 2021-02-08 2021-06-04 中国工商银行股份有限公司 Service interface testing method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815139A (en) * 2019-01-03 2019-05-28 深圳壹账通智能科技有限公司 Interface test method, device, computer equipment and storage medium
CN111427765B (en) * 2020-02-17 2022-09-20 叮当快药科技集团有限公司 Method and system for automatically starting interface performance test realized based on jmeter
AU2021225408B2 (en) * 2020-02-28 2023-11-30 Hexaware Technologies Limited System and method for application environment migration

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019153472A1 (en) * 2018-02-07 2019-08-15 平安科技(深圳)有限公司 Automated interface testing method, device, equipment, and storage medium
CN109597761A (en) * 2018-12-03 2019-04-09 四川长虹电器股份有限公司 A kind of automatic interface testing method based on Jmeter
CN112905459A (en) * 2021-02-08 2021-06-04 中国工商银行股份有限公司 Service interface testing method and device, electronic equipment and storage medium
CN112817867A (en) * 2021-02-25 2021-05-18 平安消费金融有限公司 Interface test script generation method and device, computer equipment and medium

Also Published As

Publication number Publication date
CN114090454A (en) 2022-02-25

Similar Documents

Publication Publication Date Title
US7895575B2 (en) Apparatus and method for generating test driver
CN109857663B (en) Keyword driving and image similarity combined automatic test platform
CN112270149A (en) Verification platform automation integration method and system, electronic equipment and storage medium
CN111475412B (en) Software testing method, device, electronic equipment and computer readable storage medium
CN117421217A (en) Automatic software function test method, system, terminal and medium
CN110990285A (en) UI automation test method and device
CN103186459A (en) JAVA graphical user interface automatic test method based on scripts
CN110888800A (en) Service interaction function test method, device, storage medium and test system
CN110543429A (en) Test case debugging method and device and storage medium
CN111966575B (en) Graphic automatic test method for aviation onboard display software
CN114090454B (en) Interface automation test method, device, equipment and storage medium
CN111176995B (en) Test method and test system based on big data test case
CN112685311A (en) Test script automatic generation method and device, computer equipment and storage medium
CN111581101A (en) Software model testing method, device, equipment and medium
CN108132799B (en) Inter-process static program analysis information extraction method, device and equipment
CN111597105A (en) Automatic test system and method based on LV environment
CN110795341A (en) Automatic testing method, system and device for server
CN115934559A (en) Testing method of intelligent form testing system
CN115658460A (en) Automatic performance testing method and system based on cloud and vehicle-end interface
CN114297088A (en) Method, device, equipment and medium for testing front end vue frame assembly
CN111400173B (en) VTS test method, device and equipment
CN111008140B (en) Cross-platform UI (user interface) automatic testing method and device
CN113326193A (en) Applet testing method and device
CN112269740A (en) Automatic testing method and device for automatic driving software
CN114116466B (en) Unit test method, device and medium based on operation log

Legal Events

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