Distributed Network Testing Method, Device, Medium and Equipment

By building a virtual network testing environment in a server or server cluster, and using mirror files and container technology to isolate the test environment, the problems of waste of resources and poor security in distributed network testing are solved, efficient and secure testing results are achieved, and flexible testing environment customization is supported.

CN115914055BActive Publication Date: 2025-07-18凌川峰(贵州)信息技术有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110899501.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-06
Publication Date
2025-07-18
Estimated Expiration
2041-08-06

AI Technical Summary

Technical Problem

The existing technology has problems such as large resource overhead, uncontrollable test environment, poor security and difficult architecture to adjust in distributed network testing, and different test environments are difficult to isolate, affecting the security and testing effect of the online network environment.

Method used

Build a virtual network test environment in a server or server cluster, and isolate the test environment through mirror files and container technology, realize a virtual architecture that corresponds to the real network nodes one by one, receive test cases and execute test cases, return test results, and use packet capture programs and databases for data management and judgment.

Benefits of technology

It realizes a high-security and controllable test environment without occupying online resources, which can accurately simulate the online environment, reduce resource overhead, avoid disconnection between the test environment and the online environment, ensure online network security, and support flexible testing environment customization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115914055B_ABST
    Figure CN115914055B_ABST
Patent Text Reader

Abstract

This article is about a distributed network testing method, device, medium and equipment. The distributed network testing method is applied to a server or a server cluster composed of multiple servers, and includes: constructing at least one virtual network test environment; the virtual network test environment receives test cases; executing the test cases and returning the test results to the front-end interface. Simulating a distributed network test environment on a physical server can be started with one key when needed, is easy to implement and does not require occupying resources in the real network environment, improving the security of the real network environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This document relates to distributed network simulation, and particularly to distributed network testing methods, devices, media, and equipment. Background Art

[0002] A distributed network corresponds to a central control network system and is a network interconnected by node machines distributed at different locations and having multiple terminals. In a distributed network environment, when developing and configuring the functions of network nodes, before deploying the developed functions to the distributed network, it is necessary to test the distributed network system. In the existing related technologies, usually a part of the online distributed network resources is extracted to form a test environment for testing. However, this testing method has the following disadvantages: ① Large resource overhead: It is necessary to occupy the resources of the online distributed network environment for testing, and this part of the resources cannot provide formal services, resulting in resource waste. ② Uncontrollable test environment: After being used as a test environment for a long time, the test environment gradually becomes disconnected from the online environment and cannot accurately simulate the online environment. ③ Poor security: The development of some functions may introduce BUGs, thus affecting the security of the entire distributed network environment. ④ Difficult to customize the environment: After extracting server resources from the online distributed network environment, it is difficult to adjust the architecture of the distributed network. ⑤ Difficult to isolate different test environments: Some functional tests require a separate distributed network environment. At this time, it is necessary to extract servers from the online again for testing, which is a cumbersome process and has a large resource overhead. Summary of the Invention

[0003] To overcome the problems existing in the related technologies, this document provides a distributed network testing method, device, media, and equipment.

[0004] According to one aspect of this document, a distributed network testing method is provided, which is applied to a server or a server cluster composed of multiple servers and includes:

[0005] Construct at least one virtual network test environment, where the virtual network test environment is located in an isolated execution environment in the server or server cluster;

[0006] The virtual network test environment receives test cases;

[0007] Execute the test cases;

[0008] Return the test results to the front-end interface.

[0009] In some embodiments of this document, based on the foregoing solution, the constructing of the virtual network test environment includes:

[0010] Construct a virtual architecture including at least one virtual network node according to the architecture required for testing, where the virtual network nodes correspond one-to-one with the real nodes;

[0011] Package the business software in the real node into an image file;

[0012] Load the image file into the virtual network node according to the corresponding relationship to build a virtual network test environment.

[0013] In some embodiments of the present invention, based on the foregoing solution, the isolated execution environment includes at least one container, and each container corresponds to a virtual network node. The step of loading the image file into the virtual network node according to the corresponding relationship includes:

[0014] Deploy the image file to the container.

[0015] In some embodiments of the present invention, based on the foregoing solution, the step of building the virtual network test environment further includes: orchestrating at least one virtual network node that loads the image file to form different virtual network test environments.

[0016] In some embodiments of the present invention, based on the foregoing solution, the virtual network test environment includes an application programming interface. The steps for the virtual network test environment to receive test cases include:

[0017] The application programming interface receives the test data submitted by the front-end interface, constructs test cases according to the test data, or receives the test cases generated and sent by the front-end interface.

[0018] In some embodiments of the present invention, based on the foregoing solution, the virtual network test environment further includes at least one virtual network node. The steps for executing the test cases include:

[0019] The application programming interface constructs one or more test requests carrying the unique identifier of the test case according to the execution parameters of the test case, and sends the test requests to the virtual network node;

[0020] The virtual network node responds to the test request, generates response data, and sends the response data to the application programming interface.

[0021] In some embodiments of the present invention, based on the foregoing solution, the virtual network test environment further includes a packet capture program. The steps for executing the test cases further include: the packet capture program obtains the packet capture data transmitted between one or more service processes in the virtual network node, and the packet capture data transmitted between multiple virtual network nodes;

[0022] Return the obtained packet capture data to the application programming interface.

[0023] In some embodiments of the present invention, based on the foregoing solution, the test case further includes a judgment condition. The steps for executing the test case further include:

[0024] The application programming interface determines whether the response data is consistent with a preset assertion according to the determination condition, and generates assertion result information;

[0025] Alternatively, the application programming interface determines whether the response data and the packet capture data are consistent with a preset assertion according to the determination condition, and generates assertion result information.

