CN112988584B - Business testing method, device, computer equipment and storage medium - Google Patents
Business testing method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112988584B CN112988584B CN202110301143.6A CN202110301143A CN112988584B CN 112988584 B CN112988584 B CN 112988584B CN 202110301143 A CN202110301143 A CN 202110301143A CN 112988584 B CN112988584 B CN 112988584B
- Authority
- CN
- China
- Prior art keywords
- branch
- test
- path
- domain name
- port
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3698—Environments for analysis, debugging or testing of software
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
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.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a service testing method, a service testing device, a computer device, and a storage medium.
Background
When a plurality of persons cooperate to develop H5 engineering, a set of testing environment is usually only provided inside a team, and based on the requirement of development efficiency, a plurality of developers generally have independent development branches to complete respective development requirements, and after the developers complete development, the codes of the branches are combined into a main branch to enable the testers to start testing. The test environment may mix a plurality of demand codes under test at the same time, if the test A passes but the test B does not pass, so that the characteristic A needs to wait for the developer of the characteristic B to complete the fault processing and pass the test before continuing the subsequent deployment flow, and the online efficiency of the demand characteristic is greatly reduced.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device, and a storage medium capable of service testing.
A method of traffic testing, the method comprising:
acquiring a domain name to be detected and a first test port corresponding to the domain name to be detected;
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 file in the first branch test path.
A traffic testing device, the device comprising:
the domain name acquisition module is used for acquiring a first domain name corresponding to the domain name to be detected; the first domain name includes a first test port;
the path determining module is used for 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 the branch test module is used for carrying out branch test on the domain name to be tested based on the first branch test path.
A computer device comprising a memory storing a computer program and a processor implementing steps in embodiments of the application when the computer program is executed.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of an embodiment of the present application.
According to the service testing method, the device, the computer equipment and the storage medium, the first branch testing path corresponding to the service type of the domain name to be tested is determined based on the path corresponding to the first testing port, and the branch testing is carried out on the domain name to be tested based on the file in the first branch testing path, so that multiple sets of testing environments are isolated through the path of the port under the condition that server resources are not newly added, namely, each development branch is separated, one set of testing resources is exclusively used, the branch testing can be carried out based on each branch testing path, each branch testing is independent, compared with the traditional testing environment, the problem of frequent code conflict caused when a plurality of people cooperate to share the testing environment can be avoided, the problem of interdependence with other branches is also avoided, and the testing efficiency is improved.
Drawings
FIG. 1 is an application environment diagram of a business testing method in one embodiment;
FIG. 2 is a flow chart of a business testing method in one embodiment;
FIG. 3 is a schematic diagram of a forward proxy page in one embodiment;
FIG. 4 is a schematic flow diagram of a business testing method architecture in one embodiment;
FIG. 5 is a schematic flow chart of a business testing method according to another embodiment;
FIG. 6 is a block diagram of a business testing device in one embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The service testing method provided by the application can be applied to the application environment shown in figure 1. Wherein the test terminal 102 communicates with the test server 104 via a network. The test terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. The test server 104 may be implemented as a stand-alone server or as a cluster of servers. The test terminal 102 obtains a domain name to be tested and a first test port corresponding to the domain name to be tested. The test server 104 obtains the domain name to be tested and a first test port corresponding to the domain name to be tested from the test terminal 102; 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 carrying out branch test on the domain name to be tested based on the file in the first branch test path.
In one embodiment, as shown in fig. 2, a service testing method is provided, and the method is applied to the test server in fig. 1 for illustration, and includes the following steps:
step 202, obtaining a domain name to be tested and a first test port corresponding to the domain name to be tested.
The Domain Name (Domain Name), also called network Domain, is the Name of a computer or a computer group on the Internet, which is formed by a series of names separated by dots, and is used for locating and identifying 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 for pointing to the first test port of the test server. The first test port refers to a port to which the domain name to be tested is accessed currently. Each test port is used for testing different characteristics of the domain name to be tested, for example, a first test port is used for testing stability, and a second test port is used for testing whether a vulnerability exists.
A host with an IP (Internet Protocol ) address can provide different services (processes residing in memory), i.e. IP address and service are in one-to-many relationship, so how the host distinguishes these different network services, in fact, by "IP address+port", each service occupies a port alone (with a value between 0 and 65535).
For service type a, one characteristic of service 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 one port.
Specifically, a test server obtains a domain name to be tested and a first test port corresponding to the domain name to be tested. The method comprises the steps that a test server obtains a test request for a domain name to be tested and a first test port corresponding to the test domain name, wherein the test request for the first test port is obtained from a forward proxy page of a test terminal for starting forward proxy service.
Step 204, 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.
The path may refer to a file path, and is used to indicate a storage location of a file. In the test environment server, the path of each file is unique. An item may be a service type, for example, service type projectA. Or the service type is music, news, microblog, etc.
The paths corresponding to the test ports comprise branch test paths corresponding to the service types. In the paths of the same test port, the same service type uniquely corresponds to one branch test path. The paths corresponding to the test ports can also only comprise branch test paths of one service type, and can also comprise branch test paths of multiple service types.
Specifically, the test server determines 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. For example, the path corresponding to the first test port is/front 3001conf.d/, and the traffic type of the domain name to be tested is projectA, then the first branch test path corresponding to projectA is found to be/dir_3001/projectA from the path of/front 3001 conf.d/.
Step 206, performing a first branch test on the domain name to be tested based on the file in the first branch test path.
Specifically, the first branch test path includes the uploaded branch code and the configuration file required by the branch code. The test server may perform a first branch test on the domain name under test based on the file in the first branch test path.
According to the service testing method, the first branch testing path corresponding to the service type of the domain name to be tested is determined based on the path corresponding to the first testing port, and the branch testing is carried out on the domain name to be tested based on the file in the first branch testing path, so that multiple sets of testing environments are isolated through the path of the port under the condition that server resources are not newly added, namely, each branch of the test is distinguished, each development branch monopolizes one set of testing resources, the branch testing can be carried out based on each branch testing path, each branch testing is independent, and compared with the traditional testing environment, a plurality of demand codes under test are mixed at the same time, the problem of frequent code collision caused when a plurality of people cooperate to share the testing environment is avoided, the problem of interdependence with other branches is also avoided, and the testing efficiency is improved.
In one embodiment, the service testing method further comprises: when an operation instruction triggered by the test terminal and switched to a second test port is acquired, determining a second branch test path corresponding to the service type of the domain name to be tested from paths corresponding to the second test port; and performing a second branch test on the domain name to be tested based on the file in the second branch test path.
Wherein the second test port is not the same test port as the first test port. The path corresponding to the second test port comprises 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.
Specifically, when the test server acquires an operation instruction triggered by the test terminal and switched to a second test port, the test terminal determines a second branch test path corresponding to the service type of the domain name to be tested from paths corresponding to the second test port; and performing a second branch test on the domain name to be tested based on the file in the second branch test path.
In this embodiment, when an operation instruction triggered at the test terminal to switch to the second test port is obtained, a second branch test path corresponding to the service type of the domain name to be tested is determined from the paths corresponding to the second test port; and performing a second branch test on the domain name to be tested based on the file in the second branch test path, and switching in each branch test path so as to perform different branch tests on the same domain name.
In one embodiment, the method for acquiring the operation instruction switched to the second test port includes: and acquiring an operation instruction switched to the second test port from the forward proxy page of the test terminal for starting the forward proxy service.
The forward proxy service refers to a proxy service located between the test terminal and the test server, in order to acquire content from the test server, the test terminal sends a request to the proxy service and designates a port, and then the proxy service forwards the request to the test server and returns the acquired content to the test terminal.
Specifically, on the web side we can enable forward proxy by configuring proxy rules of the browser, on the mobile side we can configure http proxy (forward proxy service of desktop) directly in the system setup. The test terminal stores forward proxy rules required by the forward proxy service. Such as storing available ports for each domain name under test. And the testing terminal displays the forward proxy page, and displays the available port corresponding to the domain name to be tested on the forward proxy page. And the test server acquires an operation instruction for switching to the second test port from the forward proxy page of the test terminal for starting forward service.
In this embodiment, as shown in fig. 3, a schematic diagram of a forward proxy page in one embodiment is shown. The domain name to be tested 302 includes 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 and canceling the checking. For example, when the second test port 3002 is checked, the test server may acquire an operation instruction for switching to the second test port.
In this embodiment, the operation instruction for switching to the second test port is obtained from the forward proxy page of the test terminal for starting the forward proxy service, so that the user can quickly access the test without manually inputting the port number, and the test efficiency is improved.
In one embodiment, obtaining a domain name to be tested and a first test port corresponding to the domain name to be tested includes: and receiving a test request for the first test port sent by the reverse proxy service, wherein the test request is obtained by monitoring the first test port by the reverse proxy service.
Performing a first branch test on the domain name to be tested based on the file in the first branch test path, including: performing 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 returning a branch test result to the test terminal through the reverse proxy service.
The reverse proxy service receives the connection request, forwards the request to a server on the internal network, and returns a result obtained from the internal server to the requested test terminal. The branch test result may be that the branch test passes, the branch test does not pass, a leak in the branch test, and the like are not limited thereto.
Specifically, the test server receives a test request sent by the reverse proxy service to the first test port, where 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 file in the first branch test path to obtain a branch test result, and returns the branch test result to the test terminal through the reverse proxy service.
In this embodiment, the configuration file of the configuration// test environment of the x/nginx
server {
Listen 3001;// snoop 3001 port
Server_name dev. Cn;// Domain name under test
Include front3001 conf.d/. Conf;// path corresponding to test port 3001
}
*/front3001conf.d/
Location/projectA {// location to traffic type projectA
Root/dir_3001/projectA, and branch test path corresponding to the type of the/service
try_files /index.html
}
In this embodiment, the test server includes ports 3001 and 3002, the service type includes type a, type B and type C, and type a includes branch A1 and branch A2; type B is illustrated as including branches B1 and B2. Then type a, type B, and type C may be included in port 3001, but only one branch path, branch A1, is included under the path of type a. Likewise, only one branch path, branch B1, is included in type B of port 3001. Only one branch path, branch C1, is included in type C of port 3001. Type a, type B, and type C may be included in port 3002, but only one branch path, branch A2, is included in the path of type a and only one branch path, branch B2, is included in the path of type B.
In one embodiment, the traditional approach of not passing through the reverse proxy, assuming that 10 test environments are required, for a total of 20 service types, a total of 100×200 cases occur, which is costly to maintain. And the reverse proxy is used for distinguishing 10 sets of test environments, and the rest of test environments are maintained again, so that the maintenance cost can be reduced.
In this embodiment, a test request for a first test port is received through a reverse proxy service, where the test request is obtained by monitoring the first test port by the reverse proxy service, a first branch test is performed on a domain name to be tested based on a file in a first branch test path, a branch test result is obtained, the branch test result is returned to a test terminal through the reverse proxy service, and each port can be maintained and managed through the reverse proxy service.
In one embodiment, as shown in fig. 4, a flow chart of a business testing method architecture in one embodiment is shown. Included in fig. 4 are a client, a forward proxy service, a reverse proxy service, and a test server. And acquiring the domain name to be measured from the client. And acquiring the corresponding port through the forward proxy page corresponding to the forward proxy service. Such as domain name → 3001, domain name → 3002, domain name → 300n. When the corresponding port acquired by the forward proxy service is 3002, the reverse proxy server monitors 3002 the port to acquire a test request, and determines that the branch test path in the test server is 3002/news/, based on the port number and the service type in the test request.
In one embodiment, before acquiring the domain name to be tested, the service testing method further comprises:
Acquiring each uploaded branch code;
Based on the branch identification of each branch code, determining a branch test path corresponding to each branch code from the mapping relation between the branch identification and the branch test path of the test port; the branch test path contains configuration files required by the branch codes; the branch test path includes a service type identifier; the service type identifier is used to characterize the service type.
Copying each branch code to a corresponding branch test path to obtain each branch test path containing the branch code.
Determining a first branch test path corresponding to a service type of a domain name to be tested, including: and 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 the branch codes.
Wherein the use of branches means that work can be separated from the development main line so as not to affect the development main line. Different branches can be switched and combined, so that a plurality of 'workflows' are simultaneously owned at different stages of a project development period. Branch code refers to the portion of code required in developing a main line.
The branch identification may include at least one of a letter, a number, a letter, a symbol. The branch identification may be a branch code folder name, or the like.
Specifically, the test server acquires each uploaded branch code, and determines a branch test path corresponding to each branch code from the mapping relation between the branch identification and the branch path of the test port based on the branch identification of each branch code; the branch test path contains configuration files required by the branch codes, and the branch test path comprises a service type identifier which is used for representing the service type. And the test server copies each branch code to a corresponding branch test path to obtain each branch test path containing the branch code. And the test server determines a first branch test path corresponding to the service type identifier of the domain name to be tested from the branch test paths of the branch codes.
In this embodiment, the test server obtains each uploaded branch code, compiles and packages the branch codes, and determines a 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 codes to the corresponding branch test paths.
In this embodiment, the uploaded branch codes are obtained, the branch test paths corresponding to the branch codes are determined, the branch codes are copied to the branch test paths, the branch test paths containing the branch codes are obtained, and the first branch test paths corresponding to the service types of the domain name to be tested are determined, so that isolation of each test environment is achieved.
In one embodiment, before the uploaded branch code is obtained, the service testing method further comprises: creating branch test paths of all the test ports; and adding configuration files required by corresponding branch codes into each branch test path to obtain the branch test path containing the configuration files.
In this embodiment, a branch test path of each test port is created, a configuration file required by a corresponding branch code is added in each branch test path, and a branch test path containing the configuration file is obtained, namely, a test environment is configured, and after the branch code is uploaded, the branch test path can be directly associated with the branch test path, so that test environment isolation is realized, and test efficiency is improved.
In one embodiment, a set of branch test paths corresponding to a traffic type is obtained; acquiring a selected branch test path from a branch test path set; acquiring branch identifiers selected from branch identifier sets corresponding to service types; and associating the selected branch test path with the selected branch identifier to obtain the mapping relation between the branch test path and the branch identifier.
Wherein the branch identification is used to uniquely represent the branch code. Each set of branch codes is different. The branch identification may be a filename of the branch code, etc.
Specifically, the test server obtains a set of branch test paths corresponding to the service type. The set of branch test paths includes at least one branch test path. The set of branch identifications comprises at least one branch identification. The test terminal obtains the selected branch test path and the selected branch identification and sends the selected branch test path and the selected branch identification to the test server. And the test server associates the selected branch test path with the selected branch identifier to obtain the mapping relation between the branch test path and the branch identifier. For example, traffic type projectA, the finger identification includes finger 1 and finger 2, the finger path includes projectA/fenzhi 1/and projectA/fenzhi2/, then finger 1 and projectA/fenzhi 1/association are selected, and finger 2 and projectA/fenzhi 2/association are selected.
In this embodiment, the developer sets the development branches used by the developer and specific sets of test environments to be associated in the platform in a self-defined manner. 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. service type), and the developer can directly select. The number of packages N of the test environment is given a value which is enough to be used by default by the platform, and after the developer selects and saves the test environment, the development branch of the developer and the occupied test environment are associated.
In this embodiment, the selected branch identifier is obtained from the branch identifier set corresponding to the service type, the branch identifier is selected from the branch identifier set corresponding to the service type, and the branch identifiers are associated, so that a mapping relationship between the branch test path and the branch identifier can be obtained, and after the branch code is uploaded, the branch code can be quickly saved to the corresponding test environment, thereby improving the test efficiency.
In one embodiment, before acquiring the domain name to be tested, the service testing method further comprises: acquiring an uploaded branch code; creating a branch test path associated with the branch identification based on the branch identification of each branch code; and copying the uploaded branch codes and the required configuration files to the branch test path.
In one embodiment, as shown in fig. 5, a schematic flow chart of a service testing method in another embodiment is shown. The agile platform is a set of self-lapping web systems required in the process of falling to the ground closed loop, and is named as agile platform here, so that the technical scheme is explained later. A branch test path represents a branch test environment. Webhook is a "hook" provided by Gitlab, whose value can be customized (typically, URL (uniform resource locator, uniform resource locator system) of a third party system (e.g., the below mentioned leopard platform)), when a project works performs a certain triggering operation (e.g., code submission commit), gitlab service will automatically request the URL and carry detailed parameters of the current triggering operation (e.g., engineering warehouse address, branch, submitter, etc.), and the third party system can perform a customized task based on this. Gitlab is a web service based on Git and fully integrated, which provides an interface to facilitate the review and operation of engineering warehouse, user and rights, branches, code submission records, etc., while providing access capability for continuous integration or delivery, and provides a rich set of API interfaces for developers to facilitate integration between systems. Nginx is a high performance open source HTTP and reverse proxy web service, and the present invention primarily exploits its reverse proxy capabilities.
The agile platform comprises environment and branch mapping configuration, new engineering initialization (N sets of test environments) and construction deployment based on webhooks parameters. When pushing the own code, the developer Gitlab triggers the third party system (i.e. the leopard platform here) pointed to by the call webhooks to construct and deploy.
The test server, i.e. the test server, has a reverse proxy service, such as nginx, deployed therein. Nginx is a high performance open source HTTP and reverse proxy web service, and the present invention primarily exploits its reverse proxy capabilities. The test server listens to ports 3001, 3002 to 300N. The test server includes branch test paths of the test ports. Such as/dir_3001/projectA,/dir_3002/projectA and/dir_300N/projectA in the figures. where/dir_3001/projectA is the branch test path of branch_3001. Dir 3002/projectA is the branch test path of branch 3002. dir_300N/projectA is the branch test path of the branch branch_300N. the/dir_3001/projectA may be pointed to by snoop port 3001, dir_3002/projectA may be pointed to by snoop port 3002, and dir_3003/projectA may be pointed to by snoop port 3003.
And the tester starts an http forward proxy through the test client and accesses the domain name to be tested dev. The test client sends the request to a forward proxy server, which may be fiddler or charles, for example, that proxies the original request Host to the corresponding host+port. Only one proxy configuration is turned on at the same time. Proxy configuration 1 is the domain name under test and the corresponding test port 3001. Proxy configuration 2 is the domain name under test and the corresponding test port 3002. The proxy configuration N is the domain name to be tested and the corresponding test port 300N. The forward proxy service may obtain the domain name to be tested and direct to a test port in the corresponding test server based on the domain name to be tested.
Initializing a new project: for a new project, a developer directly builds a project (input name and Gitlab warehouse name are preferably kept consistent, here projectA is taken as an example) by entering the leopard platform, and the leopard platform firstly automatically creates a projectA catalog under the total of N catalogues (the value of the N representing the number can be customized according to actual needs) of dir_3001 to dir_300N on the test machine by executing a shell script mode. If dir_300 does not exist, the directories are automatically initialized and created. Then automatically adding the reverse proxy configuration file of each test environment of the corresponding item, and completing the initialization.
The first step of the initialization operation is to provide and define the code deployment catalogue of the N sets of test environments of the projectA items, and the second step is to provide and define the ports occupied by the N sets of test environments of the projectA items, access routes and establish mapping relations with the code deployment catalogue of the corresponding environment. Thus, the machine isolates a plurality of sets of test environments in the original test environment. The problems to be solved are as follows: code branches used by a developer are associated with a set of test environments; deploying the branch codes to the corresponding test environments; how the test end switches between multiple sets of test environments (testing multiple demands in parallel).
Environment and branch mapping configuration: the developer sets up the development branches used by himself and specific sets of test environments to be associated (mapped) in the Jaguar platform in a self-defined mode. Through the open api provided by Gitlab, the leopard platform can obtain a list of all branches of the Gitlab project corresponding to the current project (here, the reason why the project is best consistent with the Gitlab project name) and the developer can directly select the branches.
The number N of the test environments is given a value which is enough to be used by default on the Jaguar platform, and after the developer selects and saves the test environments, the development branches of the developer and the occupied test environments are related.
And (3) construction and deployment: when a developer pushes (pushes) own code, gitlab triggers a third party system (herein, a leopard platform) pointed by webhooks, and the leopard platform can determine engineering, branches and other detailed information of the current triggering operation from parameters. The method comprises the steps that a code of a current branch of a temporary directory is firstly pulled down (pull) by a Jall script through the Jall script, construction is executed based on a construction configuration file, then a test environment directory (written into a database in 2.2.2) corresponding to the current branch of the current project is read from the database, the constructed file is copied to the corresponding directory, and finally the temporary directory is deleted. So far, each developer branch has an independent test environment, and the automatic construction and deployment of code submitted to the corresponding test environment are realized.
Parallel test: the last step is how to quickly switch different test environments at the test end (different requirement characteristics can be tested in parallel), that is, where the forward proxy functions, the test end still uses the normal domain name to access (such as dev..cn), the forward proxy service (fiddler, charles, etc.) is started at the test end, and proxy rules (charles configuration is shown in the following diagram) of multiple test environments are configured, so that the switch between multiple test environments can be facilitated by hooking and unhooking.
On the web side we can enable forward proxy (window platform recommendation fiddler, mac platform recommendation charles) by configuring proxy rules of the browser (chrome also has corresponding plug-ins), on the mobile side http proxy (forward proxy service of desktop) can be configured directly in the system setup.
In this embodiment, 1. Resource angle: under the condition that the server resources are not newly added in the existing test environment, a plurality of test environments can be rapidly isolated.
2. Development angle: each development branch monopolizes one set of test resources, and the problem of frequent code conflict caused when a plurality of persons cooperate to share a test environment is avoided.
3. Iteration angle: each demand characteristic exclusively uses one set of test resources, the iteration flow is independent, mutual dependence with other characteristics is avoided, and the iteration efficiency is greatly improved.
4. Test angle: a single tester can test a plurality of independent requirement characteristics in parallel without interference, so that the working efficiency is greatly improved.
In one embodiment, a service testing method includes:
step (a 1), creating branch test paths of the test ports.
And (a 2) adding configuration files required by corresponding branch codes into each branch test path to obtain a branch test path containing the configuration files.
And (a 3) acquiring a branch test path set corresponding to the service type in the test environment server.
And (a 4) acquiring the selected branch test path from the branch test path set.
And (a 5) acquiring branch identifiers selected from the branch identifier sets corresponding to the service types.
And (a 6) associating the selected branch test path with the selected branch identifier to obtain the mapping relation between the branch test path and the branch identifier.
Step (a 7), obtaining the uploaded branch codes.
Step (a 8), based on the branch identification of the branch code, determining a branch test path corresponding to the branch code from the mapping relation between the branch identification and the branch test path of the test port; the branch test path contains configuration files required by the branch codes; the branch test path corresponds to a traffic type.
And (a 9) copying the branch codes to the corresponding branch test paths to obtain branch test paths containing the branch codes.
Step (a 10), receiving a test request for the first test port sent by the reverse proxy service, wherein the test request is obtained by monitoring the first test port by the reverse proxy service; the test request for the first test port is obtained from a forward proxy page of the test terminal that initiates the forward proxy service.
And (a 11) determining a first branch test path corresponding to the service type identifier of the domain name to be tested from branch test paths of all branch codes based on the paths corresponding to the first test ports.
And (a 12) performing 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 (a 13) returning a branch test result to the test terminal through the reverse proxy service.
And (a 14) when an operation instruction for switching to the second test port is acquired from the forward proxy page of the test terminal for starting the forward proxy service, determining a second branch test path corresponding to the service type of the domain name to be tested from paths corresponding to the second test port.
And (a 15) performing a second branch test on the domain name to be tested based on the file in the second branch test path.
According to the service testing method, the first branch testing path corresponding to the service type of the domain name to be tested is determined based on the path corresponding to the first testing port, and the branch testing is carried out on the domain name to be tested based on the file in the first branch testing path, so that multiple sets of testing environments are isolated through the path of the port under the condition that server resources are not newly added, namely, each branch of the test is distinguished, each development branch monopolizes one set of testing resources, the branch testing can be carried out based on each branch testing path, each branch testing is independent, and compared with the traditional testing environment, a plurality of demand codes under test are mixed at the same time, the problem of frequent code collision caused when a plurality of people cooperate to share the testing environment is avoided, the problem of interdependence with other branches is also avoided, and the testing efficiency is improved.
It should be understood that, although the steps in the flowcharts of fig. 2,4, and 5 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps of fig. 2,4, and 5 may include steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the steps or stages in other steps.
In one embodiment, as shown in fig. 6, there is provided a service testing apparatus, including: the system comprises a domain name acquisition module, a path determination module and a branch test module, wherein:
The domain name acquisition module is used for acquiring a first domain name corresponding to the domain name to be detected; the first domain name includes a first test port;
The path determining module is used for 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 the branch test module is used for carrying out branch test on the domain name to be tested based on the first branch test path.
According to the service testing device, the first branch testing path corresponding to the service type of the domain name to be tested is determined based on the path corresponding to the first testing port, and the branch testing is carried out on the domain name to be tested based on the file in the first branch testing path, so that multiple sets of testing environments are isolated through the path of the port under the condition that server resources are not newly added, namely, each branch of the test is distinguished, each development branch monopolizes one set of testing resources, the branch testing can be carried out based on each branch testing path, each branch testing is independent, and compared with the traditional testing environment, a plurality of demand codes under test are mixed at the same time, the problem of frequent code collision caused when a plurality of people cooperate to share the testing environment is avoided, the problem of interdependence with other branches is also avoided, and the testing efficiency is improved.
In one embodiment, the path determining module is further configured to determine, when an operation instruction triggered at the test terminal to switch to the second test port is acquired, a second branch test path corresponding to the service type of the domain name to be tested from paths corresponding to the second test port. The branch test module is also used for carrying out a second branch test on the domain name to be tested based on the file in the second branch test path.
In this embodiment, when an operation instruction triggered at the test terminal to switch to the second test port is obtained, a second branch test path corresponding to the service type of the domain name to be tested is determined from the paths corresponding to the second test port; and performing a second branch test on the domain name to be tested based on the file in the second branch test path, and switching in each branch test path so as to perform different branch tests on the same domain name.
In one embodiment, the path determining module is further configured to obtain an operation instruction for switching to the second test port from a forward proxy page of the test terminal that starts the forward proxy service.
In this embodiment, the operation instruction for switching to the second test port is obtained from the forward proxy page of the test terminal for starting the forward proxy service, so that the user can quickly access the test without manually inputting the port number, and the test efficiency is improved.
In one embodiment, the domain name obtaining module is configured to receive a test request sent by the reverse proxy service to the first test port, where the test request is obtained by the reverse proxy service monitoring the first test port. The branch test module is used for carrying out 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 returning a branch test result to the test terminal through the reverse proxy service.
In this embodiment, a test request for a first test port is received through a reverse proxy service, where the test request is obtained by monitoring the first test port by the reverse proxy service, a first branch test is performed on a domain name to be tested based on a file in a first branch test path, a branch test result is obtained, the branch test result is returned to a test terminal through the reverse proxy service, and each port can be maintained and managed through the reverse proxy service.
In one embodiment, the service testing apparatus further comprises a branch mapping module. The branch mapping module is used for acquiring each uploaded branch code; based on the branch identification of each branch code, determining a branch test path corresponding to each branch code from the mapping relation between the branch identification and the branch test path of the test port; the branch test path contains configuration files required by the branch codes; the branch test path includes a service type identifier; the service type identifier is used to characterize the service type. Copying each branch code to a corresponding branch test path to obtain each branch test path containing the branch code. The path determining module is used for determining a first branch test path corresponding to the service type identifier of the domain name to be detected from the branch test paths of the branch codes.
In this embodiment, the uploaded branch codes are obtained, the branch test paths corresponding to the branch codes are determined, the branch codes are copied to the branch test paths, the branch test paths containing the branch codes are obtained, and the first branch test paths corresponding to the service types of the domain name to be tested are determined, so that isolation of each test environment is achieved.
In one embodiment, the branch mapping module is further configured to create a branch test path for each test port; and adding configuration files required by corresponding branch codes into each branch test path to obtain the branch test path containing the configuration files.
In this embodiment, a branch test path of each test port is created, a configuration file required by a corresponding branch code is added in each branch test path, and a branch test path containing the configuration file is obtained, namely, a test environment is configured, and after the branch code is uploaded, the branch test path can be directly associated with the branch test path, so that test environment isolation is realized, and test efficiency is improved.
In one embodiment, the branch mapping module is further configured to obtain a branch test path set corresponding to the service type; acquiring a selected branch test path from a branch test path set; acquiring branch identifiers selected from branch identifier sets corresponding to service types; and associating the selected branch test path with the selected branch identifier to obtain the mapping relation between the branch test path and the branch identifier.
In this embodiment, the selected branch identifier is obtained from the branch identifier set corresponding to the service type, the branch identifier is selected from the branch identifier set corresponding to the service type, and the branch identifiers are associated, so that a mapping relationship between the branch test path and the branch identifier can be obtained, and after the branch code is uploaded, the branch code can be quickly saved to the corresponding test environment, thereby improving the test efficiency.
For specific limitations of the service testing device, reference may be made to the above limitation of the service testing method, and no further description is given here. The modules in the service testing device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a business testing method.
It will be appreciated by those skilled in the art that the structure shown in FIG. 7 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the 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-described method embodiments.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.
Claims (10)
1. A method for testing traffic, the method comprising:
acquiring a selected branch test path from a branch test path set corresponding to a service type, acquiring a branch identifier selected from a branch identifier set corresponding to the service type, associating the selected branch test path with the selected branch identifier, and acquiring a mapping relation between the branch test path and the branch identifier;
acquiring each uploaded branch code, determining a branch test path corresponding to each branch code from the mapping relation based on the branch identification of each branch code, copying each branch code to the corresponding branch test path, and acquiring each branch test path containing the branch code; the branch test path comprises a service type identifier;
When the forward proxy service acquires a first test port corresponding to a domain name to be tested and a test request for the first test port from a forward proxy page of a testing terminal, receiving the test request obtained and sent by the reverse proxy service monitoring the first test port, so as to acquire the domain name to be tested and the first test port corresponding to the domain name to be tested;
Determining a first branch test path corresponding to the service type identifier of the domain name to be tested from branch test paths of the branch codes based on the paths corresponding to the first test ports;
Performing 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;
returning the branch test result to the test terminal through the reverse proxy service;
acquiring an operation instruction for switching to a second test port from a forward proxy page of a test terminal for starting forward proxy service;
Responding to the operation instruction switched to the second test port, and determining a second branch test path corresponding to the service type of the domain name to be tested from paths corresponding to the second test port; the first test port and the second test port respectively correspond to different test environments in the test server; the first test port and the second test port are used for testing different characteristics of the domain name to be tested;
and performing a second branch test on the domain name to be tested based on the file in the second branch test path.
2. The method of claim 1, wherein the first test port is a port to which the domain name under test is currently accessing.
3. The method of claim 1, wherein the branch test path includes a configuration file required for the branch code.
4. The method of claim 1, wherein prior to the obtaining each uploaded branch code, the method further comprises:
Creating branch test paths of all the test ports;
and adding configuration files required by corresponding branch codes into each branch test path to obtain the branch test path containing the configuration files.
5. The method of claim 1, wherein the branch code is a portion of code in a development main line.
6. A traffic testing device, the device comprising:
The branch mapping module is used for acquiring a selected branch test path from a branch test path set corresponding to a service type, acquiring a branch identifier selected from a branch identifier set corresponding to the service type, associating the selected branch test path with the selected branch identifier, and acquiring a mapping relation between the branch test path and the branch identifier; acquiring each uploaded branch code, determining a branch test path corresponding to each branch code from the mapping relation based on the branch identification of each branch code, copying each branch code to the corresponding branch test path, and acquiring each branch test path containing the branch code; the branch test path comprises a service type identifier;
The domain name acquisition module is used for receiving a test request obtained and sent by a reverse proxy service monitoring the first test port when the forward proxy service acquires the first test port corresponding to the domain name to be tested and the test request for the first test port from a forward proxy page of a test terminal, so as to acquire the domain name to be tested and the first test port corresponding to the domain name to be tested;
The path determining module is used for determining a first branch test path corresponding to the service type identifier of the domain name to be tested from branch test paths of the branch codes based on the path corresponding to the first test port;
the branch test module is used for carrying out branch test on the domain name to be tested based on 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;
The path determining module is further used for acquiring an operation instruction for switching to the second test port from a forward proxy page of the test terminal for starting the forward proxy service; responding to the operation instruction switched to the second test port, and determining a second branch test path corresponding to the service type of the domain name to be tested from paths corresponding to the second test port; the first test port and the second test port respectively correspond to different test environments in the test server; the first test port and the second test port are used for testing different characteristics of the domain name to be tested;
And the branch test module is further used for carrying out a second branch test on the domain name to be tested based on the file in the second branch test path.
7. The apparatus of claim 6, wherein the branch mapping module is further configured to create a branch test path for each test port; and adding configuration files required by corresponding branch codes into each branch test path to obtain the branch test path containing the configuration files.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 5 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
10. A computer program product comprising computer instructions stored in a computer readable storage medium, characterized in that the computer instructions, when executed by a processor, implement the steps of the method of any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110301143.6A CN112988584B (en) | 2021-03-22 | 2021-03-22 | Business testing method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110301143.6A CN112988584B (en) | 2021-03-22 | 2021-03-22 | Business testing method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112988584A CN112988584A (en) | 2021-06-18 |
CN112988584B true CN112988584B (en) | 2024-11-15 |
Family
ID=76332812
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110301143.6A Active CN112988584B (en) | 2021-03-22 | 2021-03-22 | Business testing method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112988584B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110781083A (en) * | 2019-10-18 | 2020-02-11 | 苏宁消费金融有限公司 | A kind of H5 client code setting multi-environment testing method and system |
CN111639019A (en) * | 2020-04-24 | 2020-09-08 | 北京五八信息技术有限公司 | Code testing method and device and readable storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10733087B2 (en) * | 2018-10-17 | 2020-08-04 | Servicenow, Inc. | Environment for continuous testing and integration of software |
CN109857644A (en) * | 2018-12-30 | 2019-06-07 | 贝壳技术有限公司 | A kind of method and device of fast construction software testing environment |
CN110489347A (en) * | 2019-08-20 | 2019-11-22 | 深圳市钱海网络技术有限公司 | Method for edition management, device, equipment and readable storage medium storing program for executing based on GIT |
-
2021
- 2021-03-22 CN CN202110301143.6A patent/CN112988584B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110781083A (en) * | 2019-10-18 | 2020-02-11 | 苏宁消费金融有限公司 | A kind of H5 client code setting multi-environment testing method and system |
CN111639019A (en) * | 2020-04-24 | 2020-09-08 | 北京五八信息技术有限公司 | Code testing method and device and readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112988584A (en) | 2021-06-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107948314B (en) | Business processing method and device based on rule file and server | |
US7886049B2 (en) | Extensible software tool for investigating peer-to-peer usage on a target device | |
US8543998B2 (en) | System and method for building virtual appliances using a repository metadata server and a dependency resolution service | |
CN111858296B (en) | Interface testing method, device, equipment and storage medium | |
US11144292B2 (en) | Packaging support system and packaging support method | |
CN111475376A (en) | Method and device for processing test data, computer equipment and storage medium | |
CN113037891B (en) | Access method and device for stateful application in edge computing system and electronic equipment | |
CN111090452A (en) | Service environment switching method and computer-readable storage medium | |
CN114443215A (en) | Business application deployment method, apparatus, computer equipment and storage medium | |
CN114168179B (en) | Micro-service management method, micro-service management device, computer equipment and storage medium | |
US20220197620A1 (en) | Deploying micro frontends to different clusters from a single repository | |
CN110287696A (en) | A detection method, device and equipment for reverse shell process | |
CN114064475B (en) | Cloud native application testing method, device, equipment and storage medium | |
CN107844542A (en) | A kind of distributed document storage method and device | |
US11537503B2 (en) | Code editor for user interface component testing | |
CN110704041A (en) | Software development method and device | |
CN112486509B (en) | Jar package assembly hot deployment method and system | |
CN112988584B (en) | Business testing method, device, computer equipment and storage medium | |
CN112115056A (en) | Project deployment method and device, server and storage medium | |
US11748246B2 (en) | Crowd-sourced QA with trusted compute model | |
CN112783757B (en) | Test system, method, computer system, and computer-readable storage medium | |
CN115827193A (en) | Resource migration method and device, electronic equipment and storage medium | |
CN114615150A (en) | Simulation network generation method and device | |
CN114356308A (en) | Web page display editing method, device, device and storage medium | |
CN113704114A (en) | Automatic testing method, device, equipment and medium for functional interface |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |