CN110321142A - A kind of interface document update method, device, electronic equipment and storage medium - Google Patents
A kind of interface document update method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN110321142A CN110321142A CN201910495582.8A CN201910495582A CN110321142A CN 110321142 A CN110321142 A CN 110321142A CN 201910495582 A CN201910495582 A CN 201910495582A CN 110321142 A CN110321142 A CN 110321142A
- Authority
- CN
- China
- Prior art keywords
- code
- module
- interface
- updated
- object module
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 44
- 238000012545 processing Methods 0.000 claims abstract description 32
- 238000012360 testing method Methods 0.000 claims description 56
- 238000000605 extraction Methods 0.000 claims description 17
- 238000012217 deletion Methods 0.000 claims 1
- 230000037430 deletion Effects 0.000 claims 1
- 238000010200 validation analysis Methods 0.000 abstract description 8
- 230000006870 function Effects 0.000 description 23
- 238000010586 diagram Methods 0.000 description 8
- 230000001360 synchronised effect Effects 0.000 description 5
- 238000004590 computer program Methods 0.000 description 4
- 239000000284 extract Substances 0.000 description 4
- 230000005055 memory storage Effects 0.000 description 4
- 238000011161 development Methods 0.000 description 3
- 230000005611 electricity Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000003032 molecular docking Methods 0.000 description 2
- 206010000117 Abnormal behaviour Diseases 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000005192 partition Methods 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/65—Updates
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/73—Program documentation
Abstract
The embodiment of the invention discloses a kind of interface document update methods, device, electronic equipment and storage medium, wherein method includes: the object module determining code from least one module in code database according to default rule and being updated, obtain the code being updated in the object module, and the interface document of the object module, interface message is extracted from the corresponding code annotation information of the code being updated, format analysis processing is carried out to the interface message extracted, the interface message that obtains that treated, according to the interface document of treated interface message the updates object module, obtain updated interface document.Can real-time update module interface document, so as to the function compared with the accurate validation module.
Description
Technical field
The present invention relates to field of computer technology more particularly to a kind of interface document update method, device, electronic equipment and
Storage medium.
Background technique
With the continuous development of computer technology, the complexity of software systems is higher and higher, and size of code is also increasing, often
Software systems need the code of hundreds of thousands or even row up to a million easily.Therefore, when a certain Development of Module of software systems is complete
Cheng Hou, alternatively, after module is updated, it usually needs test case is generated using the interface document of the module, is used using test
Example come verify the module function whether meet demand.It is found in practice, there are the interfaces of the renewal speed of module and the module
The inconsistent problem of the renewal speed of document causes the accuracy of the test case generated according to interface document not high, cannot be compared with
Accurately verify the function of the module.
Summary of the invention
The embodiment of the present invention provides a kind of interface document update method, device, electronic equipment and storage medium, can in real time more
The interface document of new module, so as to the function compared with the accurate validation module.
In a first aspect, the embodiment of the invention provides a kind of interface document update methods, this method comprises:
The target mould that code is updated is determined from least one module in code database according to default rule
Block, the default rule include the rule being arranged according at least one of the timestamp of module, version number and lines of code;
Obtain the interface document of the code being updated in the object module and the object module, it is described to be updated
Code is at least one of code, newly-increased code and the code being replaced being deleted in the object module;
Interface message is extracted from the corresponding code annotation information of the code being updated, to the interface message extracted
Format analysis processing is carried out, the interface message that obtains that treated, the code annotation information is used to explain the code being updated;
According to the interface document of treated interface message the updates object module, updated interface text is obtained
Shelves.
Second aspect, the embodiment of the invention provides a kind of interface document updating device, which includes:
Determining module, for determining code quilt from least one module in code database according to default rule
The object module of update, the default rule include according at least one in the timestamp of module, version number and lines of code
The rule of kind setting;
Module is obtained, for obtaining the interface document of the code being updated in the object module and the object module,
The code being updated be in the code, newly-increased code and the code that is replaced being deleted in the object module at least
It is a kind of;
Extraction module, for extracting interface message from the corresponding code annotation information of the code being updated;
Processing module, for carrying out format analysis processing to the interface message extracted, the interface message that obtains that treated is described
Code annotation information is used to explain the code being updated;
Update module is obtained for the interface document according to treated interface message the updates object module
Updated interface document.
The third aspect, the embodiment of the invention provides a kind of electronic equipment, comprising:
Processor is adapted for carrying out one or one or more instruction;And
Computer readable storage medium, the computer-readable recording medium storage have one or one or more instruction, institute
It states one or one or more instruction is suitable for being loaded by the processor and being executed such as step:
Determining module, for determining code quilt from least one module in code database according to default rule
The object module of update, the default rule include according at least one in the timestamp of module, version number and lines of code
The rule of kind setting;
Module is obtained, for obtaining the interface document of the code being updated in the object module and the object module,
The code being updated be in the code, newly-increased code and the code that is replaced being deleted in the object module at least
It is a kind of;
Extraction module, for extracting interface message from the corresponding code annotation information of the code being updated;
Processing module, for carrying out format analysis processing to the interface message extracted, the interface message that obtains that treated is described
Code annotation information is used to explain the code being updated;
Update module is obtained for the interface document according to treated interface message the updates object module
Updated interface document.
Fourth aspect, the embodiment of the invention provides a kind of computer readable storage medium, the computer-readable storage
Media storage has one or one or more instruction, and described one or one or more instruction are suitable for being loaded by processor and being executed as follows
Step:
Determining module, for determining code quilt from least one module in code database according to default rule
The object module of update, the default rule include according at least one in the timestamp of module, version number and lines of code
The rule of kind setting;
Module is obtained, for obtaining the interface document of the code being updated in the object module and the object module,
The code being updated be in the code, newly-increased code and the code that is replaced being deleted in the object module at least
It is a kind of;
Extraction module, for extracting interface message from the corresponding code annotation information of the code being updated;
Processing module, for carrying out format analysis processing to the interface message extracted, the interface message that obtains that treated is described
Code annotation information is used to explain the code being updated;
Update module is obtained for the interface document according to treated interface message the updates object module
Updated interface document.
In the embodiment of the present invention, electronic equipment is detected by information such as the timestamp of module, version number and lines of code
Whether the module in code database is updated, and when being updated there are module, the module being updated is determined as object module,
The module of update can be obtained automatically in this way.And according to the corresponding interface message real-time update of the code being updated in object module
The interface document of object module, it is easy to operate, convenient so as to the function compared with the accurate validation module, it improves to interface text
The efficiency that shelves update.
Detailed description of the invention
Technical solution in order to illustrate the embodiments of the present invention more clearly, below will be to needed in embodiment description
Attached drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, general for this field
For logical technical staff, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of interface document update method provided in an embodiment of the present invention;
Fig. 2 is the flow diagram of another interface document update method provided in an embodiment of the present invention;
Fig. 3 is a kind of structural schematic diagram of interface document updating device provided in an embodiment of the present invention;
Fig. 4 is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention.
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 some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall within the protection scope of the present invention.
Based in the prior art, when an application program is completed by exploitation, and after coming into operation, it usually needs constantly update
One or more modules in the application program, so that the performance of the application program is more excellent, safety is higher etc..When using journey
After the module of sequence updates, it is also desirable to which the interface document of the synchronized update module could be tested accurately based on interface document in this way
Demonstrate,prove updated module function whether meet demand.The interface document for needing to research and develop the manual update module of engineer at present, is deposited
It leaves office or forgets the case where updating interface document researching and developing engineer, lead to module renewal speed and the interface document of the module
Renewal speed is inconsistent, cannot accurate authentication module function whether meet demand, and this interface document update side
Method operation is more complicated and time-consuming, laborious.
The problem of based on current interface document updating method, proposes in the embodiment of the present invention a kind of interface document more
New method, this method can be executed by electronic equipment, which can refer to that intelligent terminal, server or computer etc. can
For the equipment of storage, the specific implementation process of this method includes: that electronic equipment passes through the timestamp of module, version number and code
The information such as line number detect whether the module in code database is updated, when being updated there are module, the mould that will be updated
Block is determined as object module, and obtains the code being updated in object module.From the corresponding code annotation letter of code being updated
Interface message is extracted in breath, and the interface document of object module is updated according to the interface message of extraction.It can obtain automatically in this way
Take the module of update, can real-time update module interface document, so as to the function compared with the accurate validation module, operation letter
It is single, convenient, improve the efficiency updated to interface document.
It referring to Figure 1, is a kind of flow diagram of interface document update method provided in an embodiment of the present invention, the present invention
The method of embodiment can be executed by the above-mentioned electronic equipment referred to.In the present embodiment, the interface document update method
Include the following steps.
S101, the mesh that code is updated is determined from least one module in code database according to default rule
Module is marked, which includes the rule being arranged according at least one of the timestamp of module, version number and lines of code
Then.
Module refers to a part of application program, is obtained specifically, module can be according to the function division of application program
, if the application program is instant messaging program, which can handle mould for user account information management module, information transmit-receive
Block and showing interface module etc..Code database refers to the database for storing application program, can be in code database
Including one or more modules.For the interface document of synchronized update module, electronic equipment can be detected according to default rule
Whether the module in code database is updated, if detecting the module being updated, it is determined that the module being updated is target mould
Block.It can detect the module being updated automatically in this way, and efficiency is higher, not needing will be in module each in code database
History codes are compared with current code, and the module being updated herein refers to the module that the code in module is updated.
In one embodiment, in order to reduce the resource consumption of electronic equipment, electronic equipment can be based between preset time
It whether there is the module that code is updated every detecting code database according to default rule, the module that code is updated determines
For object module.Prefixed time interval can be the speed determination being updated according to module history each in code database,
The speed that the history of module is updated refers to average renewal speed or maximum update speed in preset time period etc..For example,
Internal module such as at one week is updated 4 times, is respectively 1 day, 1 day and 2 days per adjacent renewal time interval twice, then the module
The speed being updated includes every 1 day primary, and every 2 days primary, and electronic equipment can set prefixed time interval to 1 day (i.e. 24
Hour), what electronic equipment can be updated using default rule detection code database with the presence or absence of code every 24 hours
Module.
In another embodiment, in order to reduce the resource consumption of electronic equipment, electronic equipment can be carried out to module
When test, whether the code for just detecting the module is updated.Specifically, if receiving about the test instruction to a certain module, root
Whether it is updated according to the code that default rule detects the module, if the code of the module is updated, which is determined as
Object module.
In yet another embodiment, electronic equipment can detect in code database extremely according to default rule in real time
The module being updated in a few module with the presence or absence of code, and if it exists, the module for being then updated code is determined as target mould
Block.
S102, the interface document for obtaining the code and the object module that are updated in the object module, the generation being updated
Code is at least one of code, newly-increased code and the code being replaced being deleted in the object module.
After determining that object module is updated, the code that is updated in the available object module of electronic equipment, wherein
The code being updated is line code or lines of code (i.e. code segment), specifically, electronic equipment can be according to the exploitation target
The system log message of the equipment of module obtains the code that the object module is updated, and system log refers to be sent out in record system
Raw event specifically may include time and operating process etc. that event occurs.Alternatively, electronic equipment can be according to the target mould
The history codes of block obtain the code that the object module is updated, when history codes are updated for the object module nearest one
Code.Further, the interface document of the available object module of electronic equipment, the interface document of object module are for recording
The document of the interface message of the object module, interface message may include that interface name, interface uniform resource locator, interface are said
One of bright, input parameter, output parameter, returned data, the domain name of interface testing server and port are a variety of.
In one embodiment, the syslog data of the available equipment for developing the object module of electronic equipment, root
The daily record data about the object module is extracted from the syslog data according to the mark of the object module.The mark of object module
Know can be refer to object module title and/store address information of the object module etc.;The daily record data of the object module
The action event to object module is had recorded, the code updated in the object module is obtained from the daily record data of the object module.
Wherein, the equipment and the electronic equipment for developing the object module can refer to the same equipment, be also possible to distinct device.
In one embodiment, by usually being remembered in electronic equipment for the ease of the subsequent development process for checking object module
The history codes of object module are recorded, if the object module is updated herein, which refers to last update
The code of the object module afterwards;If the object module is not updated, which refers to that the object module has been developed
At when code (source code).The history codes of the available object module of electronic equipment, by history codes and the mesh
Current code is compared in mark module, to obtain updated code.
S103, interface message is extracted from the corresponding code annotation information of code that this is updated, to the interface extracted
Information carries out format analysis processing, the interface message that obtains that treated, and the code annotation information is for explaining the code being updated.
For the interface document of synchronized update object module, the corresponding code of code that electronic equipment can be updated from this
Interface message is extracted in annotation information, specifically, the corresponding code annotation information of code that electronic equipment can be updated from this
It is middle to extract the annotation information for carrying default mark, interface message is generated according to the annotation information of default mark, default mark can be with
It is identified including objective function, inputs parameter identification and output identification.For the ease of it is subsequent to the writing of interface document, modify exploitation
Deng or quickly generate test and use, electronic equipment can carry out format analysis processing to the interface message of extraction according to preset format, obtain
To treated interface message, above-mentioned preset format be can be set according to actual needs, such as preset format can be according to mesh
The type of code setting of module is marked, preset format can be the format of interface message in the interface document in the object module.
In one embodiment, for the ease of the code in user's Understanding Module, usual developer writes code
The corresponding code comments information of addition can be synchronized on code segment in the process, and uses pre- bidding in these code comments information
Know the contents such as the summary info of authentication code and parameter information respectively.Wherein, summary info includes unified to interface name, interface
Resource Locator, interface specification, returned data, the domain name of interface testing server and the explanation of port.Parameter information packet
Include the explanation to input and output parameter.Therefore, the corresponding code of code that electronic equipment can be updated from this
The annotation information for carrying default mark is extracted in annotation information, and interface message is generated according to the annotation information of default mark.For example,
Inputting parameter identification can be PAFInput, and output parameter mark can be PAFOutput, corresponding from the code being updated
Code annotation information extraction carries the annotation information of@PAFInput, and carries the annotation information of@PAFOutput.Such as carry@
The annotation information of PAFInput is@PAFInput (desc=" "), i.e. information in@PAFInput (desc=" ") in double quotation marks
To input parameter.The annotation information for carrying@PAFOutput is@PAFOutput (desc=" "), i.e.@PAFOutput (desc=
" ") in information in double quotation marks be output parameter.
S104, the interface message according to this after reason update the interface document of the object module, obtain updated interface
Document.
Interface message after electronic equipment can be managed according to this updates the interface document of the object module, after obtaining update
Interface document.
In one embodiment, if the code being updated is the code being deleted in the object module, from the target
Deleted in the interface document of module with should treated interface message that interface message matches;If the code being updated is should
The code increased newly in object module, then by this, treated that interface message is added in the interface document of the object module;If should
The code being updated is the code being replaced in the object module, then before removal is replaced in the interface document of the object module
The corresponding interface message of code, and treated that interface message is added in the interface document of the object module by this.
If the code being updated is the code being deleted in the object module, deleted code will not influence the mesh
The function of marking module shows that the corresponding interface message of deleted code is invalid interface message, it is impossible to be used in test
Therefore the function of the object module deletes that treated that interface message matches with this from the interface document of the object module
Interface message.For example, the source of the interface message in object module, i.e. each interface message are had recorded in interface document
It is to be obtained from the code annotation information of which line code.The deleted code is the of the original code in object module
112-150 line code then deletes the 112-150 of the original code from object module from the interface document of the object module
Annotation information in interface message.
If the code being updated is the code increased newly in the object module, show that newly-increased code will affect the target
The function of module, the i.e. corresponding interface message of newly-increased code are useful interface message, therefore, can treated connects by this
Message breath is added in the interface document of the object module.For example, the corresponding interface message of newly-increased code is input parameter
And output parameter, then the corresponding interface message of newly-increased code can be added to the interface text of the object module by electronic equipment
The position of parameter is stored in shelves.
If the code being updated is the code (code after being replaced) being replaced in the object module, this is replaced
The corresponding function of code before replacing in the object module is substituted in the code changed, that is, needs the interface according to the code being replaced
Information verifies the current function of the object module, therefore, can be before removing and being replaced in the interface document of the object module
The corresponding interface message of code, and treated that interface message is added in the interface document of the object module by this.For example,
Assuming that 112-150 line code in object module is substituted in the code being replaced, then electronic equipment can be using being replaced
The corresponding interface message of 112-150 line code in the interface document of the corresponding interface message replacement object module of code.
In the embodiment of the present invention, electronic equipment is detected by information such as the timestamp of module, version number and lines of code
Whether the module in code database is updated, and when being updated there are module, the module being updated is determined as object module,
The module of update can be obtained automatically in this way.And the code being updated in object module is obtained, it is corresponding from the code being updated
It extracts interface message in code annotation information, and format analysis processing is carried out to the interface message of extraction, the interface letter that obtains that treated
Breath updates the interface document of object module according to the interface message of processing.It is corresponding according to the code being updated in object module
The interface document of interface message real-time update object module, it is easy to operate, just so as to the function compared with the accurate validation module
Victory improves the efficiency updated to interface document.In addition, being conducive to subsequent by carrying out format analysis processing to the interface message of extraction
To the writing of interface document, modify exploitation.
Fig. 2 is referred to, is the flow diagram of another interface document update method provided in an embodiment of the present invention, this hair
The method of bright embodiment can be executed by the above-mentioned electronic equipment referred to.In the present embodiment, the interface document update side
Method includes the following steps.
S201, the mesh that code is updated is determined from least one module in code database according to default rule
Module is marked, which includes the rule being arranged according at least one of the timestamp of module, version number and lines of code
Then.
In one embodiment, which includes according to the rule of the time stamp setting of module, step S201 tool
Body may include following steps s11~s12.
S11, the first time stamp that each module last time updates in the code database is obtained, and each module corresponds to
The interface document last time update the second timestamp.
S12, by this in the code database, the difference between stamp and second timestamp is greater than preset threshold at the first time
Module be determined as object module.
In step s11~s12, in the available code database of electronic equipment each module last time update the
One timestamp, and the second timestamp that each module corresponding interface document last time updates.Specifically, if the module not by
Updated, then the first time stamp of a update can refer to the timestamp that the module is completed by exploitation, the module in the module
The second timestamp that the corresponding interface document last time updates can refer to the timestamp that the interface document of the module is established.If
The module is updated, then in the module first time stamp of a update can refer to that the module the last time is updated when
Between stab, the second timestamp that the module corresponding interface document last time updates can refer to the last time being updated
Stamp.Wherein, timestamp can specifically refer to time, or the character for identified time etc., same time corresponding time
Stamp is usually identical.Further, if in the code database between the first time stamp and second timestamp of a certain module
Difference is greater than preset threshold, then shows that the renewal time of the interface document of the module is not synchronous with the renewal time of the module, electricity
The module that difference between first time stamp and second timestamp is greater than preset threshold can be determined as target mould by sub- equipment
Block, wherein the preset threshold can be user's manual setting, or determined according to the renewal speed of code in module, example
Such as, which can be less than the minimum renewal speed of the code in the module.Optionally, if module in the code database
Time of the time of corresponding second timestamp instruction earlier than first time stamp instruction, it is determined that after the module updates, do not update
The interface document of the module, therefore can be using the module as object module.
As an example it is assumed that preset threshold is 2 days, it include module 1 in the code database, if the code of module 1 is nearest
The first time stamp being updated is on August 15th, 2018, the second timestamp of the corresponding interface document of module 1 being updated recently
It is on August 11st, 2018, stamp and the difference of the second timestamp are 4 days at the first time, i.e. stamp of the corresponding first time of module 1 and the
Difference between two timestamps is greater than preset threshold, it is determined that module 1 is object module.
In another embodiment, which includes the rule being arranged according to the version number of module, step S201
It may include specifically following steps s21~s22.
S21, each module is current in the code database version number and old version number are obtained, each module is gone through
The version number of module when history version number is the last interface document for updating respective modules.
S22, version number current in the code database and the different module of the old version number are determined as target
Module.
In step s21~s22, after usual module is updated, the module being updated can be endowed a new version number,
Therefore, it can judge whether the module is updated according to the version number of module.Specifically, the available code of electronic equipment
The current version number of each module and old version number in database, if the current version number of a certain module in the code database
It is not identical as the old version number, then show that the module is updated, by version number current in the code database and can be somebody's turn to do
The different module of old version number is determined as object module.For example, including module 1 in the code database, which is gone through
The version number of the module 1 when history version number is the interface document of last update respective modules 1.If the old version of module 1
It number is 1.1.2, the current version number of the module is 1.1.3, it is determined that the current version number of module 1 and old version number not phase
Together, the code of determining module 1 is updated, i.e., regard the module 1 as object module.
In yet another embodiment, which includes the rule being arranged according to the lines of code of module, step
S201 specifically may include following steps s31~s32.
S31, each module is current in the code database lines of code and history codes line number are obtained, each module
The lines of code of respective modules when history codes line number is the last interface document for updating respective modules.
S32, lines of code and the different module of history codes line number current in the code database are determined as
Object module.
In step s31~s32, when in module by newly-increased code or deleted code, then the lines of code meeting of the module
It changes, therefore, whether electronic equipment can be updated according to the lines of code of module come judgment module.Specifically, electronics
Each module current lines of code and history codes line number in the available code database of equipment, if the generation that module is current
Code line number and the history codes line number be not identical, then shows to have been increased newly code in module or be deleted code, can be by the generation
Current lines of code and the different module of history codes line number are determined as object module in code database.For example, the generation
It include module 1, the mould when history line number of the module 1 is the interface document of last update respective modules 1 in code database
The lines of code of block 1.If the history codes line number of module 1 is 1,000 rows, the current lines of code of the module is 2,000 rows, it is determined that
The current code line number and history codes line number of module 1 be not identical, and the code of determining module 1 is updated, i.e., by 1 conduct of module
Object module.
S202, the interface document for obtaining the code and the object module that are updated in the object module, the generation being updated
Code is at least one of code, newly-increased code and the code being replaced being deleted in the object module.
S203, interface message is extracted from the corresponding code annotation information of code that this is updated, to the interface extracted
Information carries out format analysis processing, the interface message that obtains that treated, and the code annotation information is for explaining the code being updated.
In one embodiment, step S203 can specifically include following steps s41~s43.
S41, type of code in the object module is obtained.
S42, the format for testing the test case of the object module is determined according to the type of code in the object module.
S43, the interface message extracted is handled according to the format of the test case, the interface letter that obtains that treated
Breath.
In step s41~s43, for the ease of it is subsequent to the writing of interface document, modify exploitation etc. or quickly generate
Test use, the type of code of the available object module of electronic equipment, type of code may include C language, object-oriented and
Literal translation formula computer programming language Python or object oriented program language Java etc..Each type of code
The format of corresponding test case is inconsistent, therefore, can be determined according to the type of code in the object module for testing this
The format of the test case of object module can be rapidly by the interface text of the object module in order to when testing object module
Shelves be added in test case, electronic equipment can according to the format of the test case to the interface message extracted at
Reason, the interface message that obtains that treated.For example, the type of code of the object module is Java, the then corresponding survey of the object module
The format of example on probation can be object numbered musical notation (JavaScript Object Notation, JSON), i.e., a kind of number of lightweight
According to exchange format, the interface message extracted is handled according to JSON format, the interface message that obtains that treated.
S204, the interface message according to this after reason update the interface document of the object module, obtain updated interface
Document.
S205, the test request for being directed to the object module is received.
S206, the interface message in the updated interface document is added to the test use for being used to test the object module
In example, the interface message in the updated interface document includes below one or more: interface name, interface unified resource
Finger URL, interface specification, input parameter, output parameter, returned data, the domain name of interface testing server and port.
S207, the object module is tested according to the test case of the object module.
In step S205~S207, when receiving the test request for object module, electronic equipment can be by this more
The interface message in interface document after new is added in the test case for testing the object module, and according to the target mould
The test case of block tests the object module, which is the newest interface text of the object module
Shelves, therefore, can accurately test the object module function whether meet demand.
In the embodiment of the present invention, electronic equipment is detected by information such as the timestamp of module, version number and lines of code
Whether the module in code database is updated, and when being updated there are module, the module being updated is determined as object module,
The module of update can be obtained automatically in this way.And the code being updated in object module is obtained, it is corresponding from the code being updated
It extracts interface message in code annotation information, and format analysis processing is carried out to the interface message of extraction, the interface letter that obtains that treated
Breath updates the interface document of object module according to the interface message of processing.It is corresponding according to the code being updated in object module
The interface document of interface message real-time update object module, it is easy to operate, just so as to the function compared with the accurate validation module
Victory improves the efficiency updated to interface document.In addition, the interface message to extraction carries out format analysis processing, in order to subsequent docking
Mouth document is write, modifies exploitation.
Fig. 3 is referred to, is a kind of structural schematic diagram of interface document updating device provided in an embodiment of the present invention, the present invention
The described device of embodiment can be set in the above-mentioned electronic equipment referred to.In the present embodiment, the interface document updating device
Include:
Determining module 301, for determining generation from least one module in code database according to default rule
The object module that is updated of code, the default rule include according in the timestamp of module, version number and lines of code extremely
A kind of rule of few setting;
Module 302 is obtained, for obtaining the interface text of the code being updated in the object module and the object module
Shelves, the code being updated are in the code, newly-increased code and the code that is replaced being deleted in the object module
It is at least one;
Extraction module 303, for extracting interface message from the corresponding code annotation information of the code being updated;
Processing module 304, for carrying out format analysis processing to the interface message extracted, the interface message that obtains that treated,
The code annotation information is used to explain the code being updated;
Update module 305 is obtained for the interface document according to treated interface message the updates object module
To updated interface document.
Optionally, the default rule includes according to the rule of the time stamp setting of module, determining module 301, specifically
For obtaining each module last time updates in the code database first time stamp and each module is corresponding connects
The second timestamp that the mouth document last time updates;It will be stabbed and second timestamp at the first time described in the code database
Between difference be greater than preset threshold module be determined as object module.
Optionally, the default rule includes according to the rule of the version number of module setting, determining module 301, specifically
For obtaining the version number and old version number that each module is current in the code database, the history version of each module
The version number of this number module when being the last interface document for updating respective modules;It will be current in the code database
Version number and the different module of the old version number are determined as object module.
Optionally, the default rule includes the rule being arranged according to the lines of code of module, determining module 301, tool
Body is for obtaining the lines of code and history codes line number that each module is current in the code database, the history of each module
The lines of code of respective modules when lines of code is the last interface document for updating respective modules;It will be in the code database
Current lines of code and the different module of history codes line number are determined as object module.
Optionally, extraction module 303, specifically for obtaining the type of code in the object module;According to the target
Type of code in module determines the format for testing the test case of the object module;According to the lattice of the test case
Formula handles the interface message extracted, the interface message that obtains that treated.
Optionally, update module 305, if being the generation being deleted in the object module for the code being updated
Code is then deleted from the interface document of the object module and treated the interface message that interface message matches;If
The code being updated is the code increased newly in the object module, then treated that interface message is added to is described by described
In the interface document of object module;If the code being updated is the code that is replaced in the object module, from described
Remove the corresponding interface message of code before being replaced in the interface document of object module, and will treated the interface message
It is added in the interface document of the object module.
Optionally, described device further include: test module 306, for receiving the test request for being directed to the object module;
Interface message in the updated interface document is added in the test case for being used to test the object module, it is described
Interface message in updated interface document includes below one or more: interface name, interface uniform resource locator,
Interface specification, input parameter, output parameter, returned data, the domain name of interface testing server and port;According to the target mould
The test case of block tests the object module.
In the embodiment of the present invention, electronic equipment is detected by information such as the timestamp of module, version number and lines of code
Whether the module in code database is updated, and when being updated there are module, the module being updated is determined as object module,
The module of update can be obtained automatically in this way.And the code being updated in object module is obtained, it is corresponding from the code being updated
It extracts interface message in code annotation information, and format analysis processing is carried out to the interface message of extraction, the interface letter that obtains that treated
Breath updates the interface document of object module according to the interface message of processing.It is corresponding according to the code being updated in object module
The interface document of interface message real-time update object module, it is easy to operate, just so as to the function compared with the accurate validation module
Victory improves the efficiency updated to interface document.In addition, to the interface message of extraction to format analysis processing is carried out, in order to subsequent right
Interface document is write, modifies exploitation.
Fig. 4 is referred to, is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention, this reality as shown in the figure
Applying the electronic equipment in example may include: one or more processors 401;One or more input units 402, it is one or more
Output device 403 and memory 404.Above-mentioned processor 401, input unit 402, output device 403 and memory 404 pass through total
Line 405 connects.
Handled device 401 can be central processing unit (Central Processing Unit, CPU), and the processor is also
It can be other general processors, digital signal processor (Digital Signal Processor, DSP), dedicated integrated electricity
Road (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor
Deng.
Input unit 402 may include that Trackpad, fingerprint adopt sensor (for acquiring the finger print information and fingerprint of user
Directional information), microphone etc., output device 403 may include display (LCD etc.), loudspeaker etc., and output device 403 can be with
Prompt information is exported, prompt information can be used for prompting target user with the presence or absence of abnormal behavior of being hospitalized.
The memory 404 may include read-only memory and random access memory, and to processor 401 provide instruction and
Data.The a part of of memory 404 can also include nonvolatile RAM, and memory 404 is calculated for storing
Machine program, the computer program include program instruction, and processor 401 is used to execute the program instruction of the storage of memory 404, with
For executing a kind of interface document update method, i.e., for performing the following operations:
The target mould that code is updated is determined from least one module in code database according to default rule
Block, the default rule include the rule being arranged according at least one of the timestamp of module, version number and lines of code;
Obtain the interface document of the code being updated in the object module and the object module, it is described to be updated
Code is at least one of code, newly-increased code and the code being replaced being deleted in the object module;
Interface message is extracted from the corresponding code annotation information of the code being updated, to the interface message extracted
Format analysis processing is carried out, the interface message that obtains that treated, the code annotation information is used to explain the code being updated;
According to the interface document of treated interface message the updates object module, updated interface text is obtained
Shelves.
Optionally, the default rule includes according to the rule of the time stamp setting of module, and processor is deposited for executing
The program instruction of reservoir storage, for performing the following operations:
It is corresponding to obtain the first time stamp of each module last time update and each module in the code database
The interface document last time update the second timestamp;
By the difference between stamp and second timestamp is greater than default threshold at the first time described in the code database
The module of value is determined as object module.
Optionally, the default rule includes the rule being arranged according to the version number of module, and processor is deposited for executing
The program instruction of reservoir storage, for performing the following operations:
The version number and old version number that each module is current in the code database are obtained, each module is gone through
The version number of history version number module when being the last interface document for updating respective modules;
Version number current in the code database and the different module of the old version number are determined as target
Module.
Optionally, the default rule includes the rule being arranged according to the lines of code of module, and processor is for executing
The program instruction of memory storage, for performing the following operations:
The lines of code and history codes line number that each module is current in the code database are obtained, each module is gone through
The lines of code of respective modules when history lines of code is the last interface document for updating respective modules;
Lines of code current in the code database and the different module of history codes line number are determined as
Object module.
Optionally, processor is used to execute the program instruction of memory storage, for performing the following operations:
Obtain the type of code in the object module;
The format for testing the test case of the object module is determined according to the type of code in the object module;
The interface message extracted is handled according to the format of the test case, the interface letter that obtains that treated
Breath.
Optionally, processor is used to execute the program instruction of memory storage, for performing the following operations:
If the code being updated is the code being deleted in the object module, from the interface of the object module
It is deleted in document and treated the interface message that interface message matches;
If the code being updated is the code increased newly in the object module, interface message that treated by described in
It is added in the interface document of the object module;
If the code being updated is the code being replaced in the object module, from the interface of the object module
Remove the corresponding interface message of code before being replaced in document, and treated that interface message is added to the target by described
In the interface document of module.
Optionally, processor is used to execute the program instruction of memory storage, for performing the following operations:
Receive the test request for being directed to the object module;
Interface message in the updated interface document is added to the test use for being used to test the object module
In example, the interface message in the updated interface document includes below one or more: interface name, interface are unified to be provided
Source finger URL, interface specification, input parameter, output parameter, returned data, the domain name of interface testing server and port;
The object module is tested according to the test case of the object module.
In the embodiment of the present invention, electronic equipment is detected by information such as the timestamp of module, version number and lines of code
Whether the module in code database is updated, and when being updated there are module, the module being updated is determined as object module,
The module of update can be obtained automatically in this way.And the code being updated in object module is obtained, it is corresponding from the code being updated
It extracts interface message in code annotation information, and format analysis processing is carried out to the interface message of extraction, the interface letter that obtains that treated
Breath updates the interface document of object module according to the interface message of processing.It is corresponding according to the code being updated in object module
The interface document of interface message real-time update object module, it is easy to operate, just so as to the function compared with the accurate validation module
Victory improves the efficiency updated to interface document.In addition, the interface message to extraction carries out format analysis processing, in order to subsequent docking
Mouth document is write, modifies exploitation.
The executable present invention of processor 401 described in the embodiment of the present invention, input unit 402, output device 403 is real
Implementation described in the first embodiment and second embodiment of the interface document update method of example offer is provided, also can be performed
The implementation of electronic equipment described in the embodiment of the present invention, details are not described herein.
A kind of computer readable storage medium, the computer-readable storage medium are provided in another embodiment of the invention
Matter is stored with computer program, and the computer program includes program instruction, realization when described program instruction is executed by processor
Interface document update method shown in Fig. 1 and Fig. 2 embodiment of the invention.
The computer readable storage medium can be the storage inside list of electronic equipment described in aforementioned any embodiment
Member, such as the hard disk or memory of control equipment.The computer readable storage medium is also possible to the outside of the control equipment
The plug-in type hard disk being equipped in storage equipment, such as the control equipment, intelligent memory card (Smart Media Card, SMC),
Secure digital (Secure Digital, SD) card, flash card (Flash Card) etc..Further, described computer-readable to deposit
Storage media can also be both including the internal storage unit for controlling equipment or including External memory equipment.It is described computer-readable
Storage medium is for other programs and data needed for storing the computer program and the control equipment.The computer
Readable storage medium storing program for executing can be also used for temporarily storing the data that has exported or will export.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure
Member and algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware
With the interchangeability of software, each exemplary composition and step are generally described according to function in the above description.This
A little functions are implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Specially
Industry technical staff can use different methods to achieve the described function each specific application, but this realization is not
It is considered as beyond the scope of this invention.It is apparent to those skilled in the art that for convenience of description and simple
Clean, the control equipment of foregoing description and the specific work process of unit can refer to corresponding processes in the foregoing method embodiment,
Details are not described herein.
In several embodiments provided herein, it should be understood that disclosed control device and method, Ke Yitong
Other modes are crossed to realize.For example, the apparatus embodiments described above are merely exemplary, for example, the unit is drawn
Point, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can
To combine or be desirably integrated into another system, or some features can be ignored or not executed.
The foregoing is merely a specific embodiment of the invention, but scope of protection of the present invention is not limited thereto, any
Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace
It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right
It is required that protection scope subject to.
Claims (10)
1. a kind of interface document update method characterized by comprising
The object module that code is updated, institute are determined from least one module in code database according to default rule
Stating default rule includes the rule being arranged according at least one of the timestamp of module, version number and lines of code;
Obtain the interface document of the code being updated in the object module and the object module, the code being updated
For at least one of code, newly-increased code and the code being replaced being deleted in the object module;
Interface message is extracted from the corresponding code annotation information of the code being updated, the interface message extracted is carried out
Format analysis processing, the interface message that obtains that treated, the code annotation information are used to explain the code being updated;
According to the interface document of treated interface message the updates object module, updated interface document is obtained.
2. the method according to claim 1, wherein the default rule includes being set according to the timestamp of module
The rule set, the mesh determining code from least one module in code database according to default rule and being updated
Mark module, comprising:
It obtains each module last time updates in the code database first time stamp and each module is corresponding connects
The second timestamp that the mouth document last time updates;
By the difference between stamp and second timestamp is greater than preset threshold at the first time described in the code database
Module is determined as object module.
3. the method according to claim 1, wherein the default rule includes being set according to the version number of module
The rule set, the mesh determining code from least one module in code database according to default rule and being updated
Mark module, comprising:
Obtain the version number and old version number that each module is current in the code database, the history version of each module
This number for the last interface document for updating respective modules when respective modules version number;
Version number current in the code database and the different module of the old version number are determined as object module.
4. the method according to claim 1, wherein the default rule includes the lines of code according to module
The rule of setting, it is described to determine what code was updated from least one module in code database according to default rule
Object module, comprising:
Obtain the lines of code and history codes line number that each module is current in the code database, the history generation of each module
The lines of code of respective modules when code line number is the last interface document for updating respective modules;
Lines of code current in the code database and the different module of history codes line number are determined as target
Module.
5. the method according to claim 1, wherein the described pair of interface message extracted carries out format analysis processing,
The interface message that obtains that treated, comprising:
Obtain the type of code in the object module;
The format for testing the test case of the object module is determined according to the type of code in the object module;
The interface message extracted is handled according to the format of the test case, the interface message that obtains that treated.
6. the method according to claim 1, wherein described in treated according to the interface message updates
The interface document of object module obtains updated interface document, comprising:
If the code being updated is the code being deleted in the object module, from the interface document of the object module
Middle deletion and treated the interface message that interface message matches;
If the code being updated is the code increased newly in the object module, treated the interface message is added
Into the interface document of the object module;
If the code being updated is the code being replaced in the object module, from the interface document of the object module
Middle removal be replaced before the corresponding interface message of code, and treated that interface message is added to the object module by described
Interface document in.
7. method according to claim 1-6, which is characterized in that the method also includes:
Receive the test request for being directed to the object module;
Interface message in the updated interface document is added in the test case for being used to test the object module,
Interface message in the updated interface document includes below one or more: interface name, interface unified resource are fixed
Position symbol, interface specification, input parameter, output parameter, returned data, the domain name of interface testing server and port;
The object module is tested according to the test case of the object module.
8. a kind of interface document updating device characterized by comprising
Determining module, for determining that code is updated from least one module in code database according to default rule
Object module, the default rule includes being set according at least one of the timestamp of module, version number and lines of code
The rule set;
Module is obtained, it is described for obtaining the interface document of the code being updated in the object module and the object module
The code being updated is at least one in the code, newly-increased code and the code that is replaced being deleted in the object module
Kind;
Extraction module, for extracting interface message from the corresponding code annotation information of the code being updated;
Processing module, for carrying out format analysis processing to the interface message extracted, obtain that treated interface message, the code
Annotation information is used to explain the code being updated;
Update module is updated for the interface document according to treated interface message the updates object module
Interface document afterwards.
9. a kind of electronic equipment characterized by comprising
Processor is adapted for carrying out one or one or more instruction;And
Readable computer storage medium, the readable computer storage medium is stored with one or one or more is instructed, and described one
Item or one or more instruction are suitable for being loaded by processor and being executed such as the described in any item interface document update sides claim 1-7
Method.
10. a kind of readable computer storage medium, which is characterized in that the readable computer storage medium is stored with one or one
Above instructions, described one or one or more instruction are suitable for being loaded by processor and being executed such as any one of claim 1-7 institute
The interface document update method stated.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910495582.8A CN110321142A (en) | 2019-06-05 | 2019-06-05 | A kind of interface document update method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910495582.8A CN110321142A (en) | 2019-06-05 | 2019-06-05 | A kind of interface document update method, device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110321142A true CN110321142A (en) | 2019-10-11 |
Family
ID=68120817
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910495582.8A Pending CN110321142A (en) | 2019-06-05 | 2019-06-05 | A kind of interface document update method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110321142A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111240967A (en) * | 2020-01-03 | 2020-06-05 | 北京字节跳动网络技术有限公司 | Code generation method and device |
CN112380281A (en) * | 2020-10-30 | 2021-02-19 | 中国人寿保险股份有限公司 | Platform layer code generation method and device, electronic equipment and storage medium |
CN112463210A (en) * | 2020-12-04 | 2021-03-09 | 上海路人王信息科技有限公司 | Interface document generation method, terminal device and computer-readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107463376A (en) * | 2017-07-21 | 2017-12-12 | 珠海牛角科技有限公司 | The method and device for automatically generating back end interface document based on Javadoc |
CN109375922A (en) * | 2018-09-26 | 2019-02-22 | 深圳壹账通智能科技有限公司 | A kind of automatic generation method and terminal device of interface document |
CN109542412A (en) * | 2018-10-16 | 2019-03-29 | 平安普惠企业管理有限公司 | Interface message generation method, device, computer equipment and storage medium |
-
2019
- 2019-06-05 CN CN201910495582.8A patent/CN110321142A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107463376A (en) * | 2017-07-21 | 2017-12-12 | 珠海牛角科技有限公司 | The method and device for automatically generating back end interface document based on Javadoc |
CN109375922A (en) * | 2018-09-26 | 2019-02-22 | 深圳壹账通智能科技有限公司 | A kind of automatic generation method and terminal device of interface document |
CN109542412A (en) * | 2018-10-16 | 2019-03-29 | 平安普惠企业管理有限公司 | Interface message generation method, device, computer equipment and storage medium |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111240967A (en) * | 2020-01-03 | 2020-06-05 | 北京字节跳动网络技术有限公司 | Code generation method and device |
CN111240967B (en) * | 2020-01-03 | 2023-09-15 | 北京字节跳动网络技术有限公司 | Code generation method and device |
CN112380281A (en) * | 2020-10-30 | 2021-02-19 | 中国人寿保险股份有限公司 | Platform layer code generation method and device, electronic equipment and storage medium |
CN112463210A (en) * | 2020-12-04 | 2021-03-09 | 上海路人王信息科技有限公司 | Interface document generation method, terminal device and computer-readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110321142A (en) | A kind of interface document update method, device, electronic equipment and storage medium | |
US20110161132A1 (en) | Method and system for extracting process sequences | |
CN104252531B (en) | A kind of file type identification method and device | |
CN104598570B (en) | The grasping means of resource and device | |
CN109508346B (en) | Cascade synchronous control method and system for DDL operation | |
CN104156198A (en) | Method and device for automatically generating software integration version updating description | |
CN109240917A (en) | A kind of blog management method and relevant apparatus | |
JP6190539B2 (en) | Log analysis apparatus, log analysis system, log analysis method, and computer program | |
EP3230869A1 (en) | Separating test verifications from test executions | |
CN107357619B (en) | Method, device, equipment and storage medium for generating card configuration file | |
CN104063245A (en) | Memory analysis and optimization method and system based on garbage collection | |
WO2018066661A1 (en) | Log analysis method, system, and recording medium | |
CN109446262A (en) | A kind of data assemblage method and device | |
CN111552673B (en) | File processing method and device, electronic equipment and storage medium | |
CN117240522A (en) | Vulnerability intelligent mining method based on attack event model | |
JP2009230618A (en) | Specification creating program, device therefor, and method thereof | |
US20190340540A1 (en) | Adaptive continuous log model learning | |
CN104239475A (en) | Method and device for analyzing time series data | |
CN109189672A (en) | Automatic test approach, server and the computer readable storage medium of micro services | |
CN105607957B (en) | A kind of data acquisition analysis system based on OPC DA | |
JP5605370B2 (en) | System model management support system, system model management support method and program | |
JP6157375B2 (en) | Operation procedure flow update device, method and program | |
CN113641523A (en) | Log processing method and device | |
EP3591481A1 (en) | Device configuration management apparatus, system, and program | |
CN103902905B (en) | Malicious code generator identification method and system based on software structure cluster |
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 |