Nothing Special   »   [go: up one dir, main page]

CN111190575A - Method, system, medium and device for constructing interface - Google Patents

Method, system, medium and device for constructing interface Download PDF

Info

Publication number
CN111190575A
CN111190575A CN201911245599.4A CN201911245599A CN111190575A CN 111190575 A CN111190575 A CN 111190575A CN 201911245599 A CN201911245599 A CN 201911245599A CN 111190575 A CN111190575 A CN 111190575A
Authority
CN
China
Prior art keywords
request
interface
definition specification
constructing
comparing
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
CN201911245599.4A
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.)
Beijing Haizhi Xingtu Technology Co ltd
Original Assignee
Beijing Haizhi Xingtu 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 Beijing Haizhi Xingtu Technology Co ltd filed Critical Beijing Haizhi Xingtu Technology Co ltd
Priority to CN201911245599.4A priority Critical patent/CN111190575A/en
Publication of CN111190575A publication Critical patent/CN111190575A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to a method, a system, a medium and a device for constructing an interface, wherein the method comprises the following steps: defining a route for sending a request to construct an interface; when a request is received through the route, analyzing a request method and request parameters in the request; comparing the request method and the request parameter obtained by analysis with the request method and the request parameter in the interface definition specification respectively, and entering the next step if all the item comparisons are consistent; an interface is constructed according to the interface definition specification. Under the condition of known interface definition, the method can quickly construct the required interface, avoid upstream and downstream work waiting and improve the work efficiency.

Description

