Application program testing method and device, equipment, storage medium and program product
By responding to selection instructions in the automation test of the application, determining the queue where the service to be tested is located, and determining the test strategy and interface information based on the queue, the problem of testers in the prior art needs to write a large number of test cases, achieving the effect of improving the efficiency of application automation testing.
Patent Information
- Application Number
- CN202411473216.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-03-28
AI Technical Summary
During the automated testing of an application, testers need to write a large number of test cases and invest a lot of manpower to conduct repeated testing to ensure the quality of the application.
The queue to which the service to be tested is located is determined by responding to the selection instruction, the test policy is determined based on the queue, and the interface information is determined based on the policy, and finally the interface information is sent to the test platform to execute the test case.
This method can select multiple services to be tested for automated testing according to the needs, without compiling the test strategies of each service to be tested or a combination of services to be tested in sequence, improving the efficiency of automated testing of the application.
Smart Images

Figure CN119718906A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment, storage medium and program product for testing an application. Background Art
[0002] With the rapid development of the software industry, various applications with different functions are constantly being launched and applied, and their business processes have become more complex. An application is a software program that is used to perform specific tasks, functions or services to meet user needs, such as web applications, mobile applications, desktop applications, etc. During the automated testing of applications, testers often need to write a large number of test cases and invest enough testers to repeatedly test the application to ensure its quality. Summary of the invention
[0003] In response to the above technical problems, the present application provides a testing method, device, equipment, storage medium and program product for an application program, which improves the efficiency of automated testing of the application program to at least partially solve the above technical problems.
[0004] In a first aspect, the present application provides a method for testing an application program, the method comprising:
[0005] In response to a first service corresponding to the first selection instruction, determining a first queue where the first service is located, the first service being any one of a plurality of services to be tested of the application program;
[0006] Determine a test strategy for the first queue, and determine interface information of the first service according to the test strategy;
[0007] The interface information is sent to the test platform, and the test platform is controlled to execute the test case of the first service based on the interface information.
[0008] In a second aspect, the present application provides a testing device for an application program, the device comprising:
[0009] A response module, configured to determine, in response to a first service corresponding to the first selection instruction, a first queue where the first service is located, wherein the first service is any one of a plurality of services to be tested of the application program;
[0010] A determination module, used to determine a test strategy for the first queue, and determine interface information of the first service according to the test strategy;
[0011] An instruction module is used to send the interface information to the test platform and control the test platform to execute the test case of the first service based on the interface information.
[0012] In a third aspect, the present application also provides a computer device, including a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps of a testing method for any application provided in an embodiment of the present application.
[0013] In a fourth aspect, the present application also provides a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the steps of a testing method for any application provided in an embodiment of the present application.
[0014] In a fifth aspect, the present application also provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the steps in the testing method of any application provided in the present application.
[0015] This application selects any one of the multiple services to be tested in the application program according to the first selection instruction as the first service. Then determine the first queue where the first service is located, determine the corresponding test strategy based on the first queue, and determine the interface information of the first service based on the test strategy. Finally, send the interface information to the test platform to control the test platform to execute the test case of the first service. In this way, any one of the multiple services to be tested can be selected as the first service according to demand, and automated testing can be performed based on the test strategy of the first queue where the first service is located. There is no need to compile the test strategy for each service to be tested or combination of services to be tested in the application program in turn, thereby improving the efficiency of automated testing of the application program. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0017] Figure 1 is a schematic diagram of a method for performing automated testing of an application;
[0018] Figure 2 is a schematic diagram of the structure of a test system for an application program provided in an embodiment of the present application;
[0019] Figure 3 It is a flowchart of a method for testing an application program provided in an embodiment of the present application;
[0020] Figure 4 is a flowchart of a method for testing an application program provided in another embodiment of the present application;
[0021] Figure 5 is a flowchart of a method for testing an application program provided in another embodiment of the present application;
[0022] Figure 6 is a timing diagram of a method for testing an application program provided in an embodiment of the present application;
[0023] Figure 7 It is a structural schematic diagram of a testing device for an application program provided in an embodiment of the present application;
[0024] Figure 8 It is a structural schematic diagram of a quality platform provided in one embodiment of the present application;
[0025] Fig. 9 is a structural schematic diagram of a mass platform provided in another embodiment of the present application;
[0026] Fig.10 It is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0028] The automated testing of applications is mainly performed through the plug-in of the test platform, which is integrated into the CI / CD process of the plug-in. The test management capabilities of the plug-in and the test platform are utilized to trigger the test platform to start testing and obtain test results during the plug-in building process, thereby automating the testing process. Figure 1 is a schematic diagram of a method for performing automated testing of an application. Figure 1, taking the test platform as the metersphere platform and the plug-in as meterspherejenkins as an example, a commonly used automated test is described. First, the service to be tested of the application is compiled and packaged on the jenkins platform and then released. The Jenkins platform is an open source automation server for building, testing and deploying software projects. By setting the metersphere jenkins plug-in, the metersphere platform can be integrated into the CI / CD process of the jenkins platform. By using the test management capabilities of the jenkins platform and the metersphere platform, the metersphere test is triggered during the construction process of the jenkins platform and the test results are obtained, thereby realizing the automation of the test process. This method is to deploy and release the service to be tested of the application through an open source publishing platform such as the jenkins platform, and then connect with the open source test platform metersphere platform through the metersphere jenkins plug-in. However, for a non-open source publishing system, it is impossible to directly connect with the open source test platform (metersphere platform) through the metersphere jenkins plug-in. At the same time, the metersphere jenkins plug-in mainly triggers automated test tasks based on service deployment. It is unable to determine whether the image version number changes during service deployment, and thus cannot accurately control whether to execute automated test tasks.
[0029] Therefore, the embodiment of the present application provides a testing method for an application, which connects the publishing platform and the testing platform through the server, thereby realizing the connection between the non-open source publishing platform and the open source testing platform. The testing method for the application in the embodiment of the present application can be run in a computer device, for example, the computer device can be a local terminal device (such as a personal computer, PC) or a server. When the testing method for the application is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0030] In order to better understand the testing method of an application provided in an embodiment of the present application, the application environment of the testing method of the application applicable to the embodiment of the present application is first described below.
[0031] See also Figure 2 , Figure 2 2 is a schematic diagram of a test system for an application provided in an embodiment of the present application. The test system for the application may include a server 210, a publishing platform 220, a test platform 230, a call interface 240, and a client 250. As an example, the test method of the application is run on Figure 2Taking the server 210 shown in as an example, the server 210 can communicate with the publishing platform 220, the calling interface 240 and the client 250 respectively through the network, and the calling interface 240 communicates with the server 210 and the test platform 230 respectively through the network. Among them, the network is used to provide a medium for the communication link. The network can include various connection types, such as wired communication links, wireless communication links, etc., which are not limited in the embodiments of the present application. Optionally, in other embodiments, the testing method of the application can also be applied to other types of electronic devices such as smart phones and laptops.
[0032] In the embodiment of the present application, the publishing platform 220 is used to send a message queue including at least one service to be tested to the server 210. After receiving the message queue, the server 210 can execute the test method of the application provided in the embodiment of the present application, and can make the test platform 230 execute the test case of the service to be tested by calling the interface 240, and complete the automated test of the service to be tested of the application. After the server 210 receives the test result returned by the test platform 230 by calling the interface 240, a test report can be generated and sent to the corresponding client 250. In this way, the client 250 can intuitively and timely obtain the automated test results of the application.
[0033] It should be understood that Figure 2 The server 210, publishing platform 220, test platform 230, call interface 240, client 250 and network in the figure are merely illustrative. According to the implementation needs, any number of servers, networks and terminal devices can be configured. Exemplarily, the server 210 can be a physical server, or a server cluster composed of multiple servers, etc. The publishing platform 220, test platform 230 and call interface 240 can be integrated into devices such as cloud servers, physical servers or virtual machines, and the client 250 can be a mobile phone, a tablet, a desktop computer, a laptop computer, etc. It is understandable that the embodiments of the present application can also allow multiple clients 250 to access the server 210 at the same time.
[0034] The following is a detailed description in conjunction with the accompanying drawings. In the embodiment of the present application, the execution subject is the server 210 as an example. The server in the embodiment of the present application can be a quality platform or a platform that can receive script editing. Among them, the quality platform can include a visual interface, and the tester can select the required test items through the visual interface to perform automated testing. It should be noted that the description order of the following embodiments is not intended to limit the preferred order of the embodiments. Although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that shown in the accompanying drawings.
[0035] Figure 3is a flowchart of a method for testing an application program provided in an embodiment of the present application. Figure 3 In one embodiment of the application, the specific process of the testing method of the application can be performed by the server 210 to execute the following steps 301-303, which are described in detail below.
[0036] Step 301: In response to a first service corresponding to a first selection instruction, determine a first queue where the first service is located, where the first service is any one of a plurality of services to be tested of an application program.
[0037] In an embodiment of the present application, the service to be tested is a module or component responsible for a specific function or service in an application program that needs to be automatically tested. These services to be tested can be programs running in the background, or a collection of a group of related functions, which are used to provide specific functions or data access to other parts of the application program or an external system. The first selection instruction refers to an instruction input by the tester to select any one of the services to be tested. The first service is a service to be tested selected by the tester. In response to the first selection instruction, the first service that needs to be tested can be determined.
[0038] In an embodiment of the present application, multiple services to be tested of an application program can be divided into multiple first queues based on the association relationship of the multiple services to be tested, and each first queue is configured with a corresponding test strategy. In this way, each test strategy can correspond to multiple first services with an association relationship. For example, first services with associations in interface addresses can be divided into a group. In this way, the test strategy corresponding to the first queue can be triggered by simply receiving any one of the first services in the first queue. Compared with the need to compile each service to be tested separately in the traditional technology to obtain the corresponding test strategy, the method of dividing multiple first queues provided in the embodiment of the present application can perform automated testing more efficiently, reduce the compilation time of testers, and can be flexibly configured according to the association relationship of the services to be tested, with higher flexibility.
[0039] Step 302: Determine a test strategy for the first queue, and determine interface information for the first service according to the test strategy.
[0040] Step 303: Send the interface information to the test platform, and control the test platform to execute the test case of the first service based on the interface information.
[0041] In an embodiment of the present application, the test strategy may include interface information corresponding to the first service. Among them, the interface information may include the interface address of the first service. Each interface address may correspond to an execution interface of the test platform. In this way, the test platform can be instructed to call the execution interface corresponding to the interface address based on the interface address, and the test case of the first service can be performed through the execution interface, thereby realizing the automated testing of the first service. In an embodiment of the present application, the test case refers to the test steps and data for performance verification of the first service, and the test case can be written in advance. In one example, the test case can be pre-configured on the test platform, and each execution interface has a corresponding test case. In another example, the test case can also be configured on the server, and each interface information of the first service corresponds to a test case. In this way, the server can send both the interface address and the test case of the first service to the test platform, and the test platform directly calls the corresponding execution interface for automated testing.
[0042] In this way, in the embodiment of the present application, any one of the multiple services to be tested can be selected as the first service according to demand, and automated testing can be performed based on the test strategy of the first queue where the first service is located. There is no need to compile the test strategy for each service to be tested or combination of services to be tested of the application in turn, thereby improving the efficiency of automated testing of the application.
[0043] Before step 301 of the embodiment of the present application, a mapping library may be established in advance to characterize a first mapping relationship between the first queue and the test strategy, and a second mapping relationship between the first service and the interface information.
[0044] Specifically, the interface information of multiple services to be tested of the application program can be obtained first. Then, the services to be tested that have an associated interface information and the same test parameters are divided into the same queue to obtain a first queue. Among them, the service to be tested in the first queue is the first service. Next, a test strategy corresponding to the first queue is configured based on the test parameters. The test strategy includes the interface information corresponding to the first service in the first queue. Finally, a mapping library is established based on the first mapping relationship between the first queue and the test strategy, and the second mapping relationship between the first service and the interface information.
[0045] In an embodiment of the present application, multiple services to be tested of an application program may respectively have corresponding interface information, such as an interface address. Interface information with an associated relationship may refer to a relationship in which the interface addresses have similarities. For example, if the first few digits of the interface addresses are the same, it can be considered that the interface addresses have an associated relationship. Test parameters refer to parameters such as the test environment and image version number for testing the service to be tested. The first services with the same test parameters are divided into the same queue, so that the same test strategy can be determined for each first queue, thereby reducing the process of compiling the test strategy for each service to be tested and improving the test efficiency.
[0046] Among them, the test strategy can also include interface information corresponding to each first service in the first queue. In this way, when communicating with the test platform, the test platform can be instructed to call the execution interface to perform automated testing of the first service. Finally, a mapping library is established based on the one-to-one first mapping relationship between the first queue and the test strategy, and the one-to-one second mapping relationship between the first service and the interface information. In this way, when the first service selected by the first selection instruction is received, the first queue where the first service is located and the test strategy corresponding to the first queue can be found through the mapping library. In addition, based on the interface information of the first service, the test platform can be instructed to call the corresponding execution interface to perform automated testing. By searching the mapping library, only the first service needs to be known to trigger the test strategy corresponding to the first queue where the first service is located, thereby improving the efficiency of automated testing of the service to be tested of the application.
[0047] In one example, the server may be a quality platform, and a mapping library may be pre-configured in the database of the quality platform. In this way, after the quality platform obtains the selected first service, it may determine the test strategy corresponding to the first queue where the first service is located according to the pre-configured mapping library. In another example, the server may also interact with the publishing platform through a script. The server configures the first mapping relationship and the second mapping relationship in an Excel file in advance. The server parses the test script and searches the Excel file according to the first service to obtain the test strategy of the first queue where the first service is located. By pre-configuring the mapping library, the test strategy of the first service may be automatically matched, thereby improving the efficiency of the automated testing of the first service.
[0048] In the related art, after obtaining the service to be tested, the test platform is usually triggered to perform automated testing. In this way, it is easy to test the service to be tested before the service to be tested is deployed. Therefore, in the embodiment of the present application, a message queue is set up, and the tester deploys the service to be tested in the message queue, and then executes the automated test program. This is because the asynchronous processing mechanism provided by the message queue can process the message when needed. In the embodiment of the present application, the second selection instruction refers to an instruction input by the tester to select at least one of the services to be tested, and these services to be tested can generate a second queue. The second queue refers to a queue composed of the services to be tested selected by the tester. The service to be tested in the second queue is a second service. Among them, the second service can come from the same first queue or from different first queues.
[0049] In response to the second selection instruction, the second queue selected by the second selection instruction is parsed, and the second service that needs to be tested can be determined. In one example, the second queue can be a kafka message queue. Kafka is a distributed message queue based on the publish / subscribe model, which defines a one-to-many dependency relationship and can be used as a cache written on the disk. It can ensure that when the data packet is not consumed in time, it is still available and not lost. The second queue received by the server is the message that the publishing platform has been deployed. Therefore, it reduces the situation where the automated test starts before the service to be tested is deployed, and improves the success rate of the automated test.
[0050] For the second service in the second queue, it is first necessary to determine whether the second service exists in the mapping library. If the second service does not exist in the mapping library, it means that the second service has not yet been configured with a corresponding test strategy. Therefore, it is necessary to add a setting identifier to the second service and store it in the mapping library. Among them, the setting identifier indicates that the second service needs to be configured with a test strategy. If the second service exists in the mapping library, it means that the second service has been configured with a corresponding test strategy. Therefore, the second service can be used as the first service, and the first queue where the first service is located can be found to perform automated testing. By updating the services to be tested in real time, new services to be tested can be added in a timely manner, and the service information stored in the server can be expanded, thereby making the testing of the services to be tested of the application more comprehensive and efficient.
[0051] In an embodiment of the present application, the consumption switch state of the second queue may be obtained first, and then the second queue may be received when the consumption switch state of the second queue is in the on state.
[0052] In the embodiment of the present application, the consumption switch refers to a switch that determines whether the server receives a message. When the consumption switch is in the on state, the second queue sent by the publishing platform can be received. On the contrary, when the message switch is in the off state, the second queue sent by the publishing platform is not received. In this way, when the automated testing of the application is not required, unnecessary test programs can be reduced by turning off the consumption switch of the server for the message queue, reducing the computing burden of the server and improving the efficiency of the automated testing.
[0053] The following example takes the server as the quality platform and the second queue as the kafka message. In one instance, the consumption switch can be operated in the following way. First, configure the switch status in the configuration file in the qa-platform service of the quality platform (such as setting the value of the "status" field), 0 means turning off the kafka consumption message, and 1 means turning on the kafka consumption message. Then, get the switch status (get the value of the "status" field). When the kafka message consumption switch is turned on (status = 1), the kafka message sent by the consumption publishing platform is turned on, otherwise, the kafka message is not consumed. The code and configuration example of the message switch are shown below.
[0054] my:
[0055] groupId:deploy-result-topic-test#groupId is the unique ID of the consumer, which is not repeated with others status:0#0 is closed, 1 is to open kafka consumption message
[0056] SEESION:021ae40f-c56f-4174-9d73-625d5d2ea270
[0057] csrfToken:JryZ0mSxA0tkEDXbfke3uAr+OIm6BghGJEjfQ0eXJh+QW4GY2PnO VTq / VpUL0F9iwv3sJuqou3fUxqZntUA68QUG / wkrqTSruZfG1kJPntY=
[0058] ApplicationRunnerController Class
[0059] @Value("${my.status}")
[0060] private int status;
[0061] try{
[0062] / / If the kafka message consumption switch is turned on, consumption is enabled
[0063] if (status == 1) {
[0064] kafkaManyThreadConsumer.consumer(topic,groupId);
[0065] }
[0066] else{
[0067] log.error("The kafka message consumption switch is 0, which means it is closed!");
[0068] }
[0069] The embodiment of the present application determines whether to turn on the consumption switch of the second queue of the receiving and publishing platform by judging the identification bit, which can reduce the waste of server resources and improve the efficiency of automated testing.
[0070] In an embodiment of the present application, each test strategy includes a calling interface corresponding to the first queue. The calling interface is used to communicate with the test platform. In an embodiment of the present application, after obtaining the calling interface of the first queue, the calling interface can be authenticated first. When the calling interface authentication passes, communication with the test platform is performed through the calling interface. Thereby ensuring the security and controllability of the calling interface. Through the authentication mechanism, the identity of the caller can be verified and permission control can be performed to ensure that only authorized users or applications can access specific interfaces and resources.
[0071] In one embodiment of the present application, the test case can be deployed on the test platform. Therefore, the interface information of the first service can include the interface address. In step 303, the interface address can be sent to the test platform by calling the interface, and the test platform is instructed to call the execution interface corresponding to the interface address to execute the test case corresponding to the execution interface.
[0072] In another embodiment of the present application, the test case can be deployed on the server. Therefore, the interface information of the first service can include the interface address and the test case. In step 303, the test case corresponding to the interface address can be determined according to the interface address. Then, the interface address and the test case are sent to the test platform by calling the interface, and the test platform is instructed to execute the test case through the execution interface corresponding to the interface address.
[0073] The deployment of test cases can reduce the computing pressure on the server or test platform and can be set based on demand, without any limitation here.
[0074] Figure 4 is a flowchart of a method for testing an application program provided in another embodiment of the present application. Figure 4 Before the server executes step 301, the testing method of the embodiment of the present application may further include steps 304-306.
[0075] Step 304: Obtain target parameters of the first service, where the target parameters include a target test environment, a target image version number, and a target service name.
[0076] Step 305: Determine whether the target image version number and the target service name exist in the execution record of the target test environment.
[0077] Step 306: If the target image version number and the target service name exist in the execution record of the target test environment, skip executing the test case of the first service.
[0078] In an embodiment of the present application, the server may check the execution record of the test strategy before matching the test strategy. The execution record of the test strategy includes relevant information of the tested service that has executed the test strategy. Such as parameters such as the target test environment, target image version number, and target service name. In order to reduce the situation of repeated execution of the service to be tested, after parsing the first service to obtain its corresponding target test environment, target image version number, and target service name, the server may compare the target test environment, target image version number, and target service name of the first service with the test environment, image version number, and service name of the tested service in the execution record. If the target test environment of the first service matches the target test environment of the tested service, the target image version number of the service to be tested matches the target image version number of the tested service, and the target service name of the first service matches the target service name of the tested service, it means that the first service has been executed, and at this time, the server can skip executing the test case of the current first service. In one example, it is possible to first determine whether there is a target test environment for the current first service in the execution record. If so, it is further determined whether there is data matching the target image version number and target service name of the first service in the target test environment. If so, it means that the current first service has been executed, and the server can skip the first service.
[0079] It should be noted that, in the embodiment of the present application, the process of matching the target test environment, target image version number and target service name of the first service with the target test environment, target image version number and target service name contained in the execution record of the test plan is not limited to the above matching order, for example, it may also be to first determine whether the target image version number matches, or to first determine whether the target service name matches. This is not limited here.
[0080] Figure 5 FIG. 1 is a flowchart of a method for testing an application program provided in another embodiment of the present application. Figure 5 After the server executes step 303, the testing method of the embodiment of the present application may further include steps 307-309.
[0081] Step 307: Receive the test result returned by the test platform by calling the interface;
[0082] Step 308: Analyze the test results and generate a test report.
[0083] Step 309: Send the test report to the client according to the set message template.
[0084] In the automated testing of traditional applications, users are usually required to click on the link of the open source test platform to view the test results, and the content of the test results is limited by the setting of the test platform. For example, the test report of the metersphere platform does not include the test results of the interface coverage, so that it is cumbersome for users to obtain the test results and the content is not comprehensive. Therefore, the embodiment of the present application can also receive the test results returned by the test platform by calling the interface, and parse the test results by the server to generate a test report. In this way, the user does not need to view the test results through the link of the third-party test platform. At the same time, the server can also send it to the client communicating with the server according to the setting message template. Among them, the setting message template can be set according to the input instruction of the tester. For example, the embodiment of the present application can count the interface coverage of the metersphere platform test so that the user can obtain the test result. In this way, the test report can be flexibly sent to the client intuitively and comprehensively according to the demand, and the user experience is also improved.
[0085] In step 309 of the embodiment of the present application, the target client address, notification rules and sending method in the set message template may be obtained first, and then the test report may be sent to the target client address by setting the sending method according to the notification rules.
[0086] In an embodiment of the present application, the target client address refers to the address information corresponding to the client to which the test report needs to be sent. The notification rule refers to rules such as notifying only successful results, notifying only failed results, or notifying all. The sending method refers to the method of sending the test report to the client, and the sending method may include, but is not limited to, text messages, emails, etc. The server can send the test report to the target client address according to the notification rules selected by the tester and the set sending method, so that the test report can be accurately pushed to the corresponding personnel according to the needs, so that the test results can be intuitively, comprehensively and timely fed back.
[0087] Figure 6 is a timing diagram of a method for testing an application program provided in an embodiment of the present application. Figure 6 Taking the automated test pipeline of the metersphere platform as an example, assuming that the server is a quality platform, the calling interface is ms-api-server, and the test strategy is a test plan as an example. In a specific embodiment, the test method of the application includes steps 601-612.
[0088] S601. The publishing platform deploys the service to be tested and sends a Kafka message to the quality platform.
[0089] S602: The quality platform parses the Kafka message and matches the corresponding test plan;
[0090] S603. Pass the test plan identifier (testplanId) to the calling interface ms-api-server.
[0091] S604: Call the interface ms-api-server for authentication.
[0092] S605, after authentication is passed, the interface ms-api-server is called to pass the service ID (projectId) and the test plan ID (testplanId) to the metersphere platform;
[0093] S606, Metersphere platform verifies whether there is a corresponding test plan;
[0094] S607. If there is a corresponding test plan, schedule the application service interface;
[0095] S608, the application service feeds back the test result to the metersphere platform;
[0096] S609, the metersphere platform returns the test result to the calling interface ms-api-sever;
[0097] S610, calling the interface ms-api-sever to return the test results to the quality platform;
[0098] S611, the quality platform generates a test report;
[0099] S612: Send the test report to the corresponding client.
[0100] The embodiment of the present application communicates with the publishing platform and the test platform metersphere of the application program respectively through the quality platform. After the publishing platform is deployed successfully, the message queue sent by the publishing platform is parsed and intelligently matched with the corresponding test plan. After matching the test plan, the test case corresponding to the metersphere platform is scheduled to be executed. At the same time, during the execution process, it is possible to control whether the image version number information of the deployed service to be tested has changed, and reduce the situation where the code has not changed and the corresponding test case is executed when the service is deployed. This can facilitate rapid automated testing after service deployment and feedback of automated testing results, greatly improving the efficiency of automated case execution of the service to be tested of the application program, and helping testers to find problems as soon as possible. In this way, the publishing platform can be directly docked with the test platform. In the case where the publishing platform is a non-open source system, the automated testing of the application program can also be performed through the open source test platform, which improves the efficiency of automated testing of the application program.
[0101] It should be understood that, although each step in the flowcharts involved in the above-mentioned embodiments is displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0102] Based on the same inventive concept, the embodiment of the present application also provides a server for implementing the above-mentioned application test method. The implementation scheme for solving the problem provided by the server is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of one or more servers provided below can refer to the above-mentioned limitations on the application test method, and the specific limitations are not repeated here.
[0103] Figure 7 is a schematic diagram of a structure of a testing device 700 for an application program provided in an embodiment of the present application. Figure 7, the test device may include a response module 701, a determination module 702 and an indication module 703. The response module 701 is used to respond to the first service corresponding to the first selection instruction and determine the first queue where the first service is located. The first service is any one of multiple services to be tested of the application. The determination module 702 is used to determine the test strategy of the first queue and determine the interface information of the first service according to the test strategy. The indication module 703 is used to send the interface information to the test platform and control the test platform to execute the test case of the first service based on the interface information.
[0104] The above-mentioned response module 701, determination module 702 and indication module 703 can respectively execute steps 301-303 in the above-mentioned method embodiment. For the detailed introduction of these modules, please refer to the introduction of the corresponding steps of the above-mentioned method, which will not be repeated here.
[0105] The server of the embodiment of the present application can be a visual quality platform and a device capable of scripting. To execute the automated test cases of the test platform through scripts, it is necessary to develop corresponding scripts, which is relatively cumbersome. However, through the quality platform, the parameters required for the automated testing of the application can be pre-configured, and the user only needs to select through the visual quality platform. The following takes the server as the quality platform as an example.
[0106] Figure 8 is a schematic diagram of a mass platform provided in one embodiment of the present application. Figure 8 In one embodiment of the present application, the quality platform may include a message management module 801, a test plan management module 802, a scheduling platform interface 803, a report management module 804 and a message notification module 805. The message management module 801 is used to receive a message queue sent by the publishing platform, such as a kafka message. The test plan management module 802 is used to match the corresponding test plan according to the message queue. The scheduling platform interface 803 is used to connect the quality platform and the test platform so that the quality platform can interact with the test platform through the corresponding test plan interface. The report management module 804 is used to obtain the test results returned by the test platform through the scheduling platform interface 803 and generate a test report. The message notification module 805 is used to send the test report to the corresponding client according to the set message template after the test report is generated. Through the visual quality platform, the embodiment of the present application can select the corresponding service to be tested and the test method according to the demand, and can also modify the parameter information of the test at any time and execute the automated test of the application in batches. The operation process is simple and convenient, and the test process is more efficient.
[0107] Fig. 9 is a structural diagram of a mass platform provided in another embodiment of the present application. Fig. 9In another embodiment of the present application, each module of the quality platform can be further divided into units with multiple functions.
[0108] The message management module 801 may include a message consumption switch 8011, a message receiving unit 8012, a message parsing unit 8013, and a service information updating unit 8014. When the message consumption switch 8011 is turned on, and the message receiving unit 8012 receives a message of successful deployment from the publishing platform, the message parsing unit 8013 parses the message queue. If there is a service to be tested that is not configured with a corresponding test plan in the message queue, the service information is synchronously updated to the service information updating unit 8014, so that the tester can configure the test plan for the service to be tested.
[0109] The test plan management module 802 may include a test plan creation unit 8021, a test plan query unit 8022, a test plan editing unit 8023, a test plan deletion unit 8024, a test plan execution unit 8025, and a test plan execution record storage unit 8026. The test plan creation unit 8021 may pre-configure the mapping relationship between the test plan and the service to be tested. The test plan query unit 8022 may query the mapping relationship according to the received information of the service to be tested to obtain the corresponding test plan. The test plan editing unit 8023 may modify the mapping relationship between the created test plan and the service to be tested, and may also delete the corresponding test plan through the test plan deletion unit 8024. The test plan execution unit 8025 may first search whether the current service to be tested already exists in the test plan execution record storage unit 8026. If the current service to be tested already exists in the test plan execution record storage unit 8026, it means that the current service to be tested has been subjected to automated testing, and the automated testing of the current service to be tested may be skipped, thereby reducing the probability of repeated testing. If the current service to be tested does not exist in the test plan execution record storage unit 8026, it means that the current service to be tested has not been subjected to automated testing, and the automated testing of the current service to be tested can be performed through the scheduling platform interface 803, thereby reducing the probability of repeated testing. The scheduling platform interface 803 can be an ms-api-server interface.
[0110] The report management module 804 may include a report adding unit 8041 and a report query unit 8042. The test plan interface of the test platform is mainly scheduled through the scheduling platform interface 803 to obtain the test results, and the test results are parsed to generate a test report. Users can add and query reports through the report management module 804, so as to know the test results more efficiently and flexibly.
[0111] The message notification module 805 may include a new message template unit 8051, a modified message template unit 8052, a query message notification template 8053, and a delete message notification template 8054. When the test plan is executed, the test report can be added, modified, queried, and deleted according to the set message template. In this way, the test report can be sent to the corresponding client according to the demand, so as to more accurately feedback the test results and improve the user experience.
[0112] The embodiment of the present application communicates with the publishing platform and the testing platform of the application respectively through the quality platform. After the publishing platform is successfully deployed, the message queue sent by the publishing platform is parsed and intelligently matched with the corresponding test plan. After matching the test plan, the test cases corresponding to the test platform are scheduled for execution. In this way, the publishing platform can be directly connected to the testing platform. In the case where the publishing platform is a non-open source system, the automated testing of the application can also be performed through the open source testing platform, thereby improving the efficiency of the automated testing of the application.
[0113] Based on the same inventive concept, the embodiment of the present application also provides a computer device, which can be a server or a terminal device, and the computer device includes a memory and a processor, and a computer program is stored in the memory, and the processor implements the steps of the test method of the above application when executing the computer program. Thereby, various functions are realized, for example: in response to the first service corresponding to the first selection instruction, the first queue where the first service is located is determined, and the first service is any one of the multiple services to be tested of the application; the test strategy of the first queue is determined, and the interface information of the first service is determined according to the test strategy; the interface information is sent to the test platform, and the test platform is controlled to execute the test case of the first service based on the interface information.
[0114] This application selects any one of the multiple services to be tested in the application program according to the first selection instruction as the first service. Then determine the first queue where the first service is located, determine the corresponding test strategy based on the first queue, and determine the interface information of the first service based on the test strategy. Finally, send the interface information to the test platform to control the test platform to execute the test case of the first service. In this way, any one of the multiple services to be tested can be selected as the first service according to demand, and automated testing can be performed based on the test strategy of the first queue where the first service is located. There is no need to compile the test strategy for each service to be tested or combination of services to be tested in the application program in turn, thereby improving the efficiency of automated testing of the application program.
[0115] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0116] In one embodiment, the computer device is a terminal device, for example, its internal structure diagram can be as follows: Fig.10As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a testing method for an application is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.
[0117] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0118] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0119] Since the computer program stored in the computer-readable storage medium can execute the testing method of any application provided in the embodiments of the present application, the beneficial effects that can be achieved by the testing method of any application provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0120] Based on the same inventive concept, the embodiment of the present application further provides a computer program product or a computer program, which includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in various optional implementations in the above embodiments.
[0121] It should be noted that the object data (including but not limited to user device information, user personal information, etc.) and conversation data involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods.
[0122] Any reference to the memory, database or other media used in the embodiments provided in the present application may 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 memory, high-density embedded non-volatile memory, resistive random access memory (Re RAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0123] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.
[0124] In the above-mentioned application test system, server, computer-readable storage medium, computer device, and computer program product embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, reference can be made to the relevant description of other embodiments. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process and beneficial effects of the above-described application test system, server, computer-readable storage medium, computer program product, computer device, and corresponding units can refer to the description of the application test method in the above embodiment, and will not be repeated here.
[0125] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0126] The above is a detailed introduction to the testing method, testing system, server, computer device, computer-readable storage medium and computer program product of an application provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for testing an application, characterized in that: The method comprises: In response to a first service corresponding to the first selection instruction, determining a first queue where the first service is located, where the first service is any one of a plurality of services to be tested of the application program; Determining a test strategy for the first queue, and determining interface information for the first service according to the test strategy; The interface information is sent to a test platform, and the test platform is controlled to execute a test case of the first service based on the interface information.
2. The testing method according to claim 1, characterized in that: The method further comprises: Obtaining interface information of multiple services to be tested of the application program; The services to be tested having associated interface information and the same test parameters are divided into the same queue to obtain the first queue, wherein the service to be tested in the first queue is the first service; Configure a test policy corresponding to the first queue based on the test parameters, the test policy including interface information corresponding to the first service in the first queue; A mapping library is established based on a first mapping relationship between the first queue and the test strategy, and a second mapping relationship between the first service and the interface information.
3. The testing method according to claim 2, characterized in that: Before the step of providing the first service of the application corresponding to the first selection instruction in response to the first selection instruction, the method includes: In response to a second queue corresponding to a second selection instruction, determining a second service in the second queue, wherein the second queue includes at least one service to be tested of the application; Determine whether the second service exists in the mapping library; If the second service does not exist in the mapping library, adding a setting identifier to the second service and storing it in the mapping library; If the second service exists in the mapping library and does not have the setting identifier, the second service is used as the first service.
4. The testing method according to claim 1, characterized in that: The interface information includes an interface address, and the test strategy includes a calling interface corresponding to the first queue; The sending the interface information to the test platform, and controlling the test platform to execute the test case of the first service based on the interface information, includes: The interface address is sent to the test platform through the calling interface, and the test platform is instructed to call the execution interface corresponding to the interface address to execute the test case corresponding to the execution interface.
5. The testing method according to claim 1, characterized in that: The interface information includes an interface address and a test case, and the test strategy includes a calling interface corresponding to the first queue; The sending the interface information to the test platform, and controlling the test platform to execute the test case of the first service based on the interface information, includes: Determine a test case corresponding to the interface address according to the interface address; The interface address and the test case are sent to the test platform through the calling interface, and the test platform is instructed to execute the test case through the execution interface corresponding to the interface address.
6. The testing method according to any one of claims 1 to 5, characterized in that: Before the step of determining the first queue where the first service is located, the method further includes: Obtain target parameters of the first service, the target parameters including a target test environment, a target image version number, and a target service name; Determine whether the target image version number and the target service name exist in the execution record of the target test environment; If the target image version number and the target service name exist in the execution record of the target test environment, the execution of the test case of the first service is skipped.
7. A testing device for an application, characterized in that: The device comprises: a response module, configured to determine, in response to a first service corresponding to a first selection instruction, a first queue where the first service is located, wherein the first service is any one of a plurality of services to be tested of an application program; a determination module, configured to determine a test strategy for the first queue, and determine interface information for the first service according to the test strategy; The instruction module is used to send the interface information to the test platform and control the test platform to execute the test case of the first service based on the interface information.
8. A computer device, characterized in that: The system comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps of the test method for an application program as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor to execute the steps of the application program testing method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The computer program product comprises a computer program, and the computer program is used by a processor to execute the steps of the method for testing an application program according to any one of claims 1 to 6.