CN111538651A - Interface testing method, device, server and storage medium - Google Patents

Interface testing method, device, server and storage medium Download PDF

Info

Publication number
CN111538651A
CN111538651A CN202010234220.6A CN202010234220A CN111538651A CN 111538651 A CN111538651 A CN 111538651A CN 202010234220 A CN202010234220 A CN 202010234220A CN 111538651 A CN111538651 A CN 111538651A
Authority
CN
China
Prior art keywords
interface
information
test case
changed
test
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
CN202010234220.6A
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 Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China 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 Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202010234220.6A priority Critical patent/CN111538651A/en
Publication of CN111538651A publication Critical patent/CN111538651A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/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 application provides an interface testing method, an interface testing device, a server and a storage medium, wherein the method comprises the following steps: acquiring an object code, wherein the object code comprises information of each interface in at least one interface; acquiring the information of each interface from the target code; comparing the information of each interface with the information of the interfaces included in the first database, and determining the interface with changed information according to the comparison result; and obtaining a test case of the interface with the changed presence information, wherein the test case is used for testing the function of the interface with the changed presence information. By the aid of the method and the device, development efficiency can be improved.

Description

Interface testing method, device, server and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to an interface testing method, an interface testing device, a server, and a storage medium.
Background
Each system service in the software development process does not exist independently, but needs to depend on or depend on other systems to finish the service for users together, and in the system development and test process, after the development of codes, a developer sends the codes to a tester for testing. When the testing party performs testing, the code-related interface can be called by running the test case of the code-related interface, so as to complete the testing of the code. The test case can be written and provided by the developer, or written by the tester itself.
However, with the change of the business requirement, the interface information changes frequently, which means that the test cases of the interfaces with the interface information changes need to be rewritten frequently. In this case, there are problems whether it is provided by the developer or written by the tester itself. If the testing party writes the testing case, although the task amount of the developer can be reduced and the extra support of the developer is not needed, the testing party is required to have the coding capability and deeply understand the development of the code, which results in large learning span of the testing party and makes the method difficult to implement in reality. If the developer provides the test case, a lot of extra work is brought to the developer, and the communication cost between the developer and the tester is increased. Therefore, in this case, both the developer and the tester do this, which brings unnecessary cost and is too dependent on manpower, resulting in low test case generation efficiency and further reduced development efficiency.
Disclosure of Invention
The embodiment of the application provides an interface testing method, an interface testing device, a server and a storage medium, and development efficiency can be improved.
In a first aspect, an embodiment of the present application provides an interface testing method, including:
acquiring an object code, wherein the object code comprises information of each interface in at least one interface;
acquiring the information of each interface from the target code;
comparing the information of each interface with the information of the interfaces included in the first database, and determining the interface with changed information according to the comparison result;
and obtaining a test case of the interface with the changed presence information, wherein the test case is used for testing the function of the interface with the changed presence information.
Optionally, the obtaining the object code includes:
when a code updating message aiming at target code sent by a code hosting device is received, the target code is obtained from the code hosting device; or the like, or, alternatively,
and receiving the object code sent by the terminal equipment.
Optionally, the obtaining information of each interface from the object code includes:
acquiring an external header file included by the object code through a preset script, wherein the external header file includes information of each interface in the at least one interface;
and calling a regular matching algorithm to acquire the information of each interface from the external header file.
Optionally, the method further comprises:
determining the type of the interface with the changed presence information according to the information of the interface with the changed presence information;
determining a target test scene corresponding to the type of the interface with the information change according to the corresponding relation between the type of the interface and the test scene; wherein the target test scenario includes at least one of: a normal test scenario, an abnormal test scenario, and a pressure test scenario;
the obtaining of the test case of the interface with the changed presence information includes:
and obtaining the test case of the interface with the changed information in the target test scene.
Optionally, after obtaining the test case of the interface with changed presence information, the method further includes:
updating the test case of the interface with the changed information to a second database; the second database comprises a test case for each of a plurality of interfaces;
determining a test case of the first interface from a second database; the first interface is not within the at least one interface;
deleting the test cases of the first interface included in the second database.
Optionally, the obtaining a test case of the interface with changed presence information includes:
when the second database including the test case of the interface with the changed presence information is inquired, obtaining the test case of the interface with the changed presence information from the second database;
when the second database does not comprise the test case of the interface with the changed information, generating a blank test case of the interface with the changed information, and acquiring the test case of the interface with the changed information according to the blank test case.
Optionally, after obtaining the test case of the interface with changed presence information from the second database, the method further includes:
calling an object acquisition method to acquire the information of each interface included in the test case of the interface with the changed information;
and matching the information of the interface with the changed information with the information of each interface included in the test case of the interface with the changed information, and updating the test case of the interface with the changed information according to a matching result.
In a second aspect, an embodiment of the present application provides an interface testing apparatus, including:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring an object code, and the object code comprises information of each interface in at least one interface;
the obtaining module is further configured to obtain information of each interface from the target code;
the processing module is used for comparing the information of each interface with the information of the interfaces included in the first database and determining the interface with information change according to the comparison result;
the obtaining module is further configured to obtain a test case of the interface with the changed presence information, where the test case is used to test a function of the interface with the changed presence information.
In a third aspect, an embodiment of the present application provides a server, including a processor and a memory, where the processor and the memory are connected to each other, where the memory is used to store a computer program, and the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method according to the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, where the computer program is executed by a processor to implement the method according to the first aspect.
In summary, the server may obtain an object code, where the object code includes information of each interface in at least one interface, and obtain the information of each interface from the object code; the server can compare the information of each interface with the information of the interfaces included in the first database, and determine the interface with the changed information according to the comparison result to obtain a test case of the interface with the changed information, wherein the test case is used for testing the function of the interface with the changed information, so that the development efficiency is 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 an interface testing method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of another interface testing method provided in the embodiment of the present application;
fig. 3 is a schematic structural diagram of an interface testing apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
In order to solve the problems in the prior art, an embodiment of the present application provides an interface test scheme, which may obtain an object code, and analyze an interface that needs to be subjected to a function test based on the object code, that is, determine an interface that has an information change, thereby obtaining a test case of the interface that has the information change, so as to test the function of the interface that has the information change.
Please refer to fig. 1, which is a flowchart illustrating an interface testing method according to an embodiment of the present disclosure. The method may be applied to a server. The server may be a single server or a cluster of servers. Specifically, the method may comprise the steps of:
s101, acquiring a target code, wherein the target code comprises information of each interface in at least one interface.
Wherein, the interface can be represented by a function, and the information of the interface can comprise a function name and a parameter.
In one embodiment, the server may obtain the object code by: the server acquires the object code from the code hosting device when receiving a code update message for the object code sent by the code hosting device. By adopting the mode, the server can acquire the latest code in time when the code is changed, and then the server can acquire the latest test case of the code in time for the interface function test, so that the interface function test efficiency is improved.
In one application scenario, a code developer may host object code at GitLab through a terminal device. The code updating message for the target code can be sent to the server through a Git Hooks function of the GitLab, and the server can acquire the target code from the GitLab when receiving the code updating message for the target code sent by the GitLab.
In one embodiment, in addition to obtaining the object code by the code hosting device, the terminal may also send the object code to the server, so that the server may also receive the object code sent by the terminal device. By adopting the method, the speed of acquiring the target code by the server can be improved. S102, obtaining the information of each interface from the target code.
In this embodiment, the server may obtain the information of each interface from the object code after obtaining the object code.
In one embodiment, the object code may include an outer header file. The pair of header files may also be referred to as a pair of external spoken files, an external interface header file, and so on. The pair of headers may include a definition for each of at least one interface used by the object code. The server may obtain an external header file included in the object code, and obtain information of each of the at least one interface from the external header file.
In one embodiment, the manner for the server to obtain the external header file included in the object code may be: and the server acquires the external header file included by the object code through a preset script. In one embodiment, the server may obtain the specified directory of the object code through a preset script, such as a header file under a Public directory.
In an embodiment, the manner for the server to obtain the information of each interface in the at least one interface from the pair of header files may be: and the server calls a regular matching algorithm to acquire the information of each interface from the pair of header files. The regular matching algorithm may also be referred to as a regular expression algorithm, a regular expression matching algorithm, or the like.
S103, comparing the information of each interface with the information of the interfaces included in the first database, and determining the interface with the changed information according to the comparison result.
In this embodiment, the server may compare the information of each interface with the information of the interface included in the first database to obtain a comparison result, and may determine, according to the comparison result, an interface in which the information is changed. In one embodiment, the information of the interfaces included in the first database may refer to information of each interface included in a previous version code corresponding to the object code. The interfaces for the presence information change may be classified into the following categories: an added interface, a deleted interface and a modified interface.
For example, the at least one interface includes an interface 1, an interface 2, and an interface 3, the first database includes information of the interface 2 and information of the interface 3, and the server may compare the information of the interface 1 and information of the interface 2 included in the object code with the information of the interface 2 and information of the interface 3 included in the first database, determine that the newly added interface is the interface 1 according to a comparison result, and determine that the interface 1 is an interface with information change.
In one embodiment, the server comparing the information for each interface with the information for the interfaces included in the first database may be a traversal comparison of the information for each interface with the information for the interfaces included in the first database for the server. Through the traversal comparison, the interface where the information change exists can be quickly determined.
S104, obtaining a test case of the interface with the changed presence information, wherein the test case is used for testing the function of the interface with the changed presence information.
In one embodiment, after obtaining the test case of the interface with the changed presence information, the server may send the test case to the electronic device corresponding to the tester. The electronic device may be a terminal or a server.
In one embodiment, the server may generate a blank test case of the interface with the changed presence information, and obtain a test case of the interface with the changed presence information according to the blank test case.
In one embodiment, the server may query whether the second database includes the test case of the interface with the changed presence information, and may generate a blank test case of the interface with the changed presence information when the test case of the interface with the changed presence information is not included in the second database, so as to obtain the test case of the interface with the changed presence information according to the blank test case. The second database is a database for storing test cases, and the second database may include test cases corresponding to each of the plurality of interfaces.
In an embodiment, the server may generate a test code for a blank test case for the server according to a manner in which the blank test case obtains the test case of the interface with the presence information change, add the test code to the blank test case, and use the test case with the test code added as the test case of the interface with the presence information change.
In one embodiment, the server may automatically generate test code for a blank test case when running the blank test case. For example, the server may generate the test code of the blank test case according to a preset generation rule. The generation rule sets up a code rule for generating the test case, so that the test code of the blank test case can be automatically generated according to the generation rule.
In one embodiment, the server may determine the type of the interface with the changed information according to the information of the interface with the changed information, and determine a target test scenario corresponding to the type of the interface with the changed information according to a corresponding relationship between the type of the interface and the test scenario; the server obtains a test case corresponding to the interface with the changed presence information in the target test scenario, wherein the test scenario may be at least one of the following: a normal test scenario, an abnormal test scenario, and a pressure test scenario. In one embodiment, a server may obtain an interface type mapping table that includes a type corresponding to information for each of a plurality of interfaces. Accordingly, the server may look up the type corresponding to the information of the interface with changed presence information as the type of the interface with changed presence information according to the interface type relationship table. In one embodiment, the server may further determine the test case of the interface with the change of the presence information in combination with the service scenario corresponding to the object code. In this case, the correspondence between the type of the interface and the test scenario may be specifically a correspondence between a service scenario and a test scenario. Correspondingly, the server can determine the target test scene corresponding to the type of the interface with the information change according to the corresponding relation among the service scene of the target code, the type of the interface and the test scene.
In one embodiment, the server may determine, from at least one interface, an interface that meets a preset condition, compare information of the interface that meets the preset condition with information of interfaces included in the first database, and determine, according to a comparison result, an interface in which information is changed, from among the interfaces that meet the preset condition. For example, the meeting of the preset condition may be that the number of times of changing the at least information is greater than or equal to a first preset number of times, or may also be an interface whose number of times of calling is greater than or equal to a second preset number of times, or may also refer to an interface whose priority is greater than or equal to a preset priority, which is not limited in the present application.
In one embodiment, the server may obtain an interface change record table associated with the object code, where the interface change record table includes a plurality of interface change information recorded within a first preset time range, and each of the plurality of interface change information may include information of an interface before information change and information of an interface after information change; the server counts the information change times of each interface according to the information of each interface (the information of each interface obtained from the target code) and an interface change record table; the server determines an interface with the information change frequency larger than or equal to a first preset frequency from the at least one interface according to the information change frequency of each interface in the at least one interface; the server compares the information of the interfaces with the information of the interfaces, wherein the information change times of the interfaces are larger than or equal to the first preset times, and determines the interfaces with the information change in the interfaces with the change times of the first preset times according to the comparison result, so that the test case of the interfaces with the information change is obtained. In this way, the interface with information change can be determined through the interface with high information change frequency, so that the determination process of the interface with information change is more targeted.
In one embodiment, the server may obtain an interface call record table associated with the object code, where the interface call record table includes interface call data recorded within a second preset time range. For example, the interface call information may refer to interface call data of at least one version of code corresponding to the object code (e.g., a last version of code corresponding to the object code). The server can determine an interface with the calling times larger than or equal to a second preset time in the at least one interface according to the interface calling record table; the server can compare the information of the interfaces with the calling times larger than or equal to the second preset times with the information of the interfaces included in the first database, and determine that the calling times are larger than or the interfaces with the changed information exist in the interfaces with the changed information according to the comparison result, so as to obtain the test case of the interfaces with the changed information.
In one embodiment, the server may determine whether the object code has an information change tag, and if it is determined that the object code has the information change tag, the server may obtain information of an interface corresponding to the information change tag from the object code; the server may determine the interface corresponding to the information change label as the interface with the changed presence information, so as to obtain the test case of the interface with the changed presence information. By adopting the mode, the interface with the information change can be determined through the information of the interface corresponding to the information change label, so that the determination process of the interface with the information change is more targeted.
In an embodiment, the server may compare the information of the interface corresponding to the information change tag with the information of the interfaces included in the first database, and determine, according to a comparison result, an interface with information change in the interface corresponding to the information change tag, so as to obtain a test case of the interface with information change. In consideration of the fact that the information change label may be marked incorrectly, the accuracy of identifying the information change interface can be ensured by comparing the information of the interface corresponding to the information change label with the information of the interface included in the first database to identify the interface with the information change. In an embodiment, if it is determined that the target code does not have the information change tag, the server may perform the step of comparing the information of each interface with the information of the interfaces included in the first database, or perform the step of acquiring the interface change record table associated with the target code, or perform the step of acquiring the interface call record table associated with the target code, which is not limited in this embodiment of the present application.
In one embodiment, the server may perform a deletion operation on the redundant test cases in the second database after obtaining the test cases of the interface for which the presence information is changed.
In one embodiment, the server may update the test case of the interface for presence information change to the second database. Moreover, the server can determine the test case of the first interface from the second database; and deleting the test cases of the first interface included in the second database. Wherein the first interface is not within the at least one interface. By the method, the test cases irrelevant to the target codes can be deleted, and further consumption of storage resources of the second database is reduced.
In one embodiment, the server may further determine a test case of the second interface from a second database, and delete the test case of the second interface included in the second database. By deleting the test cases with the reference relation in the mode, the consumption of storage resources of the second data can be reduced.
In one embodiment, the server may obtain the test case of the interface with changed presence information from the second database when querying the test case of the second database including the interface with changed presence information.
It can be seen that, in the embodiment shown in fig. 1, the server may obtain the object code and obtain the information of the interface from the object code; the server compares the information of the interface with the information of the interface included in the first database, and determines the interface with the changed information according to the comparison result so as to obtain a test case of the interface with the changed information for testing the function of the interface with the changed information, thereby automatically generating the test case of the corresponding interface and improving the development efficiency.
Please refer to fig. 2, which is a flowchart illustrating another interface testing method according to an embodiment of the present disclosure. The method may be applied to a server. The server may be a server or a cluster of servers. Specifically, the method may comprise the steps of:
s201, obtaining an object code, wherein the object code comprises information of each interface in at least one interface.
S202, acquiring the information of each interface from the target code.
S203, comparing the information of each interface with the information of the interfaces included in the first database, and determining the interface with the changed information according to the comparison result.
Steps S201 to S203 can refer to steps S101 to S103 in the embodiment of fig. 1, and the embodiments of the present application are not described herein again.
S204, when the second database including the test case of the interface with the changed presence information is inquired, obtaining the test case of the interface with the changed presence information from the second database.
S205, calling an object obtaining method to obtain the information of each interface included in the test case of the interface with the changed information.
In steps S204-S205, the server may obtain the test case of the interface with changed presence information from the second database when querying whether the second database includes the test case of the interface with changed presence information. And, the server may call an object obtaining method to obtain information of each interface included in the test case of the interface with the changed presence information, so as to execute step S206.
In an embodiment, the server calls the Object obtaining method, and the manner of obtaining the information of each interface included in the test case of the interface with changed presence information may be that the server runs the test case of the interface with changed presence information through a RunTime mechanism of Object-C to obtain the information of each interface included in the test case of the interface with changed presence information. The code used by the process may include: class _ copymethoddlist (Class, & methodCount).
S206, matching the information of the interface with the changed presence information with the information of each interface included in the test case of the interface with the changed presence information, and updating the test case of the interface with the changed presence information according to the matching result.
Due to the test case of the interface with information change acquired from the second database, the following problems may exist: part of the information in the test case of the interface with the change of presence information does not match the information of the interface with the change of presence information. In order to solve the problem, the server may match the information of the interface with the presence information change with the information of each interface included in the test case of the interface with the presence information change, and update the test case with the presence information change according to a matching result, so that the test case with the interface with the presence information change matches with the information of the interface with the presence information change.
In an embodiment, the server matches the information of the interface with the presence information change with the information of each interface included in the test case of the interface with the presence information change, and the manner of obtaining the matching result may be that the server matches the information of the interface with the presence information change with the information of each interface included in the test case of the interface with the presence information change by using a character string matching manner, so as to obtain the matching result.
In one embodiment, the matching result may include information of a third interface where there is an information change (e.g., a parameter change) that is inconsistent with information of the third interface included in the test case of the third interface. Accordingly, the server can update the test case with the changed presence information by using the information of the third interface.
In one embodiment, the matching result includes information that the first interface exists, and the server may determine a test case of the first interface from the second database and delete the test case of the first interface included in the second database. Similarly, the server may also delete the test case of the second interface in the manner mentioned in the embodiment of fig. 1, which is not described herein again in this embodiment of the present application.
As can be seen, in the embodiment shown in fig. 2, when querying that the second database includes the test case of the interface with changed presence information, the server may match the information of the interface with changed presence information included in the target code with the information of each interface included in the test case with changed presence information, and update the information of each interface included in the test case with changed presence information according to the matching result, thereby improving development efficiency.
Please refer to fig. 3, which is a schematic structural diagram of an interface testing apparatus according to an embodiment of the present application. The apparatus may employ the aforementioned server. Specifically, the apparatus may include:
an obtaining module 301, configured to obtain an object code, where the object code includes information of each interface in at least one interface.
The obtaining module 301 is further configured to obtain information of each interface from the object code.
The processing module 302 is configured to compare the information of each interface with the information of the interfaces included in the first database, and determine an interface with changed information according to a comparison result.
The obtaining module 301 is further configured to obtain a test case of the interface with changed presence information, where the test case is used to test a function of the interface with changed presence information.
In an optional implementation manner, the obtaining module 301 obtains the object code, specifically, when receiving a code update message for the object code sent by a code hosting device, obtains the object code from the code hosting device; or, receiving the object code sent by the terminal equipment.
In an optional implementation manner, the obtaining module 301 obtains the information of each interface from the object code, specifically, obtains an external header file included in the object code through a preset script, where the external header file includes the information of each interface in the at least one interface; and calling a regular matching algorithm to acquire the information of each interface from the external header file.
In an optional implementation manner, the processing module 302 is further configured to determine a type of the interface with the presence information change according to the information of the interface with the presence information change; determining a target test scene corresponding to the type of the interface with the information change according to the corresponding relation between the type of the interface and the test scene; wherein the target test scenario includes at least one of: a normal test scenario, an abnormal test scenario, and a pressure test scenario.
In an optional implementation manner, the obtaining module 301 obtains a test case of the interface with changed presence information, specifically, obtains a test case of the interface with changed presence information in the target test scenario.
In an optional implementation manner, the processing module 302 is further configured to update the test case of the interface with changed presence information to a second database after the obtaining module 301 obtains the test case of the interface with changed presence information; the second database comprises a test case for each of a plurality of interfaces; determining a test case of the first interface from a second database; the first interface is not within the at least one interface; deleting the test cases of the first interface included in the second database.
In an optional implementation manner, the obtaining module 301 obtains the test case of the interface with changed presence information, specifically, when the second database including the test case of the interface with changed presence information is queried, obtains the test case of the interface with changed presence information from the second database; when the second database does not comprise the test case of the interface with the changed information, generating a blank test case of the interface with the changed information, and acquiring the test case of the interface with the changed information according to the blank test case.
In an optional implementation manner, the processing module 302 is further configured to, after the obtaining module 301 obtains the test case of the interface with changed presence information from the second database, invoke an object obtaining method to obtain information of each interface included in the test case of the interface with changed presence information; and matching the information of the interface with the changed information with the information of each interface included in the test case of the interface with the changed information, and updating the test case of the interface with the changed information according to a matching result.
It can be seen that in the embodiment shown in fig. 3, the server may obtain the object code and obtain the information of the interface from the object code; the server compares the information of the interface with the information of the interface included in the first database, and determines the interface with the changed information according to the comparison result so as to obtain a test case of the interface with the changed information for testing the function of the interface with the changed information, thereby automatically generating the test case of the corresponding interface and improving the development efficiency.
Please refer to fig. 4, which is a schematic structural diagram of a server according to an embodiment of the present disclosure. The server described in this embodiment may include: a processor 1000, an input device 2000, an output device 3000, and a memory 4000. The processor 1000, the input device 2000, the output device 3000, and the memory 4000 may be connected by a bus or other means. In one embodiment, the input device 2000 and the output device 3000 are optional devices. The input device 2000 and the output device 3000 may be standard wired or wireless communication interfaces.
The Processor 1000 may be a Central Processing Unit (CPU), and may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 4000 may be a high-speed RAM memory or a non-volatile memory (e.g., a disk memory). The memory 4000 is used to store a set of program codes, and the processor 1000, the input device 2000 and the output device 3000 may call the program codes stored in the memory 4000. Specifically, the method comprises the following steps:
a processor 1000 configured to obtain an object code, where the object code includes information of each interface of at least one interface; acquiring the information of each interface from the target code; comparing the information of each interface with the information of the interfaces included in the first database, and determining the interface with changed information according to the comparison result; and obtaining a test case of the interface with the changed presence information, wherein the test case is used for testing the function of the interface with the changed presence information.
Optionally, the processor 1000 obtains the object code, specifically, when a code update message for the object code sent by the code hosting device is received, obtains the object code from the code hosting device; or, the object code sent by the terminal device is received through the input device 2000.
Optionally, the processor 1000 obtains the information of each interface from the object code, specifically, obtains an external header file included in the object code through a preset script, where the external header file includes the information of each interface in the at least one interface; and calling a regular matching algorithm to acquire the information of each interface from the external header file.
Optionally, the processor 1000 is further configured to determine a type of the interface with changed presence information according to the information of the interface with changed presence information; determining a target test scene corresponding to the type of the interface with the information change according to the corresponding relation between the type of the interface and the test scene; wherein the target test scenario includes at least one of: a normal test scenario, an abnormal test scenario, and a pressure test scenario.
Optionally, the processor 1000 obtains a test case of the interface with the changed presence information, specifically, obtains a test case of the interface with the changed presence information in the target test scenario.
Optionally, the processor 1000 is further configured to update the test case of the interface with changed presence information to a second database after obtaining the test case of the interface with changed presence information; the second database comprises a test case for each of a plurality of interfaces; determining a test case of the first interface from a second database; the first interface is not within the at least one interface; deleting the test cases of the first interface included in the second database.
Optionally, the processor 1000 obtains the test case of the interface with changed presence information, specifically, when the second database including the test case of the interface with changed presence information is queried, obtains the test case of the interface with changed presence information from the second database; when the second database does not comprise the test case of the interface with the changed information, generating a blank test case of the interface with the changed information, and acquiring the test case of the interface with the changed information according to the blank test case.
Optionally, the processor 1000 is further configured to, after obtaining the test case of the interface with the changed presence information from the second database, invoke an object obtaining method to obtain information of each interface included in the test case of the interface with the changed presence information; and matching the information of the interface with the changed information with the information of each interface included in the test case of the interface with the changed information, and updating the test case of the interface with the changed information according to a matching result.
In a specific implementation, the processor 1000, the input device 2000, and the output device 3000 described in this embodiment of the present application may perform the implementation described in the embodiment of fig. 1 and fig. 2, and may also perform the implementation described in this embodiment of the present application, which is not described herein again.
The 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 sampling hardware, and can also be realized in a form of sampling software functional units.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the above embodiments of the methods. The computer readable storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the invention has been described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. An interface testing method, comprising:
acquiring an object code, wherein the object code comprises information of each interface in at least one interface;
acquiring the information of each interface from the target code;
comparing the information of each interface with the information of the interfaces included in the first database, and determining the interface with changed information according to the comparison result;
and obtaining a test case of the interface with the changed presence information, wherein the test case is used for testing the function of the interface with the changed presence information.
2. The method of claim 1, wherein obtaining the object code comprises:
when a code updating message aiming at target code sent by a code hosting device is received, the target code is obtained from the code hosting device; or the like, or, alternatively,
and receiving the object code sent by the terminal equipment.
3. The method according to claim 1 or 2, wherein the obtaining the information of each interface from the object code comprises:
acquiring an external header file included by the object code through a preset script, wherein the external header file includes information of each interface in the at least one interface;
and calling a regular matching algorithm to acquire the information of each interface from the external header file.
4. The method of claim 1, further comprising:
determining the type of the interface with the changed presence information according to the information of the interface with the changed presence information;
determining a target test scene corresponding to the type of the interface with the information change according to the corresponding relation between the type of the interface and the test scene; wherein the target test scenario includes at least one of: a normal test scenario, an abnormal test scenario, and a pressure test scenario;
the obtaining of the test case of the interface with the changed presence information includes:
and obtaining the test case of the interface with the changed information in the target test scene.
5. The method of claim 1, wherein after obtaining the test case for the interface of the presence information change, the method further comprises:
updating the test case of the interface with the changed information to a second database; the second database comprises a test case for each of a plurality of interfaces;
determining a test case of the first interface from a second database; the first interface is not within the at least one interface;
deleting the test cases of the first interface included in the second database.
6. The method of claim 1, wherein obtaining the test case of the interface for presence information change comprises:
when the second database including the test case of the interface with the changed presence information is inquired, obtaining the test case of the interface with the changed presence information from the second database;
when the second database does not comprise the test case of the interface with the changed information, generating a blank test case of the interface with the changed information, and acquiring the test case of the interface with the changed information according to the blank test case.
7. The method of claim 6, wherein after obtaining the test case of the interface of the presence information change from the second database, the method further comprises:
calling an object acquisition method to acquire the information of each interface included in the test case of the interface with the changed information;
and matching the information of the interface with the changed information with the information of each interface included in the test case of the interface with the changed information, and updating the test case of the interface with the changed information according to a matching result.
8. An interface testing apparatus, comprising:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring an object code, and the object code comprises information of each interface in at least one interface;
the obtaining module is further configured to obtain information of each interface from the target code;
the processing module is used for comparing the information of each interface with the information of the interfaces included in the first database and determining the interface with information change according to the comparison result;
the obtaining module is further configured to obtain a test case of the interface with the changed presence information, where the test case is used to test a function of the interface with the changed presence information.
9. A server, comprising a processor and a memory, the processor and the memory being interconnected, wherein the memory is configured to store a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any one of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which is executed by a processor to implement the method according to any one of claims 1-7.
CN202010234220.6A 2020-03-30 2020-03-30 Interface testing method, device, server and storage medium Pending CN111538651A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010234220.6A CN111538651A (en) 2020-03-30 2020-03-30 Interface testing method, device, server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010234220.6A CN111538651A (en) 2020-03-30 2020-03-30 Interface testing method, device, server and storage medium

