CN112433935A - Test method, test device, electronic equipment and storage medium - Google Patents

Test method, test device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112433935A
CN112433935A CN202011285615.5A CN202011285615A CN112433935A CN 112433935 A CN112433935 A CN 112433935A CN 202011285615 A CN202011285615 A CN 202011285615A CN 112433935 A CN112433935 A CN 112433935A
Authority
CN
China
Prior art keywords
interface
attribute information
test
target
parameter
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
CN202011285615.5A
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.)
Ping An Consumer Finance Co Ltd
Original Assignee
Ping An Consumer Finance Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Consumer Finance Co Ltd filed Critical Ping An Consumer Finance Co Ltd
Priority to CN202011285615.5A priority Critical patent/CN112433935A/en
Publication of CN112433935A publication Critical patent/CN112433935A/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/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The application relates to a software testing technology, in particular to a testing method, a testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring preset test environment parameters corresponding to the test interface; acquiring target test environment parameters; when the target test environment parameter is successfully compared with the preset test environment parameter, acquiring first attribute information of a test interface; acquiring second attribute information corresponding to the interface document in a crawling manner; comparing the first attribute information with the second attribute information; and confirming that the test is successful when the first attribute information is successfully compared with the second attribute information. By adopting the embodiment of the application, the attribute information of the test interface and the attribute information of the crawl corresponding interface document can be obtained, and then the attribute information and the crawl corresponding interface document are compared, and if the comparison is successful, the test is successful, so that the test efficiency can be improved.

Description

