CN110109817A - Automatic interface testing method, device, equipment and storage medium - Google Patents

Automatic interface testing method, device, equipment and storage medium Download PDF

Info

Publication number
CN110109817A
CN110109817A CN201910190383.6A CN201910190383A CN110109817A CN 110109817 A CN110109817 A CN 110109817A CN 201910190383 A CN201910190383 A CN 201910190383A CN 110109817 A CN110109817 A CN 110109817A
Authority
CN
China
Prior art keywords
interface
test
testing
interface testing
instruction
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
CN201910190383.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.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201910190383.6A priority Critical patent/CN110109817A/en
Publication of CN110109817A publication Critical patent/CN110109817A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

It is a kind of for the automatic interface testing method of Software function test, device, equipment and storage medium, the method includes constructing test case file in visualization interface and be stored in target platform;When receiving download parsing instruction, by target platform downloading testing tool, at least one dependent file and at least one interface testing use-case file to executing terminal;Receive analyze the instruction when, using the testing tool of acquisition and at least one dependent file parsing obtain interface testing use-case file, to generate interface testing code;Receive execute instruction when, interface testing code is repeated within the specified duration with specified sequence using continuous integrating tool;It receives the test data returned and forms test data set;When receiving store instruction, test data set is stored.The file automating test of interface testing of asynchronous interactive can be achieved in the present invention, and the test speed of accelerating interface test file shortens software development cycle.

Description

