CN112988584A - Service testing method, device, computer equipment and storage medium - Google Patents

Service testing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112988584A
CN112988584A CN202110301143.6A CN202110301143A CN112988584A CN 112988584 A CN112988584 A CN 112988584A CN 202110301143 A CN202110301143 A CN 202110301143A CN 112988584 A CN112988584 A CN 112988584A
Authority
CN
China
Prior art keywords
branch
test
path
domain name
tested
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.)
Pending
Application number
CN202110301143.6A
Other languages
Chinese (zh)
Inventor
邢德阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Yunzhijia Network Co ltd
Original Assignee
Shenzhen Yunzhijia Network Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Yunzhijia Network Co ltd filed Critical Shenzhen Yunzhijia Network Co ltd
Priority to CN202110301143.6A priority Critical patent/CN112988584A/en
Publication of CN112988584A publication Critical patent/CN112988584A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging 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)

Abstract

The application relates to a service testing method, a service testing device, computer equipment and a storage medium. The method comprises the following steps: acquiring 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 carrying out first branch test on the domain name to be tested based on the file in the first branch test path. The method can improve the testing efficiency.

Description

Service testing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for testing a service, a computer device, and a storage medium.
Background
When a plurality of persons collaboratively develop the H5 project, only one set of test environment is usually arranged in a team, a plurality of developers usually have an independent development branch to complete respective development requirements based on the requirement of development efficiency, and after the developers complete the development, the codes of the branches of the developers are merged into the main branch to enable the testers to start the test. The test environment may be mixed with a plurality of demand codes under test at the same time, if the test a passes but the test B does not pass, the characteristic a needs to wait for the developer of the characteristic B to finish the fault processing and continue the subsequent deployment process after the test a passes, and the online efficiency of the demand characteristic is greatly reduced.
Disclosure of Invention
In view of the above, it is necessary to provide a method, an apparatus, a computer device and a storage medium capable of testing a service in response to the above technical problems.
A method of traffic testing, the method comprising:
acquiring 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 carrying out first branch test on the domain name to be tested based on the file in the first branch test path.
A traffic testing apparatus, the apparatus 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 comprises a first test port;
a path determining module, configured to determine, based on a path corresponding to the first test port, a first branch test path corresponding to the service type of the domain name to be tested;
and the branch testing module is used for performing branch testing on the domain name to be tested based on the first branch testing path.
A computer device comprising a memory storing a computer program and a processor implementing the steps in the embodiments of the present application when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out steps of embodiments 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 domain name to be tested is subjected to branch testing based on the file in the first branch testing path, so that a plurality of sets of testing environments are isolated through the path of the port under the condition that server resources are not newly added, the branches to be tested are separated, each development branch exclusively occupies one set of testing resources, branch testing can be performed based on each branch testing path, each branch testing is independent, compared with the traditional testing environment, a plurality of required codes in testing are mixed at the same time, the problem of frequent code conflict caused when a plurality of people cooperate to share the testing environment can be avoided, the problem of mutual dependence on other branches can be avoided, and the testing efficiency is improved.
Drawings
FIG. 1 is a diagram of an application environment of a method for testing services in one embodiment;
FIG. 2 is a flow diagram illustrating a method for testing services in one embodiment;
FIG. 3 is a diagram of a forward proxy page in one embodiment;
FIG. 4 is a flow chart of a business testing method architecture in one embodiment;
FIG. 5 is a schematic diagram of an architecture flow of a traffic testing method in another embodiment;
FIG. 6 is a block diagram showing the structure of a service test apparatus according to an embodiment;
FIG. 7 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The service testing method provided by the application can be applied to the application environment shown in fig. 1. Wherein the test terminal 102 communicates with the test server 104 over 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 server cluster of multiple 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 acquires 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 a path corresponding to a first test port; and performing 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, which is described by taking the application of the method to the testing server in fig. 1 as an example, and includes the following steps:
step 202, acquiring 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 certain computer or computer group on the Internet, which is composed of a string of names separated by points, and is used for positioning and identifying the computer during data transmission. The domain name to be tested is used for pointing 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 accessed by the current domain name to be tested. Each test port is used for testing different characteristics of the domain name to be tested, for example, the first test port is used for testing stability, and the second test port is used for testing whether a vulnerability exists.
A host having an IP (Internet Protocol) address can provide different services (resident memory processes), that is, the IP address and the services are in a one-to-many relationship, so how the host distinguishes the different network services is actually to distinguish the different services by "IP address + port", and each service occupies a certain port (the value is between 0 and 65535) independently.
For the service type A, one characteristic of the service type A corresponds to a set of branch codes, one set of branch codes corresponds to a set of test environments, and one set of test environments corresponds to one port.
Specifically, the 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 the file. In the test environment server, the path of each file is unique. An item may be a service type, for example service type project a. Or the service types are music, news, microblogs and the like.
The path corresponding to the test port includes a branch test path corresponding to each service type. 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 may include only one service type of branch test path, or may include multiple service types of branch test paths.
Specifically, the test server determines a first branch test path corresponding to the service type of the domain name to be tested based on a path corresponding to the first test port. For example, if the path corresponding to the first test port is/front3001conf.d/, and the traffic type of the domain name to be tested is project a, then find the first branch test path corresponding to project a as/dir _3001/project a from the path of/front3001conf.d/.
And 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 a 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, the domain name to be tested is subjected to branch testing based on the file in the first branch testing path, multiple sets of testing environments are isolated through the path of the port under the condition that no server resource is newly added, the branches to be tested are separated, each development branch exclusively occupies one set of testing resource, branch testing can be carried out based on each branch testing path, each branch testing is independent, compared with the traditional testing environment in which multiple demand codes in testing are mixed at the same time, the problem of frequent code conflict caused when multiple persons cooperate to share the testing environment can be avoided, the problem of mutual dependence on other branches can be avoided, and the testing efficiency is improved.
In one embodiment, the service testing method further includes: when an operation instruction for switching to a second test port triggered at the test terminal 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 carrying out 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 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.
Specifically, when the test server acquires an operation instruction for switching to a second test port, which is triggered at the test terminal, 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 carrying out 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 for switching to the second test port, which is triggered at the test terminal, is obtained, a second branch test path corresponding to the service type of the domain name to be tested is determined from paths corresponding to the second test port; and performing second branch test on the domain name to be tested based on the file in the second branch test path, and switching among the branch test paths to perform different branch tests on the same domain name.
In an embodiment, the manner of obtaining the operation instruction switched to the second test port includes: and 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.
The forward proxy service is a proxy service between the test terminal and the test server, in order to obtain contents 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 obtained contents to the test terminal.
Specifically, on the web side, we can enable the forward proxy by configuring the proxy rule of the browser, and on the mobile side, can directly configure the http proxy (forward proxy service of the desktop) in the system setting. The test terminal stores the forward proxy rules required by the forward proxy service. Such as an available port that stores each domain name to be tested. And the test terminal displays a forward proxy page and displays an 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 the 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, a first test port 3001, a second test port 3002 and a third test port 3003 are included. The user can switch to different test ports by checking and canceling. For example, if the second test port 3002 is selected, the test server obtains 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 that starts the forward proxy service, and the test can be quickly accessed without manually inputting a port number by a user, thereby improving the test efficiency.
In one embodiment, the 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.
Carrying out first branch test on the domain name to be tested based on the file in the first branch test path, comprising: 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 the branch test result to the test terminal through the reverse proxy service.
The reverse proxy service receives the connection request, then forwards the request to the server on the internal network, and returns the result obtained from the internal server to the requested test terminal. The branch test result may be that the branch test passed, the branch test failed, a bug in the branch test, or the like, but is not limited thereto.
Specifically, the test server receives a test request for the first test port sent by the reverse proxy service, 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 format/nginx
Figure BDA0002986306290000061
In this embodiment, the test server includes a port 3001 and a port 3002, the service type includes a type a, a type B, and a type C, and the type a includes a branch a1 and a branch a 2; type B is illustrated as including branch B1 and branch B2. Type a, type B, and type C may be included in port 3001, but the path of type a includes only one branch path down, namely branch a 1. Similarly, type B of port 3001 includes only one branch path, branch B1. Port 3001 includes only one branch path in type C, branch C1. Type a, type B, and type C may be included in port 3002, but the type a path includes only one branch path, branch a2, and the type B path includes only one branch path, branch B2.
In one embodiment, the traditional approach, not through reverse proxy, assumes that 10 sets of test environments are required, and there are 20 traffic types, and then a total of 100 x 200 cases occur, which is costly to maintain. And the reverse proxy distinguishes the 10 sets of test environments, and the remaining maintenance is carried out 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, the test request is obtained by the reverse proxy service monitoring the first test port, a first branch test is performed on a domain name to be tested based on a file in a first branch test path to obtain a branch test result, 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 an embodiment, as shown in fig. 4, a schematic flow chart of a service testing method architecture in an embodiment is shown. Fig. 4 includes a client, a forward proxy service, a reverse proxy service, and a test server. Com, the type of which is news, of the domain name to be detected is obtained from the client. And acquiring a corresponding port through a forward proxy page corresponding to the forward proxy service. Such as domain → 3001, domain → 3002, domain → 300n in the figure. When the corresponding port obtained by the forward proxy service is 3002, monitoring the 3002 port in the reverse proxy server to obtain the test request, and determining the branch test path in the test server to be 3002/news/based on the port number and the service type in the test request.
In one embodiment, before obtaining the domain name to be tested, the service testing method further includes:
acquiring each uploaded 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 based on the branch identification of each branch code; the branch test path comprises a configuration file required by the branch code; the branch test path comprises a service type identifier; the service type identifier is used for characterizing the service type.
And copying each branch code to the corresponding branch test path to obtain each branch test path containing the branch code.
Determining a first branch test path corresponding to the service type of the domain name to be tested, comprising: and determining a first branch test path corresponding to the service type identification 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 mainline so as not to affect the development mainline. Different branches can be switched and combined, so that multiple 'workflows' can be simultaneously owned at different stages of a project development cycle. The branch code refers to a part of code required in the development mainline.
The branch identifier may include at least one of a letter, a number, a letter, and 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 a mapping relation between the branch identification and a branch path of the test port based on the branch identification of each branch code; the branch test path contains a configuration file required by the branch code, and the branch test path contains a service type identifier which is used for representing the service type. The test server copies each branch code to the 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, and after performing operations such as compiling and packaging on the branch code, determines a branch test path corresponding to each branch code from a mapping relationship between the branch identifier and the branch path of the test port. And 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 including the branch codes are obtained, and the first branch test paths corresponding to the service types of the domain names to be tested are determined, so that isolation of each test environment is achieved.
In one embodiment, before obtaining the uploaded branch code, the service testing method further includes: creating a branch test path of each test port; and adding a configuration file required by the corresponding branch code in each branch test path to obtain the branch test path containing the configuration file.
In this embodiment, a branch test path of each test port is created, a configuration file required by a corresponding branch code is added to each branch test path, and a branch test path including the configuration file is obtained, that is, 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 service type is obtained; obtaining the selected branch testing path from the branch testing path set; acquiring branch identifiers selected from a branch identifier set corresponding to the 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 not the same. The branch identification may be the 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 includes at least one branch identification. And the test terminal acquires the selected branch test path and the selected branch identification and sends the branch test path and the selected branch identification to the test server. 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, if the traffic type is project a, the branch id includes branch 1 and branch 2, and the branch path includes project a/fenzhi 1/and project a/fenzhi2/, then branch 1 and project a/fenzhi 1/are taken/associated, and branch 2 and project a/fenzhi 2/are taken/associated.
In this embodiment, a developer sets the association between the development branch used by the developer and a specific set of test environment in a platform by self-definition. Through the open API provided by the Gitlab, the platform can obtain a list of all branches of the Gitlab project corresponding to the current project (namely the service type), and a developer can directly select the branch. The number of test environments N is a value which is enough to be used when the platform defaults, and after a developer selects and stores the value, own development branches are associated with the occupied test environments.
In this embodiment, the selected branch identifier is obtained from the branch identifier set corresponding to the service type, the branch identifiers are selected from the branch identifier set corresponding to the service type and are associated with each other, so that the 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 stored in the corresponding test environment, thereby improving the test efficiency.
In one embodiment, before obtaining the domain name to be tested, the service testing method further includes: acquiring the 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 code and the required configuration file to the branch test path.
In one embodiment, as shown in fig. 5, a schematic diagram of an architecture flow of a service testing method in another embodiment is shown. The strap platform is a set of self-developed web systems required in the process of landing a closed loop, and is named as the strap platform so as to facilitate the subsequent explanation of the technical scheme. A branch test path represents a branch test environment. Webhook is a kind of "hook" provided by Gitlab, and its value can be customized (usually, URL (uniform resource locator) of a third-party system (such as a strap platform mentioned below)), when a project engineering performs some trigger operation (such as code submission commit), the Gitlab service will automatically request the URL and carry detailed parameters of the current trigger operation (such as engineering warehouse address, branch, submitter, etc.), and the third-party system can perform a customized task based on this. Gitlab is a completely integrated web service based on Git, provides an interface which can facilitate the consulting and operation of engineering warehouses, users, authorities, branches, code submission records and the like, provides continuous integration or delivery access capability, and provides a set of rich API interfaces for developers to facilitate the integration among systems. Nginx is a high-performance open source HTTP and reverse proxy web service, and the invention mainly utilizes the capability of the reverse proxy.
The strap-off platform comprises environment and branch mapping configuration, new engineering initialization (N sets of test environments) and construction and deployment based on webhooks parameters. When a developer pushes own codes, the Gitlab triggers and calls a third-party system (namely a strap platform) pointed by webhooks to construct and deploy.
And the test server is a test server, and a reverse proxy service such as nginx is deployed in the test server. Nginx is a high-performance open source HTTP and reverse proxy web service, and the invention mainly utilizes the capability of the reverse proxy. The test server listens to ports 3001, 3002 through 300N. The test server includes a branch test path for each test port. Such as/dir _3001/project a,/dir _3002/project a and/dir _300N/project a in the figure. Where/dir _3001/project A is the branch test path of branch _ 3001. The/dir _3002/project A is the branch test path of branch _ 3002. The/dir _300N/project A is the branch test path of branch _ 300N. May point to/dir _3001/project a via snoop port 3001, may point to/dir _3002/project a via snoop port 3002, and may point to/dir _3003/project a via snoop port 3003.
And the tester opens the http forward proxy through the test client and accesses the domain name dev.kdweibo.cn to be tested, wherein the service type of the domain name to be tested is project A. The test client sends the request to a forward proxy server, which may be fiddler or charles, for example, and proxies the original request Host to the corresponding Host + port. Only one agent configuration is turned on at the same time. Agent configuration 1 is the domain name to be tested and the corresponding test port 3001. Agent configuration 2 is the domain name to be tested and the corresponding test port 3002. The agent configures N, i.e. 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 point 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 enters a strap-down platform to directly create a project (the input name and the name of the Gitlab warehouse are preferably kept consistent, here, protroma is taken as an example), the strap-down platform will automatically create a protroma directory under N total directories dir _3001 to dir _300N on a testing machine (the value of N representing a number can be customized according to actual needs) respectively by executing a shell script mode. If dir _300 directories do not exist, the creation of the directories is automatically initiated. And then automatically adding the reverse proxy configuration files of the test environments of the corresponding items until the initialization action is completed.
The initialization operation comprises the first step of providing and defining the code deployment directory of the N sets of test environments of the project A item, and the second step of providing and defining the ports and the access routes occupied by the N sets of test environments of the project A item and establishing a mapping relation with the code deployment directory of the corresponding environment. Therefore, a plurality of sets of test environments are isolated from the original test environment machine. And the remaining problems to be solved are: the code branch used by the developer is associated with a certain set of test environment; deploying the branch codes to the corresponding test environments; how the test side switches between sets of test environments (testing multiple requirements in parallel).
Environment and branch mapping configuration: a developer sets the association (mapping) between the development branches used by the developer and a specific set of test environment in a self-defined manner on a strap-down platform. Through the open api provided by the Gitlab, the strap platform can acquire 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 name of the Gitlab project is also located), and a developer can directly select the branch.
The number N of the test environments is a value which is given enough to be used by default on a strap-down platform, and after a developer selects and stores the value, development branches of the developer are associated with the occupied test environments.
Constructing and deploying: when a developer pushes (push) own code, the Gitlab triggers and calls a third-party system (namely a strap platform) pointed by webhooks, and the strap platform can clearly determine engineering, branches and other detailed information of the current trigger operation from parameters. The method comprises the steps that a strap-down platform firstly pulls down (pull) codes of a current branch in a temporary directory through a shell script and executes construction based on a constructed configuration file, then a test environment directory (2.2.2 in which a database is written) corresponding to the current branch of a current project is read from the database, the constructed file is copied to a corresponding directory, and finally the temporary directory is deleted. So far, each developer branch has own independent test environment, and automatic construction and deployment to the corresponding test environment after submitting codes are realized.
And (3) parallel testing: the last step is how to switch different testing environments rapidly at the testing end (different requirements can be tested in parallel), that is, where the forward proxy plays a role, the testing end still uses a normal domain name to access (e.g. dev. kdweibo. cn), the testing end starts forward proxy services (e.g. adapters, charles, etc.) and configures a plurality of sets of proxy rules of testing environments (charles configuration is shown in the following figure), and switching among the plurality of sets of testing environments can be facilitated by checking and canceling the checking.
At the web end, we can enable forward proxy (window platform recommendation fiddler, mac platform recommendation charles) by configuring proxy rules (chrome also has corresponding plug-ins) of the browser, and at the mobile end, can directly configure http proxy (forward proxy service of desktop) in the system setting.
In this embodiment, 1. resource angle: under the condition that the existing set of test environment does not increase the server resources, a plurality of sets of test environments can be isolated quickly.
2. Development angle: each development branch monopolizes one set of test resources, and the problem of frequent code conflict caused by the cooperation of multiple persons and the sharing of a test environment is avoided.
3. Iteration angle: each requirement characteristic monopolizes one set of test resources, the iteration flow is independent, the mutual dependence on other characteristics is avoided, and the iteration efficiency is greatly improved.
4. Testing angle: a single tester can test a plurality of independent demand characteristics in parallel and do not interfere with each other, thereby greatly improving the working efficiency.
In one embodiment, a traffic testing method includes:
at step (a1), a branch test path for each test port is created.
And (a2) adding the configuration file required by the corresponding branch code in each branch test path to obtain the branch test path containing the configuration file.
And (a3) acquiring a branch test path set corresponding to the service type in the test environment server.
And (a4) obtaining the selected branch test path from the branch test path set.
And (a5) acquiring the branch identifier selected from the branch identifier set corresponding to the service type.
And (a6) 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.
And (a7) acquiring the uploaded branch code.
Step (a8), based on the branch identification of the branch code, determining the 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 comprises a configuration file required by the branch code; the branch test path corresponds to a traffic type.
Step (a9), copy the branch code to the corresponding branch test path, obtain each branch test path containing branch code.
Step (a10), receiving a test request for a first test port sent by a reverse proxy service, wherein the test request is obtained by the reverse proxy service monitoring the first test port; the test request to the first test port is obtained from a forward proxy page of the test terminal that initiated the forward proxy service.
And (a11) 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 based on the path corresponding to the first test port.
And (a12) 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 (a13) returning the branch test result to the test terminal through the reverse proxy service.
Step (a14), when an 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, determining a second branch test path corresponding to the service type of the domain name to be tested from the paths corresponding to the second test port.
And (a15) 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, the domain name to be tested is subjected to branch testing based on the file in the first branch testing path, multiple sets of testing environments are isolated through the path of the port under the condition that no server resource is newly added, the branches to be tested are separated, each development branch exclusively occupies one set of testing resource, branch testing can be carried out based on each branch testing path, each branch testing is independent, compared with the traditional testing environment in which multiple demand codes in testing are mixed at the same time, the problem of frequent code conflict caused when multiple persons cooperate to share the testing environment can be avoided, the problem of mutual dependence on other branches can be avoided, and the testing efficiency is improved.
It should be understood that although the various steps in the flowcharts of fig. 2, 4 and 5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2, 4 and 5 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps or stages.
In one embodiment, as shown in fig. 6, there is provided a traffic testing apparatus, including: the device 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 comprises 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 testing module is used for performing branch testing on the domain name to be tested based on the first branch testing path.
The service testing device determines a first branch testing path corresponding to the service type of the domain name to be tested based on the path corresponding to the first testing port, and performs branch testing on the domain name to be tested based on the file in the first branch testing path, so that a plurality of sets of testing environments are isolated through the path of the port under the condition of not increasing server resources, the branches to be tested are separated, each development branch exclusively occupies one set of testing resources, the branch testing can be performed based on each branch testing path, each branch testing is independent, compared with the traditional testing environment in which a plurality of demand codes in testing are mixed at the same time, the problem of frequent code conflict caused when a plurality of persons collaboratively share the testing environment can be avoided, the problem of mutual dependence on other branches can be also avoided, and the testing efficiency is improved.
In an embodiment, the path determining module is further configured to determine, when the operation instruction for switching to the second test port, which is triggered at the test terminal, 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 is obtained. The branch testing module is further used for carrying out second branch testing on the domain name to be tested based on the file in the second branch testing path.
In this embodiment, when an operation instruction for switching to the second test port, which is triggered at the test terminal, is obtained, a second branch test path corresponding to the service type of the domain name to be tested is determined from paths corresponding to the second test port; and performing second branch test on the domain name to be tested based on the file in the second branch test path, and switching among the branch test paths to perform different branch tests on the same domain name.
In an embodiment, the path determining module is further configured to obtain, from a forward proxy page of the test terminal that starts the forward proxy service, 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 that starts the forward proxy service, and the test can be quickly accessed without manually inputting a port number by a user, thereby improving the test efficiency.
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 testing module is used for carrying out first branch testing on the domain name to be tested based on the file in the first branch testing path to obtain a branch testing result; and returning the 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, the test request is obtained by the reverse proxy service monitoring the first test port, a first branch test is performed on a domain name to be tested based on a file in a first branch test path to obtain a branch test result, 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 traffic testing apparatus further comprises a branch mapping module. The branch mapping module is used for acquiring each uploaded 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 based on the branch identification of each branch code; the branch test path comprises a configuration file required by the branch code; the branch test path comprises a service type identifier; the service type identifier is used for characterizing the service type. And copying each branch code to the 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 tested from the branch test paths of each branch code.
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 including the branch codes are obtained, and the first branch test paths corresponding to the service types of the domain names 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 a configuration file required by the corresponding branch code in each branch test path to obtain the branch test path containing the configuration file.
In this embodiment, a branch test path of each test port is created, a configuration file required by a corresponding branch code is added to each branch test path, and a branch test path including the configuration file is obtained, that is, 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; obtaining the selected branch testing path from the branch testing path set; acquiring branch identifiers selected from a branch identifier set corresponding to the 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 identifiers are selected from the branch identifier set corresponding to the service type and are associated with each other, so that the 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 stored in the corresponding test environment, thereby improving the test efficiency.
For the specific definition of the service testing device, reference may be made to the above definition of the service testing method, which is not described herein again. All or part of each module in the service testing device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the 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 comprises a nonvolatile 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 an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used 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 method of business testing.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.
In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer-readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for service testing, the method comprising:
acquiring 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 carrying out first branch test on the domain name to be tested based on the file in the first branch test path.
2. The method of claim 1, further comprising:
when an operation instruction for switching to a second test port triggered at a test terminal 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 second branch test on the domain name to be tested based on the file in the second branch test path.
3. The method of claim 2, wherein the switching to the second test port comprises:
and 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.
4. The method according to claim 1, wherein the obtaining the domain name to be tested and the first test port corresponding to the domain name to be tested comprises:
receiving a test request for the first test port sent by a reverse proxy service, wherein the test request is obtained by the reverse proxy service monitoring the first test port;
the performing a first branch test on the domain name to be tested based on the file in the first branch test path includes:
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 the branch test result to a test terminal through the reverse proxy service.
5. The method according to claim 1, wherein before obtaining the domain name to be tested, the method further comprises:
acquiring each uploaded 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 based on the branch identification of each branch code; the branch test path comprises a configuration file required by the branch code; the branch test path comprises a service type identifier;
copying each branch code to a corresponding branch test path to obtain each branch test path containing the branch code;
the determining a first branch test path corresponding to the service type of the domain name to be tested includes:
and determining a first branch test path corresponding to the service type identification of the domain name to be tested from the branch test paths of the branch codes.
6. The method of claim 5, wherein prior to the fetching of the uploaded branch code, the method further comprises:
creating a branch test path of each test port;
and adding a configuration file required by the corresponding branch code in each branch test path to obtain the branch test path containing the configuration file.
7. The method of claim 5 or 6, further comprising:
acquiring a branch test path set corresponding to the service type;
obtaining the selected branch testing path from the branch testing path set;
acquiring branch identifiers selected from a branch identifier set corresponding to the service types;
and associating the selected branch testing path with the selected branch identifier to obtain the mapping relation between the branch testing path and the branch identifier.
8. A traffic testing apparatus, characterized in that the apparatus comprises:
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 comprises a first test port;
a path determining module, configured to determine, based on a path corresponding to the first test port, a first branch test path corresponding to the service type of the domain name to be tested;
and the branch testing module is used for performing branch testing on the domain name to be tested based on the first branch testing path.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202110301143.6A 2021-03-22 2021-03-22 Service testing method, device, computer equipment and storage medium Pending CN112988584A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110301143.6A CN112988584A (en) 2021-03-22 2021-03-22 Service testing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110301143.6A CN112988584A (en) 2021-03-22 2021-03-22 Service testing method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112988584A true CN112988584A (en) 2021-06-18