Method, system, medium and device for constructing interface
Technical Field
The invention relates to the field of software development, in particular to a method, a system, a medium and equipment for constructing an interface.
Background
In the software development process, functions are sometimes called interfaces of a third party, if the interfaces of the third party are not provided in time, in order to avoid progress delay, developers or testers are required to construct interface data according to the specification defined by the interfaces, and common methods include mock. Although the method can meet the requirements and solve the problems, the method is complex in implementation and service deployment, and for testers unfamiliar with js, the working difficulty is improved and the working efficiency is reduced.
Disclosure of Invention
In view of the above technical problems, the present invention provides a method, system, medium, and apparatus for constructing an interface.
The technical scheme for solving the technical problems is as follows: a method of constructing an interface, comprising:
defining a route for sending a request to construct an interface;
when a request is received through the route, analyzing a request method and request parameters in the request;
comparing the request method and the request parameter obtained by analysis with the request method and the request parameter in the interface definition specification respectively, and entering the next step if all the item comparisons are consistent;
an interface is constructed according to the interface definition specification.
The invention has the beneficial effects that: under the condition of known interface definition, the required interface can be quickly constructed, upstream and downstream work waiting is avoided, and the work efficiency is improved.
On the basis of the technical scheme, the invention can be further improved as follows.
Further, comparing the request method and the request parameter obtained by analyzing with the request method and the request parameter in the interface definition specification respectively includes:
comparing the request method obtained by analysis with the request method in the interface definition specification, and entering the next step if the comparison is consistent;
and comparing the number and the type of the request parameters obtained by analysis with the number and the type of the request parameters in the interface definition specification respectively.
Further, still include:
and returning corresponding error prompts for the items with inconsistent comparison.
Further, the constructing an interface according to the interface definition specification specifically includes:
and according to the interface definition specification, building a data format returned by the interface, and filling required data according to the user requirement to complete interface construction.
To achieve the above object, the present invention further provides a system for constructing an interface, comprising:
a definition module for defining a route for sending a request to construct an interface;
the analysis module is used for analyzing the request method and the request parameters in the request when the request is received through the route;
the comparison module is used for comparing the request method and the request parameter obtained by analysis with the request method and the request parameter in the interface definition specification respectively;
and the construction module is used for constructing an interface according to the interface definition specification if all the item contrasts of the comparison module are consistent.
Further, the comparison module specifically includes:
the first comparison unit is used for comparing the request method obtained by analysis with the request method in the interface definition specification;
and the second comparison unit is used for comparing the number and the type of the request parameters obtained by analysis with the number and the type of the request parameters in the interface definition specification respectively if the comparison of the first comparison unit is consistent.
Further, still include:
and the prompt module is used for returning corresponding error prompts aiming at the inconsistent items compared by the comparison module.
Further, the construction module is specifically configured to:
and according to the interface definition specification, building a data format returned by the interface, and filling required data according to the user requirement to complete interface construction.
The present invention also provides a computer-readable storage medium comprising instructions which, when run on a computer, cause the computer to perform the above-described method.
The invention also provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method when executing the program.
Drawings
FIG. 1 is a flow chart of a method for constructing an interface according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for constructing an interface according to an embodiment of the present invention;
FIG. 3 is a block diagram of a system for constructing an interface according to an embodiment of the present invention;
fig. 4 is a block diagram of another system for constructing an interface according to an embodiment of the present invention.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
Fig. 1 is a flowchart of a method for constructing an interface according to an embodiment of the present invention, as shown in fig. 1, the method includes:
s1, defining a route for sending a request for constructing an interface;
specifically, before step S1, it is first required to perform environment building, specifically: python and flash are installed, and the environment is deployed locally. If the interface is convenient to call, the environment can also be directly deployed on the server, but it is inconvenient to modify the code when the environment is deployed on the server, so that in the embodiment, the environment is directly deployed on the local computer.
After the environment deployment is completed, the interface route, that is, the access route and the request method of the interface can be defined, which is exemplified as follows: route ('/api/get _ data', methods [ 'POST' ]), with the above example code, the route of the request is defined as/api/get _ data, and the request method is POST.
S2, when a request is received through the route, analyzing the request method and request parameters in the request;
s3, comparing the request method and the request parameter obtained by analysis with the request method and the request parameter in the interface definition specification respectively, and entering the next step if all the item comparisons are consistent;
specifically, in the step, whether the request is legal or not is confirmed by comparing the request method with the request parameter, and if all the items of the request method and the request parameter are consistent in comparison, the request is legal, that is, the next process for constructing the interface data can be called.
And S4, constructing an interface according to the interface definition specification.
The method for constructing the interface provided by the embodiment of the invention can quickly construct the required interface under the condition of known interface definition, avoid the waiting of upstream and downstream work and improve the working efficiency.
Optionally, in this embodiment, step S3 specifically includes:
s3.1, comparing the request method obtained by analysis with the request method in the interface definition specification, and entering the next step if the comparison is consistent;
and S3.2, comparing the number and the type of the request parameters obtained by analysis with the number and the type of the request parameters in the interface definition specification respectively.
Optionally, as an embodiment of the present invention, the method further includes:
and S5, returning corresponding error prompts for the items with inconsistent contrast.
Specifically, when there is an item with a mismatch in comparison in step S3, the process skips to step S5, where a response is returned to the request path method, the number of parameters, the format of parameters, and other errors.
Optionally, in this embodiment, step S4 specifically includes:
and according to the interface definition specification, building a data format returned by the interface, and filling required data according to the user requirement to complete interface construction.
Fig. 3 is a block diagram of a system for constructing an interface according to an embodiment of the present invention, and as shown in fig. 3, the system includes:
a definition module for defining a route for sending a request to construct an interface;
the analysis module is used for analyzing the request method and the request parameters in the request when the request is received through the route;
the comparison module is used for comparing the request method and the request parameter obtained by analysis with the request method and the request parameter in the interface definition specification respectively;
and the construction module is used for constructing an interface according to the interface definition specification if all the item contrasts of the comparison module are consistent.
Optionally, in this embodiment, the comparison module specifically includes:
the first comparison unit is used for comparing the request method obtained by analysis with the request method in the interface definition specification;
and the second comparison unit is used for comparing the number and the type of the request parameters obtained by analysis with the number and the type of the request parameters in the interface definition specification respectively if the comparison of the first comparison unit is consistent.
Optionally, as an embodiment of the present invention, as shown in fig. 4, the system further includes:
and the prompt module is used for returning corresponding error prompts aiming at the inconsistent items compared by the comparison module.
Optionally, in this embodiment, the configuration module is specifically configured to:
and according to the interface definition specification, building a data format returned by the interface, and filling required data according to the user requirement to complete interface construction.
An embodiment of the present invention further provides a computer-readable storage medium, including instructions, which, when executed on a computer, cause the computer to perform the method steps in the above method embodiment; or storing the instructions corresponding to the software modules of the system embodiments.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and when the processor executes the computer program, the method steps in the above method embodiments are implemented.
The reader should understand that in the description of this specification, reference to the description of the terms "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the modules and units in the above described system embodiment may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment of the present invention.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention essentially or partially contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A method of constructing an interface, comprising:
defining a route for sending a request to construct an interface;
when a request is received through the route, analyzing a request method and request parameters in the request;
comparing the request method and the request parameter obtained by analysis with the request method and the request parameter in the interface definition specification respectively, and entering the next step if all the item comparisons are consistent;
an interface is constructed according to the interface definition specification.
2. The method according to claim 1, wherein comparing the request method and the request parameter obtained by parsing with the request method and the request parameter in the interface definition specification respectively includes:
comparing the request method obtained by analysis with the request method in the interface definition specification, and entering the next step if the comparison is consistent;
and comparing the number and the type of the request parameters obtained by analysis with the number and the type of the request parameters in the interface definition specification respectively.
3. The method of claim 1, further comprising:
and returning corresponding error prompts for the items with inconsistent comparison.
4. The method according to claims 1 to 3, wherein constructing an interface according to the interface definition specification specifically comprises:
and according to the interface definition specification, building a data format returned by the interface, and filling required data according to the user requirement to complete interface construction.
5. A system for constructing an interface, comprising:
a definition module for defining a route for sending a request to construct an interface;
the analysis module is used for analyzing the request method and the request parameters in the request when the request is received through the route;
the comparison module is used for comparing the request method and the request parameter obtained by analysis with the request method and the request parameter in the interface definition specification respectively;
and the construction module is used for constructing an interface according to the interface definition specification if all the item contrasts of the comparison module are consistent.
6. The system for constructing an interface of claim 5, wherein the comparison module specifically comprises:
the first comparison unit is used for comparing the request method obtained by analysis with the request method in the interface definition specification;
and the second comparison unit is used for comparing the number and the type of the request parameters obtained by analysis with the number and the type of the request parameters in the interface definition specification respectively if the comparison of the first comparison unit is consistent.
7. The system of claim 5, further comprising:
and the prompt module is used for returning corresponding error prompts aiming at the inconsistent items compared by the comparison module.
8. System for constructing an interface according to claims 5 to 7, characterized in that said construction module is particularly adapted to:
and according to the interface definition specification, building a data format returned by the interface, and filling required data according to the user requirement to complete interface construction.
9. A computer-readable storage medium comprising instructions that, when executed on a computer, cause the computer to perform the method of any of claims 1-4.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-4 when executing the program.
CN201911245599.4A 2019-12-07 2019-12-07 Method, system, medium and device for constructing interface Pending CN111190575A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911245599.4A CN111190575A (en) 2019-12-07 2019-12-07 Method, system, medium and device for constructing interface

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911245599.4A CN111190575A (en) 2019-12-07 2019-12-07 Method, system, medium and device for constructing interface

