Business testing method, device, computer equipment and storage medium

By obtaining the domain name and test port to be tested, determining the branch test path for the business type, and using reverse proxy services to isolate multiple test environments, the problem of mixed code in multi-person collaborative development was solved, and independent branch testing and efficient testing processes were achieved.

CN112988584BActive Publication Date: 2024-11-15SHENZHEN YUNZHIJIA NETWORK CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202110301143.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-22
Publication Date
2024-11-15
Estimated Expiration
2041-03-22

AI Technical Summary

Technical Problem

When multiple people are collaborating to develop an H5 project, the team only has one testing environment, which leads to the code of multiple developers' development branches being mixed together, causing frequent code conflicts and dependency issues, and affecting testing efficiency.

Method used

By obtaining the domain name and test port to be tested, the branch test path of the business type is determined, and branch testing is carried out based on the path. Multiple test environments are isolated by using reverse proxy services, and each development branch has its own set of test resources.

Benefits of technology

Without adding new server resources, independent testing of each development branch was achieved, avoiding code conflicts and dependencies and improving testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112988584B_ABST
    Figure CN112988584B_ABST
Patent Text Reader

Abstract

The present application relates to a service testing method, apparatus, computer equipment and storage medium. The method comprises: obtaining a domain name to be tested and a first test port corresponding to the domain name to be tested; determining a first branch test path corresponding to the service type of the domain name to be tested based on the path corresponding to the first test port; and performing a first branch test on the domain name to be tested based on the files in the first branch test path. The use of this method can improve the test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a service testing method, apparatus, computer equipment and storage medium. Background Art

[0002] When multiple people collaborate to develop H5 projects, there is usually only one test environment within the team. Based on the need for development efficiency, multiple developers usually have an independent development branch to complete their own development needs. After the developer completes the development, the code of his branch is merged into the main branch for the tester to start testing. The test environment may be mixed with multiple requirement codes being tested at the same time. If test A passes but test B fails, feature A will have to wait for the developer of B to handle the fault and pass the test before continuing the subsequent deployment process, which greatly reduces the efficiency of launching the requirement feature. Summary of the invention

[0003] Based on this, it is necessary to provide a business testing method, device, computer equipment and storage medium to address the above technical problems.

[0004] A service testing method, the method comprising:

[0005] Obtain a domain name to be tested and a first test port corresponding to the domain name to be tested;

[0006] Determine, based on the path corresponding to the first test port, a first branch test path corresponding to the service type of the domain name to be tested;

[0007] A first branch test is performed on the domain name to be tested based on the files in the first branch test path.

[0008] A service testing device, comprising:

[0009] A domain name acquisition module, used to acquire a first domain name corresponding to the domain name to be tested; the first domain name includes a first test port;

[0010] A path determination module, configured to determine a first branch test path corresponding to the service type of the domain name to be tested based on the path corresponding to the first test port;

[0011] A branch testing module is used to perform a branch test on the domain name to be tested based on the first branch testing path.

[0012] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the various steps in the embodiments of the present application when executing the computer program.

[0013] A computer-readable storage medium stores a computer program, which implements the various steps in the embodiments of the present application when executed by a processor.

[0014] The above-mentioned business testing method, device, computer equipment and storage medium determine the first branch test path corresponding to the business type of the domain name to be tested based on the path corresponding to the first test port, and perform branch testing on the domain name to be tested based on the files in the first branch test path. Then, multiple sets of test environments are isolated through the port path without adding new server resources, that is, each branch to be tested is distinguished, and each development branch has an exclusive set of test resources. Branch testing can be performed based on each branch test path, and each branch test is independent. Compared with the traditional test environment in which multiple requirement codes being tested are mixed at the same time, it can avoid the problem of frequent code conflicts caused by multiple people collaborating to share the test environment, and also avoid the problem of mutual dependence with other branches, thereby improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 An application environment diagram of a business testing method in an embodiment;

[0016] Figure 2 A flowchart of a service testing method in an embodiment;

[0017] Figure 3 A schematic diagram of a forward proxy page in one embodiment;

[0018] Figure 4 A schematic diagram of a business testing method architecture flow in an embodiment;

[0019] Figure 5 It is a schematic diagram of the architecture flow of a business testing method in another embodiment;

[0020] Figure 6 is a structural block diagram of a service testing device in an embodiment;

[0021] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0023] The service testing method provided in this application can be applied to Figure 1In the application environment shown. Among them, the test terminal 102 communicates with the test server 104 through the network. Among them, the test terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The test server 104 can be implemented with an independent server or a server cluster composed of multiple servers. The test terminal 102 obtains the domain name to be tested and the first test port corresponding to the domain name to be tested. The test server 104 obtains the domain name to be tested and the first test port corresponding to the domain name to be tested from the test terminal 102; based on the path corresponding to the first test port, determine the first branch test path corresponding to the business type of the domain name to be tested; and perform branch testing on the domain name to be tested based on the files in the first branch test path.