Automatic interface testing method, device, equipment and storage medium
Technical field
The invention mainly relates to fields of communication technology, specifically, be related to a kind of automatic interface testing method, device, Equipment and storage medium.
Background technique
With the continuous development of software industry, software newly developed becomes increasingly complex, and function is more and more, so that software is surveyed Examination also becomes to become increasingly complex.In software test procedure, to guarantee to test quality, it usually needs design and write a large amount of survey Example on probation.However, testing example design needs higher technical level and working experience abundant, and test case is carried out The plenty of time for generally requiring to expend tester, excessively labor intensive are write and modified, and is unable to rapid abutting joint mouth and is criticized Measure examination.
Summary of the invention
The main object of the present invention is to provide a kind of automatic interface testing method, device, equipment and storage medium, it is intended to It solves the problems, such as quickly and in batches test interface document in the prior art.
To achieve the above object, the present invention provides a kind of automatic interface testing method, the interface automatic test side Method the following steps are included:
Test case file is constructed in visualization interface and is stored in target platform;
When receiving download instruction, by target platform downloading testing tool, at least one dependent file and extremely A few interface testing use-case file is to executing terminal;
Receive analyze the instruction when, utilize the testing tool of acquisition and at least one described dependent file parsing obtain The interface testing use-case file, to generate interface testing code;
Receive execute instruction when, repeated within the specified duration using continuous integrating tool with specified sequence The interface testing code;
It receives the test data returned and forms test data set;
When receiving store instruction, the test data set is stored.
It preferably, include multiple interface requests and database information in the interface testing code;The interface requests packet Include simultaneously operating interface requests and asynchronous operation interface requests;The test data includes output parameter, response time and survey Test result;It is described that the interface testing is repeated within the specified duration with specified sequence using continuous integrating tool The step of code includes:
Judge whether the interface requests are asynchronous operation interface requests;
When the interface requests are the interface requests of asynchronous operation, obtained out of database according to the database information Corresponding field is as the corresponding output parameter of the interface testing use-case.
Preferably, described described to specify sequence to repeat within the specified duration using continuous integrating tool The step of interface testing code includes:
It is not asynchronous operation interface requests in the interface requests, judges whether there is the occupy-place in the output parameter Symbol;
When there is the placeholder in the output parameter, parses the placeholder and obtained from test data concentration Corresponding field is taken, to substitute the placeholder in the output parameter;
When not having the placeholder in the interface requests, it is corresponding described directly to export the interface testing use-case Output parameter.
Preferably, the automatic interface testing method includes:
When receiving checking command, the test data set is verified;
Judge whether the output parameter is consistent with expected data;
When the output parameter is consistent with the expected data, then the test result of the interface testing use-case is marked to be Pass through;
When the output parameter and the expected data are inconsistent, then the test result of the interface testing use-case is marked Not pass through.
Preferably, the automatic interface testing method further comprises:
When receiving setting instruction, configuration information is set in the visualization interface;The configuration information includes described The specified duration;The configuration parameter includes the essential information and the IP address for executing terminal of interface.
Preferably, described the connecing for utilizing the testing tool obtained and the parsing acquisition of at least one described dependent file The step of mouthful test case file includes:
The interface requests are arranged according to back end, to generate tree node;
The interface testing code is sequentially output according to the tree node.
Preferably, the automatic interface testing method further comprises:
When receiving test report generation instruction, the test data set is generated into test report with specified format, and The test report is sent to designated person with specified sending method.
In addition, to achieve the goals above, the present invention also proposes that a kind of interface automatic test device, the interface are automatic Changing test device includes:
Module is constructed, for constructing test case file in visualization interface and being stored in target platform;
Download module, for when receiving download instruction by the target platform downloading testing tool, at least one according to Rely file and at least one interface testing use-case file to executing terminal,
Parsing module, for receiving the testing tool analyzed the instruction when using acquisition and at least one described dependence The interface testing use-case file that document analysis obtains, to generate interface testing code;
Test module, for utilizing continuous integrating tool with specified sequence in specified continue when receiving and executing instruction It is interior to repeat the interface testing code, it receives the test data of return and forms test data set;
Memory module, for storing the test data set when receiving store instruction.
In addition, to achieve the goals above, the present invention also proposes that a kind of equipment, equipment include processor and memory, place Following steps are realized when reason device when executing the computer program stored in memory for executing:
Test case file is constructed in visualization interface and is stored in target platform;
When receiving download instruction, by target platform downloading testing tool, at least one dependent file and extremely A few interface testing use-case file is to executing terminal;
Receive analyze the instruction when, utilize the testing tool of acquisition and at least one described dependent file parsing obtain The interface testing use-case file, to generate interface testing code;
Receive execute instruction when, repeated within the specified duration using continuous integrating tool with specified sequence The interface testing code;
It receives the test data returned and forms test data set;
When receiving store instruction, the test data set is stored.
In addition, to achieve the goals above, the present invention also proposes that a kind of storage medium, the storage medium are that computer can Storage medium is read, at least one instruction is stored with, at least one described instruction realizes following steps when being executed by processor:
Test case file is constructed in visualization interface and is stored in target platform;
When receiving download instruction, by target platform downloading testing tool, at least one dependent file and extremely A few interface testing use-case file is to executing terminal;
Receive analyze the instruction when, utilize the testing tool of acquisition and at least one described dependent file parsing obtain The interface testing use-case file, to generate interface testing code;
Receive execute instruction when, repeated within the specified duration using continuous integrating tool with specified sequence The interface testing code;
It receives the test data returned and forms test data set;
When receiving store instruction, the test data set is stored.
Compared with prior art, automatic interface testing method can realize that the interface testing of asynchronous interactive is file automating Test, the test speed of accelerating interface test file shorten software development cycle.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is the flow diagram of automatic interface testing method of the present invention.
Fig. 2 is the refinement flow diagram of step S14 in Fig. 1.
Fig. 3 is the refinement flow diagram of step S16 in Fig. 1.
Fig. 4 is the refinement flow diagram of step S17 in Fig. 1.
Fig. 5 is the functional block diagram of interface automatic test device of the present invention.
Fig. 6 is the device structure schematic diagram of the hardware running environment of the embodiment of the present invention.
Main element symbol description
Interface automatic test device 1
Construct module 10
Setup module 20
Download module 30
Parsing module 40
Test module 50
Receiving module 60
Correction verification module 70
Memory module 80
Report generation module 90
Memory 102
Communication bus 104
Processor 106
The present invention that the following detailed description will be further explained with reference to the above drawings.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real Applying mode, the present invention is described in further detail.
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people The model that the present invention protects all should belong in member's every other embodiment obtained without making creative work It encloses.
Description and claims of this specification and term " first " in above-mentioned attached drawing, " second " and " third " etc. are For distinguishing different objects, not for description particular order.In addition, term " includes " and their any deformations, it is intended that Non-exclusive include in covering.Such as it contains series of steps or the process, method, system, product or equipment of module and does not have It is defined in listed step or module, but optionally further comprising the step of not listing or module, or optionally further comprising For these process, methods, product or equipment intrinsic other steps or module.
Referring to Fig. 1, it is the flow chart of automatic interface testing method of the present invention.The process according to different requirements, The sequence of step can change in figure, and certain steps can be omitted.
In at least one embodiment of the present invention, the automatic interface testing method be applied to an at least terminal device and In the interface automatization test system that server is constituted.It is carried out between the terminal device and the server according to preset protocol Data transmission.Preferably, the preset protocol include, but are not limited to it is following any one: http protocol (Hyper Text Transfer Protocol, hypertext transfer protocol), HTTPS agreement (Hyper Text Transfer Protocol over Secure Socket Layer, safely for the http protocol of target) etc..In at least one embodiment of the present invention, the clothes Business device can be single server, or the server zone collectively constituted by several function servers.The terminal is set It is standby to can be any terminal with network connecting function, for example, the terminal device can be personal computer, plate electricity Brain, smart phone, personal digital assistant (Personal Digital Assistant, PDA), game machine, interactive network electricity Removable depending on (Internet Protocol Television, IPTV), intellectual wearable device, navigation device etc. sets Standby or desktop computer, number TV etc. fixed equipment.The automation interface test macro has a visualization interface.Institute The connection of the terminal devices such as mobile phone or computer can passed through for providing a user man-machine interactive interface, user by stating visualization interface To the automation interface test macro.The automation interface test macro is for continuing interface test case file Integrated, automatic test and generation test report.It may include database in the server.The database can be stored with to A few configuration information.
S11, test case file is constructed in visualization interface and is stored in target platform.
In at least one embodiment of the present invention, the interface testing use-case file is used for when being executed at least one The function or performance of interface are tested, and are executed in terminal and be performed at any one.The interface testing use-case file is deposited It is stored in target platform, and is stored with extensible markup language (Extensible Markup Language, XML).At this In at least one embodiment of invention, the target platform is Github hosted platform, and however, it is not limited to this.The interface is surveyed It may include at least one interface testing use-case and corresponding interface essential information in example text part on probation.The interface essential information It is configured according to the input of user.The interface essential information includes the input parameter of interface, test result, interface designers Whether title needs to be implemented, executes the contents such as sequence, operation duration, manner of comparison, expected data.For example, the interface It may include that product list interface, product details interface, amount verification interface and order accept interface etc., but not limited to this. Wherein, the input parameter request may include placeholder.The placeholder is that the input parameter of presently described interface depends on it The output of his interface.The format of the placeholder is (APIName. $ { FieldName }).
S12, receive setting instruction when, the visualization interface set configuration information.
In at least one embodiment of the present invention, the configuration information may include specified duration and configuration parameter. The specified duration is the time for executing ongoing operation.For example, the duration can be 30 minutes.It is described to match Setting parameter may include one of following parameter or a variety of: the essential information of the interface, is surveyed the IP address for executing terminal The specified format of test result, the specified sending method for sending test result and the specified reception staff for receiving the test result Deng however, it is not limited to this.
S13, when receiving download instruction, by the target platform downloading testing tool, at least one dependent file with And at least one interface testing use-case file is to executing terminal.
The dependent file is jar file, for text needed for the realization file automating test of interface testing use-case Part.For example, the dependent file can for parsing operating process in need using dom4j.jar file, or Needed during validation test results operation using rest-assured-3.0.0.jar file, be not limited thereto.
S14, receive analyze the instruction when, utilize the testing tool of acquisition and at least one described dependent file parsing The interface testing use-case file obtained, to generate interface testing code.
Referring to Figure 2 together, at least one embodiment of the present invention, described to utilize the testing tool obtained and institute The step of stating the interface testing use-case file that the parsing of at least one dependent file obtains can further comprise:
S141, the interface requests are arranged according to back end, to generate tree node;
S142, the interface testing code is sequentially output according to the tree node.
It at least one embodiment of the present invention, include multiple interface requests in the interface testing code.It is described to connect Mouth request can be the interface requests of simultaneously operating and the interface requests of asynchronous operation.The interface requests of the simultaneously operating be Corresponding output parameter is directly generated after execution, the interface requests of the asynchronous operation are that need to transfer out of database after execution Corresponding field is as output parameter.It can further comprise database information in the interface testing use-case file.The data Library information may include database address, user's name, password and query statement, and however, it is not limited to this.The query statement To be write with structured query language (Structured Query Language, SQL).
S15, receive execute instruction when, using continuous integrating tool with specified sequence within the specified duration Repeat the interface testing code.
In at least one embodiment of the present invention, the execution operation is realized using continuous integrating tool.It is described to hold Continuous integration tool is Jenkins.The Jenkins is open source software project, is a kind of continuous integrating work based on Java exploitation Tool, for monitoring persistently duplicate work.
S16, it receives the test data returned and forms test data set.
Also referring to Fig. 3, at least one embodiment of the present invention, the test data includes output parameter, sound Between seasonable and test result etc., however, it is not limited to this.
In at least one embodiment of the present invention, described to receive the test data returned and the step for forming test data set Suddenly can further comprise:
S161, judge whether the interface requests are asynchronous operation interface requests;
S162, when the interface requests are the interface requests of asynchronous operation, according to the database information from database It is interior to obtain corresponding field as the corresponding output parameter of the interface testing use-case;
S163, in the interface requests it is not asynchronous operation interface requests, judges whether there is institute in the output parameter State placeholder;
S164, when there is the placeholder in the output parameter, the placeholder is parsed and from the test data It concentrates and obtains corresponding field, to substitute the placeholder in the output parameter;
S165, when not having the placeholder in the interface requests, it is corresponding directly to export the interface testing use-case The output parameter.
S17, when receiving checking command, verify the test data set.
Referring to Figure 4 together, at least one embodiment of the present invention, the step of verification test data set Can further comprise:
S171, judge whether the output parameter is consistent with expected data;
S172, when the output parameter is consistent with the expected data, then mark the test of the interface testing use-case It as a result is to pass through;
S173, the output parameter and the expected data it is inconsistent when, then mark the survey of the interface testing use-case Test result is not pass through.
S18, when receiving store instruction, store the test data set.
S19, receive test report generate instruction when, by the test data set with specified format generate test report It accuses, and the test report is sent to by designated person with specified sending method.
In at least one embodiment of the present invention, the specified sending method is mail.The specified sending method can Think instant communication information, such as the modes such as wechat, QQ, IM and short message, but not limited to this.The specified format can be EXCEL, WORD, XML and PDF etc., but not limited to this.
In at least one embodiment of the present invention, the test report may include the title of interface testing use-case, phase It hopes data, the test data of return, success rate, execute total and failure sum, however, it is not limited to this.
In at least one embodiment of the present invention, above-mentioned all instructions can be is asked by the received data of input equipment Ask instruction.The input equipment may include keyboard inputs, touch screen inputs etc., but the use in the example embodiment of the disclosure Family input mode is without being limited thereto.Above-mentioned various instructions can pass through user's for the programmable button of user on a graphical user interface Operation generates.Specifically, the operation of the user includes, but are not limited to: slide, clicking operation are (such as: single-click operation, double Hit operation etc.).Specifically, the programmable button can be the physical button on the input equipment, be also possible to described defeated Enter virtual key in equipment etc. (such as: the virtual key can be a void on the display of the input equipment Quasi- icon etc.), the present invention is herein with no restrictions.
As seen from the above embodiment, automatic interface testing method can realize that the interface testing of asynchronous interactive is file automating Test, the test speed of accelerating interface test file shorten software development cycle.
Referring to figure 5., the present invention provides a kind of interface automatic test device 1, is applied in one or more equipment.This In at least one embodiment of invention, the interface automatic test device 1 is applied to an at least terminal device and server structure At interface automatization test system in.Data biography is carried out according to preset protocol between the terminal device and the server It is defeated.Preferably, the preset protocol include, but are not limited to it is following any one: http protocol (Hyper Text Transfer Protocol, hypertext transfer protocol), HTTPS agreement (Hyper Text Transfer Protocol over Secure Socket Layer, safely for the http protocol of target) etc..In at least one embodiment of the present invention, the server can To be single server, or the server zone collectively constituted by several function servers.The terminal device can be with It is any terminal with network connecting function, for example, the terminal device can be personal computer, tablet computer, intelligence Mobile phone, personal digital assistant (Personal Digital Assistant, PDA), game machine, Interactive Internet TV The removable of (Internet Protocol Television, IPTV), intellectual wearable device, navigation device etc. sets Standby or desktop computer, number TV etc. fixed equipment.
The interface automatic test device 1 provides a visualization interface.The visualization interface is for providing a user Man-machine interactive interface, user can be connected to the automation interface test macro by terminal devices such as mobile phone or computers. The automation interface test macro is used to carry out interface test case file continuous integrating, automatic test and generate to survey Examination report.It may include database in the server.The database can be stored at least one configuration information.
In one embodiment of the invention, the interface automatic test device 1 includes:
Module 10 is constructed, for constructing test case file in visualization interface and being stored in target platform.
In at least one embodiment of the present invention, the interface testing use-case file is used for when being executed at least one The function or performance of interface are tested, and are executed in terminal and be performed at any one.The interface testing use-case file is deposited It is stored in target platform, and is stored with extensible markup language (Extensible Markup Language, XML).At this In at least one embodiment of invention, the target platform is Github hosted platform, and however, it is not limited to this.The interface is surveyed It may include at least one interface testing use-case and corresponding interface essential information in example text part on probation.The interface essential information It is configured according to the input of user.The interface essential information includes the input parameter of interface, test result, interface designers Whether title needs to be implemented, executes the contents such as sequence, operation duration, manner of comparison, expected data.For example, the interface It may include that product list interface, product details interface, amount verification interface and order accept interface etc., but not limited to this. Wherein, the input parameter request may include placeholder.The placeholder is that the input parameter of presently described interface depends on it The output of his interface.The format of the placeholder is (APIName. $ { FieldName }).
Setup module 20, for setting configuration information in the visualization interface when receiving setting instruction.
In at least one embodiment of the present invention, the configuration information may include specified duration and configuration parameter. The specified duration is the time for executing ongoing operation.For example, the specified duration can be 30 minutes.Institute Stating configuration parameter may include one of following parameter or a variety of: the essential information of the interface, the IP for executing terminal Location, the specified format of test result, the specified sending method of transmission test result and reception the specified of test result connect Receipts personnel etc., however, it is not limited to this.
Download module 30, for when receiving download instruction by the target platform downloading testing tool, at least one Dependent file and at least one interface testing use-case file are to executing terminal.
The dependent file is jar file, for text needed for the realization file automating test of interface testing use-case Part.For example, the dependent file can for parsing operating process in need using dom4j.jar file, or Needed during validation test results operation using rest-assured-3.0.0.jar file, be not limited thereto.
Parsing module 40, for receive analyze the instruction when using acquisition testing tool and it is described at least one according to The interface testing use-case file for relying document analysis to obtain, to generate interface testing code.
The parsing module 40 arranges the interface requests according further to back end, to generate tree-like section Point.
The parsing module 40 is further sequentially output the interface testing code according to the tree node.
It at least one embodiment of the present invention, include multiple interface requests in the interface testing code.It is described to connect Mouth request can be the interface requests of simultaneously operating and the interface requests of asynchronous operation.The interface requests of the simultaneously operating be Corresponding output parameter is directly generated after execution, the interface requests of the asynchronous operation are that need to transfer out of database after execution Corresponding field is as output parameter.It can further comprise database information in the interface testing use-case file.The data Library information may include database address, user's name, password and query statement, and however, it is not limited to this.The query statement To be write with structured query language (Structured Query Language, SQL).
Test module 50, for utilizing continuous integrating tool with specified sequence described specified when receiving and executing instruction The interface testing code is repeated in duration.
In at least one embodiment of the present invention, the execution operation is realized using continuous integrating tool.It is described to hold Continuous integration tool is Jenkins.The Jenkins is open source software project, is a kind of continuous integrating work based on Java exploitation Tool, for monitoring persistently duplicate work.
Receiving module 60, for receiving the test data returned and forming test data set.
The receiving module 60 further judges whether the interface requests are asynchronous operation interface requests.
When the interface requests are the interface requests of asynchronous operation, the receiving module 60 is according further to the number Corresponding field is obtained out of database as the corresponding output parameter of the interface testing use-case according to library information.
It is not asynchronous operation interface requests in the interface requests, the receiving module 60 further judges the output Whether there is the placeholder in parameter.
When having the placeholder in the output parameter, the receiving module 60 further parses the placeholder And concentrated from the test data and obtain corresponding field, to substitute the placeholder in the output parameter.
In the interface requests do not have the placeholder when, the receiving module 60 further directly export described in The corresponding output parameter of interface testing use-case.
Correction verification module 70, for verifying the test data set when receiving checking command.
The correction verification module 70 further judges whether the output parameter is consistent with expected data.
When the output parameter is consistent with the expected data, the correction verification module 70 further marks the interface The test result of test case is to pass through.
The output parameter and the expected data it is inconsistent when, the correction verification module 70 further mark described in connect The test result of mouth test case is not pass through.
Memory module 80, for storing the test data set when receiving store instruction.
Report generation module 90, for receive test report generate instruction when by the test data set with specify lattice Formula generates test report, and the test report is sent to designated person with specified sending method.
In at least one embodiment of the present invention, the specified sending method is mail.The specified sending method can Think instant communication information, such as the modes such as wechat, QQ, IM and short message, but not limited to this.The specified format can be EXCEL, WORD, XML and PDF etc., but not limited to this.
In at least one embodiment of the present invention, the test report may include the title of interface testing use-case, phase It hopes data, the test data of return, success rate, execute total and failure sum, however, it is not limited to this.
In at least one embodiment of the present invention, above-mentioned all instructions can be is asked by the received data of input equipment Ask instruction.The input equipment may include keyboard inputs, touch screen inputs etc., but the use in the example embodiment of the disclosure Family input mode is without being limited thereto.Above-mentioned various instructions can pass through user's for the programmable button of user on a graphical user interface Operation generates.Specifically, the operation of the user includes, but are not limited to: slide, clicking operation are (such as: single-click operation, double Hit operation etc.).Specifically, the programmable button can be the physical button on the input equipment, be also possible to described defeated Enter virtual key in equipment etc. (such as: the virtual key can be a void on the display of the input equipment Quasi- icon etc.), the present invention is herein with no restrictions.
As seen from the above embodiment, automatic interface testing method can realize that the interface testing of asynchronous interactive is file automating Test, the test speed of accelerating interface test file shorten software development cycle.
Referring to Fig. 6, it is a kind of storage medium of the embodiment of the present invention.The storage medium is computer-readable storage Medium.Computer instruction is stored on the computer readable storage medium.The computer instruction can be stored in memory On 102, and when being executed by one or more processors 106, to realize that the interface as described in embodiment of the method above is automatic Change test method.
The memory 102 is for storing program code.The memory 102 can be in integrated circuit without material object shape The circuit with store function of formula, such as RAM (Random-Access Memory, random access memory), FIFO (First In First Out) etc..Alternatively, the memory 102 is also possible to the memory with physical form, such as memory bar, TF card (Trans-flash Card), smart media card (smart media card), safe digital card (secure digital Card), the storage facilities such as flash memory cards (flash card).The memory 102 can pass through communication bus 104 and processing Device 106 carries out data communication.It may include operating system, network communication module and interface automation in the memory 102 Test program.Operating system is to manage and control the program of interface automated test device hardware and software resource, supporting interface The operation of automatic test program and other softwares and/or program.Network communication module is for realizing in the memory 102 Communication between each component in portion, and communicated between other hardware and softwares in interface automated test device.
The processor 106 may include one or more microprocessor, digital processing unit.The processor 106 can Call the program code stored in the memory 102 to execute relevant function.For example, modules described in Fig. 1 are The program code being stored in the memory 102, and as performed by the processor 106, to realize a kind of interface automation Test class method.The processor 106 is also known as central processing unit (CPU, Central Processing Unit), is one piece super Large-scale integrated circuit is arithmetic core (Core) and control core (Control Unit).
The processor 106 is used to execute the multiple computer instructions stored in the memory 102 to realize interface certainly Multiple instruction can be performed to perform the steps of in dynamicization test method, the processor 106
S11, test case file is constructed in visualization interface and is stored in target platform.
In at least one embodiment of the present invention, the interface testing use-case file is used for when being executed at least one The function or performance of interface are tested, and are executed in terminal and be performed at any one.The interface testing use-case file is deposited It is stored in target platform, and is stored with extensible markup language (Extensible Markup Language, XML).At this In at least one embodiment of invention, the target platform is Github hosted platform, and however, it is not limited to this.The interface is surveyed It may include at least one interface testing use-case and corresponding interface essential information in example text part on probation.The interface essential information It is configured according to the input of user.The interface essential information includes the input parameter of interface, test result, interface designers Whether title needs to be implemented, executes the contents such as sequence, operation duration, manner of comparison, expected data.For example, the interface It may include that product list interface, product details interface, amount verification interface and order accept interface etc., but not limited to this. Wherein, the input parameter request may include placeholder.The placeholder is that the input parameter of presently described interface depends on it The output of his interface.The format of the placeholder is (APIName. $ { FieldName }).
S12, receive setting instruction when, the visualization interface set configuration information.
In at least one embodiment of the present invention, the configuration information may include specified duration and configuration parameter. The specified duration is the time for executing ongoing operation.For example, the duration can be 30 minutes.It is described to match Setting parameter may include one of following parameter or a variety of: the essential information of the interface, is surveyed the IP address for executing terminal The specified format of test result, the specified sending method for sending test result and the specified reception staff for receiving the test result Deng however, it is not limited to this.
S13, when receiving download instruction, by the target platform downloading testing tool, at least one dependent file with And at least one interface testing use-case file is to executing terminal.
The dependent file is jar file, for text needed for the realization file automating test of interface testing use-case Part.For example, the dependent file can for parsing operating process in need using dom4j.jar file, or Needed during validation test results operation using rest-assured-3.0.0.jar file, be not limited thereto.
S14, receive analyze the instruction when, utilize the testing tool of acquisition and at least one described dependent file parsing The interface testing use-case file obtained, to generate interface testing code.
Referring to Figure 2 together, at least one embodiment of the present invention, described to utilize the testing tool obtained and institute The step of stating the interface testing use-case file that the parsing of at least one dependent file obtains can further comprise:
S141, the interface requests are arranged according to back end, to generate tree node;
S142, the interface testing code is sequentially output according to the tree node.
It at least one embodiment of the present invention, include multiple interface requests in the interface testing code.It is described to connect Mouth request can be the interface requests of simultaneously operating and the interface requests of asynchronous operation.The interface requests of the simultaneously operating be Corresponding output parameter is directly generated after execution, the interface requests of the asynchronous operation are that need to transfer out of database after execution Corresponding field is as output parameter.It can further comprise database information in the interface testing use-case file.The data Library information may include database address, user's name, password and query statement, and however, it is not limited to this.The query statement To be write with structured query language (Structured Query Language, SQL).
S15, receive execute instruction when, using continuous integrating tool with specified sequence within the specified duration Repeat the interface testing code.
In at least one embodiment of the present invention, the execution operation is realized using continuous integrating tool.It is described to hold Continuous integration tool is Jenkins.The Jenkins is open source software project, is a kind of continuous integrating work based on Java exploitation Tool, for monitoring persistently duplicate work.
S16, it receives the test data returned and forms test data set.
Also referring to Fig. 3, at least one embodiment of the present invention, the test data includes output parameter, sound Between seasonable and test result etc., however, it is not limited to this.
In at least one embodiment of the present invention, described to receive the test data returned and the step for forming test data set Suddenly can further comprise:
S161, judge whether the interface requests are asynchronous operation interface requests;
S162, when the interface requests are the interface requests of asynchronous operation, according to the database information from database It is interior to obtain corresponding field as the corresponding output parameter of the interface testing use-case;
S163, in the interface requests it is not asynchronous operation interface requests, judges whether there is institute in the output parameter State placeholder;
S164, when there is the placeholder in the output parameter, the placeholder is parsed and from the test data It concentrates and obtains corresponding field, to substitute the placeholder in the output parameter;
S165, when not having the placeholder in the interface requests, it is corresponding directly to export the interface testing use-case The output parameter.
S17, when receiving checking command, verify the test data set.
Also referring to Fig. 3, at least one embodiment of the present invention, the step of the verification test data set Can further comprise:
S171, judge whether the output parameter is consistent with expected data;
S172, when the output parameter is consistent with the expected data, then mark the test of the interface testing use-case It as a result is to pass through;
S173, the output parameter and the expected data it is inconsistent when, then mark the survey of the interface testing use-case Test result is not pass through.
S18, when receiving store instruction, store the test data set.
S19, receive test report generate instruction when, by the test data set with specified format generate test report It accuses, and the test report is sent to by designated person with specified sending method.
In at least one embodiment of the present invention, the specified sending method is mail.The specified sending method can Think instant communication information, such as the modes such as wechat, QQ, IM and short message, but not limited to this.The specified format can be EXCEL, WORD, XML and PDF etc., but not limited to this.
In at least one embodiment of the present invention, the test report may include the title of interface testing use-case, phase It hopes data, the test data of return, success rate, execute total and failure sum, however, it is not limited to this.
In at least one embodiment of the present invention, above-mentioned all instructions can be is asked by the received data of input equipment Ask instruction.The input equipment may include keyboard inputs, touch screen inputs etc., but the use in the example embodiment of the disclosure Family input mode is without being limited thereto.Above-mentioned various instructions can pass through user's for the programmable button of user on a graphical user interface Operation generates.Specifically, the operation of the user includes, but are not limited to: slide, clicking operation are (such as: single-click operation, double Hit operation etc.).Specifically, the programmable button can be the physical button on the input equipment, be also possible to described defeated Enter virtual key in equipment etc. (such as: the virtual key can be a void on the display of the input equipment Quasi- icon etc.), the present invention is herein with no restrictions.
As seen from the above embodiment, automatic interface testing method can realize that the interface testing of asynchronous interactive is file automating Test, the test speed of accelerating interface test file shorten software development cycle.
It should be noted that for the various method embodiments described above, for simple description, therefore, it is stated as a series of Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the sequence of acts described because According to the present invention, some steps may be performed in other sequences or simultaneously.Secondly, those skilled in the art should also know It knows, the embodiments described in the specification are all preferred embodiments, and related actions and modules is not necessarily of the invention It is necessary.
In several embodiments provided herein, it should be understood that disclosed device, it can be by another way It realizes.For example, the apparatus embodiments described above are merely exemplary, such as the division of the module, it is only a kind of Logical function partition, there may be another division manner in actual implementation, such as multiple module or components can combine or can To be integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual Coupling, direct-coupling or communication connection can be through some interfaces, the indirect coupling or communication connection of device or module, It can be electrical or other forms.
The module as illustrated by the separation member may or may not be physically separated, aobvious as module The component shown may or may not be physical module, it can and it is in one place, or may be distributed over multiple On network module.Some or all of the modules therein can be selected to realize the mesh of this embodiment scheme according to the actual needs 's.
It, can also be in addition, each functional module in various embodiments of the present invention can integrate in a processor It is that modules physically exist alone, can also be integrated in two or more modules in a module.Above-mentioned integrated mould Block both can take the form of hardware realization, can also be realized in the form of software function module.
If the integrated module is realized in the form of software function module and sells or use as independent product When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words It embodies, which is stored in a storage medium, including some instructions are used so that a computer Equipment (can for personal computer, server or network equipment etc.) execute each embodiment the method for the present invention whole or Part steps.
It should also be noted that, herein, the terms "include", "comprise" or its any other variant are intended to non- It is exclusive to include, so that the process, method, article or the device that include a series of elements not only include those elements, It but also including other elements that are not explicitly listed, or further include solid by this process, method, article or device Some elements.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including There is also other identical elements in the process, method of the element, article or device.
The above, the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although referring to before Stating embodiment, invention is explained in detail, those skilled in the art should understand that: it still can be to preceding Technical solution documented by each embodiment is stated to modify or equivalent replacement of some of the technical features;And these It modifies or replaces, the range for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution.

