CN111352610A - Interface return value modification method and device, electronic equipment and storage medium - Google Patents
Interface return value modification method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111352610A CN111352610A CN202010139615.8A CN202010139615A CN111352610A CN 111352610 A CN111352610 A CN 111352610A CN 202010139615 A CN202010139615 A CN 202010139615A CN 111352610 A CN111352610 A CN 111352610A
- Authority
- CN
- China
- Prior art keywords
- interface
- return value
- configuration information
- expected result
- field
- 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
- 238000002715 modification method Methods 0.000 title claims description 19
- 238000000034 method Methods 0.000 claims abstract description 35
- 238000012986 modification Methods 0.000 claims abstract description 27
- 230000004048 modification Effects 0.000 claims abstract description 27
- 238000004590 computer program Methods 0.000 claims description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 2
- 230000003631 expected effect Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/20—Software design
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3644—Software debugging by instrumenting at runtime
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The invention discloses a method and a device for modifying interface return values, electronic equipment and a storage medium, which can be used for configuring the interface return values in advance and storing configuration information into a configuration file; then, when the interface is used, acquiring a real return value of the interface, and acquiring interface configuration information corresponding to the interface from a configuration file; and judging whether the expected result of the interface in the interface configuration information is the same as the real return value or not, and if not, modifying the return value into the expected result. In the technical scheme of the invention, if the return value of the interface does not meet the expectation, the service code does not need to be operated online again, and only the return value needs to be modified into the expected result, so that the process of searching for the bug online is omitted, the time for modifying the return value of the interface is saved, and the modification efficiency is improved.
Description
Technical Field
The invention relates to the technical field of software development, in particular to an interface return value modification method and device, electronic equipment and a storage medium.
Background
In the process of developing the network page, technicians design different service codes according to different pages, the back end executes the service codes, the front end analyzes the execution result of the service codes, and after the analysis is successful, the front end can display the page corresponding to the service codes.
At present, the back end needs to request a corresponding data interface according to the content of the service code, obtain a return value of the data interface, and send the return value to the front end for analysis. However, when the service for data acquisition is reported in error or other uncontrollable risks occur, the situation that the return value of the data interface is null or cannot be analyzed by the front end is easily caused, and further, the problem that part of functions of the page displayed by the front end are unavailable or all the functions are unavailable is caused. In order to solve these problems, technicians usually need to perform the online process of the service code again after the page is abnormal, analyze and modify the bugs in the code, and then change the corresponding return values, so that the front end normally displays the page.
However, the above method for modifying the return value needs to bring the service code online again and find a bug in the code, and the whole process is very tedious and time-consuming, so that the efficiency of modifying the return value by using the above method is low.
Disclosure of Invention
The invention provides an interface return value modification method, an interface return value modification device, electronic equipment and a storage medium, and aims to solve the problems of complicated process and low efficiency of the conventional interface return value modification method.
In a first aspect, the present invention provides an interface return value modification method, including:
acquiring interface configuration information corresponding to an interface from a configuration file, wherein the configuration file is used for storing interface configuration information corresponding to different interfaces, and the interface configuration information is used for representing an expected result which is preset and is required to be acquired by the interface;
and if the return value of the interface is not the same as the expected result of the interface in the interface configuration information, modifying the return value according to the expected result, wherein the return value is real data acquired when the interface is called on line.
With reference to the first aspect, in an implementation manner of the first aspect, if a return value of the interface is not the same as the expected result of the interface in the interface configuration information, the step of modifying the return value according to the expected result includes:
determining whether a field corresponding to the expected result in the interface configuration information exists in the return value, wherein the expected result in the interface configuration information is greater than or equal to 1, and the return value includes N fields, where N is an integer greater than or equal to 0;
if yes, determining whether the data corresponding to the field in the return value is the same as the expected result;
and if not, modifying the data corresponding to the field in the return value according to the expected result.
With reference to the first aspect, in an implementation manner of the first aspect, after the determining whether a field corresponding to the expected result in the interface configuration information exists in the return value, the method further includes:
if the field corresponding to the expected result in the interface configuration information does not exist in the return value, adding the field into the return value;
and configuring the expected result into the data corresponding to the field in the return value.
With reference to the first aspect, in an implementation manner of the first aspect, the step of obtaining interface configuration information corresponding to an interface from a configuration file includes:
if the interface configuration information corresponding to the interface does not exist in the configuration file, acquiring an expected result corresponding to the interface;
and storing the expected result and the corresponding field in the configuration file in the form of a key value pair, wherein the key value pair is the interface configuration information.
With reference to the first aspect, in an implementation manner of the first aspect, the step of obtaining interface configuration information corresponding to an interface from a configuration file further includes:
periodically writing the interface configuration information in the configuration file into a memory;
if the updated interface configuration information exists, the new interface configuration information is used for covering the old interface configuration information;
and acquiring interface configuration information corresponding to the interface from the memory.
In a second aspect, the present invention provides an interface return value modification apparatus, including:
the information acquisition module is used for acquiring interface configuration information corresponding to the interfaces from a configuration file, wherein the configuration file is used for storing the interface configuration information corresponding to different interfaces, and the interface configuration information is used for representing an expected result which is preset and is required to be acquired by the interfaces;
and the return value modification module is used for modifying the return value according to the expected result when the return value of the interface is different from the expected result of the interface in the interface configuration information, wherein the return value is real data acquired when the interface is called on line.
With reference to the second aspect, in an implementation manner of the second aspect, the return value modification module includes:
a field determining unit, configured to determine whether a field corresponding to the expected result in the interface configuration information exists in the return value, where the expected result in the interface configuration information is greater than or equal to 1, and the return value includes N fields, where N is an integer greater than or equal to 0;
a data determining unit, configured to determine, when a field corresponding to the expected result in the interface configuration information exists in the return value, whether data corresponding to the field in the return value is the same as the expected result;
and the modifying unit is used for modifying the data corresponding to the field in the return value according to the expected result when the data corresponding to the field in the return value is different from the expected result.
With reference to the second aspect, in an implementable manner of the second aspect, the modifying unit is further configured to: when a field corresponding to the expected result in the interface configuration information does not exist in the return value, adding the field into the return value; and configuring the expected result into the data corresponding to the field in the return value.
With reference to the second aspect, in an implementation manner of the second aspect, the apparatus further includes:
the configuration module is used for acquiring an expected result corresponding to the interface when the interface configuration information corresponding to the interface does not exist in the configuration file; and storing the expected result and the corresponding field in the configuration file in the form of a key value pair, wherein the key value pair is the interface configuration information.
With reference to the second aspect, in an implementation manner of the second aspect, the information obtaining module is further configured to periodically write the interface configuration information in the configuration file into the memory; when updated interface configuration information exists, the old interface configuration information is covered by the new interface configuration information; and acquiring interface configuration information corresponding to the interface from the memory.
In a third aspect, the present invention provides an electronic device, comprising: a memory for storing program instructions; and the processor is used for calling and executing the program instructions in the memory so as to realize the interface return value modification method of the first aspect.
In a fourth aspect, the present invention provides a storage medium, in which a computer program is stored, and when at least one processor of an interface return value modification apparatus executes the computer program, the interface return value modification apparatus executes the interface return value modification method according to the first aspect.
According to the technical scheme, the interface return value modification method, the interface return value modification device, the electronic equipment and the storage medium can be used for configuring the interface return value in advance and storing configuration information into the configuration file; then, when the interface is used, acquiring a real return value of the interface, and acquiring interface configuration information corresponding to the interface from a configuration file; and judging whether the expected result of the interface in the interface configuration information is the same as the real return value or not, and if not, modifying the return value into the expected result. In the technical scheme of the invention, if the return value of the interface does not meet the expectation, the service code does not need to be operated online again, and only the return value needs to be modified into the expected result, so that the process of searching for the bug online is omitted, the time for modifying the return value of the interface is saved, and the modification efficiency is improved.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without any inventive exercise.
Fig. 1 is a flowchart of an interface return value modification method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method for modifying a return value according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for acquiring interface configuration information according to an embodiment of the present invention;
fig. 4 is a flowchart of another method for obtaining interface configuration information according to an embodiment of the present invention;
fig. 5 is a block diagram illustrating an interface return value modification apparatus according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention.
Detailed Description
At present, when a back end processes a service code, if a data acquisition service reports an error or other uncontrollable risks occur, a situation that a return value of a data interface called by the back end is empty or the return value of the data interface cannot be analyzed by the front end is easily caused, in order to solve an anomaly of a front-end page, a technician generally needs to perform an online flow of the service code again, analyze and modify a bug in the code, and then change a corresponding return value, so that the front end normally displays the page. However, this method for modifying the return value needs to bring the service code online again and find a bug in the code, and the whole process is very tedious and time-consuming, so that the efficiency of modifying the return value using the above method is low. Therefore, the invention provides a method for modifying the interface return value, if the interface return value does not meet the expectation, the service code does not need to be operated on line again, and only the return value needs to be modified into the expected result, thereby saving the process of finding the bug on line, saving the time for modifying the interface return value and improving the modification efficiency.
Fig. 1 is a flowchart of an interface return value modification method according to an embodiment of the present invention. As shown in fig. 1, the method for modifying an interface return value according to the embodiment of the present invention includes:
s101, acquiring interface configuration information corresponding to an interface from a configuration file, wherein the configuration file is used for storing interface configuration information corresponding to different interfaces, and the interface configuration information is used for representing an expected result which is preset and should be acquired by the interface.
In the embodiment of the invention, different services call different interfaces, the expected effect of each service can be determined firstly, and then the expected result which can enable the service to achieve the expected effect is configured for the interface corresponding to each service. After setting, storing the configuration information corresponding to each interface in a configuration file. In addition, the number of the data acquired by the interface is related to the service corresponding to the interface, and can be 1 or a plurality of; furthermore, the expected results that the preset interface should obtain may also be 1 or several, and furthermore, the expected results of the interface may be set for a part of all the obtained data, or may also be set for all the obtained data, for example, interface a may actually obtain 5 data, but may set the expected results for only the second data in advance, and in the subsequent step S102, it is only necessary to determine whether the second data in the real data obtained by the interface is the same as the expected results; for another example, the interface a may actually acquire 5 pieces of data, may set an expected result for all the data in advance, and in the subsequent step S102, it needs to determine whether the 5 pieces of real data acquired by the interface are respectively the same as their expected results.
S102, if the return value of the interface is different from the expected result of the interface in the interface configuration information, modifying the return value according to the expected result, wherein the return value is real data acquired when the interface is called on line.
In the embodiment of the invention, the real data acquired by the interface needs to be compared with an expected result, and whether the real data acquired by the interface has a problem or not is judged, and whether the real data acquired by the interface needs to be modified or not is judged. If the expected result and the corresponding real data exist in the corresponding interface, judging whether the real data is the same as the expected result, if so, indicating that the data acquired in the interface has no problem, and does not need to be modified, and if not, indicating that the data acquired in the interface is wrong, wherein the specific error reason may be a service error for providing the data or other problems. For example, if the return value of interface B is-1 and the expected result in the interface configuration information of interface B is 1, the values of the two are not the same, and it is necessary to modify-1 in the return value to 1.
Therefore, the interface return value modification method provided in the embodiment of the present invention can configure the interface return value in advance, and store the configuration information into the configuration file; then, when the interface is used, acquiring a real return value of the interface, and acquiring interface configuration information corresponding to the interface from a configuration file; and judging whether the expected result of the interface in the interface configuration information is the same as the real return value or not, and if not, modifying the return value into the expected result. In the technical scheme of the invention, if the return value of the interface does not meet the expectation, the service code does not need to be operated online again, and only the return value needs to be modified into the expected result, so that the process of searching for the bug online is omitted, the time for modifying the return value of the interface is saved, and the modification efficiency is improved.
Fig. 2 is a flowchart of a method for modifying a return value according to an embodiment of the present invention. As shown in fig. 2, in the embodiment of the present invention, if the return value of the interface is not the same as the expected result of the interface in the interface configuration information, the step of modifying the return value according to the expected result includes:
s201, determining whether a field corresponding to the expected result in the interface configuration information exists in the return value, where the expected result in the interface configuration information is greater than or equal to 1, and the return value includes N fields, where N is an integer greater than or equal to 0.
In the embodiment of the invention, the call to the interface is realized by a specific code, and the attribute of different data needing to be acquired in the interface and the type of the data are represented by different fields in the code. As described above, for the preset of the interface, a plurality of expected results or one expected result may be set, and then there are a plurality of or one corresponding fields.
S202, if yes, determining whether the data corresponding to the field in the return value is the same as the expected result.
If the field corresponding to the expected result in the interface configuration information exists in the return value, the fact that the field corresponding to the actual data of one or more return values is the same as the field corresponding to the expected result is indicated. In this embodiment of the present invention, the field is used to indicate the attribute of the acquired data and the type of the data, and certainly, the content of the field includes the acquired data itself, and after the presence of the field is determined, the content of the field is also determined.
In addition, after step S201, the method further includes:
s301, if the field corresponding to the expected result in the interface configuration information does not exist in the return value, adding the field into the return value.
S302, in the return value, the expected result is configured to be the data corresponding to the field.
Generally, data should be contained in the return value of the interface, but the situation that data cannot be obtained due to a problem of a service providing the data is not excluded, at this time, the return value of the interface is null, that is, no field exists in the return value, in this case, a field corresponding to an expected result of the interface does not exist in the return value, and at this time, in order to enable front-end page display to be unaffected, both the field corresponding to the expected result and the expected result need to be added to the return value; alternatively, several fields exist in the return value of the interface, but the field corresponding to the expected result does not exist in the fields, and the field corresponding to the expected result and the expected result are added to the return value.
S203, if the data corresponding to the field in the return value are different, the data corresponding to the field in the return value are modified according to the expected result, namely the data corresponding to the field in the return value are replaced by the expected result, so that the data corresponding to the field in the return value are ideal, and the display of the front end on the page cannot be influenced by using the ideal data.
Therefore, in the embodiment of the invention, the modification of the return value comprises two types of fields of adding the return value and modifying the return value, so that the correct field data in the return value is ensured to be the same as the expected result, and the field data can be ensured to be correctly analyzed by the front end without influencing the page display.
Fig. 3 is a flowchart of a method for acquiring interface configuration information according to an embodiment of the present invention. As shown in fig. 3, in the embodiment of the present invention, the step of obtaining interface configuration information corresponding to an interface from a configuration file includes:
s401, if the interface configuration information corresponding to the interface does not exist in the configuration file, obtaining an expected result corresponding to the interface.
In the embodiment of the invention, the configuration of the interface is carried out before the interface is formally used, so that the interface configuration information corresponding to the interface can be obtained every time after the back end executes the service code to call the interface. However, operations such as adding an interface calling code in a service code are not excluded, and at this time, because the newly added interface is not configured in advance, the interface configuration information corresponding to the interface cannot be found in the configuration file, and in order to avoid the problem that the front-end page cannot be displayed due to the problem of the interface return value, if the interface configuration information cannot be obtained from the configuration file, the interface needs to be configured immediately, the new configuration information is used to complete the judgment on whether the return value needs to be modified or not, and the interface configuration information corresponding to the interface is stored in the configuration file so as to be used next time.
S402, storing the expected result and the corresponding field in the configuration file in a form of a key value pair, wherein the key value pair is the interface configuration information. For example, the field is used as a key, and the expectation corresponding to the field is used as a value, so that a key-value form may be formed, and similarly, the field and its corresponding real data may be saved in the return value of the interface in a key-value pair form, and in the subsequent determination process, the determination on the field may be implemented by determining the key, and the determination on the data may be implemented by determining the value.
Therefore, in the interface return value modification method in the embodiment of the present invention, the expected result of each interface can be set, and the data of a certain field or all fields in the interface return value can be judged and modified, so as to ensure that the front end normally displays the page.
Fig. 4 is a flowchart of another method for acquiring interface configuration information according to an embodiment of the present invention. As shown in fig. 4, in the embodiment of the present invention, the step of obtaining interface configuration information corresponding to an interface from a configuration file further includes:
s501, periodically writing the interface configuration information in the configuration file into a memory.
In the embodiment of the present invention, in order to facilitate that the back end can quickly obtain the interface configuration information when running the service code, the interface configuration information in the configuration file may also be periodically written into the memory, where the periodic writing refers to an operation performed at intervals, such as 5 minutes, 10 minutes, and the like. The back-end may then directly obtain the interface configuration information from a memory, where the memory refers to a memory space in the back-end, and generally speaking, the configuration file is not in the back-end.
S502, if the updated interface configuration information exists, the old interface configuration information is covered by the new interface configuration information.
In the embodiment of the invention, because the function or property of the service is changed, the ideal data obtained by calling the interface for the service code is also changed, and at the moment, the expected result in the interface configuration information needs to be modified, namely, the interface configuration information is updated; or because the function or property of the service changes, the ideal data obtained by the service code calling interface is increased more than before, and at this time, the expected result of the interface configuration information also needs to be increased, and this situation can also be regarded as that the interface configuration information is updated, and then the old interface configuration information needs to be replaced by the new interface configuration information.
And S503, acquiring interface configuration information corresponding to the interface from the memory.
According to the scheme, the interface return value modification method provided by the embodiment of the invention can be used for configuring the return value of the interface in advance and storing the configuration information into the configuration file; then, when the interface is used, acquiring a real return value of the interface, and acquiring interface configuration information corresponding to the interface from a configuration file; and judging whether the expected result of the interface in the interface configuration information is the same as the real return value or not, and if not, modifying the return value into the expected result. In the technical scheme of the invention, if the return value of the interface does not meet the expectation, the service code does not need to be operated online again, and only the return value needs to be modified into the expected result, so that the process of searching for the bug online is omitted, the time for modifying the return value of the interface is saved, and the modification efficiency is improved.
Fig. 5 is a block diagram of an interface return value modification apparatus according to an embodiment of the present invention. As shown in fig. 5, the interface return value modification apparatus in the embodiment of the present invention includes: an information obtaining module 51, configured to obtain interface configuration information corresponding to an interface from a configuration file, where the configuration file is used to store interface configuration information corresponding to different interfaces, and the interface configuration information is used to indicate an expected result that a preset interface should obtain; a return value modification module 52, configured to modify, when the return value of the interface is different from the expected result of the interface in the interface configuration information, the return value according to the expected result, where the return value is real data obtained when the interface is called online.
Wherein the return value modification module comprises: a field determining unit, configured to determine whether a field corresponding to the expected result in the interface configuration information exists in the return value, where the expected result in the interface configuration information is greater than or equal to 1, and the return value includes N fields, where N is an integer greater than or equal to 0; a data determining unit, configured to determine, when a field corresponding to the expected result in the interface configuration information exists in the return value, whether data corresponding to the field in the return value is the same as the expected result; and the modifying unit is used for modifying the data corresponding to the field in the return value according to the expected result when the data corresponding to the field in the return value is different from the expected result.
The modification unit is further configured to: when a field corresponding to the expected result in the interface configuration information does not exist in the return value, adding the field into the return value; and configuring the expected result into the data corresponding to the field in the return value.
The interface return value modification apparatus further includes: the configuration module is used for acquiring an expected result corresponding to the interface when the interface configuration information corresponding to the interface does not exist in the configuration file; and storing the expected result and the corresponding field in the configuration file in the form of a key value pair, wherein the key value pair is the interface configuration information.
The information acquisition module is also used for periodically writing the interface configuration information in the configuration file into a memory; when updated interface configuration information exists, the old interface configuration information is covered by the new interface configuration information; and acquiring interface configuration information corresponding to the interface from the memory.
Fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 6, an electronic device provided in an embodiment of the present invention includes: a memory 61 for storing program instructions; and a processor 62 for calling and executing the program instructions in the memory to implement the interface return value modification method in the above embodiment.
In an embodiment of the present invention, the processor 62 and the memory 61 may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present invention. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
The present invention also provides a storage medium, in which a computer program is stored, and when at least one processor of the interface return value modification apparatus executes the computer program, the interface return value modification apparatus executes the interface return value modification method described in the above embodiments.
The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The same and similar parts in the various embodiments in this specification may be referred to each other. In particular, for the embodiments of the service construction apparatus and the service loading apparatus, since they are substantially similar to the embodiments of the method, the description is simple, and the relevant points can be referred to the description in the embodiments of the method.
The above-described embodiments of the present invention should not be construed as limiting the scope of the present invention.
Claims (12)
1. An interface return value modification method, comprising:
acquiring interface configuration information corresponding to an interface from a configuration file, wherein the configuration file is used for storing interface configuration information corresponding to different interfaces, and the interface configuration information is used for representing an expected result which is preset and is required to be acquired by the interface;
and if the return value of the interface is not the same as the expected result of the interface in the interface configuration information, modifying the return value according to the expected result, wherein the return value is real data acquired when the interface is called on line.
2. The method of claim 1, wherein if the return value of the interface is not the same as the expected result of the interface in the interface configuration information, the step of modifying the return value according to the expected result comprises:
determining whether a field corresponding to the expected result in the interface configuration information exists in the return value, wherein the expected result in the interface configuration information is greater than or equal to 1, and the return value includes N fields, where N is an integer greater than or equal to 0;
if yes, determining whether the data corresponding to the field in the return value is the same as the expected result;
and if not, modifying the data corresponding to the field in the return value according to the expected result.
3. The method of claim 2, wherein after determining whether the field corresponding to the expected result in the interface configuration information exists in the return value, further comprising:
if the field corresponding to the expected result in the interface configuration information does not exist in the return value, adding the field into the return value;
and configuring the expected result into the data corresponding to the field in the return value.
4. The method of claim 1, wherein the step of obtaining interface configuration information corresponding to the interface from the configuration file comprises:
if the interface configuration information corresponding to the interface does not exist in the configuration file, acquiring an expected result corresponding to the interface;
and storing the expected result and the corresponding field in the configuration file in the form of a key value pair, wherein the key value pair is the interface configuration information.
5. The method of claim 1, wherein the step of obtaining interface configuration information corresponding to the interface from the configuration file further comprises:
periodically writing the interface configuration information in the configuration file into a memory;
if the updated interface configuration information exists, the new interface configuration information is used for covering the old interface configuration information;
and acquiring interface configuration information corresponding to the interface from the memory.
6. An interface return value modification apparatus, comprising:
the information acquisition module is used for acquiring interface configuration information corresponding to the interfaces from a configuration file, wherein the configuration file is used for storing the interface configuration information corresponding to different interfaces, and the interface configuration information is used for representing an expected result which is preset and is required to be acquired by the interfaces;
and the return value modification module is used for modifying the return value according to the expected result when the return value of the interface is different from the expected result of the interface in the interface configuration information, wherein the return value is real data acquired when the interface is called on line.
7. The apparatus of claim 6, wherein the return value modification module comprises:
a field determining unit, configured to determine whether a field corresponding to the expected result in the interface configuration information exists in the return value, where the expected result in the interface configuration information is greater than or equal to 1, and the return value includes N fields, where N is an integer greater than or equal to 0;
a data determining unit, configured to determine, when a field corresponding to the expected result in the interface configuration information exists in the return value, whether data corresponding to the field in the return value is the same as the expected result;
and the modifying unit is used for modifying the data corresponding to the field in the return value according to the expected result when the data corresponding to the field in the return value is different from the expected result.
8. The apparatus of claim 7, wherein the modifying unit is further configured to: when a field corresponding to the expected result in the interface configuration information does not exist in the return value, adding the field into the return value; and configuring the expected result into the data corresponding to the field in the return value.
9. The apparatus of claim 6, further comprising:
the configuration module is used for acquiring an expected result corresponding to the interface when the interface configuration information corresponding to the interface does not exist in the configuration file; and storing the expected result and the corresponding field in the configuration file in the form of a key value pair, wherein the key value pair is the interface configuration information.
10. The apparatus according to claim 6, wherein the information obtaining module is further configured to periodically write the interface configuration information in the configuration file into a memory; when updated interface configuration information exists, the old interface configuration information is covered by the new interface configuration information; and acquiring interface configuration information corresponding to the interface from the memory.
11. An electronic device, comprising: a memory for storing program instructions;
a processor for calling and executing program instructions in said memory to implement the interface return value modification method of any of claims 1-5.
12. A storage medium having stored therein a computer program which, when executed by at least one processor of an interface return value modification apparatus, causes the interface return value modification apparatus to execute the interface return value modification method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010139615.8A CN111352610A (en) | 2020-03-03 | 2020-03-03 | Interface return value modification method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010139615.8A CN111352610A (en) | 2020-03-03 | 2020-03-03 | Interface return value modification method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111352610A true CN111352610A (en) | 2020-06-30 |
Family
ID=71192447
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010139615.8A Pending CN111352610A (en) | 2020-03-03 | 2020-03-03 | Interface return value modification method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111352610A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112199082A (en) * | 2020-10-14 | 2021-01-08 | 杭州安恒信息技术股份有限公司 | HTTP response processing method and device, electronic equipment and storage medium |
CN113672496A (en) * | 2021-07-09 | 2021-11-19 | 微梦创科网络科技(中国)有限公司 | Testing method and system based on cosine similarity |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030200357A1 (en) * | 2002-04-23 | 2003-10-23 | Motorola, Inc. | Programmatic universal policy based software component system for software component framework |
CN104899106A (en) * | 2014-03-07 | 2015-09-09 | 阿里巴巴集团控股有限公司 | Processing method and processing device when interface service is abnormal |
WO2016095729A1 (en) * | 2014-12-16 | 2016-06-23 | 阿里巴巴集团控股有限公司 | Message processing method, device and system |
CN107203465A (en) * | 2016-03-18 | 2017-09-26 | 阿里巴巴集团控股有限公司 | System interface method of testing and device |
CN107294808A (en) * | 2017-07-05 | 2017-10-24 | 网易(杭州)网络有限公司 | The methods, devices and systems of interface testing |
CN107908485A (en) * | 2017-10-26 | 2018-04-13 | 中国平安人寿保险股份有限公司 | Interface parameters transmission method, device, equipment and computer-readable recording medium |
CN108804271A (en) * | 2018-06-28 | 2018-11-13 | 北京潘达互娱科技有限公司 | Interface tolerating measure method and device |
CN110109818A (en) * | 2019-03-15 | 2019-08-09 | 平安城市建设科技(深圳)有限公司 | Monitoring method, device, terminal and the readable storage medium storing program for executing of back end interface data |
CN110109656A (en) * | 2019-03-25 | 2019-08-09 | 平安科技(深圳)有限公司 | Interface analogy method, device, computer equipment and storage medium |
-
2020
- 2020-03-03 CN CN202010139615.8A patent/CN111352610A/en active Pending
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030200357A1 (en) * | 2002-04-23 | 2003-10-23 | Motorola, Inc. | Programmatic universal policy based software component system for software component framework |
CN104899106A (en) * | 2014-03-07 | 2015-09-09 | 阿里巴巴集团控股有限公司 | Processing method and processing device when interface service is abnormal |
WO2016095729A1 (en) * | 2014-12-16 | 2016-06-23 | 阿里巴巴集团控股有限公司 | Message processing method, device and system |
CN107203465A (en) * | 2016-03-18 | 2017-09-26 | 阿里巴巴集团控股有限公司 | System interface method of testing and device |
CN107294808A (en) * | 2017-07-05 | 2017-10-24 | 网易(杭州)网络有限公司 | The methods, devices and systems of interface testing |
CN107908485A (en) * | 2017-10-26 | 2018-04-13 | 中国平安人寿保险股份有限公司 | Interface parameters transmission method, device, equipment and computer-readable recording medium |
CN108804271A (en) * | 2018-06-28 | 2018-11-13 | 北京潘达互娱科技有限公司 | Interface tolerating measure method and device |
CN110109818A (en) * | 2019-03-15 | 2019-08-09 | 平安城市建设科技(深圳)有限公司 | Monitoring method, device, terminal and the readable storage medium storing program for executing of back end interface data |
CN110109656A (en) * | 2019-03-25 | 2019-08-09 | 平安科技(深圳)有限公司 | Interface analogy method, device, computer equipment and storage medium |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112199082A (en) * | 2020-10-14 | 2021-01-08 | 杭州安恒信息技术股份有限公司 | HTTP response processing method and device, electronic equipment and storage medium |
CN113672496A (en) * | 2021-07-09 | 2021-11-19 | 微梦创科网络科技(中国)有限公司 | Testing method and system based on cosine similarity |
CN113672496B (en) * | 2021-07-09 | 2023-12-22 | 微梦创科网络科技(中国)有限公司 | Cosine similarity-based test method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108388514B (en) | Interface automation test method, device, equipment and computer readable storage medium | |
CN108415998B (en) | Application dependency relationship updating method, terminal, device and storage medium | |
CN112187933B (en) | Method and system for monitoring services in multi-architecture cloud platform | |
CN111158741A (en) | Method and device for monitoring change of dependency relationship of business module on third-party class library | |
US20210026756A1 (en) | Deriving software application dependency trees for white-box testing | |
CN111352610A (en) | Interface return value modification method and device, electronic equipment and storage medium | |
CN114442930A (en) | Method and device for controlling group disk array, electronic equipment and readable storage medium | |
CN117370092A (en) | Random test program, chip detection method and device | |
CN110688320B (en) | Global variable detection method and device and terminal equipment | |
CN117171030A (en) | Method, device, equipment and storage medium for detecting software running environment | |
CN110347572B (en) | Method, device, system, equipment and medium for outputting performance log | |
CN111176987A (en) | Method and device for uniformly outputting front-end log, computer equipment and storage medium | |
CN114356290A (en) | Data processing method and device and computer readable storage medium | |
CN113986592A (en) | Log recording method and device, terminal equipment and readable storage medium | |
CN113157583A (en) | Test method, device and equipment | |
CN109240906B (en) | Database configuration information adaptation method and device, computer equipment and storage medium | |
CN110727537A (en) | Method and device for uniformly processing response message, computer equipment and storage medium | |
CN117192343B (en) | Chip testing method based on auxiliary system, electronic equipment and medium | |
CN115757346A (en) | Data migration method and device, electronic equipment and storage medium | |
CN116361176A (en) | Control method and device of embedded equipment, processor and electronic equipment | |
CN116339732A (en) | View page drawing method, device, equipment and storage medium | |
CN114942849A (en) | Multithreading function processing method and device and electronic equipment | |
CN117573130A (en) | Code processing method, device, electronic equipment and storage medium | |
CN115576571A (en) | PC OS system installation checking method, system, computer device and storage medium | |
CN116661769A (en) | Code generation method, device, equipment and storage medium of recommendation strategy |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200630 |