[0024] In one embodiment, Figure 2 As shown, a business testing method is provided, which is applied to Figure 1 The following steps are used as an example to illustrate the test server in the example:

[0025] Step 202: Obtain the domain name to be tested and the first test port corresponding to the domain name to be tested.

[0026] Among them, the domain name (Domain Name), also known as the network domain, is the name of a computer or computer group on the Internet composed of a string of names separated by dots, which is used to locate the computer during data transmission. The domain name to be tested is used to point to the test server. The first test port corresponding to the domain name to be tested is used to point to the first test port of the test server. The first test port refers to the port to which the current domain name to be tested is connected. Each test port is used to test different characteristics of the domain name to be tested, for example, the first test port is used to test stability, and the second test port is used to test whether there are vulnerabilities.

[0027] A host with an IP (Internet Protocol) address can provide different services (processes resident in memory), that is, the IP address and service are in a one-to-many relationship. So how does the host distinguish these different network services? In fact, it distinguishes different services through "IP address + port". Each service occupies a certain port alone (the value is between 0-65535).

[0028] For business type A, one feature of business type A corresponds to a set of branch codes, a set of branch codes corresponds to a set of test environments, and a set of test environments corresponds to a port.

[0029] Specifically, the test server obtains the domain name to be tested and the first test port corresponding to the domain name to be tested, that is, the test server obtains a test request for the domain name to be tested and the first test port corresponding to the test domain name, wherein the test request for the first test port is obtained from the forward proxy page of the test terminal that starts the forward proxy service.

[0030] Step 204: Determine a first branch test path corresponding to the service type of the domain name to be tested based on the path corresponding to the first test port.

[0031] The path may refer to a file path, which indicates the storage location of a file. In the test environment server, the path of each file is unique. A project may be a business type, such as projectA. Alternatively, the business type may be music, news, or microblog.

[0032] The path corresponding to the test port includes branch test paths corresponding to each service type. In the path of the same test port, the same service type corresponds to only one branch test path. The path corresponding to the test port may include only branch test paths of one service type, or may include branch test paths of multiple service types.

[0033] Specifically, the test server determines the first branch test path corresponding to the service type of the domain name to be tested based on the path corresponding to the first test port. For example, if the path corresponding to the first test port is / front3001conf.d / and the service type of the domain name to be tested is projectA, then the first branch test path corresponding to projectA is found under the path / front3001conf.d / as / dir_3001 / projectA.

[0034] Step 206: Perform a first branch test on the domain name to be tested based on the files in the first branch test path.

[0035] Specifically, the first branch test path includes the uploaded branch code and the configuration files required by the branch code. Then the test server can perform the first branch test on the domain name to be tested based on the files in the first branch test path.

[0036] The above-mentioned business testing method determines the first branch test path corresponding to the business type of the domain name to be tested based on the path corresponding to the first test port, and performs branch testing on the domain name to be tested based on the files in the first branch test path. In this way, multiple test environments are isolated through the port path without adding new server resources, that is, each branch to be tested is distinguished, and each development branch has an exclusive set of test resources. Branch testing can be performed based on each branch test path, and each branch test is independent. Compared with the traditional test environment where multiple requirement codes being tested are mixed at the same time, it can avoid the problem of frequent code conflicts caused by multiple people collaborating to share the test environment, and also avoid the problem of mutual dependence with other branches, thereby improving the test efficiency.

[0037] In one embodiment, the service testing method also includes: when an operation instruction to switch to the second test port triggered by the test terminal is obtained, determining a second branch test path corresponding to the service type of the domain name to be tested from the path corresponding to the second test port; and performing a second branch test on the domain name to be tested based on the files in the second branch test path.

[0038] The second test port is not the same as the first test port. The path corresponding to the second test port includes a second branch test path corresponding to the service type. The first branch test path is different from the second branch test path. The first branch test is also different from the second branch test.

[0039] Specifically, when the test server obtains the operation instruction to switch to the second test port triggered by the test terminal, the test terminal determines the second branch test path corresponding to the business type of the domain name to be tested from the path corresponding to the second test port; and performs a second branch test on the domain name to be tested based on the files in the second branch test path.

[0040] In this embodiment, when an operation instruction to switch to the second test port triggered by the test terminal is obtained, a second branch test path corresponding to the business type of the domain name to be tested is determined from the path corresponding to the second test port; a second branch test is performed on the domain name to be tested based on the file in the second branch test path, and switching can be performed among the branch test paths to perform different branch tests on the same domain name.

[0041] In one embodiment, the method for acquiring the operation instruction for switching to the second test port includes: acquiring the operation instruction for switching to the second test port from a forward proxy page of the test terminal that starts the forward proxy service.

[0042] Among them, the forward proxy service refers to the proxy service located between the test terminal and the test server. In order to obtain content from the test server, the test terminal sends a request to the proxy service and specifies the port. Then the proxy service forwards the request to the test server and returns the obtained content to the test terminal.

[0043] Specifically, on the web side, we can enable forward proxy by configuring the proxy rules of the browser, and on the mobile side, we can directly configure the http proxy (forward proxy service for desktop computers) in the system settings. The test terminal stores the forward proxy rules required for the forward proxy service. For example, the available ports for each domain name to be tested are stored. The test terminal displays the forward proxy page, and displays the available ports corresponding to the domain name to be tested on the forward proxy page. The test server obtains the operation instruction to switch to the second test port from the forward proxy page of the test terminal that starts the forward service.

[0044] In this embodiment, Figure 3 As shown, it is a schematic diagram of a forward proxy page in an embodiment. It includes a domain name to be tested 302, a first test port 3001, a second test port 3002, and a third test port 3003. The user can switch to different test ports by checking or unchecking. For example, if the second test port 3002 is checked, the test server will obtain an operation instruction to switch to the second test port.

[0045] In this embodiment, an operation instruction to switch to the second test port is obtained from the forward proxy page of the test terminal that starts the forward proxy service, so that the test can be quickly accessed without the user manually inputting the port number, thereby improving the test efficiency.

[0046] In one embodiment, obtaining the domain name to be tested and the first test port corresponding to the domain name to be tested includes: receiving a test request for the first test port sent by a reverse proxy service, where the test request is obtained by the reverse proxy service monitoring the first test port.

[0047] The method includes performing a first branch test on the domain name to be tested based on the files in the first branch test path, and obtaining a branch test result; and returning the branch test result to the test terminal through a reverse proxy service.

[0048] The reverse proxy service receives the connection request, forwards the request to the server on the internal network, and returns the result obtained from the internal server to the requesting test terminal. The branch test result can be branch test passed, branch test failed, branch test has a vulnerability, etc., but is not limited to this.

[0049] Specifically, the test server receives a test request for the first test port sent by the reverse proxy service, and the test request is obtained by the reverse proxy service monitoring the first test port. The test server performs a first branch test on the domain name to be tested based on the files in the first branch test path, obtains the branch test result, and returns the branch test result to the test terminal through the reverse proxy service.

[0050] In this embodiment, * / nginx.conf configuration / / configuration file of the test environment

[0051] server {

[0052] listen 3001; / / Listen to port 3001

[0053] server_name dev.***.cn; / / Domain name to be tested

[0054] include front3001conf.d / *.conf; / / Test the path corresponding to port 3001

[0055] }

[0056] * / front3001conf.d /

[0057] location / projectA { / / Locate the business type projectA

[0058] root / dir_3001 / projectA; / / Branch test path corresponding to the business type

[0059] try_files / index.html

[0060] }

[0061] In this embodiment, the test server includes port 3001 and port 3002, the business types include type A, type B and type C, type A includes branch A1 and branch A2; type B includes branch B1 and branch B2. Then port 3001 may include type A, type B and type C, but the path of type A only includes one branch path, namely branch A1. Similarly, type B of port 3001 only includes one branch path, namely branch B1. Type C of port 3001 only includes one branch path, namely branch C1. Port 3002 may include type A, type B and type C, but the path of type A only includes one branch path, namely branch A2, and the path of type B only includes one branch path, namely branch B2.

[0062] In one embodiment, in the traditional way without reverse proxy, assuming that 10 test environments are needed and there are 20 business types, there will be 100*200 situations in total, and the maintenance cost is high. However, by using reverse proxy to separate the 10 test environments, the remaining ones can be maintained, which can reduce the maintenance cost.

[0063] In this embodiment, a test request for the first test port is received through the reverse proxy service. The test request is obtained by the reverse proxy service listening to the first test port. The first branch test is performed on the domain name to be tested based on the file in the first branch test path to obtain the branch test result. The branch test result is returned to the test terminal through the reverse proxy service. Each port can be maintained and managed through the reverse proxy service. Since the branch test is performed using the files in the path corresponding to the port, when a branch needs to be added, the port can be managed through the reverse proxy service, which is convenient for expansion.

[0064] In one embodiment, Figure 4 The figure shows a schematic diagram of the architecture flow of a business testing method in an embodiment. Figure 4 It includes the client, forward proxy service, reverse proxy service and test server. Get the domain name **.com to be tested from the client, and the type is news. Get the corresponding port through the forward proxy page corresponding to the forward proxy service. As shown in the figure, domain name → 3001, domain name → 3002, domain name → 300n. When the corresponding port obtained by the forward proxy service is 3002, the reverse proxy server listens to port 3002 to obtain the test request. Based on the port number and business type in the test request, the branch test path located in the test server is determined to be 3002 / news / .

[0065] In one embodiment, before obtaining the domain name to be tested, the service testing method further includes:

[0066] Get each uploaded branch code;

[0067] Based on the branch identifier of each branch code, the branch test path corresponding to each branch code is determined from the mapping relationship between the branch identifier and the branch test path of the test port; the branch test path contains the configuration file required by the branch code; the branch test path includes a business type identifier; the business type identifier is used to characterize the business type.

[0068] Copy each branch code to the corresponding branch test path to obtain each branch test path containing the branch code.

[0069] Determining a first branch test path corresponding to the service type of the domain name to be tested includes: determining a first branch test path corresponding to the service type identifier of the domain name to be tested from the branch test paths of each branch code.

[0070] Among them, using branches means that work can be separated from the main line of development to avoid affecting the main line of development. Different branches can be switched and merged, so that multiple "workflows" can be achieved at the same time at different stages of the project development cycle. Branch code refers to the part of the code required in the main line of development.

[0071] The branch identifier may include at least one of text, numbers, letters, and symbols. The branch identifier may be a branch code folder name, etc.

[0072] Specifically, the test server obtains each uploaded branch code, and based on the branch identifier of each branch code, determines the branch test path corresponding to each branch code from the mapping relationship between the branch identifier and the branch path of the test port; the branch test path contains the configuration file required for the branch code, and the branch test path includes the business type identifier, which is used to characterize the business type. The test server copies each branch code to the corresponding branch test path and obtains each branch test path containing the branch code. The test server determines the first branch test path corresponding to the business type identifier of the domain name to be tested from the branch test path of each branch code.

[0073] In this embodiment, the test server obtains each uploaded branch code, compiles, packages, and other operations on the branch code, and then determines the branch test path corresponding to each branch code from the mapping relationship between the branch identifier and the branch path of the test port. The test server copies the compiled and packaged branch code to the corresponding branch test path.

[0074] In this embodiment, the uploaded branch code is obtained, and the branch test path corresponding to each branch code is determined, the branch code is copied to the branch test path, and the branch test path containing the branch code is obtained, and the first branch test path corresponding to the business type of the domain name to be tested is determined, thereby isolating each test environment.

[0075] In one embodiment, before obtaining the uploaded branch code, the service testing method further includes: creating a branch test path for each test port; adding a configuration file required by the corresponding branch code to each branch test path to obtain a branch test path containing the configuration file.

[0076] In this embodiment, a branch test path is created for each test port, and a configuration file required for the corresponding branch code is added to each branch test path to obtain a branch test path containing the configuration file, that is, the test environment is configured. After the branch code is uploaded, it can be directly associated with the branch test path, thereby realizing test environment isolation and improving test efficiency.

[0077] In one embodiment, a branch test path set corresponding to a business type is obtained; a selected branch test path is obtained from the branch test path set; a branch identifier selected from a branch identifier set corresponding to the business type is obtained; the selected branch test path is associated with the selected branch identifier to obtain a mapping relationship between the branch test path and the branch identifier.

[0078] The branch identifier is used to uniquely represent the branch code. Each set of branch codes is different. The branch identifier can be the file name of the branch code, etc.

[0079] Specifically, the test server obtains a branch test path set corresponding to the business type. The branch test path set contains at least one branch test path. The branch identification set contains at least one branch identification. The test terminal obtains the selected branch test path and the selected branch identification, and sends them to the test server. The test server associates the selected branch test path with the selected branch identification to obtain a mapping relationship between the branch test path and the branch identification. For example, the business type is projectA, the branch identification includes branch 1 and branch 2, and the branch path includes projectA / fenzhi1 / and projectA / fenzhi2 / , then branch 1 is selected to be associated with projectA / fenzhi1 / , and branch 2 is selected to be associated with projectA / fenzhi2 / .

[0080] In this embodiment, the developer customizes the development branch he uses and the specific test environment he associates with on the platform. Through the open API provided by Gitlab, the platform can obtain a list of all branches of the Gitlab project corresponding to the current project (i.e., business type), and the developer can directly select it. The number of test environments N is given a sufficient value by default on the platform. After the developer selects and saves, his development branch and the occupied test environment are already associated.

[0081] In this embodiment, the selected branch identifier is obtained from the branch identifier set corresponding to the business type, and the branch identifier is selected from the branch identifier set corresponding to the business type and associated, so that the mapping relationship between the branch test path and the branch identifier can be obtained. After the branch code is uploaded, the branch code can be quickly saved to the corresponding test environment to improve the test efficiency.

[0082] In one embodiment, before obtaining the domain name to be tested, the business testing method also includes: obtaining the uploaded branch code; creating a branch test path associated with the branch identifier based on the branch identifier of each branch code; and copying the uploaded branch code and the required configuration file to the branch test path.

[0083] In one embodiment, Figure 5As shown, it is a schematic diagram of the architecture flow of the business testing method in another embodiment. The Jaguar platform is a self-developed web system required in the closed-loop landing process, and is named the Jaguar platform here to facilitate the subsequent elaboration of the technical solution. A branch test path represents a branch test environment. Webhook is a "hook" provided by Gitlab, whose value can be customized (usually the URL (uniformresource locator) of a third-party system (such as the Jaguar platform mentioned below)). When a project performs a certain trigger operation (such as code submission commit), the Gitlab service will automatically request the URL and carry the detailed parameters of the current trigger operation (such as the project warehouse address, branch, submitter, etc.), and the third-party system can customize the task based on this. Gitlab is a fully integrated web service based on Git, which provides an interface to facilitate the review and operation of project warehouses, users and permissions, branches, code submission records, etc., while providing access capabilities for continuous integration or delivery, and providing developers with a rich set of API interfaces to facilitate integration between systems. Nginx is a high-performance open source HTTP and reverse proxy web service. The present invention mainly utilizes its reverse proxy capabilities.

[0084] The Jaguar platform includes environment and branch mapping configuration, new project initialization (N sets of test environments), and build deployment based on webhooks parameters. When developers push their own code, Gitlab will trigger a call to the third-party system pointed to by webhooks (here is the Jaguar platform) for build and deployment.

[0085] Test server, that is, test server, in which a reverse proxy service, such as nginx, is deployed. Nginx is a high-performance open source HTTP and reverse proxy web service, and the present invention mainly utilizes its reverse proxy capability. The test server listens on ports 3001, 3002 to 300N. The test server contains branch test paths for each test port. As shown in the figure, / dir_3001 / projectA, / dir_3002 / projectA and / dir_300N / projectA. Among them, / dir_3001 / projectA is the branch test path of branch branch_3001. / dir_3002 / projectA is the branch test path of branch branch_3002. / dir_300N / projectA is the branch test path of branch branch_300N. By listening to port 3001, you can point to / dir_3001 / projectA, by listening to port 3002, you can point to / dir_3002 / projectA, and by listening to port 3003, you can point to / dir_3003 / projectA.

[0086] The tester opens the http forward proxy through the test client and accesses the domain name to be tested dev.***.cn, where the business type of the domain name to be tested is projectA. The test client sends the request to the forward proxy service. The forward proxy server can be, for example, fiddler or charles, which proxies the original request Host to the corresponding host+port. Only one proxy configuration is opened at the same time. Proxy configuration 1 is the domain name to be tested and the corresponding test port 3001. Proxy configuration 2 is the domain name to be tested and the corresponding test port 3002. Proxy configuration n is the domain name to be tested and the corresponding test port 300N. The forward proxy service can obtain the domain name to be tested and point to the test port in the corresponding test server based on the domain name to be tested.

[0087] New project initialization: For a new project, the developer enters the Jaguar platform and directly creates a new project (the input name should be consistent with the Gitlab warehouse name, here we take projectA as an example). The Jaguar platform will first automatically create a projectA directory in a total of N directories from dir_3001 to dir_300N on the test machine (the value of N represents a number that can be customized according to actual needs) by executing a shell script. If the directories dir_300* do not exist, these directories will be automatically initialized and created first. Then the reverse proxy configuration files of each test environment of the corresponding project are automatically added, and the initialization action has been completed.

[0088] The first step of the initialization operation is to provide and clarify the code deployment directory of the N test environments of the projectA project. The second step is to provide and clarify the ports and access routes occupied by the N test environments of the projectA project and establish a mapping relationship with the code deployment directory of the corresponding environment. In this way, multiple test environments are isolated in the original test environment machine. The remaining problems to be solved are: the code branch used by the developer is associated with a certain test environment; the branch code is deployed to the corresponding test environment; how the test end switches between multiple test environments (testing multiple requirements in parallel).

[0089] Environment and branch mapping configuration: Developers can customize the development branch they use and the specific test environment they are associated with (mapped to). Through the open API provided by Gitlab, the Jaguar platform can obtain a list of all branches of the Gitlab project corresponding to the current project (this is also the reason why the project name should be consistent with the Gitlab project name), and developers can directly select it.

[0090] The number of test environments N is set to a sufficient value by default on the Jaguar platform. After the developer selects and saves the value, his or her development branch and the occupied test environment are associated.

[0091] Build and deploy: When developers push their own code, Gitlab will trigger a call to the third-party system pointed to by webhooks (here is the Jaguar platform). The Jaguar platform can clearly identify the project, branch, and other detailed information of the current triggering operation from the parameters. The Jaguar platform will first pull the code of the current branch in a temporary directory through a shell script and perform the build based on the build configuration file. Then, it will read the test environment directory corresponding to the current branch of the current project from the database (written to the database in 2.2.2), copy the built files to the corresponding directory, and finally delete the temporary directory. At this point, each developer's branch has its own independent test environment, and has realized automatic building and deployment to the corresponding test environment after submitting the code.

[0092] Parallel testing: The last step is how to quickly switch between different test environments on the test side (different requirements and features can be tested in parallel). This is where the forward proxy comes into play. For the test side, the normal domain name is still used for access (such as dev.***.cn). Start the forward proxy service (fiddler, Charles, etc.) on the test side and configure multiple sets of proxy rules for the test environment (Charles configuration is shown in the figure below). You can easily switch between multiple test environments by checking and unchecking.

[0093] On the web side, we can enable forward proxy (fiddler is recommended for window platform and charles is recommended for mac platform) by configuring the browser's proxy rules (chrome also has corresponding plug-ins). On the mobile side, you can directly configure the http proxy in the system settings (forward proxy service for desktop computers).

[0094] In this embodiment, 1. From a resource perspective: multiple test environments can be quickly isolated without adding new server resources in an existing test environment.

[0095] 2. Development perspective: Each development branch has its own set of test resources to avoid frequent code conflicts caused by multiple people collaborating on a shared test environment.

[0096] 3. Iteration perspective: Each requirement feature has its own set of test resources, and the iteration process is independent, avoiding mutual dependence with other features, which greatly improves iteration efficiency.

[0097] 4. Testing perspective: A single tester can test multiple independent requirements in parallel without interfering with each other, greatly improving work efficiency.

[0098] In one embodiment, a service testing method includes:

[0099] Step (a1), creating a branch test path for each test port.

[0100] Step (a2), adding the configuration files required by the corresponding branch code to each branch test path, and obtaining the branch test path including the configuration files.

[0101] Step (a3), obtaining a branch test path set corresponding to the business type in the test environment server.

[0102] Step (a4), obtaining the selected branch test path from the branch test path set.

[0103] Step (a5), obtaining a branch identifier selected from a branch identifier set corresponding to the service type.

[0104] Step (a6), associating the selected branch test path with the selected branch identifier to obtain a mapping relationship between the branch test path and the branch identifier.

[0105] Step (a7), obtain the uploaded branch code.

[0106] Step (a8), based on the branch identifier of the branch code, determine the branch test path corresponding to the branch code from the mapping relationship between the branch identifier and the branch test path of the test port; the branch test path includes the configuration file required by the branch code; the branch test path corresponds to the service type.

[0107] Step (a9), copying the branch code to the corresponding branch test path, and obtaining each branch test path containing the branch code.

[0108] Step (a10), receiving a test request for the first test port sent by the reverse proxy service, the test request is obtained by the reverse proxy service monitoring the first test port; the test request for the first test port is obtained from the forward proxy page of the test terminal that starts the forward proxy service.

[0109] Step (a11), based on the path corresponding to the first test port, determine a first branch test path corresponding to the service type identifier of the domain name to be tested from the branch test paths of each branch code.

[0110] Step (a12), performing a first branch test on the domain name to be tested based on the files in the first branch test path, and obtaining a branch test result.

[0111] Step (a13), returning the branch test result to the test terminal through the reverse proxy service.

[0112] Step (a14), when obtaining an operation instruction to switch to the second test port from the forward proxy page of the test terminal that starts the forward proxy service, determining a second branch test path corresponding to the service type of the domain name to be tested from the path corresponding to the second test port.

[0113] Step (a15), performing a second branch test on the domain name to be tested based on the files in the second branch test path.

[0114] The above-mentioned business testing method determines the first branch test path corresponding to the business type of the domain name to be tested based on the path corresponding to the first test port, and performs branch testing on the domain name to be tested based on the files in the first branch test path. In this way, multiple test environments are isolated through the port path without adding new server resources, that is, each branch to be tested is distinguished, and each development branch has an exclusive set of test resources. Branch testing can be performed based on each branch test path, and each branch test is independent. Compared with the traditional test environment where multiple requirement codes being tested are mixed at the same time, it can avoid the problem of frequent code conflicts caused by multiple people collaborating to share the test environment, and also avoid the problem of mutual dependence with other branches, thereby improving the test efficiency.

[0115] It should be understood that although Figure 2 , 4 The steps in the flowcharts of and 5 are shown in sequence as indicated by arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 , 4 At least part of the steps in 5 may include multiple steps or multiple stages. These steps or stages do not necessarily have to be executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily one by one, but can be executed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0116] In one embodiment, Figure 6 As shown, a service testing device is provided, including: a domain name acquisition module, a path determination module and a branch testing module, wherein:

[0117] A domain name acquisition module, used to acquire a first domain name corresponding to the domain name to be tested; the first domain name includes a first test port;