Publications (1)

Publication Number Publication Date
CN111538651A true CN111538651A (en) 2020-08-14

Family

ID=71952183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010234220.6A Pending CN111538651A (en) 2020-03-30 2020-03-30 Interface testing method, device, server and storage medium

Country Status (1)

Country Link
CN (1) CN111538651A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114721970A (en) * 2022-06-08 2022-07-08 广州易方信息科技股份有限公司 Method and device for automatic testing and accurate testing of construction interface

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302710A (en) * 2014-07-03 2016-02-03 腾讯科技(深圳)有限公司 Method and apparatus for determining test case in need of regression testing
CN106909510A (en) * 2017-03-02 2017-06-30 腾讯科技(深圳)有限公司 A kind of method and server for obtaining test case
CN107273281A (en) * 2016-04-06 2017-10-20 阿里巴巴集团控股有限公司 Service interface test method, system based on code change
US20190042399A1 (en) * 2017-08-03 2019-02-07 Fujitsu Limited Test run control method and apparatus
CN109947646A (en) * 2019-03-13 2019-06-28 平安信托有限责任公司 Interface test method, device, computer equipment and storage medium
CN110147317A (en) * 2019-04-19 2019-08-20 平安普惠企业管理有限公司 Code test method and device, electronic equipment and storage medium
CN110609785A (en) * 2018-06-15 2019-12-24 中移(杭州)信息技术有限公司 Software interface testing method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105302710A (en) * 2014-07-03 2016-02-03 腾讯科技(深圳)有限公司 Method and apparatus for determining test case in need of regression testing
CN107273281A (en) * 2016-04-06 2017-10-20 阿里巴巴集团控股有限公司 Service interface test method, system based on code change
CN106909510A (en) * 2017-03-02 2017-06-30 腾讯科技(深圳)有限公司 A kind of method and server for obtaining test case
US20190042399A1 (en) * 2017-08-03 2019-02-07 Fujitsu Limited Test run control method and apparatus
CN110609785A (en) * 2018-06-15 2019-12-24 中移(杭州)信息技术有限公司 Software interface testing method and device
CN109947646A (en) * 2019-03-13 2019-06-28 平安信托有限责任公司 Interface test method, device, computer equipment and storage medium
CN110147317A (en) * 2019-04-19 2019-08-20 平安普惠企业管理有限公司 Code test method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114721970A (en) * 2022-06-08 2022-07-08 广州易方信息科技股份有限公司 Method and device for automatic testing and accurate testing of construction interface

