Movatterモバイル変換


[0]ホーム

URL:


CN110688315A - Interface code detection report generation method, electronic device, and storage medium - Google Patents

Interface code detection report generation method, electronic device, and storage medium
Download PDF

Info

Publication number
CN110688315A
CN110688315ACN201910919307.4ACN201910919307ACN110688315ACN 110688315 ACN110688315 ACN 110688315ACN 201910919307 ACN201910919307 ACN 201910919307ACN 110688315 ACN110688315 ACN 110688315A
Authority
CN
China
Prior art keywords
interface
codes
detection report
code
preset
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
CN201910919307.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.)
China Merchants Finance Technology Co Ltd
Original Assignee
China Merchants Finance 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 China Merchants Finance Technology Co LtdfiledCriticalChina Merchants Finance Technology Co Ltd
Priority to CN201910919307.4ApriorityCriticalpatent/CN110688315A/en
Publication of CN110688315ApublicationCriticalpatent/CN110688315A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

The invention relates to a data processing technology and provides an interface code detection report generation method, an electronic device and a storage medium. The method comprises the steps of receiving a request for generating an interface code detection report sent by a user, wherein the request comprises a first group of interface codes and a second group of interface codes to be detected, analyzing the first group of interface codes and the second group of interface codes by using a preset code analyzer, respectively extracting code blocks corresponding to the two groups of interface codes, converting the code blocks into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, comparing and analyzing the attribute information of the two groups of interface codes to obtain difference parameters and same parameters of the two groups of interface codes, filling the difference parameters and the same parameters into a predetermined template file, generating the interface code detection report, and sending the interface code detection report to the user. The invention can improve the accuracy of detecting the difference between the interface development and the interface pre-design.

Description