[0026] In some embodiments of this article, based on the foregoing solution, the virtual network test environment further includes a packet capture program and a database, and executing the test case further includes: the packet capture program obtains packet capture data transmitted between one or more service processes in a virtual network node, and packet capture data transmitted between multiple virtual network nodes;

[0027] The obtained packet capture data is stored in the database according to the unique identifier of the test case.

[0028] In some embodiments of this article, based on the foregoing solution, the distributed network test method further includes:

[0029] When the application programming interface receives the unique identifier of the test case sent by the front-end interface, the application programming interface obtains the packet capture data corresponding to the unique identifier from the database.

[0030] According to one aspect of this article, there is provided a distributed network test method, which is applied to a front-end interface and includes:

[0031] Receiving input information from a user, where the input information includes at least one of preset configuration information and preset function information;

[0032] Generating test data or generating one or more test cases;

[0033] Sending the test data or one or more test cases to the virtual network test environment to request testing;

[0034] Receiving a test result.

[0035] In some embodiments of this article, based on the foregoing solution, the information generated according to the preset configuration at least includes: the identifier of the virtual network test environment, execution parameters; the execution parameters include one or more of a test URL, a test node, a request method, and request header information.

[0036] In some embodiments of this article, based on the foregoing solution, the distributed network test method further includes: saving the one or more test cases.

[0037] According to one aspect of this article, there is provided a distributed network test device, which is applied to a server or a server cluster composed of multiple servers and includes:

[0038] A test environment construction module for constructing at least one virtual network test environment, where the virtual network test environment is located in an isolated execution environment in a server or a server cluster;

[0039] A test case receiving module for receiving test cases in the virtual network test environment;

[0040] An execution module for executing the test cases;

[0041] A response module for returning a front-end interface.

[0042] According to one aspect of the present disclosure, there is provided a distributed network testing apparatus applied to a front-end interface, including:

[0043] An information receiving module for receiving user input information, where the input information includes at least one of preset configuration information and preset function information;

[0044] A data conversion module for generating test data or generating one or more test cases;

[0045] A sending module for sending the test data or one or more test cases to a virtual network test environment to request testing;

[0046] A response receiving module for receiving test results.

[0047] According to one aspect of the present disclosure, there is provided a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed, the steps of a distributed network testing method are implemented.

[0048] According to one aspect of the present disclosure, there is provided a computer device including a processor, a memory, and a computer program stored on the memory, and when the processor executes the computer program, the steps of a distributed network testing method are implemented.

[0049] By constructing a virtual network test environment in the present disclosure, it is possible to simulate a complete set of online distributed network environments on a server or a server cluster composed of multiple servers. When needed, testing can be started with one key, realizing controllability of the test environment; since the virtual network test environment is isolated from the real online distributed network environment, the security is high. There is no need to extract servers from the online environment to form a test environment, which is easy to implement and does not require occupying resources in the real network environment, saving resource overhead.

[0050] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings, which form a part of this specification, are used to provide a further understanding of this specification. The schematic embodiments and descriptions thereof in this specification are used to explain this specification and do not unduly limit this specification. In the drawings:

[0052] Figure 1 is a flowchart of a distributed network testing method shown according to an exemplary embodiment.

[0053] Figure 2 is a schematic diagram of a virtual network testing environment shown according to an exemplary embodiment.

[0054] Figure 3 is a schematic diagram of a server including multiple virtual network testing environments shown according to an exemplary embodiment.

[0055] Figure 4 is a flowchart of a distributed network testing method shown according to an exemplary embodiment.

[0056] Figure 5 is a schematic diagram of a front-end interface shown according to an exemplary embodiment.

[0057] Figure 6 is a block diagram of a distributed network testing device shown according to an exemplary embodiment.

[0058] Figure 7 is a block diagram of a distributed network testing device shown according to an exemplary embodiment.

[0059] Figure 8 is a block diagram of a computer device shown according to an exemplary embodiment. Detailed Embodiments

[0060] To make the objectives, technical solutions, and advantages of the embodiments of this specification clearer, the following will clearly and completely describe the technical solutions in the embodiments of this specification with reference to the accompanying drawings in the embodiments of this specification. Apparently, the described embodiments are some, but not all, of the embodiments of this specification. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this specification without creative efforts shall fall within the scope of protection of this specification. It should be noted that, without conflict, the embodiments in this specification and the features in the embodiments may be combined with each other arbitrarily.

[0061] A distributed network corresponds to a central control network system and is a network interconnected by nodes distributed at different locations and having multiple terminals. In a distributed network environment, when developing and configuring the functions of network nodes, before deploying the developed functions to the distributed network, it is necessary to test the distributed network system. In related technologies, generally, a part of the server resources are extracted from the online distributed network to form a test environment to test the newly developed software and configurations. This solution requires a large amount of server resources, and the server resources used for testing cannot be used to provide formal services anymore, resulting in high resource overhead. Moreover, the test environment is uncontrollable, which affects the test effect; once a new BUG is introduced, it may have an adverse impact on the security of the entire online network environment; when different tasks need to be tested, it is difficult to adjust the test environment, and the test environment cannot be customized according to different test tasks; different test environments are difficult to isolate; when it is necessary to verify the test results, it is necessary to deploy a packet capture program on the servers in the test environment to capture packets, resulting in difficult verification of test results.

[0062] In view of the problems existing in the related technologies, this article provides a distributed network testing method.

[0063] Figure 1 It is a flowchart of a distributed network testing method shown according to an exemplary embodiment. Refer to Figure 1 , the distributed network testing method is applied to a server or a server cluster composed of multiple servers. In some embodiments, the server may be a host. The distributed network testing method at least includes steps S11 to S13, which are introduced in detail as follows:

[0064] In step S11, at least one virtual network test environment is constructed, and the virtual network test environment is located in an isolated execution environment in the server or server cluster. A virtual network test environment is constructed in the server or the server cluster composed of multiple servers. The server or the server cluster composed of multiple servers is used to virtualize the functions of real network nodes and install the business software in the real network nodes. In one embodiment, the business software for virtualizing the functions of one real network node can be installed on one server, or the business software for virtualizing the functions of multiple real network nodes can be installed on one server. In order to isolate the test software from the server and improve the security of the server, an isolated execution environment is established on the server, and the virtual network test environment is located in the above isolated execution environment. For example, the isolated execution environment can adopt container technology to isolate the virtual network environment in the container, and the security problems of the test environment will not affect the physical server, so that the physical server can better execute the test tasks.

[0065] In this embodiment, to construct a virtual network test environment, instead of extracting network resources from an online distributed network, a server dedicated to constructing the virtual network test environment is configured. The server or a server cluster composed of multiple servers has sufficient storage space and memory for constructing the virtual network test environment.

[0066] Figure 2 It is a schematic diagram of a virtual network test environment shown according to an exemplary embodiment. Refer to Figure 2 , constructing a virtual network test environment includes:

[0067] According to the architecture required for testing, construct a virtual architecture including at least one virtual network node, where the virtual network nodes correspond one-to-one with the real nodes;

[0068] Package the business software in the real node into an image file;

[0069] Load the image file into the virtual network nodes according to the corresponding relationship to construct a network test environment.

[0070] A network test environment is built by a server or a server cluster composed of multiple servers. Virtual network nodes are used to replace the real nodes online for testing. To ensure that the built network test environment is the same as the real online environment, first, according to the test task, it is necessary to determine how many network nodes are required to complete the test task. Because different test tasks require corresponding different architectures, that is, different nodes are configured. For example, to test whether the edge node correctly responds to user requests, only a single node needs to be tested. At this time, a virtual network test environment can be composed of a single virtual network node. If testing whether the edge node can correctly backhaul to the origin, a test environment needs to be composed of multiple nodes such as edge nodes, central nodes, and origin server nodes. At this time, a virtual network test environment can be composed of multiple virtual network nodes. The number of nodes required for different test tasks can be different, and the processing logics of each node are different, so the architectures may also be different. A virtual architecture is built on a server or a server cluster composed of multiple servers. The virtual architecture includes N virtual network nodes, where N is an integer greater than or equal to 1. The N virtual network nodes correspond one-to-one with N real nodes. For example, when building a test environment for testing whether the edge node can correctly backhaul to the origin, first build a virtual architecture. This virtual architecture includes 3 virtual network nodes, and they correspond one-to-one with the edge node, central node, and origin server node respectively. The business software in the real nodes is packaged by the user, and the business software in one node is packaged into an image file. The packaged image file is loaded into the corresponding virtual network node. For example, after the business software of the real edge node online is packaged, the packaged image file is loaded into the virtual network node corresponding to the edge node in the network test environment built on a server or a server cluster composed of multiple servers; after the business software of the real central node online is packaged, the packaged image file is loaded into the virtual network node corresponding to the central node in the network test environment built on a server or a server cluster composed of multiple servers. The built virtual network test environment includes the business software of each real node required for the test, and the logical relationship between the virtual network nodes is the same as that between the real nodes. The virtual network test environment in the server or the server cluster composed of multiple servers executes the test task, which has the same effect as the test environment composed of real nodes, and does not require occupying real online network resources, saving resource overhead. Since the business software in the virtual network node is an image file packaged from the business software in the real network node and is the same as the business software in the real node, after the business software in the real network node is updated, the image file in the virtual network node can be updated in time, avoiding the gradual disconnection between the test environment and the online network resources and being able to accurately and effectively simulate the online environment.

[0071] In an exemplary embodiment, the isolated execution environment includes at least one container, and each container corresponds to a virtual network node. Loading the image file into the virtual network node according to the corresponding relationship includes:

[0072] Deploy the image file to the container.

[0073] According to the number of virtual network nodes in the architecture of the virtual network test environment, create the same number of containers with the same logical relationship in a server or a server cluster composed of multiple servers. Then, deploy the packaged image files in each real node to the corresponding containers according to the corresponding relationship to achieve isolation of the virtual network test environment. In this embodiment, deploying the business software of each real node to a separate container can isolate the test environment from the server or a server cluster composed of multiple servers through container technology. For example, it can allow users to deploy custom code to the containers in the virtual network test environment, facilitating users to flexibly adjust the virtual network test environment. The scope of action of the code is restricted within the container, ensuring the security of the server or a server cluster composed of multiple servers.

[0074] In addition, each container corresponds to a virtual network node, and each virtual network node corresponds to a real network node. After packaging the business software in the real network node, deploy the image file to the container. Thus, after establishing at least one virtual network test environment, the existing virtual network nodes can be orchestrated in units of containers.

[0075] Figure 3 is a schematic diagram of a server including multiple virtual network test environments shown according to an exemplary embodiment. Refer to Figure 3 , constructing the virtual network test environment further includes: orchestrating at least one virtual network node that has loaded the image file to form different virtual network test environments.

[0076] After loading the business software of the real node on the line into the virtual network node on the server, the virtual network node can be orchestrated to orchestrate different virtual network test environments for testing different test tasks. For example, only the virtual network node 1 corresponding to one edge node is orchestrated to form a virtual network test environment 1 for testing the software to be deployed on the edge node. Another example is to orchestrate the virtual network node 1, the virtual network node 2 corresponding to the central server, and the virtual network node 3 corresponding to the origin server to form a virtual network test environment 2 for testing the origin configuration. The virtual network node 1 can belong to both the virtual network test environment 1 and the virtual network test environment 2. Multiple virtual network test environments can exist simultaneously in the server or a server cluster composed of multiple servers, as long as the storage space and memory of the server or the server cluster composed of multiple servers meet the requirements. Therefore, it is convenient to customize the virtual network test environment and avoid the problem that the architecture in the real distributed network is difficult to adjust. For the multiple virtual network test environments existing in the server or the server cluster composed of multiple servers, after determining the corresponding virtual network test environment according to the test task, the virtual network test environment can be started with one key, and then the business software corresponding to the N virtual network nodes in the virtual network test environment can be started.

[0077] In step S12, the virtual network test environment receives the test case.

[0078] After the virtual network test environment is constructed, it can receive the test case and execute the test task.

[0079] Reference Figure 2 , in an exemplary embodiment, the virtual network test environment includes an application programming interface. The virtual network test environment receiving the test case includes:

[0080] The application programming interface receives the test data submitted by the front-end interface and constructs a test case according to the test data; or receives the test case generated and sent by the front-end interface.

[0081] In this application, the virtual network test environment includes an application programming interface. The application programming interface is used for the virtual network test environment to interact with the outside world. For example, the application programming interface can be an API interface, which is used to receive test cases and provide the test cases to the virtual network test environment for testing. Or, it can receive test data, construct test cases based on the test data, and then provide the test cases to the virtual network test environment for testing. It is also used to receive the response data of the virtual network node and output the response data to the front-end interface for the user to view. By constructing test cases, the response data can be classified and stored according to the test cases, which is convenient for the management of the response data. The test data is generated by the front-end interface according to the information input by the user. The front-end interface can generate test data from the user input information, send it to the application programming interface of the specified test environment, and then the application programming interface constructs the test data into test cases. The front-end interface can also directly construct test cases based on the test data and then send them to the application programming interface.

[0082] Each virtual network test environment has a unique application programming interface. Therefore, when a server or a server cluster composed of multiple servers includes multiple virtual network test environments, selecting the application programming interface means selecting the virtual network test environment. The user inputs information on the front-end interface and specifies the name of the application programming interface. The test data or test cases generated by the front-end interface can be sent to the specified application programming interface to call the corresponding virtual network test environment for testing.

[0083] The test data is generated after the front-end interface receives the user input information. The front-end interface submits the generated test data to the application programming interface. Or, the front-end interface generates test cases based on the user input information, and the virtual network test environment receives the test data or test cases through the application programming interface.

[0084] Whether the test cases are generated by the front-end interface or by the application programming interface, the test cases include execution parameters, and the execution parameters can be one or more of test URL, test node, request method, and request header information.

[0085] In step S13, the test case is executed, and the test result is returned to the front-end interface.

[0086] After receiving the test case, the virtual network test environment can execute the test case, respond to the test case, and generate response data.

[0087] In an exemplary embodiment, the virtual network test environment further includes at least one virtual network node. Executing the test case includes:

[0088] The application programming interface constructs one or more test requests carrying the unique identifier of the test case according to the execution parameters of the test case, and sends the test requests to at least one virtual network node;

[0089] At least one virtual network node responds to the test request, generates response data, and sends the response data to the application programming interface. The application programming interface can feedback the response data to the front-end interface as the test result.

[0090] According to the response data, it can be determined whether the function of the software to be tested meets the requirements. For example, during the anti-leeching function test, the user enters a URL that conforms to the anti-leeching rule on the front-end interface, then generates an anti-leeching test case, and sends the test case to the application programming interface of the virtual network test environment. The virtual network test environment responds to the test case. If the response data is a status code of 200, it indicates that the anti-leeching function is available; if the response data is a status code of 403, it indicates that the anti-leeching function is not available.

[0091] For example, during the anti-leeching function test, the user enters a URL that conforms to the anti-leeching rule on the front-end interface, then generates an anti-leeching test case. The parameter of the anti-leeching test case is the URL, and the anti-leeching test case is sent to the specified application programming interface. The application programming interface generates a test request with the unique identifier of the test case according to the URL, and sends the test request to the virtual network test environment, and the virtual network node in the virtual network test environment responds. After receiving the test request, the virtual network node responds to the URL that conforms to the anti-leeching rule. Since the business software in the virtual network node is the same as the business software in the real network node, it will respond like a real online node and generate response data. For example, during the above anti-leeching function test, when the virtual network node receives a URL that conforms to the anti-leeching rule and responds, the response status code can be 200 or 403.

[0092] The response data is sent to the application programming interface of the virtual network test environment. The user can obtain the response data through the front-end interface connected to the application programming interface and make a judgment based on the response data. For example, during the above anti-leeching function test, if the response data status code is 200, it indicates that the business software or configuration in the node is correct, the test is successful, and the business software or configuration can be deployed to the real online node. If the response data status code is 403, it indicates that the business software or configuration in the node is incorrect. After adjusting the business software or configuration, the test can be carried out again until the response data is correct.

[0093] In an exemplary embodiment, the virtual network test environment further includes a packet capture program, and executing the test case further includes: the packet capture program obtains the packet capture data transmitted between one or more business processes in the virtual network node, and the packet capture data transmitted between multiple virtual network nodes;

[0094] Return the captured packet data to the application programming interface.

