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

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

Info

Publication number
CN118277275A
CN118277275A CN202410522141.3A CN202410522141A CN118277275A CN 118277275 A CN118277275 A CN 118277275A CN 202410522141 A CN202410522141 A CN 202410522141A CN 118277275 A CN118277275 A CN 118277275A
Authority
CN
China
Prior art keywords
interface
test
target
test case
target interface
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
CN202410522141.3A
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.)
FAW Group Corp
Original Assignee
FAW Group Corp
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 FAW Group Corp filed Critical FAW Group Corp
Priority to CN202410522141.3A priority Critical patent/CN118277275A/en
Publication of CN118277275A publication Critical patent/CN118277275A/en
Pending legal-status Critical Current

Links

Landscapes

  • Tests Of Electronic Circuits (AREA)

Abstract

The embodiment of the invention discloses an interface testing method, an interface testing device, electronic equipment and a storage medium, wherein the method comprises the following steps: responding to a full-interface test request of equipment to be tested, and acquiring interface test cases corresponding to each interface of the equipment to be tested from a pre-established test case library; automatically importing each interface test case into a target test script, and respectively executing the following operations for each target interface in the equipment to be tested by triggering the target test script: repackaging the input module by using a target interface test case of the target interface, and sending an input signal defined in the target interface test case to the target interface; the output module is repackaged by using the target interface test case, and an actual output signal is read from the target interface; and carrying out consistency matching on the actual output signal and the expected output signal defined in the target interface test case to generate test result data corresponding to the target interface, thereby improving the interface test efficiency.

Description