Interface code detection report generation method, electronic device, and storage medium
Technical Field
The present invention relates to the field of data processing, and in particular, to a method for generating an interface code detection report, an electronic device, and a storage medium.
Background
In an Application Programming Interface (API) testing process, situations such as data migration, code reconfiguration, frequent iteration and the like are often encountered, and in these situations, a developer is required to analyze whether a developed API is consistent with a pre-designed API. However, the analysis of whether the developed API is consistent with the pre-designed API under the above-mentioned circumstances is usually to manually detect the difference between the developed API and the pre-designed API and to record the detected difference result, but the detection method based on human is inefficient and has low accuracy.
Disclosure of Invention
In view of the above, the present invention provides an interface code detection report generation method, an electronic device, and a storage medium, and aims to improve the accuracy of detecting a difference between interface development and interface pre-design.
In order to achieve the above object, the present invention provides a method for generating an interface code detection report, including:
a receiving step: receiving a request for generating an interface code detection report sent by a user, wherein the request comprises a first group of interface codes and a second group of interface codes to be detected;
an identification step: analyzing the first group of interface codes and the second group of interface codes by using a preset code analyzer, and respectively extracting preset type code blocks corresponding to the two groups of interface codes;
a conversion step: converting the preset type code block into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, and comparing and analyzing the attribute information of the two groups of interface codes to obtain difference parameters and same parameters of the two groups of interface codes; and
a generation step: and filling the difference parameters and the same parameters into a predetermined template file to generate an interface code detection report, and sending the interface code detection report to the user so that the user can display the interface code detection report.
Preferably, the attribute information of the interface code includes:
the name of the interface, the path of the interface, the uniform resource locator of the interface, the input parameter of the interface, the request mode of the interface and the output parameter of the interface.
Preferably, the preset conversion rule includes:
identifying the annotation line of the preset type code block to obtain the interface type and the interface path of the code block, and identifying the interface function of the preset type code block to obtain the interface name, the input parameters of the interface and the output parameters of the interface of the code block;
preferably, the converting step further comprises:
and converting the preset type code block into interface data in a JSON format by using a preset JSON parser, and storing the interface data into a preset database.
Preferably, the generating step comprises:
filling the same parameters of the two groups of interface codes to a first preset position in a predetermined template file;
and filling the difference parameters of the two groups of interface codes to a second preset position in a predetermined template file.
To achieve the above object, the present invention also provides an electronic device, including: the memory and the processor are characterized in that an interface code detection report generation program is stored on the memory, and the interface code detection report generation program is executed by the processor to realize the following steps:
a receiving step: receiving a request for generating an interface code detection report sent by a user, wherein the request comprises a first group of interface codes and a second group of interface codes to be detected;
an identification step: analyzing the first group of interface codes and the second group of interface codes by using a preset code analyzer, and respectively extracting preset type code blocks corresponding to the two groups of interface codes;
a conversion step: converting the preset type code block into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, and comparing and analyzing the attribute information of the two groups of interface codes to obtain difference parameters and same parameters of the two groups of interface codes; and
a generation step: and filling the difference parameters and the same parameters into a predetermined template file to generate an interface code detection report, and sending the interface code detection report to the user so that the user can display the interface code detection report.
Preferably, the preset conversion rule includes:
and identifying the annotation line of the preset type code block to obtain the interface type and the interface path of the code block, and identifying the interface function of the preset type code block to obtain the interface name, the input parameters of the interface and the output parameters of the interface of the code block.
Preferably, the converting step further comprises:
and converting the preset type code block into interface data in a JSON format by using a preset JSON parser, and storing the interface data into a preset database.
Preferably, the generating step comprises:
filling the same parameters of the two groups of interface codes to a first preset position in a predetermined template file;
and filling the difference parameters of the two groups of interface codes to a second preset position in a predetermined template file.
To achieve the above object, the present invention further provides a computer-readable storage medium, which includes an interface code detection report generation program, and when the interface code detection report generation program is executed by a processor, the computer-readable storage medium implements any step of the interface code detection report generation method as described above.
The interface code detection report generation method, the electronic device and the storage medium provided by the invention have the advantages that the request for generating the interface code detection report sent by a user is received, the request comprises a first group of interface codes and a second group of interface codes to be detected, the first group of interface codes and the second group of interface codes are analyzed by using a preset code analyzer, code blocks corresponding to the two groups of interface codes are respectively extracted, the code blocks are converted into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, the attribute information of the two groups of interface codes is compared and analyzed to obtain difference parameters and same parameters of the two groups of interface codes, the difference parameters and the same parameters are filled into a predetermined template file to generate the interface code detection report, and the interface code detection report is sent to the user. The invention can detect whether the development of the interface is consistent with the pre-design of the interface when the code reconstruction, the data migration and the frequent iteration occur to the interface, thereby improving the accuracy of detecting the difference between the development and the design of the interface and providing an intuitive and visible method for the interface management.
Drawings
FIG. 1 is a diagram of an electronic device according to a preferred embodiment of the present invention;
FIG. 2 is a block diagram of a preferred embodiment of the interface code detection report generation process of FIG. 1;
FIG. 3 is a flow chart of a preferred embodiment of a method for generating an interface code detection report according to the present invention;
the implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a schematic diagram of an electronic device 1 according to a preferred embodiment of the invention is shown.
The electronic device 1 includes but is not limited to: memory 11, processor 12, display 13, and network interface 14. The electronic device 1 is connected to a network through a network interface 14 to obtain raw data. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System for mobile communications (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), Wi-Fi, or a communication network.
The memory 11 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 11 may be an internal storage unit of the electronic device 1, such as a hard disk or a memory of the electronic device 1. In other embodiments, the memory 11 may also be an external storage device of the electronic apparatus 1, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided in the electronic apparatus 1. Of course, the memory 11 may also comprise both an internal memory unit of the electronic apparatus 1 and an external memory device thereof. In this embodiment, the memory 11 is generally used for storing an operating system installed in the electronic device 1 and various types of application software, such as a program code of the interface code detection report generation program 10. Further, the memory 11 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 12 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 12 is generally used for controlling the overall operation of the electronic device 1, such as performing data interaction or communication related control and processing. In this embodiment, the processor 12 is configured to run the program code or the processing data stored in the memory 11, for example, the program code of the interface code detection report generation program 10.
The display 13 may be referred to as a display screen or display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-emitting diode (OLED) touch screen, or the like. The display 13 is used for displaying information processed in the electronic device 1 and for displaying a visual work interface, for example, results of data statistics.
The network interface 14 may optionally comprise a standard wired interface, a wireless interface (e.g. WI-FI interface), the network interface 14 typically being used for establishing a communication connection between the electronic apparatus 1 and other electronic devices.
Fig. 2 shows only the electronic device 1 with the components 11-14 and the interface code detection report generation program 10, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
Optionally, the electronic device 1 may further comprise a user interface, the user interface may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface may further comprise a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an Organic Light-Emitting Diode (OLED) touch screen, or the like. The display, which may also be referred to as a display screen or display unit, is suitable for displaying information processed in the electronic apparatus 1 and for displaying a visualized user interface.
The electronic device 1 may further include a Radio Frequency (RF) circuit, a sensor, an audio circuit, and the like, which are not described in detail herein.
In the above embodiment, the processor 12, when executing the interface code detection report generation program 10 stored in the memory 11, may implement the following steps:
a receiving step: receiving a request for generating an interface code detection report sent by a user, wherein the request comprises a first group of interface codes and a second group of interface codes to be detected;
an identification step: analyzing the first group of interface codes and the second group of interface codes by using a preset code analyzer, and respectively extracting preset type code blocks corresponding to the two groups of interface codes;
a conversion step: converting the preset type code block into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, and comparing and analyzing the attribute information of the two groups of interface codes to obtain difference parameters and same parameters of the two groups of interface codes; and
a generation step: and filling the difference parameters and the same parameters into a predetermined template file to generate an interface code detection report, and sending the interface code detection report to the user so that the user can display the interface code detection report.
The storage device may be the memory 11 of the electronic apparatus 1, or may be another storage device communicatively connected to the electronic apparatus 1.
For detailed description of the above steps, please refer to the following description of fig. 2 regarding a program module diagram of an embodiment of the interface code detection report generation program 10 and fig. 3 regarding a flowchart of an embodiment of an interface code detection report generation method.
In other embodiments, the interface code detection report generating program 10 may be divided into a plurality of modules, which are stored in the memory 12 and executed by the processor 13 to accomplish the present invention. The modules referred to herein are referred to as a series of computer program instruction segments capable of performing specified functions.
Referring to fig. 2, a block diagram of an embodiment of the interface code detection report generation program 10 in fig. 1 is shown. In this embodiment, the interface code detection report generation program 10 may be divided into: a receiving module 110, an identifying module 120, a converting module 130 and a generating module 140.
The receiving module 110 is configured to receive a request for generating an interface code detection report, where the request includes a first group of interface codes to be detected and a second group of interface codes to be detected.
In this embodiment, the first set of codes may be interface codes actually developed, and the second set of codes may be interface codes designed before development. The request may include two interface code files to be detected, and may also include a storage path and an identifier associated with the interface code files to be detected. That is, the related attribute information of the interface code file to be detected may be entered by the user at the time of submitting the request, or may be acquired from an address specified in the request after the user submits the request for generating the interface code detection report. The method for acquiring the interface code to be detected can also provide a user interaction interface for a user to enter a code file.
The identifying module 120 is configured to analyze the first group of interface codes and the second group of interface codes by using a preset code analyzer, and extract preset type code blocks corresponding to the two groups of interface codes respectively.
In this embodiment, in order to accelerate analysis of parameter differences between two sets of interface codes, a code analyzer is used to identify annotation keywords of a code file, and multiple code blocks of the interface codes are extracted. The code analyzer reads a code file, and extracts code blocks containing "@ RequestMapping", "@ GetMapping", "@ PostMapping", "@ PutMapping", "@ deleteMapping".
For example: when the analyzer analyzes a certain interface code, the following code blocks are extracted:
Figure BDA0002217061330000071
the index is created according to the preset keywords through the code analyzer, and the full text searching capability of the interface code is achieved, so that when the interface code is analyzed, the whole interface code is not directly analyzed, the index is inquired based on the whole interface code to extract the code block of the preset type, other irrelevant codes are removed, the code block of the preset type is contrastively analyzed, and the efficiency of contrastive analysis can be improved.
The conversion module 130 is configured to convert the preset type code block into attribute information corresponding to two sets of interface codes by using a preset conversion rule, and compare and analyze the attribute information of the two sets of interface codes to obtain a difference parameter and a same parameter of the two sets of interface codes.
In this embodiment, code blocks corresponding to two sets of interface codes are obtained, and the code blocks are analyzed to analyze attribute information of the interfaces. The attribute information of the interface includes, but is not limited to, a name of the interface, a path of the interface, a uniform resource locator of the interface, an input parameter of the interface, a request mode of the interface, an output parameter of the interface, and the like. The interface data is used for describing attribute information of the interface, and the interface data is data in a preset format, and the preset format can be set according to actual requirements, and is not limited here. For example, the preset format may be a JavaScript Object Notation (JSON) format, which is a lightweight text data interchange format that uses a JavaScript syntax to describe data objects.
When writing interface code, developer can make corresponding annotation to interface code, and provide basis for generating corresponding report or document according to annotated interface code. Annotating the interface code specifically includes annotating and interpreting attribute information of the interface, and it can be understood that a developer can annotate the interface code according to a preset annotation mode in the interface development process. The preset annotation manner may be set according to actual requirements, and is not limited herein. For example, the preset annotation mode may be a third-party annotation tool, or the preset annotation mode may be an annotation mode customized by a developer.
The code block is composed of annotation lines and interface functions, and the preset conversion rule comprises: the annotation line for identifying the code block acquires the interface type and the interface path of the code block, and the interface function for identifying the code block acquires the interface name, the input parameters of the interface and the output parameters of the interface of the code block.
The first part of the code block is an annotation line which in the developed interface code block starts with the character "@" and the interface is defined by the annotation. From the annotation line, the interface type and interface path of the defined interface data may be retrieved. For example, the code block @ GetMapping ("XXX") has an interface type of "GET" and an interface path of "XXX".
The second part of the code block is an interface function, and the interface function comprises input parameters, names, output parameters and the like of interface data.
The input parameters of the interface function are the in field array of the interface data.
The name of the interface function is the name field of the interface data.
The output parameter of the interface function is the type field of the interface data out.
For example: some interface function code is obtained as follows:
public String getUserById (@ PathVariable Integer id), then it can identify
The name field of the interface data is: getUserById
The in field array of the interface data is [ { name: "id", type: "Integer", pathType: "var" } ]
The type field of the interface data out is: string
Comparing and analyzing the attribute information of the two groups of interface codes to obtain the difference parameters and the same parameters of the two groups of interface codes.
Further, the code blocks can be converted into corresponding interface data in the JSON format by using a preset JSON parser, and the interface data corresponding to the two groups of interfaces is stored in a preset database. After receiving a request for generating an interface code detection report, interface data corresponding to the interface may be acquired from a preset database, and the interface data may be analyzed to analyze attribute information of the interface. Specifically, the interface data is analyzed according to an analysis method corresponding to the format of the interface data. For example, if the interface data is data in JSON format, the JSON parser may be used to parse the interface data, and the attribute information of the interface may be obtained after parsing the interface data.
The generating module 140 is configured to fill the difference parameter and the same parameter into a predetermined template file, generate an interface code detection report, and send the interface code detection report to the user, so that the user can display the interface code detection report.
In this embodiment, the predetermined template file may be set according to actual requirements, and is not limited herein. For example, the predetermined template file may be an EXCEL document, in which interface attribute information addition frames such as an interface name, an interface path, an interface type, an interface request method, an interface input parameter, and an interface output parameter are set, and the attribute information of two sets of interface data is respectively added to the addition frames set in the EXCEL document, so as to generate a detection report of the interface code.
Further, if the parameters of the attribute information of the two sets of interface codes are completely the same, it indicates that the two sets of interfaces designed and actually developed are the same, and if any one of the parameters of the attribute information in the two sets of interface codes is different, it indicates that the interfaces have been changed, the same parameters of the two sets of interface codes are filled into a first preset position in a predetermined template file, and the difference parameters of the two sets of interface codes are filled into a second preset position in the predetermined template file, so that the interface developers can conveniently refer to the difference parameters.
In addition, the invention also provides a method for generating the interface code detection report. Fig. 3 is a schematic method flow diagram illustrating an embodiment of a method for generating an interface code detection report according to the present invention. The processor 12 of the electronic apparatus 1 realizes the following steps of the interface code detection report generation method when executing the interface code detection report generation program 10 stored in the memory 11:
step S10: receiving a request for generating an interface code detection report sent by a user, wherein the request comprises a first group of interface codes and a second group of interface codes to be detected.
In this embodiment, the first set of codes may be interface codes actually developed, and the second set of codes may be interface codes designed before development. The request may include two interface code files to be detected, and may also include a storage path and an identifier associated with the interface code files to be detected. That is, the related attribute information of the interface code file to be detected may be entered by the user at the time of submitting the request, or may be acquired from an address specified in the request after the user submits the request for generating the interface code detection report. The method for acquiring the interface code to be detected can also provide a user interaction interface for a user to enter a code file.
Step S20: and analyzing the first group of interface codes and the second group of interface codes by using a preset code analyzer, and respectively extracting preset type code blocks corresponding to the two groups of interface codes.
In this embodiment, in order to accelerate analysis of parameter differences between two sets of interface codes, a code analyzer is used to identify annotation keywords of a code file, and multiple code blocks of the interface codes are extracted. The code analyzer reads a code file, and extracts code blocks containing "@ RequestMapping", "@ GetMapping", "@ PostMapping", "@ PutMapping", "@ deleteMapping".
For example: when the analyzer analyzes a certain interface code, the following code blocks are extracted:
Figure BDA0002217061330000101
the index is created according to the preset keywords through the code analyzer, and the full text searching capability of the interface code is achieved, so that when the interface code is analyzed, the whole interface code is not directly analyzed, the index is inquired based on the whole interface code to extract the code block of the preset type, other irrelevant codes are removed, the code block of the preset type is contrastively analyzed, and the efficiency of contrastive analysis can be improved.
Step S30: and converting the preset type code block into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, and comparing and analyzing the attribute information of the two groups of interface codes to obtain the difference parameters and the same parameters of the two groups of interface codes.
In this embodiment, code blocks corresponding to two sets of interface codes are obtained, and the code blocks are analyzed to analyze attribute information of the interfaces. The attribute information of the interface includes, but is not limited to, a name of the interface, a path of the interface, a uniform resource locator of the interface, an input parameter of the interface, a request mode of the interface, an output parameter of the interface, and the like. The interface data is used for describing attribute information of the interface, and the interface data is data in a preset format, and the preset format can be set according to actual requirements, and is not limited here. For example, the preset format may be a JavaScript Object Notation (JSON) format, which is a lightweight text data interchange format that uses a JavaScript syntax to describe data objects.
When writing interface code, developer can make corresponding annotation to interface code, and provide basis for generating corresponding report or document according to annotated interface code. Annotating the interface code specifically includes annotating and interpreting attribute information of the interface, and it can be understood that a developer can annotate the interface code according to a preset annotation mode in the interface development process. The preset annotation manner may be set according to actual requirements, and is not limited herein. For example, the preset annotation mode may be a third-party annotation tool, or the preset annotation mode may be an annotation mode customized by a developer.
The code block is composed of annotation lines and interface functions, and the preset conversion rule comprises: the annotation line for identifying the code block acquires the interface type and the interface path of the code block, and the interface function for identifying the code block acquires the interface name, the input parameters of the interface and the output parameters of the interface of the code block.
The first part of the code block is an annotation line which in the developed interface code block starts with the character "@" and the interface is defined by the annotation. From the annotation line, the interface type and interface path of the defined interface data may be retrieved. For example, the code block @ GetMapping ("XXX") has an interface type of "GET" and an interface path of "XXX".
The second part of the code block is an interface function, and the interface function comprises input parameters, names, output parameters and the like of interface data.
The input parameters of the interface function are the in field array of the interface data.
The name of the interface function is the name field of the interface data.
The output parameter of the interface function is the type field of the interface data out.
For example: some interface function code is obtained as follows:
public String getUserById (@ PathVariable Integer id), then it can identify
The name field of the interface data is: getUserById
The in field array of the interface data is [ { name: "id", type: "Integer", pathType: "var" } ]
The type field of the interface data out is: string
Comparing and analyzing the attribute information of the two groups of interface codes to obtain the difference parameters and the same parameters of the two groups of interface codes.
Further, the code blocks can be converted into corresponding interface data in the JSON format by using a preset JSON parser, and the interface data corresponding to the two groups of interfaces is stored in a preset database. After receiving a request for generating an interface code detection report, interface data corresponding to the interface may be acquired from a preset database, and the interface data may be analyzed to analyze attribute information of the interface. Specifically, the interface data is analyzed according to an analysis method corresponding to the format of the interface data. For example, if the interface data is data in JSON format, the JSON parser may be used to parse the interface data, and the attribute information of the interface may be obtained after parsing the interface data.
Step S40: and filling the difference parameters and the same parameters into a predetermined template file to generate an interface code detection report, and sending the interface code detection report to the user so that the user can display the interface code detection report.
In this embodiment, the predetermined template file may be set according to actual requirements, and is not limited herein. For example, the predetermined template file may be an EXCEL document, in which interface attribute information addition frames such as an interface name, an interface path, an interface type, an interface request method, an interface input parameter, and an interface output parameter are set, and the attribute information of two sets of interface data is respectively added to the addition frames set in the EXCEL document, so as to generate a detection report of the interface code.
Further, if the parameters of the attribute information of the two sets of interface codes are completely the same, it indicates that the two sets of interfaces designed and actually developed are the same, and if any one of the parameters of the attribute information of the two sets of interface codes is different, it indicates that the interfaces have been changed, the same parameters of the two sets of interface codes are filled into a first preset position in a predetermined template file, and the difference parameters of the two sets of interface codes are filled into a second preset position in the predetermined template file, so that the interface developers can conveniently refer to the difference parameters.
Furthermore, the embodiment of the present invention also provides a computer-readable storage medium, which may be any one or any combination of a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a Read Only Memory (ROM), an Erasable Programmable Read Only Memory (EPROM), a portable compact disc read only memory (CD-ROM), a USB memory, and the like. The computer readable storage medium includes therein an interface code detection report generation program 10, and when executed by a processor, the interface code detection report generation program 10 implements the following operations:
a receiving step: receiving a request for generating an interface code detection report sent by a user, wherein the request comprises a first group of interface codes and a second group of interface codes to be detected;
an identification step: analyzing the first group of interface codes and the second group of interface codes by using a preset code analyzer, and respectively extracting preset type code blocks corresponding to the two groups of interface codes;
a conversion step: converting the preset type code block into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, and comparing and analyzing the attribute information of the two groups of interface codes to obtain difference parameters and same parameters of the two groups of interface codes; and
a generation step: and filling the difference parameters and the same parameters into a predetermined template file to generate an interface code detection report, and sending the interface code detection report to the user so that the user can display the interface code detection report.
The specific implementation of the computer-readable storage medium of the present invention is substantially the same as the specific implementation of the interface code detection report generation method, and is not described herein again.
It should be noted that the above-mentioned numbers of the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention essentially or contributing to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) as described above and includes several instructions for enabling a terminal device (such as a mobile phone, a computer, an electronic device, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An interface code detection report generation method applied to an electronic device, the method comprising:
a receiving step: receiving a request for generating an interface code detection report sent by a user, wherein the request comprises a first group of interface codes and a second group of interface codes to be detected;
an identification step: analyzing the first group of interface codes and the second group of interface codes by using a preset code analyzer, and respectively extracting preset type code blocks corresponding to the two groups of interface codes;
a conversion step: converting the preset type code block into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, and comparing and analyzing the attribute information of the two groups of interface codes to obtain difference parameters and same parameters of the two groups of interface codes; and
a generation step: and filling the difference parameters and the same parameters into a predetermined template file to generate an interface code detection report, and sending the interface code detection report to the user so that the user can display the interface code detection report.
2. The interface code detection report generation method of claim 1, wherein the attribute information of the interface code includes:
the name of the interface, the path of the interface, the uniform resource locator of the interface, the input parameter of the interface, the request mode of the interface and the output parameter of the interface.
3. The interface code detection report generation method of claim 1, wherein the preset conversion rule includes:
and identifying the annotation line of the preset type code block to obtain the interface type and the interface path of the code block, and identifying the interface function of the preset type code block to obtain the interface name, the input parameters of the interface and the output parameters of the interface of the code block.
4. The interface code detection report generation method of claim 1, wherein said converting step further comprises:
and converting the preset type code block into interface data in a JSON format by using a preset JSON parser, and storing the interface data into a preset database.
5. The interface code detection report generation method of claim 1, wherein the generation step comprises:
filling the same parameters of the two groups of interface codes to a first preset position in a predetermined template file;
and filling the difference parameters of the two groups of interface codes to a second preset position in a predetermined template file.
6. An electronic device, comprising a memory and a processor, wherein an interface code detection report generation program is stored in the memory, and the interface code detection report generation program is executed by the processor, and the following steps are implemented:
a receiving step: receiving a request for generating an interface code detection report sent by a user, wherein the request comprises a first group of interface codes and a second group of interface codes to be detected;
an identification step: analyzing the first group of interface codes and the second group of interface codes by using a preset code analyzer, and respectively extracting preset type code blocks corresponding to the two groups of interface codes;
a conversion step: converting the preset type code block into attribute information corresponding to the two groups of interface codes by using a preset conversion rule, and comparing and analyzing the attribute information of the two groups of interface codes to obtain difference parameters and same parameters of the two groups of interface codes; and
a generation step: and filling the difference parameters and the same parameters into a predetermined template file to generate an interface code detection report, and sending the interface code detection report to the user so that the user can display the interface code detection report.
7. The electronic device of claim 6, wherein the preset conversion rule comprises:
and identifying the annotation line of the preset type code block to obtain the interface type and the interface path of the code block, and identifying the interface function of the preset type code block to obtain the interface name, the input parameters of the interface and the output parameters of the interface of the code block.
8. The electronic device of claim 6, wherein the converting step further comprises:
and converting the preset type code block into interface data in a JSON format by using a preset JSON parser, and storing the interface data into a preset database.
9. The electronic device of claim 6, wherein the generating step comprises:
filling the same parameters of the two groups of interface codes to a first preset position in a predetermined template file;
and filling the difference parameters of the two groups of interface codes to a second preset position in a predetermined template file.
10. A computer-readable storage medium, characterized in that an interface code detection report generation program is included in the computer-readable storage medium, and when the interface code detection report generation program is executed by a processor, the steps of the interface code detection report generation method according to any one of claims 1 to 5 are implemented.
CN201910919307.4A2019-09-262019-09-26Interface code detection report generation method, electronic device, and storage mediumPendingCN110688315A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201910919307.4ACN110688315A (en)2019-09-262019-09-26Interface code detection report generation method, electronic device, and storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201910919307.4ACN110688315A (en)2019-09-262019-09-26Interface code detection report generation method, electronic device, and storage medium

Publications (1)

Publication NumberPublication Date
CN110688315Atrue CN110688315A (en)2020-01-14

Family

ID=69110515

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201910919307.4APendingCN110688315A (en)2019-09-262019-09-26Interface code detection report generation method, electronic device, and storage medium

Country Status (1)

CountryLink
CN (1)CN110688315A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111553150A (en)*2020-04-022020-08-18深圳壹账通智能科技有限公司Method, system, device and storage medium for analyzing and configuring automatic API (application program interface) document
CN111798206A (en)*2020-06-242020-10-20霓检有限公司Detection data processing method, device and equipment
CN115695267A (en)*2022-10-282023-02-03北京鼎泰智源科技有限公司Data interface oriented test and verification method and device
CN116700778A (en)*2023-08-022023-09-05中邮消费金融有限公司Interface difference analysis method, device, storage medium and apparatus

Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104407872A (en)*2014-12-042015-03-11北京邮电大学Code clone detection method
CN108491331A (en)*2018-04-132018-09-04平安普惠企业管理有限公司Method for testing software, device, equipment and computer storage media
CN108681504A (en)*2018-04-132018-10-19深圳壹账通智能科技有限公司Automated testing method, test server and computer readable storage medium
CN109388566A (en)*2018-09-272019-02-26北京城市网邻信息技术有限公司A kind of code coverage rate analysis method, apparatus, equipment and storage medium
CN109634841A (en)*2018-10-262019-04-16平安科技(深圳)有限公司Electronic device, automatic interface testing method and storage medium
CN110262782A (en)*2019-05-102019-09-20平安科技(深圳)有限公司The interface comparison method and device of software systems

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104407872A (en)*2014-12-042015-03-11北京邮电大学Code clone detection method
CN108491331A (en)*2018-04-132018-09-04平安普惠企业管理有限公司Method for testing software, device, equipment and computer storage media
CN108681504A (en)*2018-04-132018-10-19深圳壹账通智能科技有限公司Automated testing method, test server and computer readable storage medium
CN109388566A (en)*2018-09-272019-02-26北京城市网邻信息技术有限公司A kind of code coverage rate analysis method, apparatus, equipment and storage medium
CN109634841A (en)*2018-10-262019-04-16平安科技(深圳)有限公司Electronic device, automatic interface testing method and storage medium
CN110262782A (en)*2019-05-102019-09-20平安科技(深圳)有限公司The interface comparison method and device of software systems

Cited By (7)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN111553150A (en)*2020-04-022020-08-18深圳壹账通智能科技有限公司Method, system, device and storage medium for analyzing and configuring automatic API (application program interface) document
CN111798206A (en)*2020-06-242020-10-20霓检有限公司Detection data processing method, device and equipment
CN111798206B (en)*2020-06-242023-11-14霓检有限公司Detection data processing method, device and equipment
CN115695267A (en)*2022-10-282023-02-03北京鼎泰智源科技有限公司Data interface oriented test and verification method and device
CN115695267B (en)*2022-10-282024-05-03北京鼎泰智源科技有限公司Data interface-oriented testing and verifying method and device
CN116700778A (en)*2023-08-022023-09-05中邮消费金融有限公司Interface difference analysis method, device, storage medium and apparatus
CN116700778B (en)*2023-08-022024-01-26中邮消费金融有限公司Interface difference analysis method, device, storage medium and apparatus

Similar Documents

PublicationPublication DateTitle
CN111459495B (en)Unit test code file generation method, electronic device and storage medium
CN110688307B (en)JavaScript code detection method, device, equipment and storage medium
CN110688315A (en)Interface code detection report generation method, electronic device, and storage medium
CN109471857B (en)SQL statement-based data modification method, device and storage medium
WO2018000998A1 (en)Interface generation method, apparatus and system
CN110825619A (en)Automatic generation method and device of interface test case and storage medium
CN110737689B (en)Data standard compliance detection method, device, system and storage medium
CN111338693B (en) Object file generation method, server and storage medium based on model construction
CN110188568A (en) Confidential information identification method, device, device and computer-readable storage medium
CN114090671A (en)Data import method and device, electronic equipment and storage medium
CN109429260B (en)Method and device for checking northbound data
CN111860641A (en) Power grid image recognition method, electronic device and storage medium
CN115408453A (en)Configured report generation method and device, computer equipment and storage medium
CN117171792A (en)Intra-enterprise knowledge question-answering method, device, equipment and medium based on large model
CN113033177B (en)Method and device for analyzing electronic medical record data
CN108897742A (en)A kind of log method for internationalizing, system, equipment and computer readable storage medium
CN115809241A (en)Data storage method and device, computer equipment and storage medium
CN112363904B (en)Log data analysis positioning method and device and computer readable storage medium
CN103064839A (en)Portable document format (Pdf) full-text on-line retrieval method
CN112380114A (en)Automatic generation method and device for reverse test case file and electronic equipment
CN110851346A (en)Method, device and equipment for detecting boundary problem of query statement and storage medium
CN116431481A (en)Code parameter verification method and device based on multi-code condition
CN114817152A (en) Query method and system for slice file
CN115268933A (en)Method and device for automatically generating process document, computer equipment and storage medium
CN106648925B (en)Mobile terminal and method for acquiring character string information thereof

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
RJ01Rejection of invention patent application after publication
RJ01Rejection of invention patent application after publication

Application publication date:20200114


[8]ページ先頭

©2009-2025 Movatter.jp