CN111274131A - Interface testing method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN111274131A
CN111274131A CN202010052077.9A CN202010052077A CN111274131A CN 111274131 A CN111274131 A CN 111274131A CN 202010052077 A CN202010052077 A CN 202010052077A CN 111274131 A CN111274131 A CN 111274131A
Authority
CN
China
Prior art keywords
interface
test
verification
result
check
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
CN202010052077.9A
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.)
Reach Best Technology Co Ltd
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Reach Best 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 Reach Best Technology Co Ltd filed Critical Reach Best Technology Co Ltd
Priority to CN202010052077.9A priority Critical patent/CN111274131A/en
Publication of CN111274131A publication Critical patent/CN111274131A/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/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

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

Abstract

The invention relates to an interface test switching method, a device, an electronic device and a storage medium, wherein a test case comprises interface information and check information of an interface to be tested, the check information is used for declaring a check field and a check condition, sending a test request to the interface to be tested according to the interface information, receiving a test result returned by the interface to be tested as a test result to be checked, and checking a parameter to be checked corresponding to the check field in the test result to be checked according to the check condition to determine the check result, because the test result returned by the interface to be tested is received, the test result can be checked according to the check field and the check condition declared by the preset check information, thereby realizing automatic test of the test result, and avoiding the process that the test result can only be manually analyzed and compared and checked after the test result is received in the prior art, the testing efficiency of the interface test is improved.

Description