[0095] Since one container corresponds to one virtual network node, and one virtual network node includes the business software in one real network node, when the virtual network node receives a test request, it will run one or more processes to respond to the received test request. To verify whether the software or configuration is correct, sometimes in addition to obtaining the response data, it is also necessary to analyze the data generated during the response process to complete the function verification. Figure 3 is a schematic diagram of a container shown according to an exemplary embodiment. Refer to Figure 3 , in this embodiment, a packet capture program is set in each container, that is, it can capture the data transmitted between each business process, and can also capture the data entering and leaving the container, that is, the data transmitted between virtual network nodes, and return the captured packet data to the application programming interface. The application programming interface can obtain the response data of the test case and the captured packet data during the test. When needed, the application programming interface can use the response data and the captured packet data of the test case as the test result and feedback it to the front-end interface at the same time for the user to determine whether the test passes. Using the captured packet data as the test result and directly feedbacking it to the application programming interface can be fed back to the front-end interface by the application programming interface. The user can directly obtain the captured packet data without having to log in to the server or the server cluster composed of multiple servers, improving the user experience. If the application programming interface receives the determination condition from the front-end interface, the application programming interface can generate the assertion result information according to the response data and the captured packet data, avoiding the cumbersome process of obtaining the captured packet data step by step.

[0096] In an exemplary embodiment, the test case further includes a determination condition, and executing the test case further includes:

[0097] The application programming interface determines whether the response data is consistent with the preset assertion according to the determination condition, and generates the assertion result information;

[0098] Alternatively, the application programming interface determines whether the response data and the captured packet data are consistent with the preset assertion according to the determination condition, and generates the assertion result information.

[0099] In this embodiment, if a user enters a determination condition in the front-end interface, the test cases generated by the front-end interface or the application programming interface include this determination condition. The application programming interface constructs a test request carrying the unique identifier of the test case according to the execution parameters of the test case, and sends the test request to at least one virtual network node in the test environment. The virtual network node responds to the test request to generate response data. At the same time, a packet capture program in the virtual network node captures the data during the test process. If the application programming interface receives the response data, the application programming interface determines whether the response data is consistent with the preset assertion according to the determination condition, and generates assertion result information. The application programming interface can return the assertion result information as the test result to the front-end interface, or can return the response data and the assertion result information as the test result to the front-end interface. If the application programming interface receives the response data and the packet capture data, the application programming interface determines whether the response data and the packet capture data are consistent with the preset assertion according to the determination condition, and generates assertion result information. The application programming interface can return the assertion result information as the test result to the front-end interface, or can return the response data, the packet capture data and the assertion result information as the test result to the front-end interface.

[0100] For example, when a user conducts an anti-leeching test, the test parameter is a URL that conforms to the anti-leeching rule, and the preset assertion is that the status code of the response is 200. When the user sets a determination condition, the determination condition is whether the status code of the response is consistent with the preset assertion. After the application programming interface obtains the response data, it will verify the test result according to the content of the response data. If the response data is a status code of 200, which is consistent with the preset assertion, the application programming interface outputs information indicating that the test result of the test case is correct to the front-end interface; if the response data is a status code of 403, which is inconsistent with the preset assertion, the application programming interface outputs information indicating that the test result of the test case is incorrect to the front-end interface. When the user enters information in the front-end interface, the user can enter a determination condition. The application programming interface can make an independent judgment on the response data or the response data and the packet capture data according to the determination condition, and generate assertion result information, without the need for the user to make a determination, thus reducing the workload of the user.

[0101] In an exemplary embodiment, referring to Figure 2 , the virtual network test environment further includes a packet capture program and a database. Executing the test case further includes: the packet capture program obtains the packet capture data transmitted between one or more service processes in the virtual network node, and the packet capture data transmitted between multiple virtual network nodes;

[0102] According to the identifier of the test case, the obtained packet capture data is stored in the database.

[0103] In this embodiment, the captured data is not fed back to the application programming interface (API), but stored in a database. The virtual network test environment only feeds back the response data to the API. Users can obtain the response data from the API through the front-end interface to make a preliminary judgment on the test results, preventing unnecessary data from being provided to users and causing interference to them. If users still need to further obtain the captured data to accurately evaluate the test results, they only need to connect to the database to obtain the above-mentioned captured data without logging in to the container, improving the user experience.

[0104] The same virtual network test environment can be used for testing different test cases. To distinguish the data in the database, the packet capture program stores the captured data corresponding to different test cases according to the identifier of the test case. After the test is completed, when users need to call the data related to a test case, they can query the database according to the identifier of the test case to quickly obtain the data related to the test case.

[0105] The database includes the built-in database of the virtual network test environment and the database built into the callback interface. In practical applications, a built-in database can be set up in each virtual network test environment, or a database can be set up within the callback interface of the API to store the captured data.

[0106] In an exemplary embodiment, when the API receives the unique identifier of the test case sent by the front-end interface, the API obtains the captured data corresponding to the unique identifier from the database.

[0107] When users cannot accurately evaluate the test results based on the response data of the virtual network test environment, they can enter the unique identifier of the test case on the front-end interface page. The front-end interface sends the unique identifier of the test case to the specified API. The API can query the database according to the unique identifier of the test case to obtain the captured data related to the test case, and feed back the captured data related to the test case to the front-end interface for users to determine the test results. Users do not need to log in to the database to query, simplifying the user operation process.

[0108] Through the above embodiments, the distributed network testing method provided in this article constructs a network testing environment on a server or a server cluster composed of multiple servers to test test cases, and can achieve the same testing effect as the real online network environment. It does not require extracting network resources from the online network environment, saving resource overhead. When the business software or configuration in the relevant nodes changes, the updated business software can be repackaged and deployed into the virtual network nodes of the distributed network environment to ensure that the distributed network environment is consistent with the real online network environment, avoiding the problem that the testing environment is out of touch with the online environment and cannot accurately simulate the online environment. Even if there are bugs in the software to be tested, it will not affect the online environment, ensuring the security of the online distributed network environment. It can also facilitate the customization of the virtual network testing environment and avoid the problem that the architecture in the real distributed network is difficult to adjust.