Claims (10)

1. a kind of automatic interface testing method, which is characterized in that the automatic interface testing method includes:
Test case file is constructed in visualization interface and is stored in target platform;
When receiving download instruction, testing tool, at least one dependent file and at least one are downloaded by the target platform A interface testing use-case file is to executing terminal;
Receive analyze the instruction when, utilize the testing tool of acquisition and at least one described dependent file parsing obtain institute Interface testing use-case file is stated, to generate interface testing code;
Receive execute instruction when, repeated within the specified duration using continuous integrating tool with specified sequence described Interface testing code;
It receives the test data returned and forms test data set;
When receiving store instruction, the test data set is stored.
2. automatic interface testing method as described in claim 1, which is characterized in that include more in the interface testing code A interface requests and database information;The interface requests include simultaneously operating interface requests and asynchronous operation interface requests;Institute Stating test data includes output parameter, response time and test result;It is described to be existed using continuous integrating tool with specified sequence The step of repeating the interface testing code in the specified duration include:
Judge whether the interface requests are asynchronous operation interface requests;
When the interface requests are the interface requests of asynchronous operation, obtained out of database according to the database information corresponding Field as the corresponding output parameter of the interface testing use-case.
3. automatic interface testing method as claimed in claim 2, which is characterized in that described to utilize continuous integrating tool to refer to Determining the step of sequence repeats the interface testing code within the specified duration includes:
It is not asynchronous operation interface requests in the interface requests, judges whether there is placeholder in the output parameter;
When there is the placeholder in the output parameter, parses the placeholder and concentrate acquisition pair from the test data The field answered, to substitute the placeholder in the output parameter;
When not having the placeholder in the interface requests, the corresponding output of the interface testing use-case is directly exported Parameter.
4. the automatic interface testing method as described in any one of claim 2 to 3, which is characterized in that the interface Automated testing method includes:
When receiving checking command, the test data set is verified;
Judge whether the output parameter is consistent with expected data;
When the output parameter is consistent with the expected data, then it is logical for marking the test result of the interface testing use-case It crosses;
When the output parameter and the expected data are inconsistent, then marking the test result of the interface testing use-case is not Pass through.
5. the automatic interface testing method as described in any one of claims 1 to 3 item, which is characterized in that the interface Automated testing method includes:
When receiving setting instruction, configuration information is set in the visualization interface;The configuration information includes described specified Duration and configuration parameter;The configuration parameter includes the essential information and the IP address for executing terminal of interface.
6. automatic interface testing method as claimed in claim 2, which is characterized in that it is described using obtain testing tool with And the parsing of described at least one dependent file obtain the interface testing use-case file the step of include:
The interface requests are arranged according to back end, to generate tree node;
The interface testing code is sequentially output according to the tree node.
7. the automatic interface testing method as described in any one of claims 1 to 3 item, which is characterized in that the interface Automated testing method further comprises:
When receiving test report generation instruction, the test data set is generated into test report with specified format, and to refer to Determine sending method and the test report is sent to designated person.
8. a kind of interface automatic test device, which is characterized in that the interface automatic test device includes:
Module is constructed, for constructing test case file in visualization interface and being stored in target platform;
Download module, for literary by target platform downloading testing tool, at least one dependence when receiving download instruction Part and at least one interface testing use-case file are to executing terminal, parsing module, for receive analyze the instruction when utilization The interface testing use-case file that the testing tool of acquisition and the parsing of at least one described dependent file obtain, is connect with generating Mouth test code;
Test module, for utilizing continuous integrating tool with specified sequence within the specified duration when receiving and executing instruction The interface testing code is repeated, the test data of return is received and forms test data set;
Memory module, for storing the test data set when receiving store instruction.
9. a kind of equipment, which is characterized in that the equipment includes processor and memory, and the processor is for executing described deposit Automatic interface testing method as claimed in any of claims 1 to 7 in one of claims is realized when the computer program stored in reservoir.
10. a kind of storage medium, which is characterized in that the storage medium is computer readable storage medium, is stored at least one A instruction, at least one described instruction realize interface as claimed in any of claims 1 to 7 in one of claims certainly when being executed by processor Dynamicization test method.
CN201910190383.6A 2019-03-13 2019-03-13 Automatic interface testing method, device, equipment and storage medium Pending CN110109817A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910190383.6A CN110109817A (en) 2019-03-13 2019-03-13 Automatic interface testing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910190383.6A CN110109817A (en) 2019-03-13 2019-03-13 Automatic interface testing method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110109817A true CN110109817A (en) 2019-08-09

