Test task generation method and device and electronic equipment
By obtaining and replacing service information, generating preset functions to be tested, it solves the problem that the page cannot be opened or the data is incorrect during service deployment, reduces the deployment difficulty and time, and ensures the normal operation of the functions.
Patent Information
- Application Number
- CN202410975317.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-01
AI Technical Summary
When redeploying a service, if there are problems with the redeployment service, it will cause the page to fail to open or the data will be displayed incorrectly.
By obtaining the network address and port information of the actual subservice and test subservice corresponding to the preset function, the target service is determined and replaced with the test subservice, and generating test subservices based on the test subservice and actual subservices other than the target service Preset functions to avoid redeploy all subservices and reduce deployment difficulty and time.
It realizes the normal operation of test and verify preset functions without redeploying all subservices, ensuring that the page can be opened and the data is displayed correctly, solving problems during the deployment process.
Smart Images

Figure CN118885394A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of multimedia technology, and in particular to a test task generating method, device and electronic device. Background Art
[0002] With the development of technology, a single service with multiple functions has gradually evolved into a service providing a single capability. Huge functions require multiple services to call each other to implement. For example, the ability that users originally implemented by opening a page to call a service now needs to be changed to opening a page and calling multiple services to implement. When a service is redeployed, if there is a problem with the redeployed service, the page cannot be opened or the displayed data is incorrect.
[0003] Therefore, how to avoid the problem that when a service is redeployed, if there is a problem with the redeployed service, the page cannot be opened or the displayed data is incorrect. Summary of the invention
[0004] In order to solve the above technical problems, the present disclosure provides a test task generating method, device and electronic device.
[0005] The technical solution of the present disclosure is as follows:
[0006] In a first aspect, the present disclosure provides a test task generation method, comprising: obtaining at least one actual sub-service corresponding to a preset function, at least one test sub-service currently to be tested of the preset function, and the actual network address and actual port information of the test sub-service; based on a name identifier of the test sub-service, determining a target service that is identical to the name identifier; wherein the target service includes any one of the actual sub-services; and generating a preset function to be tested based on the test sub-service and the actual sub-services other than the target service.
[0007] In a second aspect, the present disclosure provides a test task generating device, comprising: an acquisition unit, used to acquire at least one actual sub-service corresponding to a preset function, at least one test sub-service currently to be tested of the preset function, and an actual network address and actual port information of the test sub-service; a processing unit, used to determine, based on the name identifier of the test sub-service acquired by the acquisition unit, a target service that is the same as the name identifier; wherein the target service includes any one of the actual sub-services; the processing unit is also used to generate a preset function to be tested based on the test sub-service and the actual sub-services other than the target service.
[0008] In a third aspect, the present disclosure provides an electronic device, comprising: a memory and a processor, the memory being used to store a computer program; the processor being used to enable the electronic device to implement any one of the test task generation methods provided in the second aspect when executing the computer program.
[0009] In a fourth aspect, the present invention provides a computer-readable storage medium, comprising: a computer program is stored on the computer-readable storage medium, and the computer program is executed by a processor to generate a test task as provided in any one of the second aspects.
[0010] In a fifth aspect, the present invention provides a computer program product. When the computer program product is run on a computer, the computer executes any one of the test task generation methods provided in the second aspect.
[0011] It should be noted that the above computer instructions may be stored in whole or in part on a first computer-readable storage medium, wherein the first computer-readable storage medium may be packaged together with the processor of the electronic device, or may be packaged separately from the processor of the electronic device, which is not limited in the present disclosure.
[0012] The description of the second, third, fourth and fifth aspects in the present disclosure can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, fourth and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.
[0013] In the present disclosure, the names of the above electronic devices do not limit the devices or functional modules themselves. In actual implementation, these devices or functional modules may appear with other names. As long as the functions of each device or functional module are similar to those of the present disclosure, they fall within the scope of the claims of the present disclosure and their equivalent technologies.
[0014] These and other aspects of the present disclosure will become more apparent from the following description.
[0015] Compared with the prior art, the technical solution provided by the present invention has the following advantages:
[0016] The test task generation method provided by the present disclosure, when testing a preset function, obtains at least one actual sub-service corresponding to the preset function, at least one test sub-service currently to be tested of the preset function, and the actual network address and actual port information of the test sub-service; thereby, based on the name identifier of the test sub-service, the target service with the same name identifier can be determined; in this way, the target service can be replaced with the test sub-service, without the need to redeploy all sub-services of the preset function, thereby reducing the difficulty of deployment and shortening the deployment time. Afterwards, the preset function to be tested is generated based on the test sub-service and the actual sub-services other than the target service. In this way, it can be determined based on the business test results whether the preset function to be tested is running normally. If the business test results show that it is running normally, it means that the preset function to be tested can be deployed, thereby solving the problem that when a service is redeployed, if there is a problem with the redeployed service, the page cannot be opened or the displayed data is incorrect. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 One of the flowcharts of the test task generation method provided in the embodiment of the present disclosure;
[0020] Figure 2 A second flowchart of the test task generation method provided in an embodiment of the present disclosure;
[0021] Figure 3 A third flowchart of the test task generation method provided in an embodiment of the present disclosure;
[0022] Figure 4 A fourth flowchart of a test task generation method provided in an embodiment of the present disclosure;
[0023] Figure 5 A fifth flowchart of the test task generation method provided in an embodiment of the present disclosure;
[0024] Figure 6 A sixth flowchart of a test task generation method provided in an embodiment of the present disclosure;
[0025] Figure 7A seventh flowchart of a test task generation method provided in an embodiment of the present disclosure;
[0026] Figure 8 The eighth flowchart of the test task generation method provided in the embodiment of the present disclosure;
[0027] Fig. 9 A ninth flowchart of a test task generation method provided in an embodiment of the present disclosure;
[0028] Fig.10 A schematic diagram of the structure of a test task generating device provided in an embodiment of the present disclosure;
[0029] Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure;
[0030] Fig.12 A schematic diagram of the structure of a computer program product of a test task generating method provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0032] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0033] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0034] Nginx (engine x) in the disclosed embodiment is a high-performance HTTP and reverse proxy web server.
[0035] Eureka in the disclosed embodiments is a service discovery framework developed by Netflix, which is itself a REST-based service, mainly used to locate middle-tier services running in the AWS domain to achieve load balancing and middle-tier service failover.
[0036] The QCE (Quality Cloud Engine) in the embodiments of the present disclosure refers to a dedicated cloud environment or cloud service platform, which may provide a set of tools and services for ensuring the quality of applications deployed in the cloud environment. Such tools and services may include continuous integration, automated testing, monitoring, and performance analysis functions.
[0037] The QAE (Quality Assurance Environment) in the embodiments of the present disclosure refers to a specially configured environment that is commonly used for quality assurance activities, such as testing and verifying whether the software meets specific quality standards. In the QAE, various test instances, simulation services, test data, etc. may be deployed to support test engineers or automated test scripts to perform system testing, integration testing, acceptance testing, etc.
[0038] K8s in the disclosed embodiments refers to kubernetes, which is an abbreviation formed by replacing the eight characters "ubernete" in the middle of the name with 8.
[0039] The NodePort in the embodiment of the present disclosure is a method provided by Kubernetes for external clients of the cluster to access the service entrance.
[0040] The ClusterIP in the disclosed embodiment is a type of Service in Kubernetes, which provides a virtual network address for other resources within the cluster.
[0041] Exemplarily, the test task generation method provided by the embodiment of the present disclosure is described by taking the execution subject of the test task generation method provided by the embodiment of the present disclosure as a server as an example.
[0042] Figure 1 is a flowchart of a test task generation method according to an exemplary embodiment. Figure 1 As shown, including: S11-S13.
[0043] S11. Acquire at least one actual sub-service corresponding to a preset function, at least one test sub-service of the preset function to be tested, and the actual network address and actual port information of the test sub-service.
[0044] In some examples, after the application is deployed, the operation and maintenance personnel need to maintain the application, such as upgrading some functions of the application (such as adding a new payment method, etc.), so as to improve the user experience of the application. At present, the functions of the application are implemented by at least one service. When the preset function needs to be maintained, at least one actual sub-service of the preset function, at least one test sub-service currently to be tested of the preset function, and the actual network address and actual port information of the test sub-service can be obtained. Afterwards, based on the name identifier of the test sub-service, the target service with the same name identifier is determined. Thus, the target service can be replaced with the test sub-service, and then based on the test sub-service and the actual sub-service other than the target service, the preset function to be tested is generated. In this way, only the test sub-service can be deployed, and the preset function with the newly added test sub-service can be tested, which reduces the difficulty of deployment. Afterwards, by running the preset function to be tested, a business test result is generated. In this way, based on the business test result, it can be determined whether the preset function to be tested is running normally to ensure the user experience.
[0045] In some examples, in order to prevent the test sub-service from being directly deployed after the preset function, the test task generation method provided in the embodiment of the present disclosure obtains the deployment environment of the preset function, and then creates a test environment identical to the deployment environment in the server, so that the preset function to be tested can be run in the test environment, thereby avoiding the situation where the test sub-service is directly deployed after the preset function and cannot be executed.
[0046] S12, based on the name identifier of the test subservice, determining a target service that is identical to the name identifier; wherein the target service includes any one of the actual subservices;
[0047] In some examples, different services correspond to different task nodes in the preset function, and when maintaining the preset function, one or more task nodes are usually maintained. Therefore, when maintaining any task node, the target service with the same name identifier can be determined based on the name identifier of the task node. For example, the preset function is a payment service, and the payment service includes 4 actual sub-services, namely, actual sub-service 1 (such as: display package service A), actual sub-service 2 (such as: payment service B (supports payment method 1)), actual sub-service 3 (such as: purchase service C (only supports the opening of the first target service)) and actual sub-service 4 (such as: opening service D). Since the actual sub-service 2 only supports payment method 1, in order to facilitate user use, the operation and maintenance personnel can expand the payment method of the actual sub-service 2, such as payment method 2. At this time, a logic program for payment method 2 can be created, and the logic program can be used as a test sub-service (such as: payment service B1). Afterwards, since the name identifier (payment service B1) is the same as payment service B, the actual sub-service 2 can be used as the target service. Then, the actual sub-service 2 is replaced with the test sub-service.
[0048] For example, the name identifier may be a domain name, such as: the network address of payment service B is www.*****.com / pay? paytype=AAA, and the network address of payment service B1 is www.*****.com / pay? paytype=CCC. It can be seen that the domain name of the network address of payment service B is www.*****.com, and the domain name of the network address of payment service B1 is www.*****.com. Therefore, since the domain name of the network address of payment service B is the same as the domain name of the network address of payment service B1, payment service B can be determined to be the target service.
[0049] S13: Generate a preset function to be tested based on the test sub-service and the actual sub-services other than the target service.
[0050] In some examples, since the preset function requires one or more actual sub-services to call each other to be implemented, when generating the preset function to be tested, the call data of the preset function to be tested can be formed based on the actual network address and actual port information of the test sub-service, and the actual network address and actual port information of the actual sub-service other than the target service. Afterwards, when the preset function to be tested is run, the actual network address and actual port information in the call data can be called, so that the test sub-service and the actual sub-service other than the target service can be called each other (called according to the dependency relationship between the sub-services) to provide the preset function.
[0051] In some examples, since there are dependencies between multiple actual sub-services of the preset function, for example, in combination with the example given in S12 above, after the actual sub-service 1 is executed, the actual sub-service 2 is executed, after the actual sub-service 2 is executed, the actual sub-service 3 is executed, and after the actual sub-service 3 is executed, the actual sub-service 4 is executed. In this way, it can be determined that the dependency relationship of the actual sub-services of the preset function is that the actual sub-service 4 depends on the actual sub-service 3, the actual sub-service 3 depends on the actual sub-service 2, and the actual sub-service 2 depends on the actual sub-service 1. Therefore, when testing the preset function test sub-service, the test sub-service also needs to be run according to the dependency relationship, so as to ensure that the preset function to be tested can run normally.
[0052] Exemplarily, the dependency relationship of the actual sub-services of the preset functions is that actual sub-service 4 depends on actual sub-service 3, actual sub-service 3 depends on actual sub-service 2, and actual sub-service 2 depends on actual sub-service 1. Combined with the example given in S12 above, since the name identifier (payment service B1) is the same as payment service B, actual sub-service 2 can be used as the target service. Since actual sub-service 3 depends on actual sub-service 2, and actual sub-service 2 depends on actual sub-service 1, it is necessary to set payment service B1 to depend on actual sub-service 1, and actual sub-service 3 to depend on payment service B1. This ensures that after actual sub-service 1 is executed, payment service B1 is executed, and after payment service B1 is executed, actual sub-service 1 is executed.
[0053] In some examples, the test sub-service and the actual sub-service other than the target service can be input into the prediction model for program construction to generate the preset function to be tested. The training process of the prediction model is as follows:
[0054] Obtain training sample data and marking results of the training sample data; wherein the training sample data includes at least one group of test sub-services corresponding to the historical function and historical sub-services with the same name as the test sub-services except the historical function, and the marking results include historical functions to be tested corresponding to each group of test sub-services and historical sub-services with the same name as the test sub-services except the historical function.
[0055] The training sample data is input into the neural network model for learning, and the prediction results of the neural network model for the training sample data are obtained.
[0056] Based on the prediction results and labeling results, the network parameters of the neural network model are adjusted until the neural network model converges to obtain a prediction model.
[0057] The test task generation method provided by the embodiment of the present disclosure, when testing the preset function, obtains at least one actual sub-service corresponding to the preset function, at least one test sub-service currently to be tested of the preset function, and the actual network address and actual port information of the test sub-service; thereby, based on the name identifier of the test sub-service, the target service with the same name identifier can be determined; in this way, the target service can be replaced with the test sub-service, without the need to redeploy all sub-services of the preset function, thereby reducing the difficulty of deployment and shortening the deployment time. Afterwards, the preset function to be tested is generated based on the test sub-service and the actual sub-services other than the target service. In this way, it is possible to determine whether the preset function to be tested is running normally based on the business test results. If the business test results show that it is running normally, it means that the preset function to be tested can be deployed, thereby solving the problem that when a service is redeployed, if there is a problem with the redeployed service, the page cannot be opened or the displayed data is incorrect.
[0058] In some examples, after obtaining the preset function to be tested, combined with Figure 1 ,like Figure 2 As shown, the test task generating method provided by the embodiment of the present disclosure further includes S14.
[0059] S14: Run the preset function to be tested and generate business test results.
[0060] In some examples, after running the preset function to be tested, it is necessary to collect statistics on the operating status of the preset function to be tested, so that the business test result can be obtained based on the statistical results of the operating status. For example: run the preset function to be tested, and display the test interface corresponding to the preset function to be tested. At this time, the operation and maintenance personnel can determine the operating status of the preset function based on the first control corresponding to the test sub-service contained in the test interface, and the second control corresponding to the actual sub-service other than the target service. For example: when the test interface contains the first control corresponding to the test sub-service and the second control corresponding to the actual sub-service other than the target service, it means that the operating status of the preset function is normal. At this time, the operation and maintenance personnel can input the operating status of the preset function to the server. The server responds to the user operation of the voice indicating the operating status of the preset function to determine the business test result. For example, when the operating status of the preset function is normal, the business test result is determined to be a successful test.
[0061] Or when the target control is not included in the test interface, it indicates that the operation status of the preset function is abnormal. At this time, the operation and maintenance personnel can input the operation status of the preset function to the server. The server responds to the user operation of the voice indicating the operation status of the preset function and determines the business test result. For example, when the operation status of the preset function is abnormal, the business test result is determined to be a test failure.
[0062] Exemplarily, in combination with the example given in S12 above, if the test interface includes a first control corresponding to the payment service B1, a second control corresponding to the display package service A, a second control corresponding to the purchase service C, and a second control corresponding to the activation service D, it indicates that the operation status of the preset function is normal. At this time, the operation and maintenance personnel can input the operation status of the preset function to the server. The server responds to the user operation of the voice indicating the operation status of the preset function, determines the business test result, and determines that the business test result is a successful test when the operation status of the preset function is normal.
[0063] Alternatively, when the test interface does not include one or more of the first control corresponding to the payment service B1, the second control corresponding to the display package service A, the second control corresponding to the purchase service C, and the second control corresponding to the activation service D, it indicates that the operation status of the preset function is abnormal. At this time, the operation and maintenance personnel can input the operation status of the preset function to the server. The server responds to the user operation of the voice indicating the operation status of the preset function, and determines the business test result as a test failure. For example, when the operation status of the preset function is abnormal, the business test result is determined to be a test failure.
[0064] It should be noted that the above examples are illustrated by displaying all sub-services of the preset function to be tested in the test interface. In some other examples, each sub-service of the preset function to be tested corresponds to a test interface. At this time, all the test interfaces need to be displayed before the operating status of the preset function can be determined. For example: when the sub-service corresponding to the test interface is displayed in each test interface, the operating status of the preset function is determined to be normal. Alternatively, when the sub-service corresponding to the test interface is not displayed in at least one test interface, the operating status of the preset function is determined to be abnormal.
[0065] In some possible implementation examples, combined with Figure 1 ,like Figure 3 As shown, the above S11 can be specifically implemented through the following S110 and S111.
[0066] S110: Obtain at least one actual sub-service corresponding to a preset function, at least one test sub-service currently to be tested of the preset function, and obtain a target container for deploying the test sub-service.
[0067] In some examples, since the test sub-service needs to be mounted on a container to run, when deploying the target container of the test sub-service, it is necessary to first configure the target container, such as the network address and port information of the target container.
[0068] S111: When the target container is the first container, based on the first network address and the first port information of the target container, determine that the actual network address of the test subservice is the first network address, and the actual port information is the first port information.
[0069] In some examples, the first container is a container that does not have the capability to convert a name identifier into a second network address and second port information, such as QCE or K8s.
[0070] Exemplarily, in combination with the example given in S12 above, taking the first container as QCE and the routing mode of QCE as Eureka as an example, when deploying the test sub-service, after the application is started, the project Eureka obtains the project Eureka configuration and starts the service; wherein, the project Eureka configuration includes synchronizing all service configurations from the stable Eureka. After starting the service, the project Eureka becomes the new registration center. The network address of the new registration center is the first network address, and the port information is the first port information. After that, the payment service B1 configures the project registration center address (additions are actively registered according to the startup parameters), at which time the payment service B1 obtains the network address and port information of the project Eureka, and uses the network address and port information of the project Eureka as the network address and port information of the payment service B1 (so that the payment service B1 is deployed on the first container). At the same time, after starting the service, the project Eureka uses the synchronization tool to obtain at least one actual sub-service of the preset function from the stable Eureka (such as: display package service A, payment service B, purchase service C and activation service D). Since the project Eureka obtains the configuration information of at least one actual subservice of the preset function, when the project Eureka is used as a new registration center, there will be multiple subservices (actual subservices and test subservices), and subservices with the same name identifier will be displayed at the same time, that is, the same name identifier corresponds to one or more network parameters, and the network parameters include network address and port information.
[0071] Exemplarily, in combination with the example given in S12 above, taking the first container as QCE and the routing mode of QCE as Eureka as an example, when deploying the test sub-service, after the application is started, the project Eureka obtains the project Eureka configuration and starts the service; wherein, the project Eureka configuration includes synchronizing all service configurations (configuration information of actual sub-services other than the target service) except the target service identified by the same name as the payment service B1 from the stable Eureka. After starting the service, the project Eureka becomes the new registration center. The network address of the new registration center is the first network address, and the port information is the first port information. Afterwards, the payment service B1 configures the project registration center address (additions are actively registered according to the startup parameters), at which time the payment service B1 obtains the network address and port information of the project Eureka, and uses the network address and port information of the project Eureka as the network address and port information of the payment service B1 (so that the payment service B1 is deployed on the first container). At the same time, after the project Eureka starts the service, it uses the synchronization tool to obtain at least one actual sub-service of the preset function from the stable Eureka (such as: display package service A, payment service B, purchase service C and activation service D). Since the project Eureka obtains the configuration information of at least one actual sub-service of the preset function, when the project Eureka is used as a new registration center, there will be multiple sub-services (actual sub-services and test sub-services), and sub-services with the same name identifier will be displayed at the same time, that is, one or more network addresses and port information correspond to the same name identifier. Since the project Eureka obtains the configuration information of all actual sub-services except the target service with the same name identifier as the payment service B1, when the project Eureka is used as a new registration center, there will be no sub-services with the same name identifier, that is, one network address and one port information correspond to the same name identifier.
[0072] Exemplarily, in combination with the example given in S12 above, taking the first container as QCE and the routing mode of QCE as Nginx as an example, when deploying the test sub-service, the project Nginx obtains the project Nginx configuration after the application is started, and starts the service; wherein, the project Eureka configuration includes the Nginx basic jump configuration, and obtains the network address and port information of the application. At the same time, after the project Nginx starts the service, it becomes a new Nginx and initializes the basic configuration information. Among them, the network address corresponding to the new Nginx is the first network address, and the port information is the first port information. When the project Nginx replaces the project Nginx, at least one actual sub-service of the preset function (such as: display package service A, payment service B, purchase service C and activation service D) is obtained from the stable Nginx. Afterwards, at the same time, when the project Nginx replaces the project Nginx, when it is determined that the test sub-service is not the actual sub-service in the stable Nginx, the actual sub-service with the same name identifier as the test sub-service in the stable Nginx is used as the target service, and the target service is replaced with the test sub-service. For example, when the test subservice is payment service B1 and the target service is payment service B, payment service B is replaced with payment service B1. In this way, payment service B1 is deployed in the first container.
[0073] It can be seen that after the QCE container, once it is successfully started, the network address and port information are fixed, so the restart operation will not affect the network address and port information of the container in Nginx. At the same time, the project Nginx synchronizes the full configuration information. During the configuration information replacement process, first determine whether the subservice is the actual subservice in the stable Nginx. If not, replace it, and finally reach an nginx configuration file that is similar to the stable Nginx but not completely the same, isolating it from the stable Nginx while ensuring service sharing.
[0074] In some examples, combined with the example given in S12 above, taking the first container as K8s and the routing method of K8s as Nginx as an example, when deploying the test sub-service, K8s supports deployment using LoadBalancer. This type of Service requests the cloud server to create an external load balancer based on NodePort and ClusterIP to route external traffic to the Service. In this way, the Service can be accessed from the Internet through the public network address and public port information of the load balancer, so this public network address is used as the first network address, and the public port information is used as the first port information. Among them, the process of deploying the test sub-service on K8s is similar to the process of deploying the test sub-service on QCE, which will not be repeated here.
[0075] It can be seen that by configuring the proxy network address (external IP), when the K8s container is updated, the real network address (NodePort) changes, and the proxy network address remains unchanged, reducing the frequency of Nginx updates and shortening the environment deployment time.
[0076] In some possible implementation examples, combined with Figure 3 ,like Figure 4 As shown, the test task generating method provided by the present disclosure further includes: S15 and S16.
[0077] S15: When the target container is the second container, determine the second network address and the second port information based on the name identifier of the test subservice.
[0078] In some examples, the second container is a container capable of converting the name identifier into the second network address and the second port information, such as QAE.
[0079] In some examples, the server pre-stores the correspondence between the unused theoretical network address and theoretical port information and the name identifier. In this way, when the target container is the second container, the name identifier of the test subservice can be used to query the correspondence to obtain the theoretical network address and theoretical port information corresponding to the name identifier. Afterwards, the theoretical network address is used as the second network address, and the theoretical port information is used as the second port information.
[0080] In some examples, the server can input the name identifier of the test subservice into the conversion model to obtain the theoretical network address and theoretical port information corresponding to the name identifier. Then, the theoretical network address is used as the second network address, and the theoretical port information is used as the second port information. The training process of the conversion model is as follows:
[0081] The training sample data and the marking result of the training sample data are obtained, wherein the training sample data includes the name identifier of the historical test sub-service, and the marking result includes the theoretical network address and theoretical port information corresponding to the name identifier.
[0082] The training sample data is input into the neural network model for learning, and the prediction results of the neural network model for the training sample data are obtained.
[0083] Based on the prediction results and the labeling results, the network parameters of the neural network model are adjusted until the neural network model converges to obtain the conversion model.
[0084] In some examples, the server performs keyword extraction on the name identifier of the test subservice to obtain at least one actual keyword corresponding to the name identifier. Based on the actual keyword, a query is performed in the keyword set, and when it is determined that there is a theoretical keyword identical to the actual keyword in the keyword set, a network information set corresponding to the theoretical keyword is obtained. The server determines unused theoretical network addresses and theoretical port information in the network information set. The server randomly selects a theoretical network address as the second network address, and randomly selects a theoretical port information as the second port information.
[0085] When there are multiple theoretical keywords that are the same as the actual keyword in the keyword set, a network information set of any theoretical keyword is selected. After that, the server determines the unused theoretical network address and theoretical port information in the network information set. The server randomly selects a theoretical network address as the second network address and randomly selects a theoretical port information as the second port information.
[0086] In some examples, the server may convert the name identifier of the test sub-service into the second network address and the second port information through the Guardro-template of the QAE.
[0087] Exemplarily, in combination with the example given in S12 above, taking the first container as QAE and the routing mode of QAE as Nginx as an example, when deploying the test sub-service, the project Nginx obtains the project Nginx configuration and starts the service after the application is started; wherein the project Eureka configuration includes the Nginx basic jump configuration, and obtains the network address and port information of the application. At the same time, after the project Nginx starts the service, it becomes a new Nginx and initializes the basic configuration information. Among them, the network address corresponding to the new Nginx is the first network address, and the port information is the first port information. When the project Nginx replaces the project Nginx, it obtains at least one actual sub-service of the preset function from the stable Nginx (such as: display package service A, payment service B, purchase service C and activation service D). At the same time, after the payment service B1 is successfully started, a message of successful deployment is sent to the Guardro-template of QAE. After Guardro-template receives the deployment success message sent by payment service B1, it subscribes to the QAE Controller message, listens to this message to replace the specific part in the template file, and generates the corresponding Nginx upstream file; at the same time, it triggers Nginx to reload the configuration. In this way, the actual subservice with the same name identifier as the test subservice in the stable Nginx is used as the target service, and the target service is replaced with the test subservice. For example, when the test subservice is payment service B1 and the target service is payment service B, payment service B is replaced with payment service B1. In this way, payment service B1 is deployed in the first container.
[0088] It can be seen that due to the particularity of the QAE container, the network address and port information provided by the service cannot be obtained after startup. In order to make the use of the QAE container consistent with the QCE container, with the help of Guardro's capabilities, the server information after the QAE container is started is converted into the form of network address and port information, and replaced in the Nginx configuration to complete the routing capability of Nginx.
[0089] S16. Use the second network address as the actual network address of the test sub-service, and use the second port information as the actual port information of the test sub-service; wherein the first container and the second container are different.
[0090] In some possible implementation examples, combined with Figure 1 ,like Figure 5 As shown, the above S13 can be specifically implemented through the following S130.
[0091] S130: When the domain names of all actual sub-services are the same, based on the actual network address and actual port information of the test sub-service and the actual network address and actual port information of the actual sub-services other than the target service, generate a preset function to be tested.
[0092] In some examples, when the domain name of the actual subservice of the preset function is the same domain name, if only part of the actual subservice is modified, the routing method (Eureka, nginx) can be selected by building a template, and the actual subservice is replaced based on the name identifier for the subservice modified this time. And the execution order of the replaced actual subservice (i.e., the test subservice) and the actual subservice that has not been replaced is deployed based on the dependency relationship. Finally, the purpose of building an available environment is achieved.
[0093] In some possible implementation examples, combined with Figure 1 ,like Figure 6 As shown, the above S13 can be specifically implemented through the following S131.
[0094] S131. When there are different domain names between actual sub-services, and the routing methods corresponding to the actual sub-services with different domain names are all target routing methods, a preset function to be tested is generated based on the actual network address and actual port information of the test sub-service, and the actual network address and actual port information of the actual sub-services other than the target service.
[0095] In some examples, the target routing method includes a first method and a second method. The first method can be that one service corresponds to one network address, and the second method can be that one service corresponds to multiple network addresses, such as: the first method is Nginx, and the second method is Eureka.
[0096] In some examples, when there are different domain names between actual sub-services, and the routing methods corresponding to the actual sub-services with different domain names are all target routing methods, since the routing methods corresponding to the actual sub-services with different domain names are all target routing methods, the execution order between the test sub-service and the actual sub-services other than the target service can be known. Therefore, there is no need to re-set the execution order between the test sub-service and the actual sub-services other than the target service according to the dependency relationship, thereby reducing the deployment time.
[0097] In some possible implementation examples, combined with Figure 1 ,like Figure 7 As shown, the above S13 can be specifically implemented through the following S132-S134.
[0098] S132: when there are different domain names between the actual sub-services, and the actual sub-services with different domain names correspond to different routing modes, obtain the actual dependency relationship between the actual sub-services;
[0099] S133, based on the actual dependency relationship and the name identifier, adjusting the execution order between the test subservice and the actual subservices other than the target service to obtain a theoretical execution order;
[0100] S134: Generate a preset function to be tested based on the theoretical execution order, the actual network address and actual port information of the test sub-service, and the actual network address and actual port information of the actual sub-service other than the target service.
[0101] In some examples, when there are different domain names between actual sub-services, and the routing methods corresponding to the actual sub-services of different domain names are all target routing methods, the execution order of the sub-services between different domain names cannot be directly obtained because the actual sub-services of different domain names correspond to different routing methods. Therefore, it is necessary to set the execution order between the test sub-service and the actual sub-services other than the target service according to the dependency relationship, so as to avoid the failure of the preset function to be tested to be executed.
[0102] Exemplarily, in combination with the example given in S12 above, it is assumed that the domain names of both display package service A and payment service B are domain name A, and the routing methods of both display package service A and payment service B are Eureka, and the domain names of both purchase service C and activation service D are domain name B, and the routing methods of both purchase service C and activation service D are Nginx. If it is necessary to modify payment service B and purchase service C respectively, you can build template 1 corresponding to payment service B1 and template 2 corresponding to purchase service C1 respectively. Among them, the payment method of payment service B1 is (Nginx or Eureka), and the payment method of purchase service C1 is Nginx. Since purchase service C depends on payment service B, it is necessary to register purchase service C1 in Eureka of template 1, that is, modify payment service B1 to depend on Nginx corresponding to this project C1.
[0103] In some possible implementation examples, combined with Figure 2 ,like Figure 8 As shown, the above S14 can be specifically implemented through the following S140 and S141.
[0104] S140, running the preset function to be tested, and displaying the test interface corresponding to the preset function to be tested;
[0105] S141: When the test interface includes a first control corresponding to the test sub-service and a second control corresponding to the actual sub-service other than the target service, determine that the service test result is a test success.
[0106] In some possible implementation examples, combined with Figure 8 ,like Fig. 9As shown, the test task generating method provided by the present disclosure further includes: S17.
[0107] S17: When the target control is not included in the test interface, determine that the business test result is a test failure; wherein the target control includes one or more of the first control and the second control.
[0108] The above mainly introduces the solution provided by the embodiment of the present invention from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present invention can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0109] The embodiment of the present invention can divide the functional modules of the test task generating device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0110] like Fig.10 As shown, an embodiment of the present invention provides a schematic diagram of the structure of a test task generating device 10. The test task generating device 10 includes: an acquisition unit 101, a processing unit 102 and a display unit 103.
[0111] An acquisition unit 101 is used to acquire at least one actual sub-service corresponding to a preset function, at least one test sub-service currently to be tested of the preset function, and actual network address and actual port information of the test sub-service;
[0112] The processing unit 102 is used to determine a target service having the same name identifier as the test subservice based on the name identifier of the test subservice obtained by the obtaining unit 101; wherein the target service includes any one of the actual subservices;
[0113] The processing unit 102 is further configured to generate a preset function to be tested based on the test sub-service and the actual sub-services except the target service.
[0114] In some feasible examples, the processing unit 102 is further configured to run a preset function to be tested and generate a service test result.
[0115] In some feasible examples, the acquisition unit 101 is specifically used to acquire the target container for deploying the test subservice; the processing unit 102 is specifically used to determine, when the target container is the first container, based on the first network address and first port information of the target container acquired by the acquisition unit 101, that the actual network address of the test subservice is the first network address, and the actual port information is the first port information.
[0116] In some implementable examples, the processing unit 102 is further used to determine the second network address and the second port information based on the name identifier of the test subservice obtained by the obtaining unit 101 when the target container is the second container; the processing unit 102 is further used to use the second network address as the actual network address of the test subservice and the second port information as the actual port information of the test subservice; wherein the first container and the second container are different.
[0117] In some feasible examples, the processing unit 102 is specifically used to generate a preset function to be tested based on the actual network address and actual port information of the test sub-service obtained by the acquisition unit 101 and the actual network address and actual port information of the actual sub-service other than the target service when the domain names of all actual sub-services obtained by the acquisition unit 101 are the same.
[0118] In some feasible examples, the processing unit 102 is specifically used to generate a preset function to be tested based on the actual network address and actual port information of the test sub-service obtained by the acquisition unit 101, and the actual network address and actual port information of the actual sub-service other than the target service, when there are different domain names between the actual sub-services obtained by the acquisition unit 101, and the routing methods corresponding to the actual sub-services with different domain names are all target routing methods.
[0119] In some implementable examples, the processing unit 102 is specifically used to control the acquisition unit 101 to obtain the actual dependency relationship between the actual sub-services when there are different domain names between the actual sub-services acquired by the acquisition unit 101 and the routing methods corresponding to the actual sub-services with different domain names are different; the processing unit 102 is specifically used to adjust the execution order between the test sub-service and the actual sub-services other than the target service based on the actual dependency relationship and the name identifier to obtain the theoretical execution order; the processing unit 102 is specifically used to generate a preset function to be tested based on the theoretical execution order, the actual network address and actual port information of the test sub-service, and the actual network address and actual port information of the actual sub-service other than the target service.
[0120] In some implementable examples, the processing unit 102 is specifically used to run the preset function to be tested and control the display unit 103 to display the test interface corresponding to the preset function to be tested; the processing unit 102 is specifically used to determine that the business test result is a successful test when the test interface displayed by the display unit 103 includes a first control corresponding to the test sub-service and a second control corresponding to the actual sub-service other than the target service.
[0121] In some implementable examples, the processing unit 102 is specifically used to determine that the business test result is a test failure when the test interface displayed by the display unit 103 does not include the target control; wherein the target control includes one or more of the first control and the second control.
[0122] Of course, the test task generation device 10 provided in the embodiment of the present invention includes but is not limited to the above modules, for example, the test task generation device 10 may also include a storage unit 104. The storage unit 104 may be used to store the program code of the test task generation device 10, and may also be used to store data generated by the test task generation device 10 during operation, such as data in a write request, etc.
[0123] Fig.11 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention is shown in FIG. Fig.11 As shown, the electronic device may include: at least one processor 51, a memory 52, a communication interface 53, a communication bus 54 and a display screen 55. Fig.11 A detailed introduction to the various components of electronic equipment:
[0124] The processor 51 is the control center of the electronic device, and may be a processor or a general term for multiple processing elements. For example, the processor 51 is a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention, such as one or more DSPs, or one or more field programmable gate arrays (FPGAs).
[0125] In a specific implementation, as an embodiment, the processor 51 may include one or more CPUs, such as Fig.11 Also, as an embodiment, the electronic device may include multiple processors, such as Fig.1151 and processor 56 are shown in FIG. Each of these processors may be a single-core processor (Single-CPU) or a multi-core processor (Multi-CPU). The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0126] The memory 52 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 52 may exist independently and be connected to the processor 51 via a communication bus 54. The memory 52 may also be integrated with the processor 51.
[0127] In a specific implementation, the memory 52 is used to store the data of the present invention and execute the software program of the present invention. The processor 51 can execute various functions of the air conditioner by running or executing the software program stored in the memory 52 and calling the data stored in the memory 52.
[0128] The communication interface 53 uses any transceiver-like device to communicate with other devices or communication networks, such as Radio Access Network (RAN), Wireless Local Area Networks (WLAN), terminals, the cloud, etc. The communication interface 53 may include an acquisition unit to implement the acquisition function.
[0129] The communication bus 54 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.11 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0130] As an example, combining Fig.10 The function implemented by the acquisition unit 101 in the test task generation device 10 is the same as Fig.11 The function of the communication interface 53 in the test task generation device 10 is the same as that of the processing unit 102 in the test task generation device 10. Fig.11 The function of the processor 51 in the test task generation device 10 is the same as that of the storage unit 104 in the test task generation device 10. Fig.11 The function of the memory 52 in is the same.
[0131] Another embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a computing device, the computing device implements the data processing method as described in any one of the above examples.
[0132] In some embodiments, the disclosed methods may be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of manufacture.
[0133] Fig.12 The diagram schematically shows a conceptual partial view of a computer program product provided by an embodiment of the present invention, wherein the computer program product includes a computer program for executing a computer process on a computing device.
[0134] In one embodiment, the computer program product is provided using a signal bearing medium 410. The signal bearing medium 410 may include one or more program instructions, which when executed by one or more processors may provide the above-mentioned Figure 1 Thus, for example, reference to Figure 1 In the embodiment shown in , one or more features of S11-S14 can be undertaken by one or more instructions associated with the signal bearing medium 410. In addition, Fig.12 The program instructions in also describe example instructions.
[0135] In some examples, signal bearing medium 410 may include computer readable medium 411, such as, but not limited to, a hard drive, a compact disk (CD), a digital video disk (DVD), a digital tape, a memory, a read-only memory (ROM), or a random access memory (RAM), and the like.
[0136] In some implementations, signal bearing medium 410 may include computer recordable medium 412 such as, but not limited to, memory, read / write (R / W) CD, R / W DVD, and the like.
[0137] In some implementations, signal bearing medium 410 may include communication medium 413 such as, but not limited to, digital and / or analog communication media (eg, fiber optic cables, waveguides, wired communication links, wireless communication links, etc.).
[0138] The signal bearing medium 410 may be communicated by a wireless form of communication medium 413 (eg, a wireless communication medium conforming to the IEEE 802.41 standard or other transmission protocol). The one or more program instructions may be, for example, computer executable instructions or logic implemented instructions.
[0139] In some examples, such as for Fig.11 The described test task generating apparatus may be configured to provide various operations, functions, or actions in response to one or more program instructions in computer-readable medium 411 , computer-recordable medium 412 , and / or communication medium 413 .
[0140] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0141] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0142] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0143] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0144] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.
[0145] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A test task generation method, characterized in that: include: Acquire at least one actual sub-service corresponding to a preset function, at least one test sub-service currently to be tested of the preset function, and the actual network address and actual port information of the test sub-service; Based on the name identifier of the test subservice, determining a target service having the same name identifier as the test subservice; wherein the target service includes any one of the actual subservices; Based on the test sub-service and actual sub-services other than the target service, a preset function to be tested is generated.
2. The test task generation method according to claim 1, characterized in that: Obtaining the actual network address and actual port information of the test subservice, including: Obtain a target container for deploying the test subservice; When the target container is the first container, based on the first network address and first port information of the target container, it is determined that the actual network address of the test subservice is the first network address and the actual port information is the first port information.
3. The test task generation method according to claim 2, characterized in that: The method further comprises: When the target container is the second container, determining the second network address and the second port information based on the name identifier of the test subservice; The second network address is used as the actual network address of the test sub-service, and the second port information is used as the actual port information of the test sub-service; wherein the first container and the second container are different.
4. The test task generation method according to claim 1, characterized in that: The generating a preset function to be tested based on the test sub-service and the actual sub-services other than the target service includes: When the domain names of all the actual sub-services are the same, the preset function to be tested is generated based on the actual network address and actual port information of the test sub-service and the actual network address and actual port information of the actual sub-services other than the target service.
5. The test task generation method according to claim 1, characterized in that: The generating a preset function to be tested based on the test sub-service and the actual sub-services other than the target service includes: When there are different domain names between the actual sub-services, and the routing methods corresponding to the actual sub-services with different domain names are all target routing methods, a preset function to be tested is generated based on the actual network address and actual port information of the test sub-service, and the actual network address and actual port information of the actual sub-services other than the target service.
6. The test task generation method according to claim 1, characterized in that: The generating a preset function to be tested based on the test sub-service and the actual sub-services other than the target service includes: When there are different domain names between the actual sub-services, and the actual sub-services with different domain names correspond to different routing modes, obtaining the actual dependency relationship between the actual sub-services; Based on the actual dependency and the name identifier, adjusting the execution order between the test subservice and the actual subservices other than the target service to obtain a theoretical execution order; Based on the theoretical execution order, the actual network address and actual port information of the test sub-service, and the actual network address and actual port information of the actual sub-services except the target service, a preset function to be tested is generated.
7. A test task generating device, characterized in that: include: An acquisition unit, configured to acquire at least one actual sub-service corresponding to a preset function, at least one test sub-service currently to be tested of the preset function, and an actual network address and actual port information of the test sub-service; a processing unit, configured to determine, based on the name identifier of the test subservice acquired by the acquisition unit, a target service having the same name identifier as the test subservice; wherein the target service includes any one of the actual subservices; The processing unit is further configured to generate a preset function to be tested based on the test sub-service and actual sub-services other than the target service.
8. The test task generating device according to claim 7, characterized in that: The acquisition unit is specifically used to acquire a target container for deploying the test sub-service; The processing unit is specifically configured to determine, when the target container acquired by the acquisition unit is the first container, based on the first network address and the first port information of the target container, that the actual network address of the test subservice is the first network address and the actual port information is the first port information.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store a computer program; and the processor is used to enable the electronic device to implement the test task generation method described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a computing device, the computing device implements the test task generating method according to any one of claims 1 to 7.