[0109] Figure 4 It is a flowchart of a distributed network testing method shown according to an exemplary embodiment. Refer to Figure 4 , the distributed network testing method is applied to the front-end interface and at least includes steps S41 to S44, which are introduced in detail as follows:

[0110] In step S41, the input information of the user is received, and the input information includes at least one of preset configuration information and preset function information.

[0111] The front-end interface is connected to the application program interface of the virtual network testing environment in a server or a server cluster composed of multiple servers, and interacts with the virtual network testing environment. The front-end interface can be a remote interface located in a test platform, a configuration management platform, a customer management platform, a cloud service control platform, etc. The user can input test information on the local interface of the server or a server cluster composed of multiple servers. The user can also input test information on the remote interface, which is convenient for the user to call the virtual network testing environment.

[0112] In an exemplary embodiment, the preset configuration information at least includes: the identifier of the virtual network testing environment, execution parameters; the execution parameters include one or more of a test URL, a test node, a request method, and request header information.

[0113] Presetting some common configuration information in the front-end interface can facilitate user use.

[0114] Figure 5 It is a schematic diagram of the front-end interface shown according to an exemplary embodiment. Refer to Figure 5, after the user logs in to the test system by entering an address in the page address bar (the address can be the address of a test platform, a configuration management platform, a customer management console, or a cloud service console), the test system displays the front-end interface to the user. The user can input information through the front-end interface. The user can input relevant information according to the preset configuration to generate preset configuration information; or can select a preset function to generate preset function information. The preset functions can be some common test functions, and different preset functions have different identifiers for the convenience of the user to select. For example, the anti-leeching function test is used as a preset function, and the URLs that comply with the anti-leeching rules are integrated into the code of this preset function. When the user selects this function and clicks to run the test case, the front-end interface generates an anti-leeching test case. The parameter of the anti-leeching test case is the URL that complies with the anti-leeching rules. The application programming interface generates a test request with a unique identifier for this test case based on the URL that complies with the anti-leeching rules, and sends this test request to the virtual network test environment, and the virtual network nodes in the virtual network test environment respond.

[0115] In step S42, test data or one or more test cases are generated.

[0116] The front-end interface can generate test data or one or more test cases according to the user's input information. The test data or one or more test cases are sent to the specified application programming interface.

[0117] For example, the front-end interface can generate test cases according to the user's input information. The user selects function 1 on the front-end interface, and function 1 is the http 301 jump to https function. Test cases for testing http-format URLs are automatically generated. After clicking "Run Test Case", the determination conditions are automatically generated for this test case.

[0118] Another example is that the user enters execution parameters in the area corresponding to "Test Case 1", sets the "determination conditions", and after clicking "Run Test Case", test cases are generated and sent to the specified application programming interface.

[0119] The test cases can include only execution parameters, or can include execution parameters and determination conditions. If the user does not set the determination conditions, the test cases only include execution parameters, and the execution parameters are used for the application programming interface to construct test requests. At this time, the user needs to determine whether the test passes according to the test results by himself. If the user sets the determination conditions, the application programming interface can automatically determine whether the test passes based on the response data of the test case, or based on the response data of the test case and the packet capture data, and give the determination result.

[0120] In practical applications, the user can input information through the above multiple methods, and the front-end interface generates corresponding test data or one or more test cases according to the user's input information.

[0121] In step S43, send the test data or one or more test cases to the virtual network test environment to request a test. In practical applications, different test environments need to be selected according to different test tasks. Since each test environment is set with a unique application programming interface, therefore, only by specifying the application programming interface, the test data or test cases can be sent to the virtual network test environment corresponding to the specified application programming interface. The application programming interface can generate one or more test cases according to the test data or receive one or more test cases sent by the front-end interface, construct one or more test requests carrying the unique identifier of the test case according to the execution parameters of the one or more test cases, and send the one or more test requests to the virtual network nodes for testing.

[0122] In step S44, receive the test result.

[0123] The virtual network test environment responds to the test request and sends the test result to its own application programming interface. The front-end interface can receive the test results of one or more test cases from the specified application programming interface.

[0124] For example, when testing the anti-leech configuration information, the test parameter is a URL that conforms to the anti-leech rules. If the configuration information is correct, the test result is the response data, then the status code of the response data should be 200. Therefore, according to whether the status code in the response data is 200, the test result of the test case can be verified.

[0125] Users can easily log in to the virtual network test system, input relevant information to generate test cases, and can select different virtual network test environments according to different test requirements to quickly test various software or configurations, and verify the functions according to the response data returned by the virtual network test environment. Instead of logging in to the real distributed network environment, it reduces the test cost and improves the efficiency.

[0126] In an exemplary embodiment, the distributed network test method further includes: saving one or more test cases.

[0127] If the front-end interface can generate test cases according to the information input by the user, the user can save the already generated test cases in the local storage of the front-end interface. When the user performs subsequent test tasks, the already stored test cases can be directly called without having to re-enter the relevant information, improving the test efficiency.

[0128] Figure 6 It is a block diagram of a distributed network test device shown according to an exemplary embodiment. Refer to Figure 6, The distributed network testing device is applied to a server or a server cluster composed of multiple servers, including: a test environment construction module 601, a test case receiving module 602, and a response module 603.

[0129] The test environment construction module 601 is configured to construct at least one virtual network test environment, and the virtual network test environment is located in an isolated execution environment in the server or the server cluster.

[0130] The test case receiving module 602 is configured to receive test cases for the virtual network test environment.

[0131] The response module 603 is configured to execute the test cases and return the test results to the front-end interface.

[0132] Based on Figure 6 In the illustrated embodiment, the test environment construction module 601 is further configured to:

[0133] According to the architecture required for testing, construct a virtual architecture including virtual network nodes, where the virtual network nodes correspond one-to-one with the real nodes;