Interface testing method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of testing technologies, and in particular, to an interface testing method, an apparatus, an electronic device, and a storage medium.
Background
Interface testing is an important ring in the whole life cycle of a product or a system, and is mainly used for verifying whether interface interaction between different software components is normal or not.
In the prior art, all input signals and output signals are typically added to a library of files in automated test software. Then, interface testing is achieved by dragging signals in the file library to the testing interface.
However, in the prior art, each interface needs to be dragged by manpower when being tested, so that the interface testing efficiency is low.
Disclosure of Invention
The invention provides an interface testing method, an interface testing device, electronic equipment and a storage medium, which can improve the efficiency of interface testing.
In a first aspect, there is provided an interface testing method, the method comprising:
Responding to a full-interface test request of equipment to be tested, and acquiring interface test cases corresponding to each interface of the equipment to be tested from a pre-established test case library;
The interface test case comprises an input signal pointing to a set interface and an expected output signal corresponding to the set interface;
Automatically importing each interface test case into a target test script, and respectively executing the following operations for each target interface in the equipment to be tested by triggering the target test script:
Repackaging the input module by using a target interface test case of the target interface, and sending an input signal defined in the target interface test case to the target interface;
the output module is repackaged by using the target interface test case, and an actual output signal is read from the target interface;
and carrying out consistency matching on the actual output signal and an expected output signal defined in the target interface test case, and generating test result data corresponding to the target interface.
Optionally, before obtaining the interface test cases corresponding to each interface of the device to be tested, from a pre-established test case library, the method further includes: acquiring input signals respectively corresponding to each interface of the equipment to be tested and expected output signals respectively corresponding to each input signal; generating an interface test case according to the input signal and an expected output signal corresponding to the input signal; and constructing a test case library according to the interface test cases respectively corresponding to each interface.
Optionally, consistency matching is performed on the actual output signal and an expected output signal defined in the test case of the target interface, so as to generate test result data corresponding to the target interface, including: carrying out consistency matching on the actual output signal and an expected output signal defined in the target interface test case; if the matching is successful, generating a successful test result corresponding to the target interface, and outputting the test times corresponding to the target interface; if the matching fails, returning to execute the operation of repackaging the input module by using the target interface test case of the target interface, and sending the input signal defined in the target interface test case to the target interface until reaching the preset execution times threshold; and when the failure is still matched when the preset execution times threshold is met, generating a failure test result corresponding to the target interface, and outputting the test times corresponding to the target interface.
Optionally, the method further comprises: acquiring a test failure interface which still fails to be matched when reaching a preset execution times threshold; acquiring a signal initial value and a preset signal value range corresponding to a test failure interface from a preset database file through a reading module; if the actual output signal value is not equal to the signal initial value and the actual output signal value exceeds the preset signal value range, outputting an input signal error corresponding to the test failure interface; if the actual output signal value is equal to the signal initial value, acquiring a full-interface test result of the equipment to be tested; if the test results of the full interface are all test failures, a tracking window is obtained from the bus development environment of the device to be tested, and when no message corresponding to the input signal exists in the tracking window, the hardware fault of the device to be tested is output.
Optionally, before executing the operation for each target interface in the device under test by triggering the target test script, the method further includes: acquiring a last historical full-interface test result of the equipment to be tested; and determining the test sequence of each interface in the equipment to be tested according to the test result data of each interface in the historical full-interface test results.
Optionally, the method further comprises: after completing the interface test of each target interface in the device to be tested, summarizing to obtain the first interface number of the successful test result and the second interface number of the failure test result, and calculating the ratio of the first interface number to the second interface number; and constructing and obtaining a test analysis report corresponding to the equipment to be tested according to the ratio of the number of the first interfaces to the number of the second interfaces and the test times of each interface.
In a second aspect, there is provided an interface testing apparatus, the apparatus comprising:
the test case acquisition module is used for responding to a full-interface test request of the equipment to be tested and acquiring interface test cases respectively corresponding to each interface of the equipment to be tested from a pre-established test case library;
The interface test case comprises an input signal pointing to a set interface and an expected output signal corresponding to the set interface;
The test case execution module is used for automatically importing the test cases of the interfaces into the target test script, and respectively executing the following operations aiming at each target interface in the equipment to be tested by triggering the target test script: repackaging the input module by using a target interface test case of the target interface, and sending an input signal defined in the target interface test case to the target interface;
the actual output signal acquisition module is used for repackaging the output module by using the test case of the target interface and reading the actual output signal from the target interface;
And the test result generation module is used for carrying out consistency matching on the actual output signal and the expected output signal defined in the target interface test case to generate test result data corresponding to the target interface.
Optionally, the device further includes a use case library generating module, where the use case library generating module is specifically configured to: acquiring input signals respectively corresponding to each interface of the equipment to be tested and expected output signals respectively corresponding to each input signal; generating an interface test case according to the input signal and an expected output signal corresponding to the input signal; and constructing a test case library according to the interface test cases respectively corresponding to each interface.
In a third aspect, an electronic device is provided, the electronic device comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the interface testing method of any one of the embodiments of the present invention.
In a fourth aspect, a computer readable storage medium is provided, the computer readable storage medium storing computer instructions for causing a processor to implement an interface testing method according to any one of the embodiments of the present invention when executed.
According to the technical scheme, the interface test cases are automatically imported into the target test script, and the interface test is realized through the target test script, so that the problem of low interface test efficiency caused by the fact that the interface test is realized in a mode of dragging signals to a test interface is solved, and the interface test efficiency is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an interface testing method according to a first embodiment of the present invention;
FIG. 2 is a flow chart of another interface testing method according to a second embodiment of the present invention;
FIG. 3 is a flow chart of another interface testing method according to a third embodiment of the present invention;
Fig. 4 is a schematic structural diagram of an interface testing device according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device implementing an interface testing method according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of an interface testing method according to an embodiment of the present invention, where the method may be performed by an interface testing device, and the interface testing device may be implemented in hardware and/or software, and the interface testing device may be configured in an electronic device. As shown in fig. 1, the method includes:
s110, responding to a full-interface test request of the equipment to be tested, and acquiring interface test cases corresponding to each interface of the equipment to be tested from a pre-established test case library.
In this embodiment, the device under test may be a device containing software under test. The interface test case includes an input signal directed to a setting interface and an expected output signal corresponding to the setting interface.
In this step, specifically, according to the mapping relationship between the interfaces and the interface test cases, the interface test cases corresponding to each interface respectively may be obtained from a test case library that is built in advance.
S120, automatically importing the test cases of the interfaces into a target test script, and respectively executing the following operations for each target interface in the equipment to be tested by triggering the target test script: and repackaging the input module by using the target interface test case of the target interface, and sending the input signals defined in the target interface test case to the target interface.
In this embodiment, the target test script may include an input module and an output module.
In this step, specifically, the input signal in the test case of the target interface may be mapped to the input module, and the input signal may be sent to the target interface according to the mapped input module.
S130, repackaging the output module by using the test case of the target interface, and reading the actual output signal from the target interface.
In this embodiment, the actual output signal may be a signal output after the execution of the target interface test case is completed.
At this step, specifically, the expected output signal in the target interface test case may be mapped to the output module to read the expected output signal from the output module.
And S140, carrying out consistency matching on the actual output signal and the expected output signal defined in the target interface test case, and generating test result data corresponding to the target interface.
In this embodiment, the test result data may be used to reflect the test results of the target interface, such as a success test result and a failure test result. Wherein the success test result may be used to reflect that the target interface communication is valid and the failure test result may be used to reflect that the target interface communication is invalid.
In one embodiment, if the actual output signal is the same as the expected output signal, a success test result corresponding to the target interface is generated. If the actual output signal is different from the expected output signal, marking the target interface test case, and after all the interface test cases corresponding to the device to be tested are executed, returning to execute the step of repackaging the input module by using the target interface test case of the target interface, and sending the input signal defined in the target interface test case to the target interface so as to execute the target interface test case again.
And outputting a failure test result when the execution times of the target interface test case is greater than or equal to a preset execution times threshold value and the actual output signal is still not identical with the expected output signal. And outputting a successful test result when the execution times of the target interface test case is smaller than a preset execution times threshold value and the actual output signal is the same as the expected output signal.
According to the technical scheme, interface test cases corresponding to each interface of the equipment to be tested are obtained from a pre-established test case library by responding to a full-interface test request of the equipment to be tested; the interface test case comprises an input signal pointing to a set interface and an expected output signal corresponding to the set interface; automatically importing each interface test case into a target test script, and respectively executing the following operations for each target interface in the equipment to be tested by triggering the target test script: repackaging the input module by using a target interface test case of the target interface, and sending an input signal defined in the target interface test case to the target interface; the output module is repackaged by using the target interface test case, and an actual output signal is read from the target interface; the method comprises the steps of carrying out consistency matching on the actual output signal and the expected output signal defined in the target interface test case to generate test result data corresponding to the target interface, so that the problem of low interface test efficiency caused by the fact that interface test is realized by dragging signals to a test interface is solved, and the interface test efficiency is improved.
Example two
Fig. 2 is a flowchart of another interface testing method according to a second embodiment of the present invention, where the technical solution in this embodiment is further refined, and the technical solution in this embodiment may be combined with each of the alternatives in one or more embodiments. As shown in fig. 2, the method includes:
S210, responding to a full-interface test request of the equipment to be tested, acquiring interface test cases corresponding to each interface of the equipment to be tested from a pre-established test case library, and automatically importing each interface test case into a target test script.
In an optional implementation manner of the embodiment of the present invention, before obtaining the interface test cases corresponding to each interface of the device to be tested from the pre-established test case library, the method further includes: acquiring input signals respectively corresponding to each interface of the equipment to be tested and expected output signals respectively corresponding to each input signal; generating an interface test case according to the input signal and an expected output signal corresponding to the input signal; and constructing a test case library according to the interface test cases respectively corresponding to each interface.
In one embodiment, the interface test case may be determined based on the input signal, the desired output signal corresponding to the input signal, and the request access mode. The request access manner may be various, such as GET, POST, and PUT. Or the interface test case may be determined according to the input signal, the desired output signal corresponding to the input signal, and the confidence level of the input signal. Wherein the confidence level of the input signal may be used to determine the test order of the interface. The higher the confidence is, the earlier the execution order is.
The method has the advantages that the situation that the test case is built in a dragging signal mode, which causes complicated building process of the test case, is avoided, the test case building efficiency is improved, and the interface test efficiency is improved.
S220, repackaging the input module by using the target interface test case of the target interface, and sending the input signals defined in the target interface test case to the target interface.
S230, the output module in the target test script is repackaged by using the target interface test case, and an actual output signal is read from the target interface.
S240, carrying out consistency matching on the actual output signals and expected output signals defined in the target interface test case, if the matching is successful, executing S250, and if the matching is failed, executing S260.
S250, generating a successful test result corresponding to the target interface, and outputting the test times corresponding to the target interface.
S260, judging whether the execution times of the target interface test case reach a preset execution times threshold, if so, executing S270, and if not, returning to executing S220.
In a specific embodiment, when the actual output signal fails to match with the expected output signal and the execution times of the target interface test case do not reach the preset execution times threshold, the method directly returns to execute the operation of repackaging the input module by using the target interface test case of the target interface, and sends the input signal defined in the target interface test case to the target interface until the matching of the actual output signal and the expected output signal is successful or the execution times of the target interface test case reach the preset execution times threshold.
S270, generating a failure test result corresponding to the target interface, and outputting the test times corresponding to the target interface.
In this step, specifically, after the failure test result and the test times are output, the next interface test case may be executed.
S280, after completing the interface test of each target interface in the device to be tested, summarizing the first interface number of the successful test result and the second interface number of the failure test result, and calculating the ratio of the first interface number to the second interface number.
For example, assuming that the number of first interfaces is 3 and the number of second interfaces is 7, the ratio of the number of first interfaces is calculated to be 30% and the ratio of the number of second interfaces is calculated to be 70%.
S290, constructing and obtaining a test analysis report corresponding to the equipment to be tested according to the ratio of the number of the first interfaces to the number of the second interfaces and the test times of each interface.
According to the technical scheme provided by the embodiment of the invention, the input signal is re-executed when the actual output signal and the expected output signal are different until the execution times reach the preset execution times threshold value, so that the accuracy and the reliability of the test result are improved, and the test is prevented from falling into a dead cycle. Secondly, obtaining the first interface number of the successful test result and the second interface number of the failure test result through summarizing, and calculating the ratio of the first interface number to the second interface number; and according to the ratio of the number of the first interfaces to the number of the second interfaces and the test times of each interface, a test analysis report corresponding to the equipment to be tested is constructed and obtained, so that a maintenance plan of the equipment to be tested can be conveniently and reasonably formulated later.
Example III
Fig. 3 is a flowchart of another interface testing method according to a third embodiment of the present invention, where the technical solution is further refined, and the technical solution in this embodiment may be combined with each of the alternatives in one or more embodiments. As shown in fig. 3, the method includes:
S310, responding to a full-interface test request of the equipment to be tested, acquiring interface test cases corresponding to each interface of the equipment to be tested from a pre-established test case library, and automatically importing each interface test case into a target test script.
S320, by triggering a target test script, the following operations are respectively executed for each target interface in the device to be tested: and repackaging the input module by using the target interface test case of the target interface, and sending the input signals defined in the target interface test case to the target interface.
In an optional implementation manner of the embodiment of the present invention, before performing an operation for each target interface in the device under test by triggering the target test script, the method further includes: acquiring a last historical full-interface test result of the equipment to be tested; and determining the test sequence of each interface in the equipment to be tested according to the test result data of each interface in the historical full-interface test results.
In a specific embodiment, a test failure interface corresponding to a failure test result and a test success interface corresponding to a success test result may be obtained from test result data of each interface. Then, after determining the test sequence of the test failure interface, the test sequence of the test success interface can be determined, that is, the test case corresponding to the test failure interface is executed first.
The advantage of this arrangement is that the test case corresponding to the test failure interface is executed first, so that the test failure interface can be maintained in time.
S330, the output module is repackaged by using the target interface test case, and the actual output signal is read from the target interface.
S340, carrying out consistency matching on the actual output signal and the expected output signal defined in the target interface test case, and generating test result data corresponding to the target interface.
S350, acquiring a test failure interface which still fails to be matched when the preset execution times threshold is reached, and acquiring a signal initial value and a preset signal value range corresponding to the test failure interface from a preset database file through a reading module.
In this embodiment, the signal initial value may be a default signal value forwarded when the device under test does not receive an actual output signal corresponding to the input signal.
S360, if the actual output signal value is not equal to the initial signal value and the actual output signal value exceeds the preset signal value range, outputting an input signal error corresponding to the test failure interface.
In this step, specifically, if the actual output signal value is not equal to the initial signal value, but the actual output signal value does not exceed the preset signal value range, the software corresponding to the output test failure interface may fail.
And S370, if the actual output signal value is equal to the signal initial value, acquiring a full-interface test result of the device to be tested.
S380, if all the test results of the full interface are test failure, a tracking window is obtained from the bus development environment of the device to be tested, and when no message corresponding to the input signal exists in the tracking window, the hardware fault of the device to be tested is output.
In this step, optionally, when the test results of all the interfaces are test failures, if there is a message corresponding to the input signal in the trace window, the software corresponding to the output test failure interface fails.
According to the technical scheme, under the condition that the actual output signal value is unequal to the initial signal value and exceeds the preset signal value range, an input signal error corresponding to the test failure interface is output; if the actual output signal value is equal to the signal initial value, acquiring a full-interface test result of the equipment to be tested; if all the interface test results are test failure, a tracking window is obtained from the bus development environment of the device to be tested, and when a message corresponding to the input signal does not exist in the tracking window, the technical means of outputting the hardware fault of the device to be tested is provided, so that the problem of low interface test efficiency caused by the fact that the interface test is realized by dragging the signal to the test interface is solved, the interface test efficiency is improved, and the fault positioning is realized.
Example IV
Fig. 4 is a schematic structural diagram of an interface testing device according to a fourth embodiment of the present invention. The embodiment can be suitable for the situation of testing each interface of the device to be tested, and the interface testing device can be realized in a hardware and/or software mode and can be configured in the electronic device.
As shown in fig. 4, the interface testing device disclosed in this embodiment includes:
The test case acquisition module 41 is configured to acquire, from a test case library established in advance, an interface test case corresponding to each interface of the device to be tested in response to a full-interface test request of the device to be tested;
The interface test case comprises an input signal pointing to a set interface and an expected output signal corresponding to the set interface;
The test case execution module 42 is configured to automatically import each interface test case into the target test script, and by triggering the target test script, execute the following operations for each target interface in the device to be tested: repackaging the input module by using a target interface test case of the target interface, and sending an input signal defined in the target interface test case to the target interface;
An actual output signal obtaining module 43, configured to repackage the output module by using the test case of the target interface, and read an actual output signal from the target interface;
The test result generating module 44 is configured to perform consistency matching on the actual output signal and the expected output signal defined in the test case of the target interface, and generate test result data corresponding to the target interface.
According to the technical scheme, through the mutual coordination of the test case acquisition module, the test case execution module, the actual output signal acquisition module and the test result generation module, the problem that interface test is realized in a mode of dragging signals to a test interface, so that interface test efficiency is low is solved, and interface test efficiency is improved.
Optionally, the test result generating module 41 includes:
the consistency matching unit is used for carrying out consistency matching on the actual output signal and the expected output signal defined in the target interface test case;
the successful result output unit is used for generating a successful test result corresponding to the target interface and outputting the test times corresponding to the target interface if the matching is successful;
the repeated test unit is used for returning to execute the operation of repackaging the input module by using the target interface test case of the target interface if the matching fails, and sending the input signal defined in the target interface test case to the target interface until the preset execution times threshold is reached;
and the failure result output unit is used for generating a failure test result corresponding to the target interface when the failure result output unit is used for still matching failure when the failure result output unit determines that the preset execution frequency threshold value is reached, and outputting the test frequency corresponding to the target interface.
Optionally, the apparatus further comprises a fault location module, the module comprising:
The test failure interface acquisition unit is used for acquiring a test failure interface which still fails to be matched when reaching a preset execution times threshold;
The reference value acquisition unit is used for acquiring a signal initial value and a preset signal value range corresponding to the test failure interface from a preset database file through the reading module;
The first fault locating unit is used for outputting an input signal error corresponding to the test failure interface if the actual output signal value is not equal to the signal initial value and the actual output signal value exceeds the preset signal value range;
The full interface test result acquisition unit is used for acquiring a full interface test result of the equipment to be tested if the actual output signal value is equal to the signal initial value;
And the second fault positioning unit is used for acquiring a tracking window from the bus development environment of the equipment to be tested if the test results of the full interface are test failures, and outputting hardware faults of the equipment to be tested when no message corresponding to the input signal exists in the tracking window.
Optionally, the apparatus further includes a test sequence determination module, the module including:
the history test result acquisition unit is used for acquiring a last history full-interface test result of the equipment to be tested;
And the test sequence determining unit is used for determining the test sequence of each interface in the equipment to be tested according to the test result data of each interface in the historical full-interface test results.
Optionally, the apparatus further includes a test sequence determination module, the module including:
the historical test result acquisition unit is used for summarizing the first interface quantity of successful test results and the second interface quantity of failure test results after completing the interface test of each target interface in the equipment to be tested, and calculating the ratio of the first interface quantity to the second interface quantity;
And the test sequence determining unit is used for constructing and obtaining a test analysis report corresponding to the equipment to be tested according to the ratio of the number of the first interfaces to the number of the second interfaces and the test times of each interface.
The interface testing device provided by the embodiment of the invention can execute the interface testing method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example five
Fig. 5 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. As shown in fig. 5, at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., in which the memory stores a computer program executable by the at least one processor, the processor 11 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the interface test method.
In some embodiments, the interface testing method may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the interface test method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the interface test method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. An interface testing method, the method comprising:
Responding to a full-interface test request of equipment to be tested, and acquiring interface test cases corresponding to each interface of the equipment to be tested from a pre-established test case library;
The interface test case comprises an input signal pointing to a set interface and an expected output signal corresponding to the set interface;
automatically importing each interface test case into a target test script, and respectively executing the following operations for each target interface in the equipment to be tested by triggering the target test script:
Repackaging an input module by using a target interface test case of a target interface, and sending an input signal defined in the target interface test case to the target interface;
the output module is repackaged by using the target interface test case, and an actual output signal is read from the target interface;
And carrying out consistency matching on the actual output signal and the expected output signal defined in the target interface test case, and generating test result data corresponding to the target interface.
2. The method of claim 1, further comprising, before obtaining, from a pre-established test case library, an interface test case corresponding to each interface of the device under test, respectively:
Acquiring input signals respectively corresponding to each interface of the equipment to be tested and expected output signals respectively corresponding to each input signal;
generating an interface test case according to the input signal and an expected output signal corresponding to the input signal;
And constructing a test case library according to the interface test cases respectively corresponding to each interface.
3. The method of claim 1, wherein consistency matching the actual output signal with the expected output signal defined in the target interface test case, generating test result data corresponding to the target interface, comprises:
Carrying out consistency matching on the actual output signal and an expected output signal defined in the target interface test case;
If the matching is successful, generating a successful test result corresponding to the target interface, and outputting the test times corresponding to the target interface;
If the matching fails, returning to execute the operation of repackaging the input module by using the target interface test case of the target interface, and sending the input signal defined in the target interface test case to the target interface until the preset execution times threshold is reached;
And when the failure is still matched when the preset execution times threshold is met, generating a failure test result corresponding to the target interface, and outputting the test times corresponding to the target interface.
4. A method according to claim 3, characterized in that the method further comprises:
acquiring a test failure interface which still fails to be matched when reaching a preset execution times threshold;
Acquiring a signal initial value and a preset signal value range corresponding to the test failure interface from a preset database file through a reading module;
if the actual output signal value is not equal to the signal initial value and the actual output signal value exceeds the preset signal value range, outputting an input signal error corresponding to the test failure interface;
If the actual output signal value is equal to the signal initial value, acquiring a full-interface test result of the equipment to be tested;
If the test results of the full interface are all test failures, a tracking window is obtained from a bus development environment of the device to be tested, and when no message corresponding to the input signal exists in the tracking window, the hardware fault of the device to be tested is output.
5. The method of any of claims 1-4, further comprising, prior to performing an operation for each target interface in the device under test by triggering the target test script:
acquiring a last historical full-interface test result of the equipment to be tested;
And determining the test sequence of each interface in the equipment to be tested according to the test result data of each interface in the historical full-interface test result.
6. The method according to any one of claims 1-4, further comprising:
After completing the interface test of each target interface in the device to be tested, summarizing to obtain the first interface number of the successful test result and the second interface number of the failure test result, and calculating the ratio of the first interface number to the second interface number;
And constructing and obtaining a test analysis report corresponding to the equipment to be tested according to the ratio of the number of the first interfaces to the number of the second interfaces and the test times of each interface.
7. An interface testing apparatus, the apparatus comprising:
the test case acquisition module is used for responding to a full-interface test request of the equipment to be tested and acquiring interface test cases respectively corresponding to each interface of the equipment to be tested from a pre-established test case library;
The interface test case comprises an input signal pointing to a set interface and an expected output signal corresponding to the set interface;
The test case execution module is used for automatically importing each interface test case into a target test script, and respectively executing the following operations aiming at each target interface in the equipment to be tested by triggering the target test script: repackaging an input module by using a target interface test case of a target interface, and sending an input signal defined in the target interface test case to the target interface;
the actual output signal acquisition module is used for repackaging the output module by using the test case of the target interface and reading the actual output signal from the target interface;
and the test result generation module is used for carrying out consistency matching on the actual output signal and the expected output signal defined in the target interface test case to generate test result data corresponding to the target interface.
8. The apparatus of claim 7, further comprising a use case library generation module, wherein the use case library generation module is specifically configured to:
Acquiring input signals respectively corresponding to each interface of the equipment to be tested and expected output signals respectively corresponding to each input signal;
generating an interface test case according to the input signal and an expected output signal corresponding to the input signal;
And constructing a test case library according to the interface test cases respectively corresponding to each interface.
9. An electronic device, the electronic device comprising:
At least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the interface testing method of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the interface testing method of any one of claims 1-7.
CN202410522141.3A 2024-04-28 2024-04-28 Interface testing method and device, electronic equipment and storage medium Pending CN118277275A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410522141.3A CN118277275A (en) 2024-04-28 2024-04-28 Interface testing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410522141.3A CN118277275A (en) 2024-04-28 2024-04-28 Interface testing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN118277275A true CN118277275A (en) 2024-07-02