Interface testing method and device, electronic 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 and apparatus, an electronic device, and a storage medium.
Background
The interface test is easy to realize, low in maintenance cost and high in input-output ratio, is popular with test developers, mainly tests interfaces between systems or components, mainly checks data exchange, transfers and controls management processes and mutual logic dependency relationship, and uses interface protocols including types of HTTP (Hyper Text transfer protocol), WebService (network service) and the like.
A common interface test flow generally includes: requirement analysis, case design, script development, test execution, result analysis and the like. In the prior art, after receiving a test result returned by a test interface, a tester needs to analyze a check field in the test result first, and then compare and check the analyzed check field to determine whether the test result meets expectations.
The inventor finds that, in the prior art, the test efficiency of the interface test is low because the test result can only be manually analyzed and compared after being received.
Disclosure of Invention
The present disclosure provides an interface test method, an interface test device, an electronic device, and a storage medium, so as to at least solve the problem of low test efficiency of interface tests in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided an interface testing method, including:
acquiring a preset test case, wherein the test case comprises interface information and verification information of an interface to be tested, and the verification information is used for declaring a verification field and a verification condition;
sending a test request to the interface to be tested according to the interface information;
receiving a test result returned by the interface to be tested as a test result to be verified;
and checking the parameters to be checked corresponding to the check field in the test result to be checked according to the check condition so as to determine the check result.
Further, the interface information includes: interface address, interface name and interface test parameter;
the step of sending a test request to the interface to be tested according to the interface information comprises the following steps:
determining the interface position of the interface to be tested according to the interface address and the interface name;
and sending a test request to the interface position, wherein the test request carries the test parameters.
Further, the verifying the to-be-verified parameter corresponding to the verification field in the to-be-verified test result according to the verification condition includes:
analyzing the verification information in the test case to generate an assertion expression corresponding to the verification condition;
and judging whether the parameters to be verified corresponding to the verification fields in the test results to be verified meet the assertion expression or not.
Further, the verification information includes a preset reference verification result;
analyzing the verification information in the test case to generate an assertion expression corresponding to the verification condition, including:
determining a reference character string corresponding to the check field in the reference check result based on the check field declared by the check information, wherein the basic character string is in a preset format;
and generating an assertion expression corresponding to the checking condition based on the reference character string.
Further, the determining whether the parameter to be verified corresponding to the verification field in the test result to be verified satisfies the assertion expression includes:
constructing a checking object for performing expression operation according to the result to be checked, wherein the checking object is used for representing parameters to be checked corresponding to the checking field in the test result to be checked;
and judging whether the object to be checked meets the assertion expression or not.
Further, the determining whether the object to be verified satisfies the assertion expression includes:
and substituting the check object into the assertion expression to perform expression operation, and outputting a Boolean value as a check result of the test result to be checked.
Further, the bringing the check object into the assertion expression to perform expression operation and outputting a boolean value includes:
and bringing the verification object into the assertion expression, and acquiring the Boolean value of the verification object through a SpringEL analyzer to be used as a verification result of the test result to be verified.
According to a second aspect of the embodiments of the present disclosure, there is provided an interface testing apparatus, including:
the test case acquisition module is configured to execute acquisition of a preset test case, wherein the test case comprises interface information and verification information of an interface to be tested, and the verification information is used for declaring a verification field and a verification condition;
the request sending module is configured to execute sending of a test request to the interface to be tested according to the interface information;
the test result receiving module is configured to receive the test result returned by the interface to be tested as a test result to be verified;
and the checking module is configured to check the parameters to be checked corresponding to the checking fields in the test results to be checked according to the checking conditions so as to determine the checking results.
Further, the interface information includes: interface address, interface name and interface test parameter;
the request sending module is specifically configured to determine an interface location of the interface to be tested according to the interface address and the interface name, and send a test request to the interface location, where the test request carries the test parameters.
Further, the verification module is specifically configured to perform parsing on the verification information in the test case to generate an assertion expression corresponding to the verification condition, and determine whether the to-be-verified parameter corresponding to the verification field in the to-be-verified test result satisfies the assertion expression.
Further, the verification information includes a preset reference verification result;
the verification module is specifically configured to execute a verification field declared based on the verification information, determine, in the reference verification result, a reference character string corresponding to the verification field, where the reference character string is in a preset format, and generate, based on the reference character string, an assertion expression corresponding to the verification condition.
Further, the verification module is specifically configured to execute building a verification object for performing expression operation according to the result to be verified, where the verification object is used to represent a parameter to be verified corresponding to the verification field in the test result to be verified, and determine whether the object to be verified satisfies the assertion expression.
Further, the verification module is specifically configured to perform expression operation by bringing the verification object into the assertion expression, and output a boolean value as a verification result of the test result to be verified.
Further, the verification module is specifically configured to perform bringing the verification object into the assertion expression, and obtain a boolean value of the verification object through a SpringEL parser as a verification result of the test result to be verified.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus, including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement any of the above described interface testing methods.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, wherein instructions that, when executed by a processor of an electronic device, enable the electronic device to perform any one of the interface testing methods described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, wherein the instructions of the computer program product, when executed by a processor of an electronic device, enable the electronic device to perform the interface testing method according to any one of the above.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects: acquiring a preset test case, wherein the test case comprises interface information and verification information of an interface to be tested, the verification information is used for declaring a verification field and a verification condition, and according to the interface information, sending test request to the interface to be tested, and receiving test result returned by the interface to be tested as test result to be verified, and checking the parameters to be checked corresponding to the check fields in the test result to be checked according to the check conditions to determine the check result, because the test result returned by the interface to be tested is received, the test result can be verified according to the verification field and the verification condition stated by the preset verification information, the automatic test of the test result is realized, therefore, the process that the test result can be manually analyzed and compared and checked only after the test result is received in the prior art can be avoided, and the test efficiency of the interface test is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a flow chart illustrating a method of interface testing according to an exemplary embodiment.
FIG. 2 is a flow chart illustrating another method of interface testing according to an example embodiment.
FIG. 3 is a block diagram illustrating an interface test apparatus according to an exemplary embodiment.
FIG. 4 is an electronic device shown in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Fig. 1 is a flow chart illustrating a method of interface testing according to an exemplary embodiment, as shown in fig. 1, including the following steps.
S101: and acquiring a preset test case.
In this step, the Test Case (Test Case) refers to a file describing a Test task for the interface to be tested, where the Test Case may include interface information and verification information of the interface to be tested, and the verification information is used to declare a verification field and a verification condition.
As can be understood by those skilled in the art, the Interface is tested, which is substantially to test functions/services/programs and the like corresponding to the Interface, and may be an API (Application programming Interface) between the programs or a UI (User Interface) between the User and the programs, and the functions/services/programs corresponding to the Interface can process the test parameters and return the processed result (referred to as a test result in the embodiment of the present invention) by inputting the test parameters into the Interface.
In an embodiment, the interface information is used to describe a preset test task, for example, a to-be-tested interface corresponding to the test task, and related test parameters, and optionally, the interface information may include an interface address, an interface name, and interface test parameters, where the interface address may be an address of a server where the to-be-tested interface is located, the interface name is used to identify the to-be-tested interface, and the interface test parameters may be parameters for testing the to-be-tested interface.
For example, the interface address may be http://127.0.0.1:8080, the interface name may be/api/get/User, and the interface parameter may be User Identity Document (User account) and User password (User password).
In one embodiment, the check information may be assertion information, and the check field may be used to determine a valid field of a test result returned by the interface to be tested, where the valid field is a field in the test result that reflects accuracy of the test result. The above-mentioned verification condition may be an expected result, which may be used as an index for verifying whether the test result is accurate.
For example, the assertion information may be json ($. result') ═ 1), where "$. result" in the assertion information is a designated check field, and "$. result" is a check condition, and the entire assertion information includes information: and determining whether the field value of the result field in the test result is equal to 1, if so, determining true, otherwise, determining false.
S102: and sending a test request to the interface to be tested according to the interface information.
In this step, since the interface information is used to describe the test task and indicates the object to be tested and the test parameters corresponding to the test task, the test request can be sent to the interface to be tested according to the interface information.
In one embodiment, under the request that the interface information includes the interface address, the interface name and the interface test parameter, the sending of the test request to the interface to be tested may be implemented by the following steps, including:
step A: and determining the interface position of the interface to be tested according to the interface address and the interface name.
In the step a, when the interface information includes an interface address and an interface name, the interface address indicates a communication address of a server where the interface to be tested is located, so that the server where the interface to be tested is located can be located through the interface address, and further, the interface name identifies the interface to be tested, so that after the server where the interface to be tested is located, the interface to be tested can be found in the located server through the interface name, and thus, the interface position of the interface to be tested is determined.
Illustratively, when the interface address is http://127.0.0.1:8080 and the interface name is/api/get/user, the interface position of the interface to be tested can be determined to be http:// 127.0.0.1/api/get/user.
And B: and sending a test request to the interface position, wherein the test request carries the test parameters.
The interface position of the interface to be tested can be determined through the step A, so that a test request carrying the test parameters can be sent to the interface position.
When HTTP (Hyper Text Transfer Protocol) is used as a communication Protocol for direct interface, the test request and the interface position may be combined into a URL (Uniform Resource Locator), where the URL includes both the interface position for locating the interface to be tested and the test parameters for solving the test.
Illustratively, when the interface location is http://127.0.0.1/api/get/user and the test parameter is UserID ═ 12345678, then the generated URL may be http:// 127.0.0.1/api/get/user? The UserID 12345678, which is loaded via HTTP protocol, may send the test parameter UserID 12345678 to the interface under test located at HTTP:// 127.0.0.1/api/get/user.
In one embodiment, the sending of the test request may be implemented using httpparent in Java, which is specifically used to send HTTP requests.
S103: and receiving a test result returned by the interface to be tested as a test result to be verified.
In this step, the test result is obtained by processing the received test parameters by the interface to be tested.
For example, when the test parameter is 12345678, and the interface to be tested is the user information query interface, the user information query interface may search the database for the user information with the UserID of 12345678 after the UserID carried in the received test request is 12345678, and feed back the searched user information as the test result to the requesting end.
For example, the test results are { "result":1, "userInfo": { "name": Zhang III "," age ":20," sender ": boy", "school": university of Beijing XX "}. It includes content divided into two parts, including result and userInfo.
Alternatively, the test result can be { \\ \ result \ 1, \\ \ users \ 1, \ tags \ 4,5, \\ \ tags \ and \ ZhouJeglon \ } which are different from each other.
Wherein, the result is 1, which indicates that the corresponding user information is found by the currently received test parameter UserID of 12345678, and the specific user information includes: name, age, gender and school, and specifically, the user information of the user with UserID of 12345678 is that the name is zhang san, the age is 20 years, the gender is male, and the school is university beijing XX.
S104: and checking the parameters to be checked corresponding to the check fields in the test result to be checked according to the check conditions to determine the check result.
In this step, as before, the verification information is used to declare the verification field and the verification condition, so that the valid field can be determined from the test result to be detected through the verification field, and the field value corresponding to the valid field is the parameter to be verified.
For example, the test result is { "result":1, "userInfo": { "name": Zhang III "," age ":20," sender ": boy", "school": university of Beijing XX "}. When the check information declares that result is a check field, the parameter to be checked is a field value '1' corresponding to the result field, and when the check information declares that name is the check field, the parameter to be checked is a field value 'zhang san' corresponding to the name field.
Further, the verification condition may be an expected result, for example, if the to-be-verified parameter in the name field in the test result is zhang, the expected result is obtained, or if the to-be-verified parameter in the result field in the test result is 1, the expected result is obtained.
Therefore, the parameters to be verified corresponding to the verification fields in the test results to be verified can be verified according to the verification conditions, whether the parameters to be verified meet the verification conditions or not is determined, if yes, the output is correct, and if not, the output is wrong.
In the embodiment shown in fig. 1, a preset test case may be obtained, where the test case includes interface information and verification information of an interface to be tested, the verification information is used to declare a verification field and a verification condition, and send a test request to the interface to be tested according to the interface information, receive a test result returned by the interface to be tested, as a test result to be verified, and verify a parameter to be verified in the test result to be verified, which corresponds to the verification field, according to the verification condition, to determine the verification result, and since the test result returned by the interface to be tested is received, the test result may be verified according to the verification field and the verification condition declared by the preset verification information, thereby implementing automatic testing of the test result, and thus avoiding a process of manually analyzing and comparing the test result after the test result is received in the prior art, the testing efficiency of the interface test is improved.
Fig. 2 is a flow chart illustrating another method of interface testing, according to an example embodiment, as shown in fig. 2, including the following steps.
S201: and acquiring a preset test case.
The specific implementation manner of this step is the same as or similar to that of step S101, and is not described herein again.
S202: and sending a test request to the interface to be tested according to the interface information.
The specific implementation manner of this step is the same as or similar to that of step S101, and is not described herein again.
S203: and receiving a test result returned by the interface to be tested as a test result to be verified.
The specific implementation manner of this step is the same as or similar to that of step S101, and is not described herein again.
S204: and analyzing the verification information in the test case to generate an assertion expression corresponding to the verification condition.
In this step, the check condition satisfies an expected condition, which can be generally expressed by using an expression.
For example, if the value is greater than the preset value, the expected condition is satisfied, or if the value is less than the expected value, the expected condition is satisfied, so that by parsing the check information, the check condition in the check information can be determined, and thus an assertion expression corresponding to the check condition is further determined, for example, when the assertion expression result equals 0, which indicates that the expected condition is satisfied when the field value of the result field in the returned test result equals 0.
In one embodiment, a parser may be first established, for example: ExpressionParser parameter ();
after the parser is used to parse the check information, an assertion expression is generated, for example: expression, wherein an assertion represents check information.
In one embodiment, the verification information may further include a preset reference verification result;
and determining a reference character string corresponding to the check field in a reference check result based on the check field declared by the check information, wherein the basic character string is in a preset format, and generating an assertion expression corresponding to the check condition based on the reference character string.
The benchmark check result is a correct return result of the test case, for example, { "result":1, "userName": gexiaojing "} should be returned, i.e., the benchmark check result is {" result ":1," userName ": gexiaojing" }.
Optionally, the preset format may be a JSONPath (JavaScript Object Notation) format, and since the JSONPath format in the reference verification result is $, result ', based on $, result ', the assertion expression that generates the corresponding verification condition is json ($, result ') — 1.
S205: and judging whether the parameters to be verified of the corresponding verification fields in the test results to be verified meet the assertion expression or not.
In this step, the parameters to be verified corresponding to the verification fields in the test result to be verified are the same as or will die of step S104, and are not described herein again.
Since the assertion expression indicates a judgment method, once, whether the parameter to be verified satisfies the assertion expression is judged by checking the parameter to be verified and the assertion expression.
In one embodiment, the step of determining whether the parameter to be verified of the corresponding verification field in the test result to be verified satisfies the assertion expression may be implemented by the following steps:
step 1: and constructing a check object for executing expression operation according to the result to be checked.
In step 1, it may be defined that a class AssertContext is defined first, and a generated context object of the structure to be checked is constructed in SpingEL using the result to be checked as a check object.
The verification object is constructed according to the structure to be verified and conforms to a SpingEL analytic mode or an expression operation mode, and is used for representing the parameter to be verified of the corresponding verification field in the test result to be verified.
Optionally, the test result to be verified may be a JSON-formatted character string, and at this time, the JSON path may be used to analyze the test result to be verified in the JSON format, so as to obtain an easily identifiable character string, where the character string constitutes at least one field, such as a result field, a name field, or a userInfo field.
In one embodiment, the check object may be constructed by the result to be checked in a manner of newstandardevaluationcontext (associatcontext).
Step 2: and judging whether the object to be checked meets the assertion expression or not.
Through the obtained assertion expression and the check object, whether the object to be checked meets the assertion expression or not can be judged.
In one embodiment, the verification object may be substituted into the assertion expression to perform expression operation, and a boolean value may be output as a verification result of the test result to be verified.
The Boolean value (Boolean) is one of True or False, when the output Boolean value is True, the interface test is passed, and when the output Boolean value is False, the interface test is failed, and the returned result is abnormal.
In one embodiment, the check object is brought into the assertion expression, and the boolean value of the check object is obtained through the SpringEL parser as the check result of the test result to be checked.
Substituting the check object into the predicate expression for expression operation may use SpringEL.
For example, the present invention may be implemented by using Boolean value (context).
And acquiring the Boolean value of the whole assertion expression by using the SpringEL, substituting the verification object into the assertion expression, and inputting the verification object into the SpringEL to verify the Boolean value of the verification object.
Illustratively, the test result of the test case is { "result":1, "userName": gexiaojing "}, the test result is input to bring the check object into the assertion expression, and whether the relational expression returns true or false can be known by directly using SpringEL.
Through the assertion expression and the SpringEL, developers do not need to rewrite codes to extract the value of the field of the check object result, and therefore the interface can be tested more simply and conveniently.
In the embodiment shown in fig. 2 provided by the present application, a preset test case may be obtained, and a test request may be sent to an interface to be tested according to interface information, and a test result returned by the interface to be tested may be received as a test result to be verified, and verification information in the test case may be analyzed to generate an assertion expression corresponding to a verification condition, and to determine whether a parameter to be verified in a test result corresponding to a verification field satisfies the assertion expression, and the test result returned by the interface to be tested may be verified according to the verification field and the verification condition declared by the preset verification information, so as to implement an automatic test of the test result, thereby avoiding a process of manually analyzing and comparing the test result after receiving the test result in the prior art, and improving the test efficiency of the interface test, furthermore, the interface can be tested more simply and conveniently through the assertion expression and the verification object.
FIG. 3 is a block diagram illustrating an interface test apparatus according to an exemplary embodiment. Referring to fig. 3, the apparatus includes a test case obtaining module 301, a request sending module 302, a test result receiving module 303, and a verifying module 304.
The test case obtaining module 301 is configured to execute obtaining of a preset test case, where the test case includes interface information and verification information of an interface to be tested, and the verification information is used to declare a verification field and a verification condition;
a request sending module 302 configured to execute sending a test request to an interface to be tested according to the interface information;
the test result receiving module 303 is configured to execute receiving of a test result returned by the interface to be tested as a test result to be verified;
the checking module 304 is configured to perform checking on the to-be-checked parameters corresponding to the check fields in the to-be-checked test result according to the checking conditions to determine a checking result.
Further, the interface information includes: interface address, interface name and interface test parameter;
the request sending module 302 is specifically configured to determine an interface location of the interface to be tested according to the interface address and the interface name, and send a test request to the interface location, where the test request carries the test parameters.
Further, the verification module 304 is specifically configured to perform parsing on the verification information in the test case to generate an assertion expression corresponding to the verification condition, and determine whether the to-be-verified parameter corresponding to the verification field in the to-be-verified test result satisfies the assertion expression.
Further, the verification information includes a preset reference verification result;
the verification module 304 is specifically configured to execute a verification field declared based on the verification information, determine, in a reference verification result, a reference character string corresponding to the verification field, where the basic character string is in a preset format, and generate, based on the reference character string, an assertion expression corresponding to the verification condition.
Further, the checking module 304 is specifically configured to execute building a checking object for performing expression operation according to the result to be checked, where the checking object is used to represent the parameter to be checked of the corresponding checking field in the test result to be checked, and determine whether the object to be checked satisfies the assertion expression.
Further, the checking module 304 is specifically configured to perform an expression operation by bringing the checking object into the assertion expression, and output a boolean value as a checking result of the test result to be checked.
Further, the checking module 304 is specifically configured to perform bringing the checking object into the assertion expression, and obtain a boolean value of the checking object through the SpringEL parser as a checking result of the test result to be checked.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 4 is a block diagram illustrating S400 for interface testing according to an example embodiment. For example, S400 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 4, S400 may include one or more of the following components: processing component 402, memory 404, power component 406, multimedia component 408, audio component 410, input/output (I/O) interface 412, sensor component 414, and communication component 416.
The processing component 402 generally controls the overall operations of S400, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 402 may include one or more processors 420 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 402 can include one or more modules that facilitate interaction between the processing component 402 and other components. For example, the processing component 402 can include a multimedia module to facilitate interaction between the multimedia component 408 and the processing component 402.
The memory 404 is configured to store various types of data to support the operation at S400. Examples of such data include instructions for any application or method operating on S400, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 404 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power supply components 406 provide power to the various components of S400. Power components 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for S400.
The multimedia component 408 includes a screen between the S400 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 408 includes a front facing camera and/or a rear facing camera. When the S400 is in an operation mode, such as a photographing mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 410 is configured to output and/or input audio signals. For example, the audio component 410 includes a Microphone (MIC) configured to receive an external audio signal when the S400 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 404 or transmitted via the communication component 416. In some embodiments, audio component 410 also includes a speaker for outputting audio signals.
The input/output interface 412 provides an interface between the processing component 402 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 414 includes one or more sensors for providing various aspects of state assessment for S400. For example, the sensor component 414 may detect the open/closed state of S400, the relative positioning of the components, such as the display and keypad of S400, the sensor component 414 may also detect a change in position of S400 or one of the components of S400, the presence or absence of user contact with S400, the orientation or acceleration/deceleration of S400, and a change in temperature of S400. The sensor assembly 414 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 414 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 416 is configured to facilitate communication between the S400 and other devices in a wired or wireless manner. S400 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 416 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 416 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, S400 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a storage medium comprising instructions, such as the memory 404 comprising instructions, executable by the processor 420 of S400 to perform the above-described method is also provided. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. An interface testing method, comprising:
acquiring a preset test case, wherein the test case comprises interface information and verification information of an interface to be tested, and the verification information is used for declaring a verification field and a verification condition;
sending a test request to the interface to be tested according to the interface information;
receiving a test result returned by the interface to be tested as a test result to be verified;
and checking the parameters to be checked corresponding to the check field in the test result to be checked according to the check condition so as to determine the check result.
2. The interface test method of claim 1, wherein the interface information comprises: interface address, interface name and interface test parameter;
the step of sending a test request to the interface to be tested according to the interface information comprises the following steps:
determining the interface position of the interface to be tested according to the interface address and the interface name;
and sending a test request to the interface position, wherein the test request carries the test parameters.
3. The interface testing method according to claim 1 or 2, wherein the verifying the to-be-verified parameter corresponding to the verification field in the to-be-verified test result according to the verification condition includes:
analyzing the verification information in the test case to generate an assertion expression corresponding to the verification condition;
and judging whether the parameters to be verified corresponding to the verification fields in the test results to be verified meet the assertion expression or not.
4. The interface testing method according to claim 3, wherein the verification information includes a preset reference verification result;
analyzing the verification information in the test case to generate an assertion expression corresponding to the verification condition, including:
determining a reference character string corresponding to the check field in the reference check result based on the check field declared by the check information, wherein the basic character string is in a preset format;
and generating an assertion expression corresponding to the checking condition based on the reference character string.
5. The interface testing method according to claim 4, wherein the determining whether the parameter to be verified corresponding to the verification field in the test result to be verified satisfies the assertion expression includes:
constructing a checking object for performing expression operation according to the result to be checked, wherein the checking object is used for representing parameters to be checked corresponding to the checking field in the test result to be checked;
and judging whether the object to be checked meets the assertion expression or not.
6. The interface testing method according to claim 5, wherein the determining whether the object to be verified satisfies the assertion expression comprises:
and substituting the check object into the assertion expression to perform expression operation, and outputting a Boolean value as a check result of the test result to be checked.
7. The interface testing method of claim 6, wherein the bringing the check object into the assertion expression for expression operation and outputting a boolean value comprises:
and bringing the verification object into the assertion expression, and acquiring the Boolean value of the verification object through a SpringEL analyzer to be used as a verification result of the test result to be verified.
8. An interface testing apparatus, comprising:
the test case acquisition module is configured to execute acquisition of a preset test case, wherein the test case comprises interface information and verification information of an interface to be tested, and the verification information is used for declaring a verification field and a verification condition;
the request sending module is configured to execute sending of a test request to the interface to be tested according to the interface information;
the test result receiving module is configured to receive the test result returned by the interface to be tested as a test result to be verified;
and the checking module is configured to check the parameters to be checked corresponding to the checking fields in the test results to be checked according to the checking conditions so as to determine the checking results.
9. An interface testing electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the interface testing method of any one of claims 1 to 7.
10. A storage medium having instructions which, when executed by a processor of an interface test electronic device, enable the interface test electronic device to perform the interface test method of any one of claims 1 to 7.
CN202010052077.9A 2020-01-17 2020-01-17 Interface testing method and device, electronic equipment and storage medium Pending CN111274131A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010052077.9A CN111274131A (en) 2020-01-17 2020-01-17 Interface testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010052077.9A CN111274131A (en) 2020-01-17 2020-01-17 Interface testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111274131A true CN111274131A (en) 2020-06-12

Family

ID=70998761

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010052077.9A Pending CN111274131A (en) 2020-01-17 2020-01-17 Interface testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111274131A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111679989A (en) * 2020-06-16 2020-09-18 贝壳技术有限公司 Interface robustness testing method and device, electronic equipment and storage medium
CN112069292A (en) * 2020-09-09 2020-12-11 苏州思必驰信息科技有限公司 Data permission verification method and device
CN112612665A (en) * 2020-12-26 2021-04-06 中国农业银行股份有限公司 Testing method, device and equipment of financial intelligent equipment
CN113110997A (en) * 2021-04-23 2021-07-13 中国工商银行股份有限公司 Test method, device and equipment
CN113742207A (en) * 2020-09-23 2021-12-03 北京沃东天骏信息技术有限公司 Interface testing method, device, equipment and computer readable storage medium
CN115114176A (en) * 2022-08-30 2022-09-27 云账户技术(天津)有限公司 Assertion method, device, medium, apparatus, and program for automated test result
CN115129592A (en) * 2022-06-29 2022-09-30 北京永信至诚科技股份有限公司 Test method and system for interface test process and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664388A (en) * 2017-03-31 2018-10-16 北京京东尚科信息技术有限公司 Dynamic field data return to test system, method, electronic equipment and the readable storage medium storing program for executing of interface
CN109446071A (en) * 2018-09-26 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, interface test device, electronic equipment and storage medium
CN109522225A (en) * 2018-11-09 2019-03-26 网宿科技股份有限公司 A kind of automatic test asserts method and device, test platform and storage medium
CN110083526A (en) * 2019-03-15 2019-08-02 深圳壹账通智能科技有限公司 Applied program testing method, device, computer installation and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108664388A (en) * 2017-03-31 2018-10-16 北京京东尚科信息技术有限公司 Dynamic field data return to test system, method, electronic equipment and the readable storage medium storing program for executing of interface
CN109446071A (en) * 2018-09-26 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, interface test device, electronic equipment and storage medium
CN109522225A (en) * 2018-11-09 2019-03-26 网宿科技股份有限公司 A kind of automatic test asserts method and device, test platform and storage medium
CN110083526A (en) * 2019-03-15 2019-08-02 深圳壹账通智能科技有限公司 Applied program testing method, device, computer installation and storage medium

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111679989A (en) * 2020-06-16 2020-09-18 贝壳技术有限公司 Interface robustness testing method and device, electronic equipment and storage medium
CN112069292A (en) * 2020-09-09 2020-12-11 苏州思必驰信息科技有限公司 Data permission verification method and device
CN112069292B (en) * 2020-09-09 2022-07-12 思必驰科技股份有限公司 Data permission verification method and device
CN113742207A (en) * 2020-09-23 2021-12-03 北京沃东天骏信息技术有限公司 Interface testing method, device, equipment and computer readable storage medium
CN112612665A (en) * 2020-12-26 2021-04-06 中国农业银行股份有限公司 Testing method, device and equipment of financial intelligent equipment
CN113110997A (en) * 2021-04-23 2021-07-13 中国工商银行股份有限公司 Test method, device and equipment
CN115129592A (en) * 2022-06-29 2022-09-30 北京永信至诚科技股份有限公司 Test method and system for interface test process and electronic equipment
CN115114176A (en) * 2022-08-30 2022-09-27 云账户技术(天津)有限公司 Assertion method, device, medium, apparatus, and program for automated test result

Similar Documents

Publication Publication Date Title
CN111274131A (en) Interface testing method and device, electronic equipment and storage medium
CN111221733A (en) Information processing method and device, mobile terminal and storage medium
CN107423218B (en) Application testing method, device and terminal
CN115185717B (en) Interface calling method and device, electronic equipment and storage medium
CN107562500B (en) Debugging device, method and equipment
CN109684112B (en) Program file operation method, device, terminal and storage medium
CN113157256B (en) Method and device for generating interface code, electronic equipment, storage medium and product
CN108984417B (en) Software testing method, device, terminal and storage medium
CN114741292A (en) Test script management method and device, electronic equipment and storage medium
CN111079040B (en) Resource sniffing method, device, terminal, server and storage medium
CN110221813B (en) Application data connection establishment method and device, storage medium and electronic equipment
CN112559309A (en) Method and device for adjusting page performance acquisition algorithm
CN113626321B (en) Bridging test method, device, system and storage medium
CN111061633B (en) Webpage first screen time detection method, device, terminal and medium
CN114428737A (en) Communication method, device, equipment and storage medium based on micro service system
CN107193622B (en) Code compiling processing method and device and terminal
CN107526683B (en) Method and device for detecting functional redundancy of application program and storage medium
CN112416751A (en) Processing method and device for interface automation test and storage medium
CN109947640B (en) Regression test-based core function coverage statistical method and device
CN113206772B (en) Method, device, equipment, medium and product for judging correctness of response message
CN111143184B (en) Data processing method, device and system
CN113515746B (en) Security hole detection method and device, electronic equipment, storage medium and product
CN112631695B (en) Data verification method and device, electronic equipment and storage medium
CN113965476B (en) Inspection method, device and equipment based on application
CN110119471B (en) Method and device for checking consistency of search results

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