Test method, test device, electronic equipment and storage medium
Technical Field
The present application relates to the field of software testing, and in particular, to a testing method, an apparatus, an electronic device, and a storage medium.
Background
At present, in the product testing process, the interface document and the return value of the actual testing interface are easily overlooked through manual field-by-field verification or comparison by a comparison tool, and errors are easily caused when an interface testing case is updated by searching for newly added/deleted/changed fields. The conventional processing mode is mainly through manual verification, and if the manual verification is carried out, an interface needing verification is called, and the interface is checked to output the parameters, so that the defect that the interface is easy to overlook and make mistakes is caused.
Disclosure of Invention
The embodiment of the application provides a test method, a test device, electronic equipment and a storage medium, and test efficiency can be improved.
In a first aspect, an embodiment of the present application provides a testing method, where the method includes:
acquiring preset test environment parameters corresponding to the test interface;
acquiring target test environment parameters;
when the target test environment parameter is successfully compared with the preset test environment parameter, acquiring first attribute information of the test interface;
acquiring second attribute information corresponding to the interface document in a crawling manner;
comparing the first attribute information with the second attribute information;
and confirming that the test is successful when the first attribute information is successfully compared with the second attribute information.
In a second aspect, an embodiment of the present application provides a testing apparatus, including: a first obtaining unit, a second obtaining unit, a third obtaining unit, a fourth obtaining unit, a comparing unit and a determining unit,
the first obtaining unit is used for obtaining preset test environment parameters corresponding to the test interface;
the second acquisition unit is used for acquiring target test environment parameters;
the third obtaining unit is configured to obtain first attribute information of the test interface when the target test environment parameter is successfully compared with the preset test environment parameter;
the fourth obtaining unit is used for obtaining second attribute information corresponding to the interface document in a crawling mode;
the comparison unit is used for comparing the first attribute information with the second attribute information;
the determining unit is configured to confirm that the test is successful when the first attribute information and the second attribute information are successfully compared.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps in the first aspect of the embodiment of the present application.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program for electronic data exchange, where the computer program enables a computer to perform some or all of the steps described in the first aspect of the embodiment of the present application.
In a fifth aspect, embodiments of the present application provide a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, where the computer program is operable to cause a computer to perform some or all of the steps as described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
The embodiment of the application has the following beneficial effects:
it can be seen that, in the testing method, the testing device, the electronic device, and the storage medium described in the embodiments of the present application, the preset testing environment parameter corresponding to the testing interface is obtained, the target testing environment parameter is obtained, when the target testing environment parameter is successfully compared with the preset testing environment parameter, the first attribute information of the testing interface is obtained, the second attribute information corresponding to the interface document is obtained in a crawling manner, the first attribute information is compared with the second attribute information, when the first attribute information is successfully compared with the second attribute information, it is determined that the testing is successful, the attribute information of the testing interface and the attribute information of the crawling corresponding interface document can be obtained, and then the two are compared, and if the comparison is successful, the testing is successful, so that the testing efficiency can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present application 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 some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a testing method provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart of another testing method provided in the embodiments of the present application;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 4 is a block diagram of functional units of a testing apparatus according to an embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," and the like in the description and claims of the present application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The electronic device according to the embodiment of the present application may include various handheld devices (such as a mobile phone, a tablet computer, a POS machine, etc.) having a wireless communication function, a desktop computer, an in-vehicle device, a wearable device (a smart watch, a smart bracelet, a wireless headset, an augmented reality/virtual reality device, smart glasses), an AI robot, a computing device, or other processing devices connected to a wireless modem, and various forms of User Equipment (UE), a Mobile Station (MS), a terminal device (terminal device), etc. For convenience of description, the above-mentioned devices are collectively referred to as electronic devices.
The following describes embodiments of the present application in detail.
Referring to fig. 1, fig. 1 is a schematic flow chart of a testing method provided in an embodiment of the present application, and as shown in the drawing, the testing method is applied to an electronic device, and includes:
101. and acquiring preset test environment parameters corresponding to the test interface.
In the embodiment of the present application, the preset test environment parameters of the test interface may be set by the user or default by the system. The preset testing environment parameters may include software testing environment parameters, and/or hardware testing environment parameters. The software testing environment parameters may include at least one of: CPU temperature, GPU temperature, foreground application type, number of processes, CPU resource occupancy, GPU resource occupancy, memory size, screen resolution, system type, and the like, without limitation. The hardware test environment parameters may include at least one of: a CPU model, a GPU model, a CPU core count, a CPU processing rate, a GPU processing rate, and the like, which are not limited herein. Different interfaces have different test environment parameters corresponding to different test requirements or interface attributes.
102. And acquiring target test environment parameters.
The target testing environment parameters may include software testing environment parameters and/or hardware testing environment parameters. The software testing environment parameters may include at least one of: CPU temperature, GPU temperature, foreground application type, number of processes, CPU resource occupancy, GPU resource occupancy, memory size, screen resolution, system type, and the like, without limitation. The hardware test environment parameters may include at least one of: a CPU model, a GPU model, a CPU core count, a CPU processing rate, a GPU processing rate, and the like, which are not limited herein.
103. And when the target test environment parameter is successfully compared with the preset test environment parameter, acquiring first attribute information of the test interface.
In this embodiment of the application, the first attribute information may be at least one of the following: interface return values, interface names, interface locations, interface roles, interface entries, and the like, without limitation. The test interface may be a hardware interface or a virtual interface. The test interface may be one or more interfaces. In a specific implementation, the electronic device may compare the target test environment parameter with a preset test environment parameter, for example, the target test environment parameter is a CPU temperature, the preset test environment temperature is a preset CPU temperature range, when the CPU temperature is within the preset CPU temperature range, the target test environment parameter is successfully compared with the preset test environment parameter, when the target test environment parameter is successfully compared with the preset test environment parameter, the first attribute information of the test interface is obtained, otherwise, the test environment needs to be debugged, and after the debugging is completed and the comparison with the preset test environment parameter is successful, the subsequent steps may be executed.
Optionally, in step 103, the obtaining first attribute information of the test interface includes:
a11, acquiring a target identifier of the test interface;
a12, determining the first attribute information corresponding to the target identifier according to a mapping relationship between preset identifiers and attribute information.
The mapping relationship between the preset identifier and the attribute information may be pre-stored in the electronic device, and the identifier of the interface may be at least one of the following: name, label, storage location, type of interface, etc., without limitation.
Furthermore, the electronic device may obtain a target identifier of the test interface, and may determine first attribute information corresponding to the target identifier according to a mapping relationship between a preset identifier and the attribute information, and further may read the attribute information corresponding to the target identifier according to the interface identifier.
104. And acquiring second attribute information corresponding to the interface document in a crawling manner.
In specific implementation, the interface document may correspond to the test interface, and the electronic device may obtain the interface document in a crawling manner and read second attribute information corresponding to the interface document. The second attribute information may be at least one of: interface return values, interface names, interface locations, interface roles, interface entries, and the like, without limitation. The electronic equipment can crawl from a webpage by using a jsup through a java program, and the corresponding interface document data is analyzed by using the gson through the java program, so that the condition of manual verification error can be avoided. The electronic equipment can also use jsup to crawl from a webpage through a java program, automatically generate corresponding data entry and entry parameters through the use of gson analysis by the java program, and automatically verify corresponding data entry and entry parameters.
Optionally, in the step 104, obtaining the second attribute information corresponding to the interface document in a crawling manner may include the following steps:
41. acquiring an interface document corresponding to the test interface in a crawling manner;
42. determining a target attribute information identifier corresponding to the target test environment parameter according to a mapping relation between a preset test environment parameter and an attribute information identifier;
43. acquiring an attribute information set of the interface document;
44. and acquiring attribute information corresponding to the target attribute information identifier from the attribute information set to obtain the second attribute information.
In the embodiment of the application, different attribute information may correspond to different attribute identifiers, and the attribute identifier is used to identify each attribute information.
In specific implementation, the electronic device may obtain an interface document corresponding to the test interface in a crawling manner, where the interface document reflects attribute information of the test interface to a certain extent, and further, the electronic device may determine a target attribute information identifier corresponding to the target test environment parameter according to a preset mapping relationship between the test environment parameter and the attribute information identifier. The electronic equipment can obtain the attribute information set of the interface document, further obtain the attribute information corresponding to the target attribute information identifier from the attribute information set to obtain the second attribute information, and thus, the attribute information meeting the requirements of the test environment can be obtained from the interface document for realizing the subsequent test.
105. And comparing the first attribute information with the second attribute information.
The electronic device may compare one or more parameters of the first attribute information with corresponding parameters of the second attribute information. In a specific implementation, the participation of the interface in/out of the interface document, or the participation of the interface in/out of the interface document may be compared. For example, the electronic device may obtain an interface to be checked according to the automatically generated join request, and check correctness of the name and the type of the join, for example, the name and the type of the join of the interface may be compared with the name and the type of the join of the interface document.
Optionally, when the first attribute information includes a first interface entry and the second attribute information includes a second interface entry, the step 105 of comparing the first attribute information with the second attribute information may be implemented as follows:
and comparing the first interface input parameter with the second interface input parameter, and confirming that the test is successful when the first interface input parameter is successfully participated in the second interface input reference pair.
In a specific implementation, the electronic device may compare the first interface input parameter with the second interface input parameter to implement automatic verification, and if the first interface input parameter and the second interface input parameter are successful, the test is determined to be successful, otherwise, the test is failed. The first interface entry may include at least one parameter: interface name, interface type, interface function, key code parameter, etc., without limitation, the key code parameter may be at least one of: the function of the code, the function type of the code, the length of the code, the execution time of the code, the number of iterations of the code, and the like, which are not limited herein. The second interface entry may include at least one parameter: interface name, interface type, interface function, key code parameter, etc., without limitation, the key code parameter may be at least one of: the function of the code, the function type of the code, the length of the code, the execution time of the code, the number of iterations of the code, and the like, which are not limited herein. When the first interface parameter and the second interface parameter both include the interface type, the first interface parameter and the second interface parameter may be compared, and if the interface types of the first interface parameter and the second interface parameter are the same, the comparison is successful.
Optionally, the step of comparing the first interface entry parameter with the second interface entry parameter may include the following steps:
a1, acquiring a target test item;
a2, determining a target index identifier corresponding to the target test item according to a mapping relation between preset test items and index identifiers;
a3, screening the first interface input parameters according to the target index identification to obtain target first interface input parameters;
a4, screening the second interface input parameters according to the target index identification to obtain target second interface input parameters;
a5, comparing the target first interface with the target second interface.
In the embodiment of the application, the test items can be set by a user or defaulted by a system, and the test interface can correspond to at least one test item. The mapping relation between preset test items and index identifications can be prestored in the electronic equipment, the index identifications corresponding to different test items are different, one test item can correspond to at least one index identification, and the index identification can be used for selecting parameters corresponding to interface parameter access. The electronic equipment can obtain a target test item, a target index identifier corresponding to the target test item is determined according to a preset mapping relation between the test item and the index identifier, then, the first interface parameter can be screened according to the target index identifier to obtain a target first interface parameter, the second interface parameter can be screened according to the target index identifier to obtain a target second interface parameter, finally, the target first interface parameter and the target second interface parameter can be compared, if the comparison is successful, the test is successful, otherwise, the test is failed.
Optionally, when the first attribute information includes a first interface entry parameter and the second attribute information includes a second interface exit parameter, the comparing the first attribute information with the second attribute information may be performed according to the following manner:
and comparing the first interface input parameter with the second interface output parameter, and confirming that the test is successful when the first interface input parameter is successfully compared with the second interface parameter.
In a specific implementation, the electronic device may compare the first interface input parameter with the second interface output parameter to implement automatic verification, that is, when the first interface input parameter and the second interface output parameter are successfully compared, it is determined that the test is successful, otherwise, the test is failed. The first interface entry may include at least one parameter: interface name, interface type, interface function, key code parameter, etc., without limitation, the key code parameter may be at least one of: the function of the code, the function type of the code, the length of the code, the execution time of the code, the number of iterations of the code, and the like, which are not limited herein. The second interface out-of-reference may include at least one parameter: interface name, interface type, interface function, key code parameter, etc., without limitation, the key code parameter may be at least one of: the function of the code, the function type of the code, the length of the code, the execution time of the code, the number of iterations of the code, and the like, which are not limited herein. When the first interface input parameter and the second interface output parameter both include the interface type, the first interface input parameter and the second interface output parameter can be compared, and if the interface types of the first interface input parameter and the second interface output parameter are the same, the comparison is successful.
Optionally, when the first attribute information includes a first interface parameter and the second attribute information includes a second interface parameter, the comparing the first attribute information with the second attribute information includes:
and comparing the first interface parameter output with the second interface parameter input, and confirming that the test is successful when the first interface parameter input is successful in participating in the second interface parameter input.
In a specific implementation, the electronic device may compare the first interface parameter output with the second interface parameter input to implement automatic verification, that is, when the first interface parameter output and the second interface parameter input are successful, it is determined that the test is successful, otherwise, the test is failed. The first interface out-of-reference may include at least one parameter: interface name, interface type, interface function, key code parameter, etc., without limitation, the key code parameter may be at least one of: the function of the code, the function type of the code, the length of the code, the execution time of the code, the number of iterations of the code, and the like, which are not limited herein. The second interface entry may include at least one parameter: interface name, interface type, interface function, key code parameter, etc., without limitation, the key code parameter may be at least one of: the function of the code, the function type of the code, the length of the code, the execution time of the code, the number of iterations of the code, and the like, which are not limited herein. When the first interface output parameter and the second interface input parameter both include the interface type, the first interface output parameter and the second interface input parameter can be compared, and if the interface types of the first interface output parameter and the second interface input parameter are the same, the comparison is successful.
Optionally, when the first attribute information includes a first interface parameter and the second attribute information includes a second interface parameter, the comparing the first attribute information with the second attribute information includes:
and comparing the first interface output parameter with the second interface output parameter, and confirming that the test is successful when the first interface input parameter and the second interface output parameter are successful.
In specific implementation, the electronic device may compare the first interface output parameter with the second interface output parameter to implement automatic verification, that is, when the first interface output parameter and the second interface output parameter are successfully compared, it is determined that the test is successful, otherwise, the test is failed. The first interface out-of-reference may include at least one parameter: interface name, interface type, interface function, key code parameter, etc., without limitation, the key code parameter may be at least one of: the function of the code, the function type of the code, the length of the code, the execution time of the code, the number of iterations of the code, and the like, which are not limited herein. The second interface out-of-reference may include at least one parameter: interface name, interface type, interface function, key code parameter, etc., without limitation, the key code parameter may be at least one of: the function of the code, the function type of the code, the length of the code, the execution time of the code, the number of iterations of the code, and the like, which are not limited herein. When the first interface output parameter and the second interface output parameter both include the interface type, the first interface output parameter and the second interface output parameter can be compared, and if the interface types of the first interface output parameter and the second interface output parameter are the same, the comparison is successful.
104. And confirming that the test is successful when the first attribute information is successfully compared with the second attribute information.
In a specific implementation, the electronic device may confirm that the test of the test interface is successful when the first attribute information and the second attribute information are successfully compared, and otherwise, confirm that the test of the test interface is failed when the first attribute information and the second attribute information are failed to be compared.
It can be seen that, in the testing method described in this embodiment of the present application, the preset testing environment parameter corresponding to the testing interface is obtained, the target testing environment parameter is obtained, when the target testing environment parameter is successfully compared with the preset testing environment parameter, the first attribute information of the testing interface is obtained, the second attribute information corresponding to the interface document is obtained in a crawling manner, the first attribute information is compared with the second attribute information, when the first attribute information is successfully compared with the second attribute information, it is determined that the testing is successful, the attribute information of the testing interface and the attribute information of the crawling corresponding interface document can be obtained, and then the two are compared, and if the comparison is successful, the testing is successful, so that the testing efficiency can be improved.
Referring to fig. 2, fig. 2 is a schematic flowchart of a testing method applied to an electronic device according to an embodiment of the present application, where as shown in the figure, the testing method includes:
201. and acquiring preset test environment parameters corresponding to the test interface.
202. And acquiring target test environment parameters.
203. And when the target test environment parameter is successfully compared with the preset test environment parameter, acquiring first attribute information of the test interface.
204. And acquiring second attribute information corresponding to the interface document in a crawling manner.
205. And comparing the first attribute information with the second attribute information.
The detailed description of the steps 201 to 205 may refer to the corresponding steps described in the above fig. 1, and is not repeated herein.
206. And when the first attribute information is successfully compared with the second attribute information, acquiring target identity information of the user.
Wherein, the target identity information may be at least one of the following: user name, job title, company level, post, etc., without limitation.
207. And determining the target interface authority corresponding to the target identity information according to a preset mapping relation between the identity information and the interface operation authority.
The mapping relationship between the preset identity information and the interface operation authority can be stored in the electronic device in advance, and the operation authority can be at least one of the following: readable authority, editing authority, query authority, read-write authority, etc., which are not limited herein.
208. And operating the test interface according to the target interface authority.
The electronic device can operate the test interface according to the target interface permission to realize further testing, or can complete other functions through the test interface.
It can be seen that the test method described in the embodiment of the present application obtains a preset test environment parameter corresponding to a test interface, obtains a target test environment parameter, obtains first attribute information of the test interface when the comparison between the target test environment parameter and the preset test environment parameter is successful, obtains second attribute information corresponding to an interface document in a crawling manner, compares the first attribute information with the second attribute information, obtains target identity information of a user when the comparison between the first attribute information and the second attribute information is successful, determines a target interface authority corresponding to the target identity information according to a mapping relationship between the preset identity information and an interface operation authority, operates the test interface according to the target interface authority, and on one hand, can obtain the attribute information of the test interface and crawl the attribute information of the corresponding interface document, and comparing the two, and if the comparison is successful, indicating that the test is successful, so that the test efficiency can be improved, and on the other hand, corresponding operation can be executed on the test interface according to the user authority.
In accordance with the foregoing embodiments, please refer to fig. 3, fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application, and as shown in the drawing, the electronic device includes a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor, and in an embodiment of the present application, the programs include instructions for performing the following steps:
acquiring preset test environment parameters corresponding to the test interface;
acquiring target test environment parameters;
when the target test environment parameter is successfully compared with the preset test environment parameter, acquiring first attribute information of the test interface;
acquiring second attribute information corresponding to the interface document in a crawling manner;
comparing the first attribute information with the second attribute information;
and confirming that the test is successful when the first attribute information is successfully compared with the second attribute information.
It can be seen that, in the electronic device described in this embodiment of the present application, the preset test environment parameter corresponding to the test interface is obtained, the target test environment parameter is obtained, when the comparison between the target test environment parameter and the preset test environment parameter is successful, the first attribute information of the test interface is obtained, the second attribute information corresponding to the interface document is obtained in a crawling manner, the first attribute information is compared with the second attribute information, when the comparison between the first attribute information and the second attribute information is successful, the test success is confirmed, the attribute information of the test interface and the attribute information of the interface document corresponding to the crawling can be obtained, and then the comparison between the first attribute information and the second attribute information is successful, and the test success is indicated, so the test efficiency can be improved.
Optionally, in the aspect of obtaining the first attribute information of the test interface, the program includes instructions for performing the following steps:
acquiring a target identifier of the test interface;
and determining the first attribute information corresponding to the target identifier according to a mapping relation between preset identifiers and attribute information.
Optionally, in terms of obtaining the second attribute information corresponding to the interface document in a crawling manner, the program includes instructions for performing the following steps:
acquiring an interface document corresponding to the test interface in a crawling manner;
determining a target attribute information identifier corresponding to the target test environment parameter according to a mapping relation between a preset test environment parameter and an attribute information identifier;
acquiring an attribute information set of the interface document;
and acquiring attribute information corresponding to the target attribute information identifier from the attribute information set to obtain the second attribute information.
Optionally, when the first attribute information includes a first interface entry and the second attribute information includes a second interface entry, in the aspect of comparing the first attribute information with the second attribute information, the program includes an instruction for executing the following steps:
and comparing the first interface input parameter with the second interface input parameter, and confirming that the test is successful when the first interface input parameter is successfully participated in the second interface input reference pair.
Optionally, in the aspect of comparing the first interface entry with the second interface entry, the program includes instructions for performing the following steps:
acquiring a target test item;
determining a target index identifier corresponding to the target test item according to a mapping relation between a preset test item and the index identifier;
screening the first interface input parameters according to the target index identification to obtain target first interface input parameters;
screening the second interface input parameters according to the target index identification to obtain target second interface input parameters;
and comparing the target first interface access with the target second interface access.
Optionally, when the first attribute information includes a first interface entry and the second attribute information includes a second interface exit, in the aspect of comparing the first attribute information with the second attribute information, the program includes an instruction for executing the following steps:
and comparing the first interface input parameter with the second interface output parameter, and confirming that the test is successful when the first interface input parameter and the second interface output parameter are successful.
Optionally, when the first attribute information includes a first interface parameter and the second attribute information includes a second interface parameter, in the aspect of comparing the first attribute information with the second attribute information, the program includes an instruction for executing the following steps:
and comparing the first interface output parameter with the second interface input parameter, and confirming that the test is successful when the first interface output parameter is successfully participated in the second interface input reference pair.
The above description has introduced the solution of the embodiment of the present application mainly from the perspective of the method-side implementation process. It is understood that the electronic device comprises corresponding hardware structures and/or software modules for performing the respective functions in order to realize the above-mentioned functions. Those of skill in the art will readily appreciate that the present application is capable of hardware or a combination of hardware and computer software implementing the various illustrative elements and algorithm steps described in connection with the embodiments provided herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the electronic device may be divided into the functional units according to the method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
Fig. 4 is a block diagram showing functional units of a test apparatus 400 according to an embodiment of the present application. The test apparatus 400, the apparatus 400 comprising: a first obtaining unit 401, a second obtaining unit 402, a third obtaining unit 403, a fourth obtaining unit 404, a comparing unit 405, and a determining unit 406, wherein,
the first obtaining unit 401 is configured to obtain a preset test environment parameter corresponding to the test interface;
the second obtaining unit 402 is configured to obtain a target test environment parameter;
the third obtaining unit 403 is configured to obtain first attribute information of the test interface when the target test environment parameter is successfully compared with the preset test environment parameter;
the fourth obtaining unit 404 is configured to obtain, in a crawling manner, second attribute information corresponding to the interface document;
the comparing unit 405 is configured to compare the first attribute information with the second attribute information;
the determining unit 406 is configured to confirm that the test is successful when the first attribute information is successfully compared with the second attribute information.
It can be seen that, the test device described in this embodiment of the present application obtains the preset test environment parameter corresponding to the test interface, obtains the target test environment parameter, obtains the first attribute information of the test interface when the target test environment parameter is successfully compared with the preset test environment parameter, obtains the second attribute information corresponding to the interface document in a crawling manner, compares the first attribute information with the second attribute information, confirms that the test is successful when the first attribute information is successfully compared with the second attribute information, can obtain the attribute information of the test interface and crawl the attribute information of the corresponding interface document, compares the two, and if the comparison is successful, indicates that the test is successful, thereby improving the test efficiency.
Optionally, in terms of obtaining the first attribute information of the test interface, the third obtaining unit 403 is specifically configured to:
acquiring a target identifier of the test interface;
and determining the first attribute information corresponding to the target identifier according to a mapping relation between preset identifiers and attribute information.
Optionally, in terms of obtaining the second attribute information corresponding to the interface document in a crawling manner, the fourth obtaining unit 404 is specifically configured to:
acquiring an interface document corresponding to the test interface in a crawling manner;
determining a target attribute information identifier corresponding to the target test environment parameter according to a mapping relation between a preset test environment parameter and an attribute information identifier;
acquiring an attribute information set of the interface document;
and acquiring attribute information corresponding to the target attribute information identifier from the attribute information set to obtain the second attribute information.
Optionally, when the first attribute information includes a first interface entry and the second attribute information includes a second interface entry, in the aspect of comparing the first attribute information with the second attribute information, the comparing unit 405 is specifically configured to:
and comparing the first interface input parameter with the second interface input parameter, and confirming that the test is successful when the first interface input parameter is successfully participated in the second interface input reference pair.
Optionally, in the aspect of comparing the first interface entry and the second interface entry, the comparing unit 405 is specifically configured to:
acquiring a target test item;
determining a target index identifier corresponding to the target test item according to a mapping relation between a preset test item and the index identifier;
screening the first interface input parameters according to the target index identification to obtain target first interface input parameters;
screening the second interface input parameters according to the target index identification to obtain target second interface input parameters;
and comparing the target first interface access with the target second interface access.
Optionally, when the first attribute information includes a first interface entry parameter and the second attribute information includes a second interface exit parameter, in the aspect of comparing the first attribute information with the second attribute information, the comparing unit 405 is specifically configured to:
and comparing the first interface input parameter with the second interface output parameter, and confirming that the test is successful when the first interface input parameter and the second interface output parameter are successful.
Optionally, when the first attribute information includes a first interface parameter and the second attribute information includes a second interface parameter, in the aspect of comparing the first attribute information with the second attribute information, the comparing unit 405 is specifically configured to: :
and comparing the first interface output parameter with the second interface input parameter, and confirming that the test is successful when the first interface output parameter is successfully participated in the second interface input reference pair.
It can be understood that the functions of each program module of the testing apparatus in this embodiment may be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process may refer to the related description of the foregoing method embodiment, which is not described herein again.
Embodiments of the present application also provide a computer storage medium, where the computer storage medium stores a computer program for electronic data exchange, the computer program enabling a computer to execute part or all of the steps of any one of the methods described in the above method embodiments, and the computer includes an electronic device.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods as described in the above method embodiments. The computer program product may be a software installation package, the computer comprising an electronic device.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer readable memory if it is implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a memory, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the above-mentioned method of the embodiments of the present application. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, which may include: flash Memory disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method of testing, the method comprising:
acquiring preset test environment parameters corresponding to the test interface;
acquiring target test environment parameters;
when the target test environment parameter is successfully compared with the preset test environment parameter, acquiring first attribute information of the test interface;
acquiring second attribute information corresponding to the interface document in a crawling manner;
comparing the first attribute information with the second attribute information;
and confirming that the test is successful when the first attribute information is successfully compared with the second attribute information.
2. The method of claim 1, wherein the obtaining the first attribute information of the test interface comprises:
acquiring a target identifier of the test interface;
and determining the first attribute information corresponding to the target identifier according to a mapping relation between preset identifiers and attribute information.
3. The method according to claim 1 or 2, wherein the obtaining of the second attribute information corresponding to the interface document by crawling includes:
acquiring an interface document corresponding to the test interface in a crawling manner;
determining a target attribute information identifier corresponding to the target test environment parameter according to a mapping relation between a preset test environment parameter and an attribute information identifier;
acquiring an attribute information set of the interface document;
and acquiring attribute information corresponding to the target attribute information identifier from the attribute information set to obtain the second attribute information.
4. The method according to claim 1 or 2, wherein when the first attribute information includes a first interface entry and the second attribute information includes a second interface entry, the comparing the first attribute information with the second attribute information includes:
and comparing the first interface input parameter with the second interface input parameter, and confirming that the test is successful when the first interface input parameter is successfully participated in the second interface input reference pair.
5. The method of claim 4, wherein the comparing the first interface entry with the second interface entry comprises:
acquiring a target test item;
determining a target index identifier corresponding to the target test item according to a mapping relation between a preset test item and the index identifier;
screening the first interface input parameters according to the target index identification to obtain target first interface input parameters;
screening the second interface input parameters according to the target index identification to obtain target second interface input parameters;
and comparing the target first interface access with the target second interface access.
6. The method according to claim 1 or 2, wherein when the first attribute information includes a first interface entry and the second attribute information includes a second interface exit, the comparing the first attribute information with the second attribute information includes:
and comparing the first interface input parameter with the second interface output parameter, and confirming that the test is successful when the first interface input parameter and the second interface output parameter are successful.
7. The method according to claim 1 or 2, wherein when the first attribute information includes a first interface out-reference and the second attribute information includes a second interface in-reference, the comparing the first attribute information with the second attribute information includes:
and comparing the first interface output parameter with the second interface input parameter, and confirming that the test is successful when the first interface output parameter is successfully participated in the second interface input reference pair.
8. A test apparatus, the apparatus comprising: a first obtaining unit, a second obtaining unit, a third obtaining unit, a fourth obtaining unit, a comparing unit and a determining unit,
the first obtaining unit is used for obtaining preset test environment parameters corresponding to the test interface;
the second acquisition unit is used for acquiring target test environment parameters;
the third obtaining unit is configured to obtain first attribute information of the test interface when the target test environment parameter is successfully compared with the preset test environment parameter;
the fourth obtaining unit is used for obtaining second attribute information corresponding to the interface document in a crawling mode;
the comparison unit is used for comparing the first attribute information with the second attribute information;
the determining unit is configured to confirm that the test is successful when the first attribute information and the second attribute information are successfully compared.
9. An electronic device comprising a processor, a memory for storing one or more programs and configured for execution by the processor, the programs comprising instructions for performing the steps of the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to carry out the method according to any one of claims 1-7.
CN202011285615.5A 2020-11-17 2020-11-17 Test method, test device, electronic equipment and storage medium Pending CN112433935A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011285615.5A CN112433935A (en) 2020-11-17 2020-11-17 Test method, test device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011285615.5A CN112433935A (en) 2020-11-17 2020-11-17 Test method, test device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112433935A true CN112433935A (en) 2021-03-02