Family

ID=91649689

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410522141.3A Pending CN118277275A (en) 2024-04-28 2024-04-28 Interface testing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN118277275A (en)

Similar Documents

Publication Publication Date Title
CN116647377A (en) Website inspection method and device, electronic equipment and storage medium
CN116185880A (en) Automatic test method, device, equipment and medium for embedded system
CN116089197A (en) Fault equipment switching exercise method, device, equipment and storage medium
CN115437961A (en) Data processing method and device, electronic equipment and storage medium
CN118277275A (en) Interface testing method and device, electronic equipment and storage medium
CN114546799A (en) Point burying log checking method and device, electronic equipment, storage medium and product
CN116306400B (en) Integrated circuit verification method, system, device, equipment and medium
CN117492822B (en) Change contrast method, device, electronic equipment and storage medium
CN115563015B (en) Code heat statistics method, device, equipment and storage medium
CN117609087A (en) Code processing method, device, equipment and medium
CN117453747A (en) Data quality detection method and device, electronic equipment and storage medium
CN117539700A (en) Test management method, device, equipment and medium
CN114238149A (en) Batch testing method of accounting system, electronic device and storage medium
CN116567115A (en) Message detection method and device, electronic equipment and medium
CN117609801A (en) Data comparison method, device, equipment and medium
CN117670236A (en) Mobile-terminal-based to-be-handled flow approval method, device, equipment and medium
CN116302914A (en) Software testing method and device, electronic equipment and storage medium
CN116303071A (en) Interface testing method and device, electronic equipment and storage medium
CN117648252A (en) Function test method and device for software application, electronic equipment and storage medium
CN117061564A (en) Verification method, device, equipment and medium for vehicle signal transmission state
CN117931155A (en) Code generation method, device, equipment and medium
CN117493214A (en) Interface message generation method and device, electronic equipment and storage medium
CN117312168A (en) Interface test case generation method, device, equipment and storage medium
CN117827647A (en) Execution method, device, equipment and medium of test script
CN115543712A (en) Automatic detection method and device for equipment configuration information, electronic equipment and medium

Legal Events

Date Code Title Description
PB01 Publication