Family

ID=76332812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110301143.6A Pending CN112988584A (en) 2021-03-22 2021-03-22 Service testing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112988584A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN110781083A (en) * 2019-10-18 2020-02-11 苏宁消费金融有限公司 H5 client code setting multi-environment testing method and system
US20200125485A1 (en) * 2018-10-17 2020-04-23 Servicenow, Inc. Environment for continuous testing and integration of software
CN111639019A (en) * 2020-04-24 2020-09-08 北京五八信息技术有限公司 Code testing method and device and readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200125485A1 (en) * 2018-10-17 2020-04-23 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
CN110781083A (en) * 2019-10-18 2020-02-11 苏宁消费金融有限公司 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

Similar Documents

Publication Publication Date Title
CN112118565B (en) Multi-tenant service gray level publishing method, device, computer equipment and storage medium
CN112000348B (en) Control method, device and computer equipment for service gray level release
CN108804618B (en) Database configuration method, device, computer equipment and storage medium
CN109814854B (en) Project framework generation method, device, computer equipment and storage medium
US11144292B2 (en) Packaging support system and packaging support method
CN112965700B (en) Routing-based micro-service processing method and device, computer equipment and medium
US20060020937A1 (en) System and method for extraction and creation of application meta-information within a software application repository
GB2407893A (en) Software development for a wireless mobile device
CN110689232A (en) Workflow configuration optimization processing method and device and computer equipment
CN110673923A (en) XWIKI system configuration method, system and computer equipment
CN110365724B (en) Task processing method and device and electronic equipment
US20220103555A1 (en) Service deployment method, device, system, and computer-readable storage medium
US11397569B2 (en) Deploying micro frontends to different clusters from a single repository
CN114168179B (en) Micro-service management method, micro-service management device, computer equipment and storage medium
CN113037891B (en) Access method and device for stateful application in edge computing system and electronic equipment
CN114443294B (en) Big data service component deployment method, system, terminal and storage medium
CN114328097A (en) File monitoring method and device, electronic equipment and storage medium
CN112115056B (en) Project deployment method and device, server and storage medium
CN111831567B (en) Application test environment configuration method, device, system and medium
CN112068820B (en) Method and device for processing configuration of micro-service, computer equipment and storage medium
CN112506590A (en) Interface calling method and device and electronic equipment
CN112988584A (en) Service testing method, device, computer equipment and storage medium
CN112486509B (en) Jar package assembly hot deployment method and system
CN114443215A (en) Service application deployment method and device, computer equipment and storage medium
CN112783757B (en) Test system, method, computer system, and computer-readable storage medium

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