Family

ID=74700649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011285615.5A Pending CN112433935A (en) 2020-11-17 2020-11-17 Test method, test device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112433935A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114297058A (en) * 2021-12-23 2022-04-08 马上消费金融股份有限公司 Test method and device
CN114338146A (en) * 2021-12-27 2022-04-12 中国民航信息网络股份有限公司 Dynamic code-based crawler-resistant method, system, client and server

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114297058A (en) * 2021-12-23 2022-04-08 马上消费金融股份有限公司 Test method and device
CN114338146A (en) * 2021-12-27 2022-04-12 中国民航信息网络股份有限公司 Dynamic code-based crawler-resistant method, system, client and server
CN114338146B (en) * 2021-12-27 2023-08-15 中国民航信息网络股份有限公司 Anti-crawler method, system, client and server based on dynamic code

Similar Documents

Publication Publication Date Title
CN109033772B (en) Verification information input method and device
CN112612686A (en) Performance test method and device, electronic equipment and storage medium
CN111552633A (en) Interface abnormal call testing method and device, computer equipment and storage medium
CN107908553B (en) Association testing method, application server and computer readable storage medium
CN112433935A (en) Test method, test device, electronic equipment and storage medium
CN113448862B (en) Software version testing method and device and computer equipment
CN111475390A (en) Log collection system deployment method, device, equipment and storage medium
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN112711640A (en) Method and device for configuring business handling process
CN113010944A (en) Model checking method, electronic equipment and related product
CN110688305B (en) Test environment synchronization method, device, medium and electronic equipment
CN115617780A (en) Data import method, device, equipment and storage medium
CN112214405A (en) Software testing method and device, electronic equipment and readable storage medium
CN108809896A (en) A kind of information calibration method, device and electronic equipment
CN112561690A (en) Method, system, equipment and storage medium for testing credit card staging service interface
CN110516258B (en) Data verification method and device, storage medium and electronic device
CN105162799A (en) Method for checking whether client is legal mobile terminal or not and server
CN114968822A (en) Interface testing method and device, computer equipment and storage medium
CN115470281A (en) Batch data importing method and device, terminal equipment and storage medium
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium
CN112596745A (en) Model deployment method and device, electronic equipment and storage medium
CN113128168A (en) Pad parameter checking and correcting method and device, computer equipment and storage medium
CN111538542A (en) System configuration method and related device
CN112417324A (en) Chrome-based URL (Uniform resource locator) interception method and device and computer equipment
CN113885963B (en) Secondary development file execution method, device and storage medium

Legal Events

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