[0118] A path determination module, configured to determine a first branch test path corresponding to a service type of a domain name to be tested based on a path corresponding to the first test port;

[0119] The branch test module is used to perform a branch test on the domain name to be tested based on the first branch test path.

[0120] The above-mentioned business testing device determines the first branch test path corresponding to the business type of the domain name to be tested based on the path corresponding to the first test port, and performs branch testing on the domain name to be tested based on the files in the first branch test path. Then, multiple test environments are isolated through the port path without adding new server resources, that is, each branch to be tested is distinguished, and each development branch has an exclusive set of test resources. Branch testing can be performed based on each branch test path, and each branch test is independent. Compared with the traditional test environment in which multiple requirement codes being tested are mixed at the same time, it can avoid the problem of frequent code conflicts caused by multiple people collaborating to share the test environment, and also avoid the problem of mutual dependence with other branches, thereby improving the test efficiency.

[0121] In one embodiment, the path determination module is further used to determine a second branch test path corresponding to the service type of the domain name to be tested from the path corresponding to the second test port when an operation instruction to switch to the second test port triggered by the test terminal is obtained. The branch test module is also used to perform a second branch test on the domain name to be tested based on the files in the second branch test path.

[0122] In this embodiment, when an operation instruction to switch to the second test port triggered by the test terminal is obtained, a second branch test path corresponding to the business type of the domain name to be tested is determined from the path corresponding to the second test port; a second branch test is performed on the domain name to be tested based on the file in the second branch test path, and switching can be performed among the branch test paths to perform different branch tests on the same domain name.

[0123] In one embodiment, the path determination module is further used to obtain an operation instruction to switch to the second test port from a forward proxy page of the test terminal that starts the forward proxy service.

[0124] In this embodiment, an operation instruction to switch to the second test port is obtained from the forward proxy page of the test terminal that starts the forward proxy service, so that the test can be quickly accessed without the user manually inputting the port number, thereby improving the test efficiency.

[0125] In one embodiment, the domain name acquisition module is used to receive a test request for the first test port sent by the reverse proxy service, and the test request is obtained by the reverse proxy service monitoring the first test port. The branch test module is used to perform a first branch test on the domain name to be tested based on the file in the first branch test path to obtain a branch test result; and return the branch test result to the test terminal through the reverse proxy service.

[0126] In this embodiment, a test request for the first test port is received through the reverse proxy service. The test request is obtained by the reverse proxy service listening to the first test port. The first branch test is performed on the domain name to be tested based on the file in the first branch test path to obtain the branch test result. The branch test result is returned to the test terminal through the reverse proxy service. Each port can be maintained and managed through the reverse proxy service. Since the branch test is performed using the files in the path corresponding to the port, when a branch needs to be added, the port can be managed through the reverse proxy service, which is convenient for expansion.

[0127] In one embodiment, the service testing device also includes a branch mapping module. The branch mapping module is used to obtain each uploaded branch code; based on the branch identifier of each branch code, the branch test path corresponding to each branch code is determined from the mapping relationship between the branch identifier and the branch test path of the test port; the branch test path contains the configuration file required for the branch code; the branch test path includes a service type identifier; the service type identifier is used to characterize the service type. Each branch code is copied to the corresponding branch test path to obtain each branch test path containing the branch code. The path determination module is used to determine the first branch test path corresponding to the service type identifier of the domain name to be tested from the branch test path of each branch code.

[0128] In this embodiment, the uploaded branch code is obtained, and the branch test path corresponding to each branch code is determined, the branch code is copied to the branch test path, and the branch test path containing the branch code is obtained, and the first branch test path corresponding to the business type of the domain name to be tested is determined, thereby isolating each test environment.

[0129] In one embodiment, the branch mapping module is further used to create a branch test path for each test port; and to add a configuration file required by the corresponding branch code to each branch test path to obtain a branch test path including the configuration file.

[0130] In this embodiment, a branch test path is created for each test port, and a configuration file required for the corresponding branch code is added to each branch test path to obtain a branch test path containing the configuration file, that is, the test environment is configured. After the branch code is uploaded, it can be directly associated with the branch test path, thereby realizing test environment isolation and improving test efficiency.

[0131] In one embodiment, the branch mapping module is also used to obtain a branch test path set corresponding to the business type; obtain a selected branch test path from the branch test path set; obtain a branch identifier selected from a branch identifier set corresponding to the business type; associate the selected branch test path with the selected branch identifier to obtain a mapping relationship between the branch test path and the branch identifier.

[0132] In this embodiment, the selected branch identifier is obtained from the branch identifier set corresponding to the business type, and the branch identifier is selected from the branch identifier set corresponding to the business type and associated, so that the mapping relationship between the branch test path and the branch identifier can be obtained. After the branch code is uploaded, the branch code can be quickly saved to the corresponding test environment to improve the test efficiency.