Family

ID=67484349

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910190383.6A Pending CN110109817A (en) 2019-03-13 2019-03-13 Automatic interface testing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110109817A (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110764997A (en) * 2019-09-06 2020-02-07 武汉迎风聚智科技有限公司 Database interface conformance testing method and device
CN110851361A (en) * 2019-11-08 2020-02-28 拉扎斯网络科技(上海)有限公司 Interface testing method and device, electronic equipment and readable storage medium
CN110888804A (en) * 2019-11-11 2020-03-17 网联清算有限公司 Interface test method and interface test platform
CN110955600A (en) * 2019-11-27 2020-04-03 中国银行股份有限公司 Interface test method and device
CN112131127A (en) * 2020-09-28 2020-12-25 北京同邦卓益科技有限公司 Interface testing method, device and system and electronic equipment
CN112612665A (en) * 2020-12-26 2021-04-06 中国农业银行股份有限公司 Testing method, device and equipment of financial intelligent equipment
CN112631914A (en) * 2020-12-24 2021-04-09 上海幻电信息科技有限公司 Data testing method and device
CN112699044A (en) * 2021-01-05 2021-04-23 长沙市到家悠享家政服务有限公司 Pressure testing method, equipment and storage medium
CN113064823A (en) * 2021-03-30 2021-07-02 奇瑞汽车股份有限公司 Method and device for testing functions of automobile parts and computer storage medium
CN113297083A (en) * 2021-05-27 2021-08-24 山东云海国创云计算装备产业创新中心有限公司 Cross-platform IC test method, device, equipment and medium
CN116756043A (en) * 2023-08-10 2023-09-15 东方空间技术(山东)有限公司 Software testing method, device and equipment of target equipment and storage medium
CN117520210A (en) * 2024-01-05 2024-02-06 芯瞳半导体技术(山东)有限公司 System software testing method, target machine and remote testing central control machine

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110764997A (en) * 2019-09-06 2020-02-07 武汉迎风聚智科技有限公司 Database interface conformance testing method and device
CN110764997B (en) * 2019-09-06 2021-07-23 武汉迎风聚智科技有限公司 Database interface conformance testing method and device
CN110851361A (en) * 2019-11-08 2020-02-28 拉扎斯网络科技(上海)有限公司 Interface testing method and device, electronic equipment and readable storage medium
CN110888804B (en) * 2019-11-11 2022-02-01 网联清算有限公司 Interface test method and interface test platform
CN110888804A (en) * 2019-11-11 2020-03-17 网联清算有限公司 Interface test method and interface test platform
CN110955600A (en) * 2019-11-27 2020-04-03 中国银行股份有限公司 Interface test method and device
CN110955600B (en) * 2019-11-27 2023-11-10 中国银行股份有限公司 Interface testing method and device
CN112131127A (en) * 2020-09-28 2020-12-25 北京同邦卓益科技有限公司 Interface testing method, device and system and electronic equipment
CN112131127B (en) * 2020-09-28 2024-04-16 北京同邦卓益科技有限公司 Interface testing method, device and system and electronic equipment
CN112631914A (en) * 2020-12-24 2021-04-09 上海幻电信息科技有限公司 Data testing method and device
CN112612665A (en) * 2020-12-26 2021-04-06 中国农业银行股份有限公司 Testing method, device and equipment of financial intelligent equipment
CN112699044B (en) * 2021-01-05 2023-02-24 长沙市到家悠享家政服务有限公司 Pressure testing method, equipment and storage medium
CN112699044A (en) * 2021-01-05 2021-04-23 长沙市到家悠享家政服务有限公司 Pressure testing method, equipment and storage medium
CN113064823A (en) * 2021-03-30 2021-07-02 奇瑞汽车股份有限公司 Method and device for testing functions of automobile parts and computer storage medium
CN113064823B (en) * 2021-03-30 2024-04-09 奇瑞汽车股份有限公司 Method and device for testing functions of parts of automobile and computer storage medium
CN113297083A (en) * 2021-05-27 2021-08-24 山东云海国创云计算装备产业创新中心有限公司 Cross-platform IC test method, device, equipment and medium
CN116756043A (en) * 2023-08-10 2023-09-15 东方空间技术(山东)有限公司 Software testing method, device and equipment of target equipment and storage medium
CN116756043B (en) * 2023-08-10 2023-11-03 东方空间技术(山东)有限公司 Software testing method, device and equipment of target equipment and storage medium
CN117520210A (en) * 2024-01-05 2024-02-06 芯瞳半导体技术(山东)有限公司 System software testing method, target machine and remote testing central control machine
CN117520210B (en) * 2024-01-05 2024-04-16 芯瞳半导体技术(山东)有限公司 System software testing method, target machine and remote testing central control machine

Similar Documents

Publication Publication Date Title
CN110109817A (en) Automatic interface testing method, device, equipment and storage medium
CN110096429A (en) Test report generation method, device, equipment and storage medium
US11163671B2 (en) Automatically executing stateless transactions with data dependency in test cases
US9419884B1 (en) Intelligent automated testing method for restful web services
CN104572114B (en) A kind of binding device, using updating device and method
CN104639653A (en) Self-adaptive method and system based on cloud architecture
CN110275831A (en) The mock data verification method and device of protocol interface
CN108846286A (en) Cross site scripting leak detection method and device
CN104915193B (en) A kind for the treatment of method and apparatus of flow engine
CN109806592A (en) A kind of monitoring method and device of game resource
CN112988608A (en) Data testing method and device, computer equipment and storage medium
Wang et al. A model-based framework for cloud API testing
CN110413971A (en) Information processing method, device, terminal and the server of online document
Probert et al. TTCN: the international notation for specifying tests of communications systems
US20220198025A1 (en) Web Attack Simulator
US10310962B2 (en) Infrastructure rule generation
EP1510919A2 (en) Systems and methods for synchronizing software execution across data processing systems and platforms
CN116346660A (en) Data processing method, device, equipment and medium based on dependent replacement service
JP5737249B2 (en) Load simulation apparatus, simulation apparatus, load simulation method, simulation method, and program
Luo et al. Clustering and tailoring user session data for testing web applications
CN113495723B (en) Method, device and storage medium for calling functional component
KR101739854B1 (en) Computational science open platform, test system and method
WO2022155685A1 (en) Web attack simulator
Hallé et al. Runtime verification for the web: a tutorial introduction to interface contracts in web applications
CN114004206A (en) Form generation method and device, computer equipment and storage medium

Legal Events

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