Similar Documents

Publication Publication Date Title
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN110209652B (en) Data table migration method, device, computer equipment and storage medium
CN110489421B (en) Data storage method, apparatus, computer readable storage medium and computer device
CN111061678B (en) Service data processing method, device, computer equipment and storage medium
CN110688305B (en) Test environment synchronization method, device, medium and electronic equipment
CN109361628B (en) Message assembling method and device, computer equipment and storage medium
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN110990346A (en) File data processing method, device, equipment and storage medium based on block chain
CN108460271B (en) Terminal identification method and device
CN111897846A (en) Cache data verification method, device, equipment and storage medium
CN111324441A (en) Operating environment switching method and device, computer equipment and storage medium
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN111369237B (en) Data processing method and device and computer storage medium
CN112181830B (en) Memory leak detection method, device, terminal and medium
CN111538651A (en) Interface testing method, device, server and storage medium
CN111046393B (en) Vulnerability information uploading method and device, terminal equipment and storage medium
CN107506474B (en) Database operation method and device based on object mapping
CN116304079A (en) Timing-based profile data management method, apparatus, and readable storage medium
CN112783866B (en) Data reading method, device, computer equipment and storage medium
CN114021133A (en) Code processing method and device, electronic equipment and storage medium
CN112699272B (en) Information output method and device and electronic equipment
CN109634636B (en) Application processing method, device, equipment and medium
CN114490402A (en) Method and device for checking validity of message field
CN109491699B (en) Resource checking method, device, equipment and storage medium of application program
CN108491448B (en) Data pushing method and device

Legal Events

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