Interface verification method and device and related equipment
By setting sections at the business interface of the old business system, obtaining real business data and comparing the output results of the new and old business systems, the problem of low reliability of interface verification results in the existing technology is solved, and efficient and reliable interface verification is achieved.
Patent Information
- Application Number
- CN202411443735.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-16
- Publication Date
- 2025-02-07
AI Technical Summary
In the prior art, the reliability of interface verification results is low, mainly due to the reliance on manual testing and complex data comparison, which is time-consuming and labor-intensive and prone to omissions and errors.
By setting sections at the business interface of the old business system, obtaining real business data, and calling the corresponding interface of the new business system, comparing the output results returned by the two, and generating interface verification results to determine the business processing logic of the corresponding interface of the new and old business systems. Whether the same or not.
It achieves more efficient access to interface verification results, and ensures the reliability of interface verification results by using real business data, avoiding the time-consuming and errors of manual testing.
Smart Images

Figure CN119396722A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of software testing, and in particular to an interface verification method, device and related equipment. Background Art
[0002] When a business system such as a query system needs to be upgraded and reconstructed, Figure 1 and Figure 2 As shown, while keeping the database unchanged, a new development language or a new technical framework is used to develop a new business system, and then replace the original old business system, so as to achieve the goals of improving system throughput, improving system performance, and reducing resource consumption.
[0003] During the upgrade and reconstruction process, the business logic of the new business system is required to be consistent with the business logic of the old business system to ensure the accuracy and consistency of business processing before and after the replacement of the old and new business systems.
[0004] In the related art, the verification of interface logic in new business systems relies on manual testing and complex data comparison. The verification process is not only time-consuming and labor-intensive, but also prone to omissions and errors because the data used in the verification process are all false data fabricated by testers. In other words, the reliability of the interface verification results obtained based on the related art is low. Summary of the invention
[0005] The purpose of the present disclosure is to provide an interface verification method, apparatus and related equipment to solve the technical problem of low reliability of interface verification results output by related technologies.
[0006] In a first aspect, the present application provides an interface verification method, the method comprising:
[0007] Acquire target input data based on a section set at a first business interface, and a first output result returned by the first business interface using the target input data as an interface input parameter, wherein the first business interface is one of a plurality of business interfaces included in the old business system, and the target input data is business input data received by the first business interface in a production environment;
[0008] Calling a second business interface to obtain a second output result returned by the second business interface using the target input data as an interface input parameter, wherein the second business interface is a business interface used to replace the first business interface among multiple business interfaces included in the new business system, and the new business system is a system used to replace the old business system;
[0009] An interface verification result is generated according to the first output result and the second output result, where the interface verification result is used to indicate whether the service processing logics of the first service interface and the second service interface are the same.
[0010] In a second aspect, the present application further provides an interface verification device, the device comprising:
[0011] A data acquisition module, configured to acquire target input data based on a section set at a first business interface, and a first output result returned by the first business interface using the target input data as an interface input parameter, wherein the first business interface is one of a plurality of business interfaces included in the old business system, and the target input data is business input data received by the first business interface in a production environment;
[0012] an interface calling module, used to call a second business interface, and obtain a second output result returned by the second business interface using the target input data as an interface input parameter, wherein the second business interface is a business interface used to replace the first business interface among multiple business interfaces included in the new business system, and the new business system is a system used to replace the old business system;
[0013] A verification module is used to generate an interface verification result according to the first output result and the second output result, wherein the interface verification result is used to indicate whether the business processing logic of the first business interface and the second business interface is the same.
[0014] In a third aspect, the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method described in the first aspect.
[0015] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0016] In a fifth aspect, the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the method described in the first aspect.
[0017] In the present application, through the setting of aspects, the real business data corresponding to the interface to be verified is obtained in a non-invasive manner, and the different output results returned by the corresponding interfaces of the new and old business systems for the real business data are compared, so as to determine whether the business processing logic of the corresponding interfaces of the new and old business systems is the same, so as to replace the manual interface testing method of the related technology. This can not only obtain the interface verification results more efficiently, but also ensure the reliability of the obtained interface verification results because the data used in the verification process is real business data. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic diagram of a system upgrade and reconstruction solution provided in an embodiment of the present application;
[0019] Figure 2 is a schematic diagram of another system upgrade and reconstruction solution provided in an embodiment of the present application;
[0020] Figure 3 It is a flowchart of an interface verification method provided in an embodiment of the present application;
[0021] Figure 4 This is a schematic diagram of the architecture of another system upgrade and reconstruction solution provided in an embodiment of the present application;
[0022] Figure 5 It is a structural diagram of an interface verification device provided in an embodiment of the present application;
[0023] Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present disclosure to clearly and completely describe the technical solutions in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.
[0025] The present disclosure provides an interface verification method, such as Figure 3 As shown, the interface verification method includes:
[0026] Step 301: Acquire target input data based on a slice set at a first business interface, and a first output result returned by the first business interface using the target input data as an interface input parameter.
[0027] The first business interface is one of a plurality of business interfaces included in the old business system, and the target input data is business input data received by the first business interface in a production environment.
[0028] Exemplarily, the services corresponding to the old service system can be understood as query services, such as general search services, video search services, text search services, and the like.
[0029] In this application, the business interface included in the old business system is the Application Programming Interface (API) set in the old business system. By providing input parameters (referred to as input parameters) to the API based on the input parameter format defined by the API, you can get the output results returned by the API based on the input input parameters.
[0030] The multiple business interfaces included in the old business system are connected in series and / or in parallel to cooperate with each other to provide relevant functions of the corresponding business of the old business system. For example, if the multiple business interfaces included in the old business system are set to be business interface A, business interface B and business interface C;
[0031] Then, business interface A, business interface B and business interface C can be connected in series in sequence. At this time, the data transmission logic of the old business system is: the old business system receives the query keyword input by the user, calls business interface A, and obtains the interface output result a returned by the business interface A with the query keyword as the interface input parameter; calls business interface B, and obtains the interface output result b returned by the business interface B with the interface output result a as the interface input parameter; calls business interface C, and obtains the interface output result c returned by the business interface C with the interface output result b as the interface input parameter, and finally forms the query result returned by the old business system in response to the query keyword according to the interface output result c.
[0032] Business interface A, business interface B, and business interface C can also be connected in parallel. In this case, the data transmission logic of the old business system is:
[0033] The old business system receives the query keyword input by the user;
[0034] If it is determined that the data type / query requirement corresponding to the query keyword matches the business interface A, the business interface A is called to obtain the interface output result a returned by the business interface A with the query keyword as the interface input parameter, and the query result returned by the old business system in response to the query keyword is formed according to the interface output result a;
[0035] If it is determined that the data type / query requirement corresponding to the query keyword matches the business interface B, then the business interface B is called to obtain the interface output result b returned by the business interface B with the query keyword as the interface input parameter, and the query result returned by the old business system in response to the query keyword is formed according to the interface output result b;
[0036] If it is determined that the data type / query requirement corresponding to the query keyword matches the business interface C, the business interface C is called to obtain the interface output result c returned by the business interface C with the query keyword as the interface input parameter, and the query result returned by the old business system in response to the query keyword is formed according to the interface output result c;
[0037] For example, when different business interfaces of parallel connection are distinguished by data type, business interface A can be understood as a business interface supporting keyword query in digital format, business interface B can be understood as a business interface supporting keyword query in text format, and business interface C can be understood as a business interface supporting keyword query in formula format (such as regular expression);
[0038] When different parallel-connected business interfaces are distinguished based on query requirements, taking the video query business as an example, business interface A can be understood as a business interface that supports video name / actor name queries, business interface B can be understood as a business interface that supports video plot queries, and business interface C can be understood as a business interface that supports video type / video rating queries.
[0039] Among them, the aspect set at the first business interface can be understood as a component set at the first business interface based on the Aspect Oriented Programming (AOP) technology. Based on the setting of the component, the interface request (which can be understood as the aforementioned target input data) input into the first business interface can be intercepted.
[0040] The first business interface is specifically any one of the multiple business interfaces included in the old business system, among which at least some of the business interfaces associated with the upgrade and reconstruction requirements of the old business system, wherein at least some of the business interfaces associated with the upgrade and reconstruction requirements of the old business system can be pre-determined by relevant personnel before the upgrade and reconstruction of the old business system, or determined based on a preset analysis model before the upgrade and reconstruction of the old business system.
[0041] Step 302: Call the second business interface to obtain a second output result returned by the second business interface using the target input data as an interface input parameter.
[0042] The second service interface is a service interface used to replace the first service interface among multiple service interfaces included in the new service system, and the new service system is a system used to replace the old service system.
[0043] The multiple business interfaces included in the old business system correspond one to one with the multiple business interfaces included in the new business system, and the second business interface is the business interface in the new business system corresponding to the first business interface.
[0044] Step 303: Generate an interface verification result according to the first output result and the second output result.
[0045] The interface verification result is used to indicate whether the service processing logics of the first service interface and the second service interface are the same.
[0046] It should be understood that the business system targeted in this case is specifically a query system. Ideally, the new business system and the old business system only differ in query performance, and there should be no difference in business processing logic. Simply put, for the same query keyword entered by the user, the new business system and the old business system should output the same query results, and only the speed at which the two return their respective query results differs. Generally speaking, compared with the old business system, the new business system outputs query results for the same query keyword faster.
[0047] Specifically, when the first output result and the second output result are the same, the interface verification result is used to indicate that the business processing logic of the first business interface and the second business interface are the same;
[0048] When the first output result and the second output result are different, the interface verification result is used to indicate that the business processing logic of the first business interface and the second business interface are different. At this time, the first output result and the second output result are associated and stored in a preset database, and a warning message (carrying at least the target business data and the interface identifier of the second business interface) is issued to the outside. Based on the warning message, the user is guided to correct the business processing logic of the second business interface so that the corrected business processing logic of the second business interface is consistent with the business processing logic of the first business interface (that is, the first business interface and the second business interface will return the same output result when processing the same input data).
[0049] In the present application, when the development of the new business system is completed, the old business system will continue to run in the production environment while the new business system will be started separately. At this time, the old business system is used as a system that provides business services to the outside world in the production environment. The target input data is intercepted from the first business interface in a non-invasive manner through the aforementioned aspect, and the second business interface corresponding to the first business interface in the new business system is called to obtain the second output result returned by the second business interface with the target input data as the interface input parameter. By comparing the different output results returned by the new and old business systems for the target input data, it is determined whether the business processing logic of the corresponding interfaces of the new and old business systems is the same, so as to replace the manual interface testing method of the related technology. This can not only obtain the interface verification result more efficiently, but also because the input data used in the verification process is real business data, it can also ensure the reliability of the obtained interface verification result.
[0050] In some embodiments, after obtaining the target input data based on the aspect set at the first business interface, the target input data can be asynchronously transmitted to the second business interface through the set data channel to avoid the operation of transmitting the target input data to the second business interface affecting the performance of the old business system.
[0051] In one embodiment, calling the second service interface to obtain the second output result returned by the second service interface using the target input data as an interface input parameter includes:
[0052] When the preset interface calling switch is in an on state, the second service interface is called based on the interface calling switch to obtain a second output result returned by the second service interface using the target input data as an interface input parameter.
[0053] When the preset interface call switch is in the off state, the second business interface is in an idle or dormant state, and the target input data obtained through the slice will be discarded to release part of the computing resources occupied by the second business interface.
[0054] In this embodiment, the interface call switch is set to make the call of the second business interface more flexible, so as to avoid the interference of the test work on the normal operation of the business system. Specifically, based on the above settings, although the setting of the aspect can be used to collect data of the real business scenario in real time when the old business system is running, and use it as the test of the new business system to obtain a more accurate test effect, although the existence of the aspect and the corresponding second business interface in the new system will not interfere with the code processing logic of the old business system, the operation of the second business interface requires certain computing resources. Therefore, in the high-frequency access scenario, the old business system needs to call the available computing resources as much as possible to respond to the user's access request to avoid the need for slow response or even jamming, and the interface call switch is used to realize flexible control of the second business interface, so that in the high-frequency access scenario, the computing resources occupied by the second business interface can be released by closing the interface call switch for use by the old business system, so as to better meet the response performance requirements in the high-frequency access scenario, and in the non-high-frequency access scenario, the interface call switch needs to be enabled to input the data collected by the aspect into the second business interface for testing as much as possible, so as to obtain more testing opportunities as much as possible, thereby improving the test effect of the new business system.
[0055] The on and off of the interface call switch can be manually controlled by the user. For example, in the application, when it is detected that the data processing pressure of the server in the production environment (used to provide computing power support for the old business system) is high, the user can stop calling the corresponding business interface of the new business system by turning off the interface call switch, so as to reduce the data processing pressure of the server and ensure the stable operation of the old business system.
[0056] Automatic control can also be performed based on a set control program, such as setting a detection of the proportion of the load of the old business system in the total load of the server in the production environment. If the proportion is greater than or equal to the set proportion, the control interface calls the switch to be closed to release the load resources occupied by the interface and the new business system for buffering by the old business system; if the proportion is less than the set proportion, the control interface calls the switch to restart or remain open.
[0057] In some implementations, the interface call switch can be controlled to automatically turn on during the target time period to complete the verification of whether the business processing logic of the business interfaces corresponding to the new and old business systems are the same, and the interface call switch can be controlled to automatically turn off during the non-target time period to avoid the above-mentioned verification operation occupying the available computing power of the old business system, wherein the target time period can be understood as a time period with a low query frequency for the corresponding business of the old business system (such as early morning), and the non-time period can be understood as a time period other than the target time period.
[0058] In one embodiment, acquiring target input data based on a slice set at the first business interface includes:
[0059] Acquire multiple candidate input data based on the aspect set at the first business interface, each of the candidate input data is business input data received by the first business interface in the production environment;
[0060] The plurality of candidate input data are sampled to determine at least one sampled input data, where the at least one sampled input data includes the target input data.
[0061] In this embodiment, data sampling is used to reduce the frequency of verification operations while ensuring the reliability of verification results, thereby reducing the frequency of interface calls to the new business system, alleviating the crowding out of the available computing power of the old business system by the above-mentioned verification operations, and ensuring the smooth and reliable operation of the old business system.
[0062] Exemplarily, the multiple candidate input data may be sampled based on a preset sampling frequency to determine the at least one sampled input data; or the multiple candidate input data may be sampled based on a preset sampling algorithm (such as a random sampling algorithm) to determine the at least one sampled input data.
[0063] In one embodiment, the method further comprises:
[0064] Obtaining a first time taken by the first service interface to return the first output result, and a second time taken by the second service interface to return the second output result;
[0065] When the first duration is less than or equal to the second duration, performance alarm information is output, where the performance alarm information is used to indicate that the service processing performance of the second service interface is less than or equal to the service processing performance of the first service interface.
[0066] It should be understood that the new business system in this application only adopts a more efficient development language or technical framework than the old business system, and does not change the business processing logic of the old business system. Therefore, the time taken to output the results can only represent "performance" but does not reflect the pros and cons of the business processing logic.
[0067] In this embodiment, in addition to comparing whether the first output result and the second output result are the same, a first time taken by the first business interface to return the first output result and a second time taken by the second business interface to return the second output result are further compared to avoid the generation of a reverse optimized business interface.
[0068] In some embodiments, the interface verification result can be determined by comprehensively considering the time difference (i.e., the difference between the first time and the second time) and the output result difference (i.e., the difference between the first output result and the second output result). For example, when the first time is greater than the second time, and the first output result is the same as the second output result, it can be considered that the second business interface input parameter meets the verification requirements when it is the target input data; otherwise, it can be considered that the second business interface input parameter does not meet the verification requirements when it is the target input data.
[0069] In other embodiments, the timing difference (i.e., the difference between the first timing and the second timing) can also be set not to affect the determination of the interface verification result, that is, no matter whether the first timing is greater than or less than the second timing, as long as the first output result and the second output result are the same, it is considered that the second business interface input parameter meets the verification requirements when it is the target input data, otherwise it is considered that the second business interface input parameter does not meet the verification requirements when it is the target input data.
[0070] In the application, if the output performance alarm information can be set, the new business system is not allowed to replace the old business system unless the alarm is cleared;
[0071] However, in some implementations, when performance alarm information is output, the user can also be allowed to decide whether to replace the old business system with the new business system. For example, for the 1,000 business interfaces in the new business system, there are 1-2 business interfaces whose processing performance is weaker than that of the old business system. Although performance alarm information will be output, since the processing performance of most interfaces in the new business system is higher than that of the corresponding business interfaces in the old business system, from the overall performance level, the user can be allowed to replace the old business system with the new business system.
[0072] In one embodiment, after generating the interface verification result according to the first output result and the second output result, the method further includes:
[0073] Obtain N of the interface verification results generated within a preset verification period, where N is a positive integer;
[0074] When each of the N interface verification results indicates that the service processing logic of the first service interface and the second service interface is the same, generating a first message indicating that the second service interface has passed the verification;
[0075] When the N interface verification results include at least one interface verification result indicating that the service processing logics of the first service interface and the second service interface are different, a second message indicating that the second service interface has failed verification is generated.
[0076] In this embodiment, the verification time of the business interface is extended by setting a preset verification period to collect as many types of data as possible that the corresponding business interface may encounter in the production environment, and only when the N interface verification results within the preset verification period indicate that the business processing logic of the first business interface and the second business interface is the same, a first message indicating that the second business interface has passed the verification is generated; otherwise, a second message indicating that the second business interface has not passed the verification is generated to enhance the accuracy of the verification result of the generated business interface.
[0077] Exemplarily, the preset verification period may be one day, three days, one week, etc.
[0078] It should be noted that, if it is set that in addition to comparing whether the first output result and the second output result are the same, a first time taken for the first service interface to return the first output result and a second time taken for the second service interface to return the second output result are further compared, then the generation condition of the first message indicating that the second service interface has passed the verification is:
[0079] Each of the N interface verification results indicates that the business processing logic of the first business interface and the second business interface is the same, and the first time corresponding to each of the N interface verification results is greater than the second time corresponding to each interface verification result.
[0080] At this time, the second message is generated without generating the first message.
[0081] In one embodiment, after generating the interface verification result according to the first output result and the second output result, the method further includes:
[0082] When multiple business interfaces included in the new business system have passed verification, the business traffic corresponding to the old business system is gradually diverted to the new business system according to the preset grayscale deployment mechanism, and the operation of the new business system is monitored to see whether it is normal;
[0083] When it is monitored that the operation of the new service system remains normal within a preset monitoring period, the old service system is replaced based on the new service system.
[0084] Among them, when it is monitored that the new business system has abnormal operation during the preset monitoring period, the diversion operation of the business traffic corresponding to the old business system is stopped until the defect corresponding to the above abnormal problem in the new business system is repaired, and then the above diversion operation is repeated.
[0085] In the application, when the output result returned by the new business system for the allocated traffic (generated by the old business system diversion) is the same as the expected result (or the output result returned by the old business system for the traffic), the new business system is considered to be operating normally, otherwise it is considered abnormal.
[0086] In this embodiment, when multiple business interfaces included in the new business system have passed verification, the business traffic corresponding to the old business system is gradually diverted to the new business system through a preset grayscale deployment mechanism, so as to achieve limited actual measurement of the operating status of the new business system while ensuring the operational stability of the business system and keeping the system upgrade risk within a controllable range. Only when the actual measurement passes, the switch between the old and new business systems is performed.
[0087] Exemplarily, the grayscale deployment mechanism may be:
[0088] In the first monitoring sub-period, 80% of the service traffic is allocated to the old service system, and 20% of the service traffic is allocated to the new service system;
[0089] In the second monitoring sub-period, 60% of the service traffic is allocated to the old service system, and 40% of the service traffic is allocated to the new service system;
[0090] In the third monitoring sub-period, 30% of the service traffic is allocated to the old service system, and 30% of the service traffic is allocated to the new service system;
[0091] The preset monitoring period includes the first monitoring sub-period, the second monitoring sub-period and the third monitoring sub-period.
[0092] For ease of understanding, the following examples are provided:
[0093] like Figure 4 As shown, the system reconstruction process is as follows:
[0094] Step 1: Pre-upgrade preparation.
[0095] Conduct a comprehensive performance and functional analysis of the old business system, identify the business interfaces and functional points that need to be upgraded, design and develop new business interfaces based on this, and fully test the new business interfaces in a test environment to ensure their performance and stability.
[0096] Step 2: Automated verification.
[0097] By setting the aspect at the business interface of the old business system, the real request (understood as the aforementioned target input data) sent by the gateway to the business interface of the old business system (understood as the aforementioned first business interface) is intercepted in a non-invasive manner, and the corresponding interface of the new business system (understood as the aforementioned second business interface) is asynchronously called, and the two output results returned by the two business interfaces for the same real request are compared and recorded.
[0098] The specific process is: in the old business system, through aspect programming technology, the real request data of the online environment (i.e. the aforementioned target input data) is collected in real time. The collected content may include request parameters, header information, etc., which are used as interface input parameters of the corresponding business interface of the new business system (i.e. the aforementioned second business interface) for subsequent interface testing.
[0099] Among them, a switch (which can be understood as the aforementioned interface call switch) is set to control whether to perform comparison and verification, and the configuration center can control the opening and closing of the switch.
[0100] When the switch is in the on state, the collected real request data will be asynchronously transmitted to the corresponding interface of the new business system through the set data channel to avoid the above data transmission process affecting the operating environment of the old business system (avoiding data transmission operations from squeezing out the available computing power of the old business system).
[0101] After obtaining the output results of the business interface corresponding to the new business system, use the preset comparison tool to compare and record the output results of the new and old business systems. The comparison tool can be a json-unit-assertj tool. Specifically, if the comparison tool finds that the two output results are consistent, no other processing is performed. If the two output results are inconsistent, an error log is formed according to the corresponding real request, the two output results and the corresponding business interface identifier, and the error log is stored in the database. At the same time, the error log is output externally to prompt the user to correct the business processing logic of the business interface corresponding to the new business system, so that the corrected business processing logic of the new business system is consistent with the business processing logic of the old business system.
[0102] In the application, the comparison tool can also perform visual display of the two inconsistent output results when the two output results are inconsistent.
[0103] Step 3: Design and implement a grayscale deployment strategy.
[0104] Gradually introduce the business interfaces of the new business system into the production environment to control the risks of system upgrades. Specifically, formulate an appropriate grayscale release ratio and schedule (which can be understood as the aforementioned grayscale deployment mechanism) based on the business needs and system load corresponding to the old business system.
[0105] Step 4: Full deployment and verification.
[0106] After the new business system is verified to be correct during the grayscale deployment phase (i.e. the new business system operates normally during the preset monitoring period), the new business system will be fully deployed to ensure the stability and consistency of the new business system through comprehensive functional and performance verification.
[0107] Step 5: New business system monitoring and maintenance.
[0108] After the upgrade of the old business system is completed, continue to monitor the performance and user feedback of the new business system to ensure the stable operation of the business interface of the new business system.
[0109] Through the application of the above solution, the correctness of the interface logic can be guaranteed during system reconstruction, ensuring business continuity and stability, and avoiding business interruption or performance degradation due to interface upgrades. Among them, through automated verification and comparison settings, potential problems can be detected and handled in real time during the system reconstruction process, effectively reducing the risk of system upgrades.
[0110] See also Figure 5 , Figure 5 is an interface verification device provided by an embodiment of the present disclosure, such as Figure 5 As shown, the interface verification device 500 includes:
[0111] A data acquisition module 501 is used to acquire target input data based on a section set at a first business interface, and a first output result returned by the first business interface using the target input data as an interface input parameter, wherein the first business interface is one of a plurality of business interfaces included in the old business system, and the target input data is business input data received by the first business interface in a production environment;
[0112] The interface calling module 502 is used to call a second business interface and obtain a second output result returned by the second business interface using the target input data as an interface input parameter, wherein the second business interface is a business interface used to replace the first business interface among multiple business interfaces included in the new business system, and the new business system is a system used to replace the old business system;
[0113] The verification module 503 is used to generate an interface verification result according to the first output result and the second output result, wherein the interface verification result is used to indicate whether the business processing logic of the first business interface and the second business interface are the same.
[0114] In one embodiment, the interface calling module 502 includes:
[0115] The interface calling unit is used to call the second business interface based on the preset interface calling switch when the preset interface calling switch is in the turned-on state, and obtain the second output result returned by the second business interface with the target input data as the interface input parameter.
[0116] In one embodiment, the data acquisition module 501 includes:
[0117] A candidate data acquisition unit, configured to acquire a plurality of candidate input data based on a section set at the first business interface, each of the candidate input data being business input data received by the first business interface in a production environment;
[0118] The data sampling unit is used to sample the multiple candidate input data to determine at least one sampled input data, where the at least one sampled input data includes the target input data.
[0119] In one embodiment, the interface verification device 500 further includes a performance comparison module, and the performance comparison module is used to:
[0120] Obtaining a first time taken by the first service interface to return the first output result, and a second time taken by the second service interface to return the second output result;
[0121] When the first duration is less than or equal to the second duration, performance alarm information is output, where the performance alarm information is used to indicate that the service processing performance of the second service interface is less than or equal to the service processing performance of the first service interface.
[0122] In one embodiment, the interface verification device 500 further includes a message generation module, and the message generation module is used to:
[0123] Obtain N of the interface verification results generated within a preset verification period, where N is a positive integer;
[0124] When each of the N interface verification results indicates that the service processing logic of the first service interface and the second service interface is the same, generating a first message indicating that the second service interface has passed the verification;
[0125] When the N interface verification results include at least one interface verification result indicating that the service processing logics of the first service interface and the second service interface are different, a second message indicating that the second service interface has failed verification is generated.
[0126] In one embodiment, the interface verification device 500 further includes a system switching module, and the system switching module is used to:
[0127] When multiple business interfaces included in the new business system have passed verification, the business traffic corresponding to the old business system is gradually diverted to the new business system according to the preset grayscale deployment mechanism, and the operation of the new business system is monitored to see whether it is normal;
[0128] When it is monitored that the operation of the new service system remains normal within a preset monitoring period, the old service system is replaced based on the new service system.
[0129] The interface verification device 500 provided in the embodiment of the present disclosure can implement each process in the above-mentioned interface verification method embodiment, and will not be described again here to avoid repetition.
[0130] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0131] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0132] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 to a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0133] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0134] The computing unit 601 can be various general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSP), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as the interface verification method. For example, in some embodiments, the interface verification method can be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the interface verification method described above can be executed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the interface verification method in any other appropriate manner (eg, by means of firmware).
[0135] Various embodiments of the systems and techniques described above herein may be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0136] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0137] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0138] As used herein, the term "machine-readable medium" refers to any computer program product, apparatus, and / or device (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0139] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0140] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0141] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0142] The present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the above Figure 1 or Figure 3The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.
[0143] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0144] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. An interface verification method, characterized in that: The method comprises: Acquire target input data based on a section set at a first business interface, and a first output result returned by the first business interface using the target input data as an interface input parameter, wherein the first business interface is one of a plurality of business interfaces included in the old business system, and the target input data is business input data received by the first business interface in a production environment; Calling a second business interface to obtain a second output result returned by the second business interface using the target input data as an interface input parameter, wherein the second business interface is a business interface of a plurality of business interfaces included in a new business system and used to replace the first business interface, and the new business system is a system used to replace the old business system; An interface verification result is generated according to the first output result and the second output result, where the interface verification result is used to indicate whether the service processing logics of the first service interface and the second service interface are the same.
2. The method according to claim 1, characterized in that The calling of the second service interface to obtain the second output result returned by the second service interface using the target input data as an interface input parameter includes: When the preset interface calling switch is in an on state, the second service interface is called based on the interface calling switch to obtain a second output result returned by the second service interface using the target input data as an interface input parameter.
3. The method according to claim 1, characterized in that The acquiring target input data based on the aspect set at the first business interface includes: Acquire multiple candidate input data based on the aspect set at the first business interface, each of the candidate input data is business input data received by the first business interface in the production environment; The plurality of candidate input data are sampled to determine at least one sampled input data, where the at least one sampled input data includes the target input data.
4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: Obtaining a first time taken by the first service interface to return the first output result, and a second time taken by the second service interface to return the second output result; When the first duration is less than or equal to the second duration, performance alarm information is output, where the performance alarm information is used to indicate that the service processing performance of the second service interface is less than or equal to the service processing performance of the first service interface.
5. The method according to any one of claims 1 to 3, characterized in that: After generating the interface verification result according to the first output result and the second output result, the method further includes: Obtain N of the interface verification results generated within a preset verification period, where N is a positive integer; When each of the N interface verification results indicates that the service processing logic of the first service interface and the second service interface is the same, generating a first message indicating that the second service interface has passed the verification; When the N interface verification results include at least one interface verification result indicating that the service processing logics of the first service interface and the second service interface are different, a second message indicating that the second service interface has failed verification is generated.
6. The method according to claim 5, characterized in that After generating the interface verification result according to the first output result and the second output result, the method further includes: When multiple business interfaces included in the new business system have passed verification, the business traffic corresponding to the old business system is gradually diverted to the new business system according to the preset grayscale deployment mechanism, and the operation of the new business system is monitored to see whether it is normal; When it is monitored that the operation of the new service system remains normal within a preset monitoring period, the old service system is replaced based on the new service system.
7. An interface verification device, characterized in that: The device comprises: A data acquisition module, configured to acquire target input data based on a section set at a first business interface, and a first output result returned by the first business interface using the target input data as an interface input parameter, wherein the first business interface is one of a plurality of business interfaces included in the old business system, and the target input data is business input data received by the first business interface in a production environment; an interface calling module, used to call a second business interface, and obtain a second output result returned by the second business interface using the target input data as an interface input parameter, wherein the second business interface is a business interface used to replace the first business interface among multiple business interfaces included in the new business system, and the new business system is a system used to replace the old business system; A verification module is used to generate an interface verification result according to the first output result and the second output result, wherein the interface verification result is used to indicate whether the business processing logic of the first business interface and the second business interface is the same.
8. An electronic device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the method according to any one of claims 1 to 6 when executed by the processor.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 6.