Proxy service configuration method and apparatus, computer device, and storage medium
Patent Information
- Application Number
- CN202310140900.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-15
- Publication Date
- 2026-09-04
- Estimated Expiration
- 2043-02-15
AI Technical Summary
[0003]但是,由于开发的新版本页面和新版本数据接口未正式上线或测试环境不稳定,导致在提测过程中很多时候会出现使用了新版本页面,却未能获取到新版本数据接口的情况
[0034] For a description of the effects of the configuration device, computer equipment, and computer-readable storage medium for the above-mentioned proxy service, please refer to the description of the configuration method for the above-mentioned proxy service, which will not be repeated here.
Smart Images

Figure CN116166269B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a method, apparatus, computer device, and storage medium for configuring a proxy service. Background Technology
[0002] During business integration testing, to obtain new business functions, front-end developers typically need to develop new versions of web pages, while back-end developers develop matching new versions of data interfaces. To verify whether the new business functions can function correctly, testers need to submit tests to the newly developed web pages and data interfaces.
[0003] However, due to the fact that the newly developed page and data interface have not been officially launched or the testing environment is unstable, there are often situations during the testing process where the new page is used but the new data interface cannot be accessed. In this case, to complete the testing of the new page, testers need to have high programming skills and write an interface proxy service to call the new data interface, which greatly increases the difficulty of testing.
[0004] Therefore, how to reduce the testing difficulty when submitting new versions of pages and data interfaces for testing has become an urgent problem to be solved. Summary of the Invention
[0005] This disclosure provides at least one method, apparatus, computer device, and storage medium for configuring a proxy service.
[0006] In a first aspect, embodiments of this disclosure provide a method for configuring a proxy service, including:
[0007] In response to the proxy configuration operation being triggered, the configured target interface proxy rules are obtained; the target interface proxy rules indicate a second data interface for proxying the first data interface; the first data interface is used to obtain the first test data of the target version; the second data interface is used to obtain the second test data of versions after the target version;
[0008] Based on the initial syntax of the target interface proxy rule, the target interface proxy rule is converted into executable code that conforms to the target syntax; the initial syntax and the target syntax have different applicable objects, and the target syntax is matched with the proxy execution tool;
[0009] The executable code is executed using the proxy execution tool to start a target proxy service associated with the first data interface; the target proxy service is used to obtain the second test data through the second data interface, and the second test data is used to test the page functionality.
[0010] In one possible implementation, after initiating the target proxy service associated with the first data interface, the method further includes:
[0011] In response to triggering a page function related to the first data interface on the page to be tested, the second test data is obtained from the second data interface using the target proxy service;
[0012] The page functions are tested using the second test data to obtain the test results corresponding to the page functions.
[0013] In one possible implementation, obtaining the configured target interface proxy rules includes:
[0014] Send the target user identifier to the cloud management platform;
[0015] Obtain the list of proxy rules that match the target user identifier, as fed back by the cloud management platform; the list of proxy rules includes at least one interface proxy rule;
[0016] In response to the rule selection operation, the interface proxy rule selected from the proxy rule list is used as the target interface proxy rule.
[0017] In one possible implementation, the step of using the proxy execution tool to execute the executable code to start the target proxy service associated with the first data interface includes:
[0018] Start the request forwarding service; the request forwarding service has the function of intercepting requests to access the initial data interface and forwarding the intercepted requests to the target data interface;
[0019] In response to combining the proxy execution tool with the initiated request forwarding service, the executable code is executed using the proxy execution tool combined with the request forwarding service to initiate the target proxy service.
[0020] In one possible implementation, the interface proxy rules are configured according to the following steps:
[0021] Use the command-line interface (CLI) tool to obtain the target user identifier and configure the proxy rules to be debugged;
[0022] If the debugging of the proxy rule to be debugged is successful, the proxy rule to be debugged and the target user identifier are sent to the cloud management platform, so that the cloud management platform will store the proxy rule to be debugged as a configured interface proxy rule and associate it with the target user identifier.
[0023] In one possible implementation, after obtaining the test results corresponding to the page function, the method further includes:
[0024] If the test results indicate that the test has passed, the page functionality will be published online.
[0025] In one possible implementation, the step of responding to triggering a page function related to the first data interface on the page to be tested, and obtaining the second test data from the second data interface using the target proxy service, includes:
[0026] In response to triggering a page function related to the first data interface on the page to be tested, a target request for the first data interface is generated.
[0027] After intercepting the target request through the target proxy service, the target request is forwarded to the second data interface, and the second test data corresponding to the first test data is obtained from the second data interface.
[0028] Secondly, embodiments of this disclosure also provide a configuration apparatus for a proxy service, comprising:
[0029] The acquisition module is used to acquire the configured target interface proxy rules in response to the proxy configuration operation being triggered; the target interface proxy rules indicate a second data interface for proxying the first data interface; the first data interface is used to acquire the first test data of the target version; the second data interface is used to acquire the second test data of versions after the target version;
[0030] The conversion module is used to convert the target interface proxy rule into executable code that conforms to the target syntax based on the initial syntax of the target interface proxy rule; the initial syntax and the target syntax have different applicable objects, and the target syntax is matched with the proxy execution tool;
[0031] The startup module is used to execute the executable code using the proxy execution tool to start the target proxy service associated with the first data interface; the target proxy service is used to obtain the second test data through the second data interface, and the second test data is used to test the page functionality.
[0032] Thirdly, an optional implementation of this disclosure also provides a computer device, a processor, and a memory, wherein the memory stores machine-readable instructions executable by the processor, and the processor is configured to execute the machine-readable instructions stored in the memory. When the machine-readable instructions are executed by the processor, the steps of the first aspect above, or any possible implementation of the first aspect, are performed.
[0033] Fourthly, an optional implementation of this disclosure also provides a computer-readable storage medium storing a computer program that, when run, performs the steps of the first aspect or any possible implementation of the first aspect.
[0034] For a description of the effects of the configuration device, computer equipment, and computer-readable storage medium for the above-mentioned proxy service, please refer to the description of the configuration method for the above-mentioned proxy service, which will not be repeated here.
[0035] The proxy service configuration method, apparatus, computer device, and storage medium provided in this disclosure, by pre-configuring interface proxy rules, allow testers to directly obtain the necessary interface proxy rules when testing is required, eliminating the need for testers to actively write code for proxying data interfaces. Then, by converting the target interface proxy rules into executable code conforming to the target syntax and executing it, the deployment and startup of the target proxy service for data interface proxying can be automatically completed. Subsequently, the started target proxy service can be used to perform functional testing of the page under test. The entire process of configuring the target proxy service not only eliminates the need for testers to actively write code, reducing the technical requirements and testing difficulty for testers, but also enables rapid and automatic deployment, which is beneficial to improving the efficiency of subsequent functional testing.
[0036] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0037] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.
[0038] Figure 1 A flowchart illustrating a method for configuring a proxy service provided in an embodiment of this disclosure is shown;
[0039] Figure 2 This illustration shows a flowchart of a specific implementation of a proxy service configuration method provided in an embodiment of this disclosure;
[0040] Figure 3This illustration shows a specific process diagram of a configuration and consumer interface proxy rule provided in an embodiment of this disclosure;
[0041] Figure 4 A schematic diagram of a configuration apparatus for a proxy service provided in an embodiment of this disclosure is shown;
[0042] Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of this disclosure is shown. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown herein can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.
[0044] Furthermore, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein.
[0045] In this article, "multiple or several" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0046] Research has revealed that, since testers typically lack coding skills, directly requiring them to write API proxy services to call the new version's data interface—for example, by writing whistle code—when a new version's data interface cannot be obtained, not only increases the technical requirements and difficulty of testing but also fails to guarantee the accuracy of the code, thus compromising the accuracy of the test results. Therefore, accurately configuring code services when a new version's data interface cannot be obtained has become a significant technical challenge.
[0047] Based on the above research, this disclosure provides a method, apparatus, computer device, and storage medium for configuring a proxy service. By pre-configuring interface proxy rules, testers can directly obtain the necessary interface proxy rules when testing, eliminating the need for testers to actively write code for proxying data interfaces. Then, by converting the target interface proxy rules into executable code conforming to the target syntax and executing it, the deployment and startup of the target proxy service for data interface proxying can be automatically completed. Subsequently, the started target proxy service can be used to perform functional testing of the pages under test. The entire process of configuring the target proxy service not only eliminates the need for testers to actively write code, reducing the technical requirements and testing difficulty for testers, but also enables rapid and automatic deployment, which is beneficial to improving the efficiency of subsequent functional testing.
[0048] The shortcomings of the above solutions are the result of the inventor's practical experience and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.
[0049] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0050] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0051] It should be noted that the specific terms mentioned in the embodiments of this disclosure include:
[0052] CLI: Command-Line Interface, was the most widely used user interface before the widespread adoption of graphical user interfaces. Users input commands via the keyboard, and the computer receives and executes the commands.
[0053] Whistle: A cross-platform web debugging proxy tool based on Node.js;
[0054] Express is a minimalist and flexible web application development framework based on the Node.js platform. It offers a range of powerful features that enable the rapid creation of various web and mobile applications. Simply put, Express is the Node.js module used to build servers.
[0055] To facilitate understanding of this embodiment, a detailed description of the proxy service configuration method disclosed in this disclosure embodiment will be provided first. The execution subject of the proxy service configuration method provided in this disclosure embodiment is generally a terminal device or other processing device with certain computing capabilities. The terminal device can be a user equipment (UE), mobile device, user terminal, terminal, personal digital assistant device (PDA), handheld device, computer device, etc. In some possible implementations, the proxy service configuration method can be implemented by the processor calling computer-readable instructions stored in the memory.
[0056] The following describes the configuration method of the proxy service provided in this embodiment, taking the test client as the execution subject as an example.
[0057] like Figure 1 The flowchart shown is a configuration method for a proxy service provided in an embodiment of this disclosure, which may include the following steps:
[0058] S101: In response to the proxy configuration operation being triggered, obtain the configured target interface proxy rules; the target interface proxy rules indicate that there is a second data interface for proxying the first data interface; the first data interface is used to obtain the first test data of the target version; the second data interface is used to obtain the second test data of versions after the target version.
[0059] Here, proxy rules for various interfaces, configured by the proxy rule administrator, can be pre-stored on the cloud management platform. Different proxy rules are used to indicate the proxy relationship between different data interfaces. For example, proxy rule 1 indicates that data interface a is used to proxy data interface 1, proxy rule 2 indicates that data interface b is used to proxy data interface 2, and proxy rule 3 indicates that data interface c is used to proxy data interface 3. The proxied data interface indicated in the proxy rule can be used to obtain the first test data of the target version. The data interface indicated in the proxy rule for proxying the proxied data interface can be used to obtain the second test data of a version after the target version. The second test data can specifically be the second test data corresponding to the first test data (also called mock data), and the first and second test data are different. The target version can be any version, and the versions after the target version can specifically be any version that is iteratively updated after the target version. For example, the versions after the target version can be the next version, the next-next version, etc., of the target version. For example, the target version can be an old version, and the versions after the target version can be new versions. The second test data is used to test the new page functions in the new version of the page, while the first test data can be used to test the old page functions in the old version of the page.
[0060] The proxy configuration operation is used to configure the proxy service. The proxy configuration operation can be triggered in specific situations, such as triggering the page test process, actively triggering the page interface proxy process, actively triggering the interface proxy rule acquisition service, actively triggering the data simulation process, and the user actively sending a request to the cloud management platform to obtain the interface proxy rules.
[0061] The target interface proxy rule is a proxy rule selected by the tester from multiple interface proxy rules. It is used to instruct the second data interface used to proxy the first data interface. The first data interface is used to obtain the first test data for the target version; this interface corresponds to the target version of the page, which can be the previous version. The second data interface is used to obtain the second test data for versions following the target version; this interface corresponds to the new version of the page, which can be the next version, the version after that, etc. The target interface proxy rule can include at least one.
[0062] For example, after logging into the test client, testers can use the CLI tool deployed on the test client to trigger a data simulation process, in which the test client requests the various interface proxy rules of the storage from the cloud management platform. After obtaining the various interface proxy rules from the cloud management platform, the testers can select the target interface proxy rule to be used from the obtained interface proxy rules.
[0063] In one embodiment, the above-described S101 can be implemented according to the following steps:
[0064] S101-1: Send the target user identifier to the cloud management platform.
[0065] Here, different proxy rule administrators can have different user identifiers, which are used to uniquely identify the proxy rule administrator. The target user identifier is the user identifier corresponding to the proxy rule administrator who configured the target interface proxy rule.
[0066] In practice, after determining that a target proxy rule administrator is needed, testers can use the CLI tool in the test client to input the target user identifier of the target proxy rule administrator. The test client can then send the target user identifier to the cloud management platform.
[0067] S101-2: Obtain the list of proxy rules that match the target user identifier from the cloud management platform; the list of proxy rules includes at least one interface proxy rule.
[0068] Here, each proxy rule administrator corresponds to a list of proxy rules. Since each proxy rule administrator has a unique user identifier, the proxy rule list corresponding to each proxy rule administrator is the list of proxy rules that matches the user identifier of that proxy rule administrator. The proxy rule list corresponding to each proxy rule administrator can include the various interface proxy rules pre-configured by that proxy rule administrator.
[0069] In practice, after receiving the target user identifier sent by the test server, the cloud management platform can determine the list of proxy rules matching the target user identifier from the stored list of proxy rules and send this list of matching proxy rules back to the test server. In this way, the test server can obtain the list of proxy rules matching the target user identifier.
[0070] S101-3: In response to the rule selection operation, the interface proxy rule selected from the proxy rule list will be used as the target interface proxy rule.
[0071] Here, the rule selection operation refers to the operation of selecting a proxy rule from the interface proxy rules included in the proxy rule list. For example, the rule selection operation can be the operation of clicking on an interface proxy rule.
[0072] For example, after obtaining a list of proxy rules matching the target user identifier, the testing end can display this list to the testers. The testers can then click on an interface proxy rule in the displayed list, and the testing end can respond to this click by using the clicked interface proxy rule as the target interface proxy rule.
[0073] S102: The initial syntax based on the target interface proxy rules converts the target interface proxy rules into executable code that conforms to the target syntax; the initial syntax and the target syntax are applicable to different objects, and the target syntax is matched with the proxy execution tool.
[0074] Here, the API proxy rules configured by the proxy rule administrator can be written using a preset initial syntax. For example, the initial syntax can be based on Whistle syntax, while the target syntax matches the proxy execution tool; that is, the target syntax is one that the proxy execution tool deployed locally on the test server can recognize. The proxy execution tool is a tool that can start the proxy service according to the target API proxy rules and can run on the test server. The initial syntax and the target syntax are different syntaxes and have different applicability. For example, the initial syntax is suitable for the proxy rule administrator, helping them to quickly and accurately write proxy rules, but it is not easy for the proxy execution tool to understand. The target syntax is suitable for the proxy execution tool, making it easy for the proxy execution tool to recognize, but not easy for the proxy rule administrator to recognize.
[0075] For example, based on the conversion relationship between the initial syntax and the target syntax corresponding to the target interface proxy rule, the target interface proxy rule can be converted into executable code that the proxy execution tool can recognize and run. In this way, the acquired target interface proxy rule can be converted into a proxy configuration that can be consumed on the test end.
[0076] S103: Execute executable code using the proxy execution tool to start the target proxy service associated with the first data interface; the target proxy service is used to obtain the second test data through the second data interface, and the second test data is used to test the page functionality.
[0077] Here, the first test data is data obtained from the first data interface, and the second test data, which can be called mock data, is data obtained from the second data interface and can be used to test the page functionality of the page under test. The target proxy service can intercept requests to the first data interface and convert them into requests to the second data interface to obtain the second test data corresponding to the first test data. The first test data is used to test the original page functionality of the page under test, and the second test data is used to test new page functionality of the page under test.
[0078] In practice, after obtaining executable code that conforms to the target syntax, the executable code can be run using a proxy execution tool. If the executable code is successfully run, the target proxy service related to the first data interface can be started.
[0079] In one embodiment, S103 described above can also be implemented according to the following steps:
[0080] S103-1: Start the request forwarding service; the request forwarding service has the function of intercepting requests to access the initial data interface and forwarding the intercepted requests to the target data interface.
[0081] Here, the proxy execution tool can be a proxy middleware that exists as a plugin. In order to ensure the operation of the proxy execution tool, it is necessary to provide a corresponding slot service for the proxy execution tool. The request forwarding service is the slot service that can ensure the operation of the proxy execution tool.
[0082] For example, the request forwarding service can be a service provided by the Express server, equivalent to a basic proxy framework, which has the function of intercepting requests to access the initial data interface and forwarding the intercepted requests to the target data interface. For example, if the initial data interface is data interface 1 and the target data interface is data interface a, for a request to access data interface 1, the request forwarding service can be used to forward the request to data interface a.
[0083] In practice, after obtaining the executable code, you can first start the Express server and use the services provided by the Express server as request forwarding services.
[0084] S103-2: In response to combining the proxy execution tool with the initiated request forwarding service, the executable code is executed using the proxy execution tool combined with the request forwarding service to initiate the target proxy service.
[0085] In practice, the proxy execution tool can be inserted into a slot provided by the request forwarding service, thus combining the proxy execution tool with the started request forwarding service. This combination ensures the smooth operation of the proxy execution tool. Then, the inserted proxy execution tool (i.e., the proxy execution tool combined with the request forwarding service) can execute executable code, thereby setting up the proxy associated with the first data interface and starting the target proxy service.
[0086] In this way, by pre-configuring interface proxy rules, testers can directly obtain the necessary interface proxy rules when they need to perform tests, without requiring them to actively write code for proxying data interfaces. Then, by converting the target interface proxy rules into executable code conforming to the target syntax and executing it, the deployment and startup of the target proxy service for data interface proxying can be automatically completed. Subsequently, the started target proxy service can be used to perform functional testing of the pages under test. The entire process of configuring the target proxy service not only eliminates the need for testers to actively write code, reducing the technical requirements and testing difficulty, but also enables rapid and automated deployment, which improves the efficiency of subsequent functional testing.
[0087] like Figure 2 The diagram shown is a flowchart illustrating a specific implementation of a proxy service configuration method provided in this disclosure, which may include the following steps:
[0088] 1. Agent consumers (e.g., testers, product personnel, etc.) trigger the data simulation process through CLI tools deployed on the test site.
[0089] 2. The test server retrieves a list of proxy rules from the cloud management platform. This list of proxy rules retrieved from the cloud management platform can be a list of proxy rules that match the target user identifier.
[0090] 3. Proxy consumer selects target interface proxy rules.
[0091] 4. Convert the target interface proxy rules into proxy configuration. That is, convert the target interface proxy rules into executable code that conforms to the target syntax.
[0092] 5. Send the agent configuration to the agent execution tool and start the agent. Here, you can send the executable code to the agent execution tool and use the agent execution tool to execute the executable code to start the target agent service related to the first data interface.
[0093] 6. Complete the configuration and startup of the agent.
[0094] The specific implementation process of 1 to 6 above can be referred to the above embodiments, and will not be repeated here. Based on 1 to 6 above, non-technical personnel such as testers can obtain interface proxy rules and complete the configuration of proxy services in the cloud by using CLI tools. This allows them to quickly synchronize the proxy rules set by the proxy rule administrator without writing code themselves, and then use the configured proxy service to perform product acceptance and correctness verification.
[0095] Furthermore, after starting the target proxy service, when a request for the first data interface is subsequently obtained, the target proxy service can be used to redirect the request to the second data interface.
[0096] In one embodiment, after the target proxy service is started, the following steps may also be performed:
[0097] Step 1: In response to triggering the page function related to the first data interface on the page to be tested, obtain the second test data from the second data interface using the target proxy service.
[0098] Here, the page to be tested can be a new version page that needs to be tested. The page functions of the previous version page of this new version page can be tested using the first test data obtained from the first data interface, while the page to be tested cannot be tested using the first test data obtained from the first data interface.
[0099] Page functionality refers to the functions that page components in the page to be tested can have. The page to be tested can include multiple page components, and different page components can have different page functions. Different page functions can be associated with different data interfaces, and testers can start different target proxy services for different page functions.
[0100] In practice, after starting the target proxy service, it can be used to test the page to be tested. For example, a tester can trigger a page function related to the first data interface on the page to be tested displayed on the test client (e.g., clicking a page component related to the first data interface). The test client can respond to the tester's trigger operation. If it is determined that the data interface triggered by the trigger operation matches the data interface proxied by the target proxy service, the started target proxy service can be used to obtain second test data from the second data interface for testing the page function related to the first data interface.
[0101] For example, the first data interface can be www.abc.com, the second data interface can be www.aabbcc.com, and the page function associated with the first data interface can be page function a. After the tester triggers page function a, the second test data can be obtained from www.aabbcc.com using the target proxy service.
[0102] In one embodiment, step one above can be implemented according to the following steps:
[0103] S1: In response to triggering page functions related to the first data interface on the page to be tested, generate a target request for the first data interface.
[0104] For example, the test client can generate a target request for requesting data from the first data interface in response to triggering a page function related to the first data interface on the page to be tested.
[0105] S2: After intercepting the target request through the target proxy service, forward the target request to the second data interface, and obtain the second test data corresponding to the first test data from the second data interface.
[0106] For example, a target proxy service can be used to analyze the target request. If it is determined that the target request matches the target interface proxy rule corresponding to the target proxy service, that is, if it is determined that the data interface requested by the target request is the data interface proxied by the target proxy service, the target proxy service can be used to intercept the target request. After successfully intercepting the target request, the target proxy service can be used to forward the target request to the second data interface to obtain the second test data corresponding to the first test data from the second data interface.
[0107] Step 2: Use the second test data to test the page functions and obtain the test results corresponding to the page functions.
[0108] Here, test results can include "test passed" and "test failed." If a test fails, it indicates a functional error in the page being tested. This error information can then be relayed to the developers for fixes.
[0109] For example, testers can use the acquired second test data to test the triggered page functionality and obtain test results. For instance, if the second test data matches the page functionality, the test result can be determined as passed; otherwise, the test result can be determined as failed.
[0110] In one embodiment, if the test result corresponding to the page function indicates that the test has passed, the page function can also be published online.
[0111] For example, if the page functionality test passes, it means the page functions correctly and can support normal user operation. Therefore, the page functionality can be published online for use by all users.
[0112] Optionally, once it's confirmed that all page functions within the test page have passed testing, the entire test page can be published online. This allows users to directly access the new version of the test page.
[0113] In one embodiment, the step of storing the interface proxy rules on the cloud management platform can be implemented according to the following steps:
[0114] T1: Use the command-line interface (CLI) tool to obtain the target user identifier and configure the agent rules to be debugged.
[0115] Here, the proxy rule administrator can configure interface proxy rules using CLI tools deployed on the test or development side. Proxy rules to be debugged are the interface proxy rules configured by the proxy rule administrator that have not yet been debugged.
[0116] Specifically, after the proxy rules administrator logs into the CLI tool, it can first be determined whether the administrator has permission to configure interface proxy rules. If so, the target user identifier entered by the administrator can be obtained, and the administrator can be allowed to configure the interface proxy rules, which will then be used as the proxy rules to be debugged. Since the CLI uses whistle for proxy capability support at the underlying level, the administrator can use whistle syntax to configure the interface proxy rules.
[0117] The reason for using the interface proxy rules configured by the proxy rule administrator as the proxy rules to be debugged is that after obtaining the interface proxy rules configured by the proxy rule administrator, it is necessary to debug them in order to verify the rationality and feasibility of the configured interface proxy rules.
[0118] It should be noted that the code rules administrator can configure at least one proxy rule to be debugged.
[0119] Here, because the CLI tool is a command-line view tool, proxy rule administrators can configure proxy rules directly within the view interface. This graphical configuration approach provides proxy rule administrators with a better interactive and configuration experience.
[0120] T2: If the proxy rule to be debugged passes the debugging test, send the proxy rule to be debugged and the target user identifier to the cloud management platform so that the cloud management platform can store the proxy rule to be debugged as a configured interface proxy rule and associate it with the target user identifier.
[0121] In practice, since the CLI tool itself provides proxy capabilities, the corresponding proxy rules of the CLI tool can be configured in advance, and then the proxy capabilities provided by the CLI tool can be used to debug the configured proxy rules to be debugged.
[0122] If the proxy rule to be debugged passes the debugging test, it indicates that the proxy rule can operate accurately and reasonably. Then, the debugged proxy rule and the obtained target user identifier can be sent to the cloud management platform. After receiving the proxy rule to be debugged and the target user identifier, the cloud management platform can generate a list of proxy rules related to the target user identifier. The proxy rule to be debugged is then stored as a configured interface proxy rule in the list of proxy rules related to the target user identifier, thereby achieving the associated storage of interface proxy rules and target user identifiers.
[0123] Conversely, if the debugging of the proxy rule to be debugged fails, it indicates that there is an anomaly in the proxy rule to be debugged. An anomaly message can then be generated and fed back to the proxy rule administrator so that the proxy rule administrator can fix the anomaly in the proxy rule to be debugged.
[0124] Furthermore, after storing the target user identifier and each configured interface proxy rule as a proxy rule list on the cloud management platform, testers on the test side can use a CLI tool to retrieve the corresponding proxy rule list from the cloud management platform based on the target user identifier and display it through the CLI tool. Then, testers can select the target interface proxy rule from the retrieved proxy rule list and start the target proxy service on the test side using the target interface proxy rule to implement the proxy.
[0125] like Figure 3 The diagram illustrates a specific process for configuring and consuming interface proxy rules according to an embodiment of this disclosure, which may include the following steps:
[0126] a. Proxy rules administrator configures interface proxy rules.
[0127] b. Synchronize the API proxy rules to the cloud management platform. Here, after the configured API proxy rules have passed the test, the API proxy rules can be sent to the cloud management platform.
[0128] c. The agent consumer retrieves the agent rule list from the cloud management platform using the CLI tool.
[0129] d. The cloud management platform returns a list of agent rules.
[0130] e. The agent consumer starts the proxy according to the selected target interface proxy rules.
[0131] For the specific implementation process of a to e above, please refer to the above embodiments, which will not be repeated here.
[0132] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0133] Based on the same inventive concept, this disclosure also provides a proxy service configuration device corresponding to the proxy service configuration method. Since the principle of the device in this disclosure for solving the problem is similar to the above-mentioned proxy service configuration method in this disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0134] like Figure 4 The diagram shown is a schematic of a configuration device for a proxy service provided in an embodiment of this disclosure, including:
[0135] The acquisition module 401 is used to acquire the configured target interface proxy rule in response to the proxy configuration operation being triggered; the target interface proxy rule indicates a second data interface for proxying the first data interface; the first data interface is used to acquire the first test data of the target version; the second data interface is used to acquire the second test data of the version after the target version;
[0136] The conversion module 402 is used to convert the target interface proxy rule into executable code that conforms to the target syntax based on the initial syntax of the target interface proxy rule; the initial syntax and the target syntax have different applicable objects, and the target syntax is matched with the proxy execution tool;
[0137] The startup module 403 is used to execute the executable code using the proxy execution tool to start the target proxy service associated with the first data interface; the target proxy service is used to obtain the second test data through the second data interface, and the second test data is used to test the page functionality.
[0138] In one possible implementation, the device further includes:
[0139] Test module 404, after starting the target proxy service related to the first data interface, is used for:
[0140] In response to triggering a page function related to the first data interface on the page to be tested, the second test data is obtained from the second data interface using the target proxy service;
[0141] The page functions are tested using the second test data to obtain the test results corresponding to the page functions.
[0142] In one possible implementation, the acquisition module 401, when acquiring the configured target interface proxy rules, is used to:
[0143] Send the target user identifier to the cloud management platform;
[0144] Obtain the list of proxy rules that match the target user identifier, as fed back by the cloud management platform; the list of proxy rules includes at least one interface proxy rule;
[0145] In response to the rule selection operation, the interface proxy rule selected from the proxy rule list is used as the target interface proxy rule.
[0146] In one possible implementation, the startup module 403, when executing the executable code using the proxy execution tool to start the target proxy service associated with the first data interface, is configured to:
[0147] Start the request forwarding service; the request forwarding service has the function of intercepting requests to access the initial data interface and forwarding the intercepted requests to the target data interface;
[0148] In response to combining the proxy execution tool with the initiated request forwarding service, the executable code is executed using the proxy execution tool combined with the request forwarding service to initiate the target proxy service.
[0149] In one possible implementation, the device further includes:
[0150] Configuration module 405 is used to configure interface proxy rules according to the following steps:
[0151] Use the command-line interface (CLI) tool to obtain the target user identifier and configure the proxy rules to be debugged;
[0152] If the debugging of the proxy rule to be debugged is successful, the proxy rule to be debugged and the target user identifier are sent to the cloud management platform, so that the cloud management platform will store the proxy rule to be debugged as a configured interface proxy rule and associate it with the target user identifier.
[0153] In one possible implementation, the device further includes:
[0154] After obtaining the test results corresponding to the page functions, the publishing module 406 is used for:
[0155] If the test results indicate that the test has passed, the page functionality will be published online.
[0156] In one possible implementation, the test module 404, when responding to triggering a page function related to the first data interface in the page to be tested and obtaining the second test data from the second data interface using the target proxy service, is configured to:
[0157] In response to triggering a page function related to the first data interface on the page to be tested, a target request for the first data interface is generated.
[0158] After intercepting the target request through the target proxy service, the target request is forwarded to the second data interface, and the second test data corresponding to the first test data is obtained from the second data interface.
[0159] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0160] Based on the same technical concept, embodiments of this application also provide a computer device. (Refer to...) Figure 5 The diagram shown is a structural schematic of a computer device provided in an embodiment of this application, comprising:
[0161] The system comprises a processor 51, a memory 52, and a bus 53. The memory 52 stores machine-readable instructions executable by the processor 51. The processor 51 executes these machine-readable instructions, and when executed, performs the following steps: S101: In response to a triggered proxy configuration operation, the processor obtains a configured target interface proxy rule; the target interface proxy rule indicates a second data interface for proxying a first data interface; the first data interface is used to obtain first test data for a target version; the second data interface is used to obtain second test data for versions after the target version; S102: Based on the initial syntax of the target interface proxy rule, the processor converts the target interface proxy rule into executable code conforming to the target syntax; the initial syntax and the target syntax have different applicable objects, and the target syntax matches the proxy execution tool; and S103: The processor executes the executable code using the proxy execution tool to start a target proxy service related to the first data interface; the target proxy service is used to obtain second test data through the second data interface, and the second test data is used to test the page functionality.
[0162] The aforementioned memory 52 includes a main memory 521 and an external memory 522. The main memory 521, also known as internal memory, is used to temporarily store the computational data in the processor 51, as well as the data exchanged with external memory such as a hard disk. The processor 51 exchanges data with the external memory 522 through the main memory 521. When the computer device is running, the processor 51 and the memory 52 communicate through the bus 53, so that the processor 51 executes the execution instructions mentioned in the above method embodiments.
[0163] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the proxy service configuration method described in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0164] The computer program product of the proxy service configuration method provided in this disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the steps of the proxy service configuration method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.
[0165] The computer program product can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0166] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0167] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0168] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0169] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0170] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the user through pop-up information or by asking the user to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.
[0171] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.
Claims
1. A method for configuring a proxy service, characterized in that, include: In response to the proxy configuration operation being triggered, the configured target interface proxy rules are obtained; the target interface proxy rules indicate a second data interface for proxying the first data interface; the first data interface is used to obtain the first test data of the target version; the second data interface is used to obtain the second test data of versions after the target version; Based on the initial syntax of the target interface proxy rule, the target interface proxy rule is converted into executable code that conforms to the target syntax; The initial syntax and the target syntax are applicable to different objects, and the target syntax is matched with the proxy execution tool; The executable code is executed using the proxy execution tool to start a target proxy service associated with the first data interface; the target proxy service is used to obtain the second test data through the second data interface, and the second test data is used to test the page functionality; The target interface proxy rule is used to indicate the proxy relationship between the first data interface and the second data interface. The version after the target version includes any version that is iteratively updated after the target version. The second test data is used to test the new page functions in the new version page, and the first test data is used to test the old page functions in the old version page.
2. The method according to claim 1, characterized in that, After starting the target proxy service associated with the first data interface, the process also includes: In response to triggering a page function related to the first data interface on the page to be tested, the second test data is obtained from the second data interface using the target proxy service; The page functions are tested using the second test data to obtain the test results corresponding to the page functions.
3. The method according to claim 1, characterized in that, The process of obtaining the configured target interface proxy rules includes: Send the target user identifier to the cloud management platform; Obtain the list of proxy rules that match the target user identifier, as fed back by the cloud management platform; the list of proxy rules includes at least one interface proxy rule; In response to the rule selection operation, the interface proxy rule selected from the proxy rule list is used as the target interface proxy rule.
4. The method according to claim 1, characterized in that, The step of using the proxy execution tool to execute the executable code to start the target proxy service associated with the first data interface includes: Start the request forwarding service; the request forwarding service has the function of intercepting requests to access the initial data interface and forwarding the intercepted requests to the target data interface; In response to combining the proxy execution tool with the initiated request forwarding service, the executable code is executed using the proxy execution tool combined with the request forwarding service to initiate the target proxy service.
5. The method according to claim 1, characterized in that, Configure the interface proxy rules according to the following steps: Use the command-line interface (CLI) tool to obtain the target user identifier and configure the proxy rules to be debugged; If the debugging of the proxy rule to be debugged is successful, the proxy rule to be debugged and the target user identifier are sent to the cloud management platform, so that the cloud management platform will store the proxy rule to be debugged as a configured interface proxy rule and associate it with the target user identifier.
6. The method according to claim 2, characterized in that, After obtaining the test results corresponding to the page functions, the following is also included: If the test results indicate that the test has passed, the page functionality will be published online.
7. The method according to claim 2, characterized in that, The response to triggering a page function related to the first data interface on the page to be tested, and obtaining the second test data from the second data interface using the target proxy service, includes: In response to triggering a page function related to the first data interface on the page to be tested, a target request for the first data interface is generated. After intercepting the target request through the target proxy service, the target request is forwarded to the second data interface, and the second test data corresponding to the first test data is obtained from the second data interface.
8. A configuration device for an agent service, characterized in that, include: The acquisition module is used to acquire the configured target interface proxy rule in response to the proxy configuration operation being triggered; the target interface proxy rule indicates a second data interface for proxying the first data interface; the first data interface is used to acquire the first test data of the target version. The second data interface is used to obtain second test data for versions after the target version; The conversion module is used to convert the target interface proxy rule into executable code that conforms to the target syntax based on the initial syntax of the target interface proxy rule; The initial syntax and the target syntax are applicable to different objects, and the target syntax is matched with the proxy execution tool; The startup module is used to execute the executable code using the proxy execution tool to start the target proxy service associated with the first data interface; the target proxy service is used to obtain the second test data through the second data interface, and the second test data is used to test the page functionality; The target interface proxy rule is used to indicate the proxy relationship between the first data interface and the second data interface. The version after the target version includes any version that is iteratively updated after the target version. The second test data is used to test the new page functions in the new version page, and the first test data is used to test the old page functions in the old version page.
9. A computer device, characterized in that, include: A processor and a memory, the memory storing machine-readable instructions executable by the processor, the processor executing the machine-readable instructions stored in the memory, wherein when the machine-readable instructions are executed by the processor, the processor performs the steps of the proxy service configuration method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a computer device, performs the steps of the proxy service configuration method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Program testing method, system, apparatus, and computer-readable storage medium
CN109062806A
Application program interface generation method and device, equipment and storage medium
CN114115846A