[0133] For the specific definition of the service testing device, please refer to the definition of the service testing method above, which will not be repeated here. Each module in the above service testing device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0134] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a business testing method is implemented.

[0135] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0136] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0137] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0138] In one embodiment, a computer program product or computer program is provided, the computer program product or computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps in the above-mentioned method embodiments.

[0139] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0140] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0141] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A service testing method, characterized in that: The method comprises: Acquire a selected branch test path from a branch test path set corresponding to the service type, acquire a branch identifier selected from a branch identifier set corresponding to the service type, associate the selected branch test path with the selected branch identifier, and obtain a mapping relationship between the branch test path and the branch identifier; Obtain each uploaded branch code, determine the branch test path corresponding to each branch code from the mapping relationship based on the branch identifier of each branch code, copy each branch code to the corresponding branch test path, and obtain each branch test path containing the branch code; the branch test path includes a business type identifier; When the forward proxy service obtains the first test port corresponding to the domain name to be tested and the test request for the first test port from the forward proxy page of the test terminal, the reverse proxy service receives the test request obtained and sent by monitoring the first test port, so as to obtain the domain name to be tested and the first test port corresponding to the domain name to be tested; Based on the path corresponding to the first test port, determining a first branch test path corresponding to the service type identifier of the domain name to be tested from the branch test paths of each branch code; Perform a first branch test on the domain name to be tested based on the files in the first branch test path to obtain a branch test result; Returning the branch test result to the test terminal through the reverse proxy service; Obtaining an operation instruction to switch to the second test port from the forward proxy page of the test terminal that starts the forward proxy service; In response to the operation instruction to switch to the second test port, a second branch test path corresponding to the service type of the domain name to be tested is determined from the path corresponding to the second test port; the first test port and the second test port each correspond to a different test environment in the test server; the first test port and the second test port are used to test different characteristics of the domain name to be tested; A second branch test is performed on the domain name to be tested based on the files in the second branch test path.

2. The method according to claim 1, characterized in that The first test port is the port to which the domain name to be tested is currently accessed.

3. The method according to claim 1, characterized in that The branch test path includes the configuration file required by the branch code.

4. The method according to claim 1, characterized in that: Before obtaining each uploaded branch code, the method further includes: Create branch test paths for each test port; Add the configuration file required by the corresponding branch code to each branch test path to obtain the branch test path containing the configuration file.

5. The method according to claim 1, characterized in that The branch code is part of the code in the development main line.

6. A service testing device, characterized in that: The device comprises: A branch mapping module is used to obtain a selected branch test path from a branch test path set corresponding to a business type, obtain a branch identifier selected from a branch identifier set corresponding to the business type, associate the selected branch test path with the selected branch identifier, and obtain a mapping relationship between the branch test path and the branch identifier; obtain each uploaded branch code, and based on the branch identifier of each branch code, determine the branch test path corresponding to each branch code from the mapping relationship, copy each branch code to the corresponding branch test path, and obtain each branch test path containing the branch code; the branch test path includes a business type identifier; A domain name acquisition module, configured to receive the test request obtained and sent by the reverse proxy service monitoring the first test port when the forward proxy service obtains the first test port corresponding to the domain name to be tested and the test request for the first test port from the forward proxy page of the test terminal, so as to obtain the domain name to be tested and the first test port corresponding to the domain name to be tested; A path determination module, configured to determine, based on the path corresponding to the first test port, from the branch test paths of each of the branch codes, a first branch test path corresponding to the service type identifier of the domain name to be tested; A branch test module, configured to perform a branch test on the domain name to be tested based on the first branch test path to obtain a branch test result; and return the branch test result to the test terminal through the reverse proxy service; The path determination module is further used to obtain an operation instruction to switch to a second test port from a forward proxy page of a test terminal that starts a forward proxy service; in response to the operation instruction to switch to the second test port, determine a second branch test path corresponding to the service type of the domain name to be tested from the path corresponding to the second test port; the first test port and the second test port each correspond to a different test environment in a test server; the first test port and the second test port are used to test different characteristics of the domain name to be tested; The branch test module is further used to perform a second branch test on the domain name to be tested based on the files in the second branch test path.

7. The device according to claim 6, characterized in that The branch mapping module is further used to create a branch test path for each test port; add a configuration file required by the corresponding branch code to each branch test path to obtain a branch test path containing the configuration file.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

10. A computer program product, comprising computer instructions, wherein the computer instructions are stored in a computer-readable storage medium, wherein: When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Method and device for quickly establishing software testing environment

    CN109857644A

  • Version management method and device based on GIT, equipment and readable storage medium

    CN110489347A

  • H5 client code setting multi-environment test method and system

    CN110781083A

  • Code testing method and device and readable storage medium

    CN111639019A

  • Environment for continuous testing and integration of software

    US20200125485A1