Publications (1)

Publication Number Publication Date
CN111190575A true CN111190575A (en) 2020-05-22

Family

ID=70710896

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911245599.4A Pending CN111190575A (en) 2019-12-07 2019-12-07 Method, system, medium and device for constructing interface

Country Status (1)

Country Link
CN (1) CN111190575A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231894A (en) * 2020-09-18 2021-01-15 厦门大学 Visual analysis method and system for temperature field in blast furnace

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2342579A1 (en) * 2000-03-31 2001-09-30 International Business Machines Corporation Methods and systems for scheduling work
CN103809979A (en) * 2014-02-25 2014-05-21 南京南瑞继保电气有限公司 Man-machine interaction software module integration system and implementing method thereof
CN107547944A (en) * 2016-06-27 2018-01-05 中兴通讯股份有限公司 Interface realizing method and device, set top box
WO2018200135A1 (en) * 2017-04-25 2018-11-01 Intento, Inc. Intent-based organisation of apis
JP2019160105A (en) * 2018-03-16 2019-09-19 富士通株式会社 Interface conversion program, interface conversion method, and information processing device
CN110427331A (en) * 2019-09-03 2019-11-08 四川长虹电器股份有限公司 The method for automatically generating performance test script based on interface testing tool

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2342579A1 (en) * 2000-03-31 2001-09-30 International Business Machines Corporation Methods and systems for scheduling work
CN103809979A (en) * 2014-02-25 2014-05-21 南京南瑞继保电气有限公司 Man-machine interaction software module integration system and implementing method thereof
CN107547944A (en) * 2016-06-27 2018-01-05 中兴通讯股份有限公司 Interface realizing method and device, set top box
WO2018200135A1 (en) * 2017-04-25 2018-11-01 Intento, Inc. Intent-based organisation of apis
JP2019160105A (en) * 2018-03-16 2019-09-19 富士通株式会社 Interface conversion program, interface conversion method, and information processing device
CN110427331A (en) * 2019-09-03 2019-11-08 四川长虹电器股份有限公司 The method for automatically generating performance test script based on interface testing tool

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴定刚;董晓明;: "基于SOA的舰载作战系统仿真应用研究" *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112231894A (en) * 2020-09-18 2021-01-15 厦门大学 Visual analysis method and system for temperature field in blast furnace

Similar Documents

Publication Publication Date Title
CN108459964B (en) Test case selection method, device, equipment and computer readable storage medium
EP3249538A1 (en) Function execution prioritization
CN110096395A (en) Interface joint debugging test method, device, computer equipment and storage medium
CN114048701A (en) Netlist ECO method, device, equipment and readable storage medium
CN108197024B (en) Embedded browser debugging method, debugging terminal and computer readable storage medium
CN110569194A (en) interface testing method and device, electronic equipment and storage medium
CN110795331A (en) Software testing method and device
CN113448862A (en) Software version testing method and device and computer equipment
CN106648761B (en) The method and device automatically updated in QT program
CN111240981A (en) Interface testing method, system and platform
CN111190575A (en) Method, system, medium and device for constructing interface
CN115617780A (en) Data import method, device, equipment and storage medium
CN115599359A (en) Code generation method, device, equipment and medium
CN106528066B (en) Business process operation method and device
CN110888800A (en) Service interaction function test method, device, storage medium and test system
CN114461465A (en) Micro-service test method, system and related device for hybrid CPU (Central processing Unit) architecture equipment
CN110058849A (en) Generation method, device, computer equipment and the storage medium of flow chart
CN111367936B (en) Offline verification method and device for structured query language grammar
CN117667884A (en) Data migration method, device, equipment and storage medium
CN109284268A (en) A kind of method, system and the electronic equipment of fast resolving log
CN115757172A (en) Test execution method and device, storage medium and computer equipment
US20220171785A1 (en) Systems and methods of automating data processing and movement
CN113778460A (en) Production environment deployment method and device
CN109150951B (en) Method and device for starting Activity of Android system
CN112068814A (en) Method, device, system and medium for generating executable file

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
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200522