[0134] Package the business software in the real nodes into image files;

[0135] Load the image files into the virtual network nodes according to the corresponding relationship to construct a virtual network test environment.

[0136] In an exemplary embodiment, the isolated execution environment includes containers, each container corresponding to a virtual network node. Loading the image files into the virtual network nodes according to the corresponding relationship includes:

[0137] Deploy the image files to the containers.

[0138] Based on Figure 6 In the illustrated embodiment, the test environment construction module 601 is further configured to: Orchestrate multiple virtual network nodes loaded with image files to form different virtual network test environments.

[0139] Based on Figure 6 In the illustrated embodiment, the test case receiving module 602 is further configured to:

[0140] Receive the test data submitted by the front-end interface, construct test cases according to the test data, or receive the test cases generated and sent by the front-end interface.

[0141] Based on Figure 6 In the illustrated embodiment, the test case receiving module 602 is further configured to construct one or more test requests carrying the unique identifier of the test case according to the execution parameters of the test case, and send the test requests to at least one virtual network node;

[0142] The response module 603 is further configured to respond to a test request, generate response data, and send the response data to the application programming interface.

[0143] Based on Figure 6 the illustrated embodiment, the response module 603 further includes a packet capture program, and the response module 603 is further configured to:

[0144] Obtain packet capture data transmitted between one or more service processes within the virtual network node, and packet capture data transmitted between multiple virtual network nodes;

[0145] Return the obtained packet capture data to the application programming interface.

[0146] Based on Figure 6 the illustrated embodiment, the test case further includes a determination condition, and the test case receiving module 602 is further configured to:

[0147] According to the determination condition, determine whether the response data is consistent with a preset assertion, and generate assertion result information;

[0148] Alternatively, according to the determination condition, determine whether the response data and the packet capture data are consistent with a preset assertion, and generate assertion result information.

[0149] Based on Figure 6 the illustrated embodiment, the response module 603 further includes a packet capture program and a database, and the response module 603 is further configured to: The packet capture program obtains packet capture data transmitted between one or more service processes within the virtual network node, and packet capture data transmitted between multiple virtual network nodes;

[0150] Store the obtained packet capture data in the database according to the unique identifier of the test case.

[0151] Based on Figure 6 the illustrated embodiment, the test case receiving module 602 is further configured to: When receiving the unique identifier of the test case sent by the front-end interface, obtain the packet capture data corresponding to the unique identifier from the database.

[0152] Figure 7 is a block diagram of a distributed network test device shown according to an exemplary embodiment. Refer to Figure 7 , the distributed network test device applied to the front-end interface includes: an information receiving module 701, a data conversion module 702, a sending module 703, and a response receiving module 704.

[0153] The information receiving module 701 is configured to receive input information of a user, and the input information includes at least one of preset configuration information and preset function information;

[0154] The data conversion module 702 is configured to generate test data or generate one or more test cases;

[0155] The sending module 703 is configured to send test data or one or more test cases to a virtual network test environment to request testing;

[0156] The response receiving module 704 is configured to receive test results.

[0157] Based on Figure 7 the illustrated embodiment, the information receiving module 701 is further configured to save one or more test cases.

[0158] Figure 8 FIG. is a block diagram of a computer device 800 for a distributed network testing method according to an exemplary embodiment. For example, the computer device 800 may be provided as a server. Referring to Figure 8 , the computer device 800 includes a processor 801, and the number of processors may be set to one or more according to needs. The computer device 800 further includes a memory 802 for storing instructions executable by the processor 801, such as application programs. The number of memories may be set to one or more according to needs. The application programs stored therein may be one or more. The processor 801 is configured to execute instructions to perform the above-described distributed network testing method.

[0159] Those skilled in the art should understand that the embodiments herein may be provided as a method, an apparatus (device), or a computer program product. Therefore, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media including computer-usable program code. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data, including but not limited to RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically includes computer-readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.

[0160] This article is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (devices), and computer program products according to the embodiments of the present article. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 or means for implementing the functions specified in multiple blocks.

[0161] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing devices to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 or the functions specified in multiple blocks.

[0162] These computer program instructions can also be loaded onto a computer or other programmable data processing devices, such that a series of operation steps are executed on the computer or other programmable devices to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable devices provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 or the functions specified in multiple blocks.

[0163] In this article, the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, such that an article or device including a series of elements not only includes those elements but also includes other elements not explicitly listed, or also includes elements inherent to such an article or device. Without further limitations, the elements defined by the statement "including..." do not exclude the existence of additional identical elements in the article or device including the said elements.

[0164] Although the preferred embodiments of the present article have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the present article.

[0165] Obviously, those skilled in the art can make various changes and modifications to this text without departing from the spirit and scope of this text. Thus, if these modifications and variations of this text fall within the scope of the claims of this text and their equivalent technologies, the intention of this text also includes these modifications and variations.

Claims

1. A distributed network testing method, which is applied to a server or a server cluster composed of multiple servers, and is characterized in that, Including: Constructing at least one virtual network test environment, where the virtual network test environment is located in an isolated execution environment in a server or a server cluster; The virtual network test environment receiving test cases; Executing the test cases and returning the test results to the front-end interface; Wherein, the virtual network test environment includes an application programming interface, and each virtual network test environment corresponds to an application programming interface; Wherein, the constructing of the virtual network test environment includes: According to the architecture required for testing, constructing a virtual architecture including at least one virtual network node, where the virtual network nodes correspond one-to-one with the real nodes; Packing the business software in the real nodes into image files; Loading the image files into the virtual network nodes according to the corresponding relationship to construct a virtual network test environment; Wherein, the at least one virtual network node is orchestrated to orchestrate different virtual network test environments for testing different test tasks.

2. The distributed network testing method according to claim 1, wherein The isolated execution environment includes at least one container, and each container corresponds to a virtual network node. The loading of the image files into the virtual network nodes according to the corresponding relationship includes: Deploying the image files to the containers.

3. The distributed network testing method according to claim 2, wherein, The constructing of the virtual network test environment further includes: orchestrating at least one virtual network node loaded with image files to form different virtual network test environments.

4. The distributed network testing method according to claim 1, characterized in that The virtual network test environment receiving test cases includes: The application programming interface receives the test data submitted by the front-end interface, constructs test cases according to the test data, or receives the test cases generated and sent by the front-end interface.

5. The distributed network testing method according to claim 4, wherein The virtual network test environment further includes at least one virtual network node. The executing of the test cases includes: The application programming interface constructs one or more test requests carrying the unique identifier of the test case according to the execution parameters of the test case, and sends the test requests to the at least one virtual network node; The at least one virtual network node responds to the test request, generates response data, and sends the response data to the application programming interface.

6. The distributed network testing method according to claim 5, wherein The virtual network test environment further includes a packet capture program. The executing of the test cases further includes: the packet capture program obtains the packet capture data transmitted between one or more business processes in the virtual network node, and the packet capture data transmitted between multiple virtual network nodes; Returning the obtained packet capture data to the application programming interface.

7. The distributed network testing method according to claim 5, characterized in that The test cases further include determination conditions. The executing of the test cases further includes: The application programming interface determines whether the response data is consistent with the preset assertion according to the determination conditions, and generates assertion result information.

8. The distributed network testing method according to claim 6, characterized in that The test cases further include determination conditions. The executing of the test cases further includes: The application programming interface determines whether the response data and the packet capture data are consistent with the preset assertion according to the determination conditions, and generates assertion result information.

9. The distributed network testing method according to claim 5, wherein The virtual network test environment further includes a packet capture program and a database. The executing of the test cases further includes: the packet capture program obtains the packet capture data transmitted between one or more business processes in the virtual network node, and the packet capture data transmitted between multiple virtual network nodes; Store the captured data obtained into a database according to the unique identifier of the test case.

10. The distributed network testing method according to claim 9, wherein It further includes: When the application programming interface receives the unique identifier of the test case sent by the front-end interface, the application programming interface obtains the captured data corresponding to the unique identifier from the database.

11. A distributed network testing method, applied to a front-end interface, characterized in that It includes: Receive the input information of the user, where the input information includes at least one of preset configuration information and preset function information; Generate test data or generate one or more test cases; Send the test data or one or more test cases to the virtual network test environment to request testing, where the virtual network test environment is an isolated execution environment in a server or a server cluster; Receive the test result; Wherein, the virtual network test environment includes an application programming interface, and each virtual network test environment corresponds to an application programming interface; The server or the server cluster constructs a virtual architecture including at least one virtual network node according to the architecture required for testing, and the virtual network nodes correspond to the real nodes one by one; Package the business software in the real node into an image file; Load the image file into the virtual network node according to the corresponding relationship to construct a virtual network test environment; Wherein, the at least one virtual network node is orchestrated to orchestrate different virtual network test environments for testing different test tasks.

12. The distributed network testing method according to claim 11, wherein The preset configuration information at least includes: the identifier of the virtual network test environment, execution parameters; the execution parameters include one or more of a test URL, a test node, a request method, and request header information.

13. The distributed network testing method according to claim 11, wherein It further includes: Save the one or more test cases.

14. A distributed network testing device is applied to a server or a server cluster composed of multiple servers, and is characterized in that It includes: A test environment construction module for constructing at least one virtual network test environment, where the virtual network test environment is an isolated execution environment in a server or a server cluster; A test case receiving module for the virtual network test environment to receive test cases; A response module for executing the test case and returning the test result to the front-end interface; Wherein, the virtual network test environment includes an application programming interface, and each virtual network test environment corresponds to an application programming interface; Wherein, the construction of the virtual network test environment includes: Construct a virtual architecture including at least one virtual network node according to the architecture required for testing, and the virtual network nodes correspond to the real nodes one by one; Package the business software in the real node into an image file; Load the image file into the virtual network node according to the corresponding relationship to construct a virtual network test environment; Wherein, the at least one virtual network node is orchestrated to orchestrate different virtual network test environments for testing different test tasks.

15. A distributed network testing device, applied to a front-end interface, characterized in that It includes: An information receiving module for receiving the input information of the user, where the input information includes at least one of preset configuration information and preset function information; A data conversion module for generating test data or generating one or more test cases; A sending module for sending the test data or one or more test cases to the virtual network test environment to request testing, where the virtual network test environment is an isolated execution environment in a server or a server cluster; A response receiving module, configured to receive test results; Wherein, the virtual network test environment includes an application programming interface, and each virtual network test environment corresponds to an application programming interface; The server or server cluster constructs a virtual architecture including at least one virtual network node according to the architecture required for testing, and the virtual network nodes correspond one-to-one with the real nodes; Pack the business software in the real node into an image file; Load the image file into the virtual network node according to the corresponding relationship to construct a virtual network test environment; Wherein, the at least one virtual network node is orchestrated to orchestrate different virtual network test environments for testing different test tasks.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, the steps of the method described in any one of claims 1-13 are implemented.

17. A computer device, comprising a processor, a memory, and a computer program stored on the memory, characterized in that, When the processor executes the computer program, the steps of the method described in any one of claims 1-13 are implemented.

Citation Information

Patent Citations

  • Cluster test data obtaining method and apparatus

    CN107678836A

  • Pressure test method and device, electronic equipment and storage medium

    CN112714042A