Test task execution method, server, medium and program product
The central server generates a parallel test plan, and the test server executes test tasks in parallel, solving the problem of low testing efficiency in the existing technology, achieving efficient and flexible test task execution, and optimizing resource utilization.
Patent Information
- Application Number
- CN202510760427.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2045-06-09
AI Technical Summary
In the prior art, product testing methods are low efficiency and cannot be applied to some test scenarios, resulting in a linear increase in testing time and low resource utilization, which increases the cost of product testing.
The central server generates a parallel test plan. The test server generates multiple test queues according to the plan, executes test tasks in parallel, and generates test results, and makes full use of server resources using multi-threaded concurrency.
Improve testing efficiency, reduce testing time, optimize resource utilization, reduce the risk of test abnormalities, and improve production efficiency.
Smart Images

Figure CN120277000A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of testing technologies, and in particular, to a method for executing test tasks, a server, a medium, and a program product. Background Art
[0002] In the process of product generation, performance testing of products is a very important link. Related testing methods usually execute in sequence based on each test task to test various capabilities of the product.
[0003] However, the above method cannot be applied to some test scenarios, resulting in low efficiency of product testing. Summary of the Invention
[0004] This application provides a method for executing test tasks, a server, a medium, and a program product to at least solve the problem of low testing efficiency of related testing methods in related technologies.
[0005] This application provides a method for executing test tasks, including:
[0006] Obtaining a parallel test plan from a central server; wherein, the parallel test plan includes groupings of multiple test tasks and the execution order of test tasks in each grouping, and the test types of test tasks in each grouping are the same;
[0007] Generating a plurality of first test queues based on the parallel test plan, and sequentially writing the test tasks of each grouping into the corresponding first test queue;
[0008] Executing the test tasks in each first test queue in parallel, and generating first test results of each test task when all test tasks are completed;
[0009] Sending the first test results to the central server.
[0010] This application also provides a method for executing test tasks, including:
[0011] Receiving at least one test task and first test information of each test task; wherein, the first test information includes an estimated test duration, a test type, and a weight;
[0012] Generating a parallel test plan based on the first test information of each test task; wherein, the parallel test plan is used to indicate groupings of multiple test tasks and the execution order of test tasks in each grouping, and the test types of test tasks in each grouping are the same.
[0013] This application also provides a method for executing test tasks, including:
[0014] The central server receives at least one test task and the first test information of each test task; wherein, the first test information includes the estimated test duration, test type and weight;
[0015] The central server generates a parallel test plan based on the first test information of each test task; the parallel test plan includes the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same;
[0016] The central server sends the parallel test plan to the test server;
[0017] The test server generates multiple first test queues based on the parallel test plan, and writes the test tasks of each group into the corresponding first test queue in sequence;
[0018] The test server executes the test tasks in each first test queue in parallel, and generates the first test results of each test task when all the test tasks are completed;
[0019] The test server sends the first test results to the central server.
[0020] This application also provides an execution device for test tasks, including:
[0021] A first acquisition module, configured to acquire a parallel test plan from the central server; wherein, the parallel test plan includes the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same;
[0022] A first generation module, configured to generate multiple first test queues based on the parallel test plan, and write the test tasks of each group into the corresponding first test queue in sequence;
[0023] A first execution module, configured to execute the test tasks in each first test queue in parallel, and generate the first test results of each test task when all the test tasks are completed;
[0024] A first sending module, configured to send the first test results to the central server.
[0025] This application also provides an execution device for test tasks, including:
[0026] A receiving module, configured to receive at least one test task and the first test information of each test task; wherein, the first test information includes the estimated test duration, test type and weight;
[0027] A second generation module, configured to generate a parallel test plan based on the first test information of each test task; wherein, the parallel test plan is used to indicate the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same.
[0028] The present application further provides a server, including: a memory, configured to store a computer program; a processor, configured to implement the steps of any one of the above-mentioned test task execution methods when executing the computer program.
[0029] The present application further provides a computer-readable storage medium, in which a computer program is stored, and wherein the computer program implements the steps of any one of the above-mentioned test task execution methods when executed by a processor.
[0030] The present application further provides a computer program product, including a computer program, and the computer program implements the steps of any one of the above-mentioned test task execution methods when executed by a processor.
[0031] Through the present application, since the test server can generate multiple test queues according to the parallel test plan generated by the central server, execute the test tasks in each test queue in parallel, and generate corresponding test results, it is possible to solve the technical problem of low test efficiency of related test methods, achieve the technical effect of executing test tasks in parallel and efficiently, and improve test efficiency. Description of the Drawings
[0032] To more clearly illustrate the embodiments of the present application, the following will briefly introduce the drawings required in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0033] Figure 1 It is a schematic application diagram of a related test method;
[0034] Figure 2 It is a schematic structural diagram of an execution system for a test task provided by an embodiment of the present application;
[0035] Figure 3 It is a schematic flow diagram of a method for executing a test task provided by an embodiment of the present application;
[0036] Figure 4 It is a schematic interaction diagram of a method for executing a test task provided by an embodiment of the present application;
[0037] Figure 5 It is a schematic flow diagram of another method for executing a test task provided by an embodiment of the present application;
[0038] Figure 6 One of the application schematic diagrams of the execution method of the test task provided by the embodiment of the present application;
[0039] Figure 7 Another application schematic diagram of the execution method of the test task provided by the embodiment of the present application;
[0040] Figure 8 Flow schematic diagram of another execution method of the test task provided by the embodiment of the present application;
[0041] Figure 9 Structural schematic diagram of an execution device of a test task provided by the embodiment of the present application;
[0042] Figure 10 Structural schematic diagram of another execution device of a test task provided by the embodiment of the present application;
[0043] Figure 11 Structural schematic diagram of a server provided by the embodiment of the present application. Detailed implementation manners
[0044] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present application.
[0045] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0046] Functional Circuit Test (FCT) is a test method that can provide a simulated operating environment for the Unit Under Test (UUT), and by applying incentives and loads, enable the UUT to work in diverse design states, and collect various state parameters to verify its functional integrity.
[0047] Artificial Intelligence (AI) refers to a new technology science that studies and develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence.
[0048] The Central Processing Unit (CPU) is the computing and control core of a computer system and the final execution unit for information processing and program running.
[0049] Transmission Control Protocol / Internet Protocol (TCP / IP) refers to a protocol suite that enables information transmission between multiple different networks.
[0050] In the process of product production (such as server production), performance testing of products based on functional testing FCT is a very important link. The more functions a product has, the more tasks there are for functional testing, which makes the time-consuming of product functional testing longer, affecting the production cost and efficiency of the product.
[0051] Related testing methods usually execute in sequence based on the order of each test task to test the various capabilities of the product.
[0052] However, the above method is not applicable to some test scenarios, resulting in low efficiency of product testing. Figure 1 An application schematic diagram of related testing methods is provided by way of example.
[0053] See Figure 1 , when the product to be tested includes 9 test tasks such as P0 to P8 shown in 101, the related testing method can sequentially execute each test task in series according to the order of each test task, such as first executing P0 and then sequentially executing P1, P2, P4... P8 as shown in 102.
[0054] In this way, the total testing duration of the above testing method is the sum of the durations of each test task. When the number of test tasks increases, the total testing duration shows a linear growth trend, with low resource utilization, increasing the cost of product testing and affecting testing efficiency.
[0055] To address the above problems, the embodiments of the present application provide a method for executing test tasks, a server, a medium, and a program product. The test server generates multiple test queues according to a parallel test scheme generated by the central server, parallelly executes multiple test tasks in each test queue, and generates corresponding test results, realizing parallel and efficient execution of test tasks and improving testing efficiency.
[0056] To enable those skilled in the art of this technology to better understand the solution of this application, the following further detailed description of this application will be given in conjunction with the accompanying drawings and specific embodiments.
[0057] In combination with the specific application environment architecture or specific hardware architecture on which the execution of the execution method of the test task depends, the specific application environment architecture or specific hardware architecture will be described herein. Figure 2 It is a schematic structural diagram of the execution system for the test task.
[0058] See Figure 2 , the execution system 200 of the test task includes a central server 201 and at least one test server ( Figure 2 only 2 are shown in the figure, including a test server 2011 and a test server 2012), and the central server 201 is communicatively connected to each test server.
[0059] Among them, the central server 201 is used to receive at least one test task and the first test information of each test task, and generate a parallel test plan based on the first test information of each test task. The test server is used to obtain the parallel test plan from the central server 201, generate a plurality of first test queues based on the parallel test plan, write the test tasks of each group into the corresponding first test queue in sequence, execute the test tasks in each first test queue in parallel, and generate the first test results of each test task when each test task is executed, and send the first test results to the central server 201.
[0060] Figure 3 It is a schematic flowchart of an execution method of a test task provided by an embodiment of this application. As Figure 3 shown, the embodiment of this application provides an execution method of a test task, and a detailed description of the method is as follows:
[0061] S301: Obtain a parallel test plan from the central server; wherein, the parallel test plan includes the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same.
[0062] Optionally, the execution method of the test task provided in this embodiment can be applied to a test server.
[0063] Optionally, the test server obtains a parallel test plan from the central server. The parallel test plan includes multiple groups, each group includes multiple test tasks and the execution order of the test tasks, and the test types of the multiple test tasks in each group are the same. The central server is used to instruct a device (such as a server) for determining the parallel test plan according to the test task. The test server is used to instruct another device (such as another server) for executing the test tasks in parallel according to the parallel test plan.
[0064] Among them, the test type is determined based on the correlation coefficient between test tasks. Exemplarily, when the correlation coefficient between the first test task and the second test task is greater than the fourth threshold, it is determined that the correlation between the first test task and the second test task is strong, and according to the execution order, it can be determined that after the first test task is completed, the second test task must be executed. Therefore, it is determined that the types of the first test task and the second test task are the same. Also exemplarily, when the correlation coefficient among the first test task, the second test task, and the third test task is less than the fourth threshold, it is determined that the correlation among the first test task, the second test task, and the third test task is weak, and there is no necessary connection in the execution order among the first test task, the second test task, and the third test task. Then it is determined that the types of the first test task, the second test task, and the third test task are different. At this time, the first test task and the second test task are divided into test tasks within one group, and the third test task is divided into test tasks within one group. Among them, the fourth threshold can be specifically set according to the actual situation. For example, the fourth threshold is 0.7, or the fourth threshold is 0.75.
[0065] S302: Generate a plurality of first test queues based on the parallel test scheme, and sequentially write the test tasks of each group into the corresponding first test queue.
[0066] Optionally, generate a corresponding plurality of first test queues based on the number of groups in the parallel test scheme, with one test queue corresponding to one group, and sequentially write the multiple test tasks in each group into the corresponding first test queue.
[0067] S303: Execute the test tasks in each first test queue in parallel, and generate the first test results of each test task when all the test tasks are completed.
[0068] S304: Send the first test results to the central server.
[0069] Optionally, the test server starts the test tasks in each first test queue in parallel, where the test tasks in each first test queue are executed sequentially according to the execution order of the test tasks, and the first test results of each test task are generated when all the test tasks in each test queue are completed.
[0070] The embodiment of the present application can implement the parallel execution of test tasks through a multi-threaded concurrent manner, make full use of the computing power resources of the server, reduce the computing power cost, and improve the test efficiency.
[0071] Optionally, generating a plurality of first test queues based on the parallel test scheme and sequentially writing the test tasks of each group into the corresponding first test queue includes:
[0072] Generate a corresponding first test queue based on the number of groups in the parallel test scenario;
[0073] Based on the execution order of each test task in each group, write multiple test tasks in each group into the corresponding first test queue in sequence.
[0074] Optionally, determine the number of groups in the parallel test scenario, generate a first test queue corresponding to the number of groups, with one test queue corresponding to one group. Based on the execution order of each test task in each group, write multiple test tasks in each group into the corresponding first test queue in sequence.
[0075] Optionally, after writing multiple test tasks in each group into the corresponding first test queue based on the execution order of each test task in each group, further include:
[0076] Obtain the first utilization rate of the processor and the second utilization rate of the memory;
[0077] Determine the comprehensive utilization rate based on the first utilization rate and the second utilization rate;
[0078] When the comprehensive utilization rate is greater than the first threshold, delete the first number of first test queues, and determine each test task corresponding to the deleted first test queues as the first candidate test tasks;
[0079] When the test tasks in each first test queue are completed, execute the first candidate test tasks based on each first test queue;
[0080] Optionally, obtain the first utilization rate of the processor (such as the central processing unit CPU) and the second utilization rate of the memory in the test server. Among them, the first utilization rate is the difference between 1 and the ratio of the free space to the total space of the processor, and the second utilization rate is the difference between 1 and the ratio of the free space to the total space of the memory.
[0081] Optionally, determine the comprehensive utilization rate based on the first utilization rate and the second utilization rate. When the comprehensive utilization rate is greater than the first threshold, determine that the utilization rates of the processor and the memory are too high, affecting the performance of the test server, delete the first number of first test queues to reduce the number of concurrent processes in the test server, and determine each test task included in the deleted first number of first test queues as the first candidate test tasks. When the test tasks in each first test queue are completed, execute the first candidate test tasks through each first test queue.
[0082] Among them, the first threshold can be specifically set according to the actual situation. For example, the first threshold is 70%, or the first threshold is 80%.
[0083] Exemplarily, the first threshold can be determined according to the size of the comprehensive utilization rate. The first threshold is in a direct proportional relationship with the comprehensive utilization rate. When the comprehensive utilization rate is greater than the first threshold, the greater the comprehensive utilization rate, the greater the first threshold.
[0084] It can be understood that when the first candidate test task is executed through the first test queue, the first test queue is still allocated based on the group to which the first candidate test task belongs. The first test queue corresponds one-to-one with the group to which the first candidate test task belongs, and the first candidate test tasks of each group are sequentially written into the first test queue, and the first candidate test tasks in each first test queue are started in parallel. The first candidate test tasks in each first test queue are executed in the execution order of each first candidate test task in the group.
[0085] For example, the number of the first test queues is 6, namely queue one, queue two... queue six. When the comprehensive utilization rate is greater than the first threshold, it is determined to delete 2 test queues (such as queue five and queue six), and the test tasks in queue five and queue six are determined as the first candidate test tasks. The test tasks in queue one to queue four are executed in parallel. When the test tasks in queue one to queue four are all executed, the first candidate test tasks in the group corresponding to queue five are allocated to queue one, and the first candidate test tasks in the group corresponding to queue six are allocated to queue two. The first candidate test tasks in queue one and queue two are executed in parallel until the first candidate test tasks in each queue are all executed, and the first test results corresponding to the test tasks in queue one to queue four and the first candidate test tasks in queue one to queue two are generated.
[0086] Exemplarily, the comprehensive utilization rate can be the maximum value of the first utilization rate and the second utilization rate. Additionally exemplarily, the comprehensive utilization rate can be the average value of the first utilization rate and the second utilization rate.
[0087] Optionally, when the comprehensive utilization rate is less than the second threshold, a second number of second test queues are generated; wherein, the first threshold is greater than the second threshold;
[0088] At least one second candidate test task is selected from each first test queue, and each second candidate test task is executed based on each second test queue; wherein, the correlation coefficient between the second candidate test task and the test tasks in each first test queue is less than the third threshold.
[0089] Optionally, when the comprehensive utilization rate is less than the second threshold, it is determined that the resource utilization rate of the test server is low, and a second number of test queues are generated. Among them, the first threshold is greater than the second threshold, and the second threshold can be specifically set according to the actual situation. For example, the second threshold is 50% or 40%. The second number can be specifically set according to the actual situation. For example, the second number is 2, or the second number is 3.
[0090] Exemplarily, the second threshold can be determined according to the magnitude of the comprehensive utilization rate. The first threshold is inversely proportional to the comprehensive utilization rate. When the comprehensive utilization rate is less than the second threshold, the smaller the comprehensive utilization rate, the larger the second threshold.
[0091] Optionally, in the first test queue, determine the correlation coefficient between each test task and other test tasks (test tasks other than the current test task), select at least one test task whose correlation coefficient with other test tasks is less than a third threshold, and determine it as the second candidate test task. Among them, the third threshold is greater than the fourth threshold. For example, when the fourth threshold is 0.7, the third threshold is 0.75; when the fourth threshold is 0.75, the third threshold is 0.8.
[0092] In the embodiment of the present application, the comprehensive utilization rate is determined by querying the actual utilization rates of the processor and memory of the test server in real time. When the comprehensive utilization rate is greater than the first threshold, the number of concurrently executed processes in the test server is reduced (that is, the first number of the first test queues is deleted). When the comprehensive utilization rate is less than the second threshold, the number of concurrently executed processes in the test server is increased (that is, the second number of the second test queues is generated), so as to improve the utilization rate of resources in the test server and reduce the problems of test server crash or test exception caused by overloading, thereby improving the test efficiency.
[0093] Taking the comprehensive utilization rate as the maximum value of the first utilization rate and the second utilization rate as an example, the comprehensive utilization rate can be expressed by the following formula:
[0094] ;
[0095] Among them, represents the first utilization rate, represents the second utilization rate, represents the free space of the processor, represents the total space of the processor, represents the free space of the memory, represents the total space of the memory.
[0096] Based on the actual usage status of the test server, the number of concurrently executed processes is dynamically adjusted, and the concurrent execution method is continuously optimized, making full use of the performance of the server and improving the test efficiency.
[0097] Optionally, after sending the first test result to the central server, it further includes:
[0098] When a new test plan is detected in the central server, obtain the new test plan from the central server; wherein, the new test plan includes at least one second group, the second group includes at least one task to be tested, the test types of the tasks to be tested in the second group are the same, and the tasks to be tested include test tasks and / or new test tasks;
[0099] When the task to be tested is a new test task, generate at least one third test queue based on the new test plan, and write the new test tasks of each second group into the corresponding third test queue in sequence;
[0100] Execute the new test tasks in each third test queue in parallel;
[0101] When all the new test tasks are executed, feedback the second test results of all the new test tasks to the central server.
[0102] Optionally, when a new test plan is detected in the central server, obtain the new test plan from the central server. The new test plan includes at least one second group, the second group includes at least one task to be tested, the test types of the tasks to be tested in the second group are the same, and the tasks to be tested include test tasks and / or new test tasks. When the task to be tested is a new test task, generate the corresponding number of third test queues based on the number of second groups in the new test plan, and write the new test tasks of each second group into the corresponding third test queue in sequence. Execute the new test tasks in each third test queue in parallel. When all the new test tasks are executed, feedback the second test results of all the new test tasks to the central server.
[0103] Optionally, when the task to be tested is a test task, store the new test plan.
[0104] Figure 4 It is an interaction schematic diagram of an execution system for test tasks provided by an embodiment of the present application.
[0105] See Figure 4 , the test server is used to test the product to be tested based on the task to be tested. The central server includes a processor 2 and a display screen. The processor 2 is used to generate and update a parallel test plan according to the test information of the test task, and the display screen is used to display the test results. The interaction process is as follows:
[0106] 400. Receive at least one test task and the first test information of each test task, and generate a parallel test plan.
[0107] Optionally, the processor 2 of the central server receives at least one test task sent by the user through the user terminal or input by the user through an external input device, and the test information of each test task, and generates a parallel test plan based on the above test tasks and test information.
[0108] Optionally, the central server establishes a TCP / IP connection with the test server and generates a unique test task ID for each test task, facilitating identification by the test server and the display screen.
[0109] 401. Send initialization display information.
[0110] Optionally, the processor 2 sends initialization display information to the display screen to initialize the display content of the display screen.
[0111] 402. Send initialization results.
[0112] Optionally, when the initialization is completed, the display screen of the central server sends the initialization results to the test server.
[0113] 403. Obtain product configuration information and parse it.
[0114] Optionally, the test server identifies the product to be tested, obtains the product configuration information of the product to be tested, and parses it to obtain product configuration parameters.
[0115] 404. Obtain a parallel test plan.
[0116] Optionally, the test server obtains the parallel plan from the processor 2 of the central server.
[0117] 405. Parse the parallel test plan to obtain the grouping of multiple test tasks and the execution order of the test tasks in each grouping.
[0118] Optionally, the test server parses the parallel test plan to obtain multiple groupings in the parallel test plan, each grouping includes multiple test tasks, and the execution order of the test tasks in each grouping.
[0119] Optionally, the parallel test plan further includes a unique test task ID for the test task.
[0120] 406. Generate multiple first test queues based on the parallel test plan, and write the test tasks of each grouping into the corresponding first test queue in sequence.
[0121] Optionally, the test server generates multiple first test queues according to the number of groupings in the parallel test plan. The first test queues correspond to the groupings one by one, and writes the test tasks in each grouping into the corresponding first test queue in sequence.
[0122] Optionally, the test server can determine the first usage rate of its processor and the second usage rate of the memory in real time, and modify the parallel test process according to the comprehensive usage rate.
[0123] Exemplarily, when the comprehensive utilization rate is too high, such as when the comprehensive utilization rate is greater than the fifth threshold, it is determined that the test server cannot execute the test task, and the status of the test server is updated to the waiting state. After the comprehensive utilization rate of the test server is lower than the fifth threshold or the third threshold, the test task is started to be executed. Among them, the fifth threshold is greater than the first threshold. For example, when the fifth threshold is 95%, or when the fifth threshold is 98%,
[0124] 407. Execute the test tasks in each first test queue in parallel.
[0125] Optionally, the test server executes the test tasks in each first test queue in parallel to test the product under test.
[0126] 408. Obtain the test data corresponding to each test task.
[0127] Optionally, the test server obtains the test data corresponding to each test task based on the product under test.
[0128] Optionally, the test server can send data such as the execution status and progress information of each test task to the central server in real time, so that the central server can display it through the display screen, enabling the user to obtain the test situation of each product under test in real time.
[0129] Optionally, one test server can be used to test one product under test or to test multiple products under test simultaneously.
[0130] 409. Whether each test task is completed.
[0131] Optionally, the test server determines whether each test task is completed. When it is determined that each test task is completed, step 410 is executed. When each test task is not completed, the process returns to execute step 404 and subsequent steps.
[0132] 410. Generate and send each first test result.
[0133] Optionally, when it is determined that each test task is completed, the first test results corresponding to each test task are generated and sent to the processor 2 of the central server.
[0134] Optionally, when the test server sends data related to the test task to the central server, it carries the unique test task ID of the test task for easy identification by the central server.
[0135] 411. Send the first test result.
[0136] Optionally, the processor 2 of the central server sends the first test result to the display screen.
[0137] 412. Display the first test result.
[0138] Optionally, the display screen displays the first test result.
[0139] 413. Update the parallel test plan based on the first test results of each test task to obtain a first test plan.
[0140] 414. Send the first test plan.
[0141] Optionally, the processor 2 of the central server updates the parallel test plan based on the first test results of each test task to obtain a first test plan, and sends the first test plan to the test server.
[0142] Optionally, the processor 2 of the central server can recalculate the test duration of each test task according to the start test time and end test time of each test task, and update the parallel test plan.
[0143] Exemplarily, the product to be tested may include, but is not limited to, a server motherboard, a server circuit board, a vehicle circuit board, etc.
[0144] Figure 5 It is a schematic flowchart of another method for executing a test task provided by an embodiment of the present application. As Figure 5 shown, an embodiment of the present application provides a method for executing a test task, and the method is described in detail as follows:
[0145] S501: Receive at least one test task and the first test information of each test task; wherein, the first test information includes an estimated test duration, a test type, and a weight.
[0146] S502: Generate a parallel test plan based on the first test information of each test task; wherein, the parallel test plan is used to indicate the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same.
[0147] Optionally, the method for executing a test task provided in this embodiment can be applied to a central server.
[0148] Optionally, the central server receives at least one test task and the first test information of each test task. The first test information includes, but is not limited to, an estimated test duration, a test type, and a weight. The estimated test duration is used to indicate the estimated execution duration before the test task is executed. The test type may include a correlation coefficient used to indicate the correlation between the test task and other test tasks. The weight can be used to indicate the importance of the test task, and the weight of the test task is positively correlated with the importance.
[0149] Optionally, based on information such as the estimated test duration, test type, and weight of each test task, the central server determines the grouping of each test task and the execution order in each group, and generates a corresponding parallel test plan.
[0150] Optionally, when the central server finishes starting up, it obtains the information of each test task, generates a corresponding parallel test plan, and sends the parallel test plan to the test server. When receiving the test results sent by the test server, it displays the test results of each test task through the display screen.
[0151] Optionally, based on the first test information of each test task, a parallel test plan is generated, including:
[0152] Group each test task based on the test type of each test task to obtain at least one candidate grouping plan; where the candidate grouping plan includes multiple groups and at least one test task in each group;
[0153] Under each candidate grouping plan, based on the estimated test duration and weight of each test task in each group, calculate the running time of each group;
[0154] Based on the running time of each group under each candidate grouping plan, calculate the total running time of each candidate grouping plan;
[0155] Among each candidate grouping plan, determine the candidate grouping plan with the minimum total running time as the parallel test plan.
[0156] Optionally, group each test task based on the test type of each test task to obtain at least one candidate grouping plan, and each candidate grouping plan includes multiple groups and at least one test task in each group. For each candidate grouping plan, based on the estimated test duration and weight of each test task in each group, calculate the running time of each group in each candidate grouping plan, and then calculate the sum of the running durations of each group in each candidate grouping plan as the total running time of each candidate grouping plan, and determine the candidate grouping plan with the minimum total running time as the parallel test plan.
[0157] Exemplarily, based on the test tasks, 4 candidate grouping schemes are generated. The first candidate grouping scheme includes 5 groups, the second candidate grouping scheme includes 3 groups, the third candidate grouping scheme includes 4 groups, and the fourth candidate grouping scheme includes 3 groups. First, calculate the estimated test duration of the test tasks in each group of the first candidate grouping scheme, calculate the running time of each group, and then calculate the sum of the running times of each group as the first total running duration of the first candidate grouping scheme, and so on to obtain the second total running duration of the second candidate grouping scheme, the third total running duration of the third candidate grouping scheme, and the fourth total running duration of the fourth candidate grouping scheme. From the above first total running duration, second total running duration, third total running duration, and fourth total running duration, select the candidate grouping scheme corresponding to the smallest total running duration value and determine it as the parallel test scheme.
[0158] Optionally, after generating the parallel test scheme based on the first test information of each test task, it further includes:
[0159] When receiving the test result, determine the test task corresponding to the test result; the test result includes the test task ID, start test time, and test end time;
[0160] Based on the start test time and test end time of the test task corresponding to the test result, determine the actual test duration of the test task corresponding to the test result;
[0161] Based on the actual test duration, test type, and weight of each test task, update the parallel test scheme to obtain the first test scheme;
[0162] When detecting that the first test information of at least one test task has changed, based on the new first test information of the test task, update the parallel test scheme to obtain the second test scheme.
[0163] Optionally, when receiving the test result sent by the test server, determine the test task corresponding to the test result. The test result includes the test task ID, start test time of the test task, and test end time of the test task. Calculate the difference between the start test time and test end time of the test task corresponding to the test result as the actual test duration of the test task corresponding to the test result, and update the parallel test scheme according to the actual test duration, test type, and weight of each test task to obtain the first test scheme.
[0164] Optionally, when detecting that the first test information of one or more test tasks has changed, update the parallel test scheme based on the new first test information of the test task to obtain the second test scheme.
[0165] Optionally, when receiving at least one new test task, determine the second test information of each new test task;
[0166] Update the parallel test plan based on the second test information of each new test task to obtain a third test plan.
[0167] Optionally, when receiving at least one new test task, determine the second test information of each new test task, and update the parallel test plan to obtain a third test plan. The second test information includes the second estimated test duration, the second weight, and the second test type of the new test task.
[0168] Figure 6 One of the application schematic diagrams of a method for executing a test task provided by an embodiment of the present application;
[0169] Still taking the test tasks P0 to P8 shown in Figure 1 as an example. As shown in Figure 6 601, when the central server directly groups based on the execution order of the test tasks to obtain a grouping result, the test server generates corresponding test queues as queues 6011 to 601n based on the grouping result. The test server writes the test tasks of each group into the corresponding queues in sequence and executes the test tasks in queues 6011 to 601n in parallel. At this time, the test efficiency has been improved to a certain extent.
[0170] When the central server groups based on the correlation indicated by the test type in each test task, generates multiple partitions and each group includes multiple test tasks, and obtains a corresponding parallel test plan, the test server generates corresponding test queues as queues 6021 to 602n shown in 602 based on the parallel test plan. The test server writes the test tasks of each group into the corresponding test queues in sequence and executes the test tasks in queues 6021 to 602n in parallel. By comparison, it can be seen that the total execution duration of the test tasks in the test queue shown in 601 is greater than the total execution duration of the test tasks in the test queue shown in 602.
[0171] Figure 7 Another application schematic diagram of a method for executing a test task provided by an embodiment of the present application.
[0172] On the basis of the test queues shown in Figure 6 602 and each test task (i.e., the parallel test plan), when the test server sends the parallel test results to the central server, and the central server updates the parallel test plan based on the test results to obtain a new first test plan, the test server generates corresponding test queues as queues 7011 to 701n shown in Figure 7 . The test server writes the test tasks of each group into the corresponding queues in sequence and executes the test tasks in queues 7011 to 701n in parallel. By comparison, it can be seen that, asFigure 7 The total execution duration of the test tasks in the shown test queue is less than that of Figure 6 the total execution duration of the test tasks in the test queue shown in 602 in
[0173] Optionally, the central server can, based on information such as the actual running duration of the test tasks, the total running duration of the parallel test scheme, and the weights, adjust the number of groups in the parallel test scheme and the test tasks in each group multiple times until a parallel test scheme with the minimum total running duration is determined.
[0174] Exemplarily, the average running time of a group can be expressed by the following formula:
[0175] ;
[0176] where n represents the number of test tasks in n groups, represents the i-th test task in the n groups, represents the weight of the i-th test task in the n groups.
[0177] Optionally, since there are strong correlation relationships (or called dependency relationships) between some test tasks, that is, some test tasks cannot be executed simultaneously and must wait for one task to finish before the next task can be executed. Therefore, when the central server groups based on the test information of each test task, it can generate multiple candidate grouping schemes according to the correlation coefficient between the test tasks, and determine the candidate grouping scheme with the minimum total running duration in each candidate grouping scheme as the parallel test scheme.
[0178] Exemplarily, the central server determines the candidate grouping scheme with the minimum total average running time of the groups as the parallel test scheme, as shown in the following formula:
[0179] ;
[0180] where the candidate grouping scheme includes m groups and n groups. The M group includes m test tasks, and the n group includes n test tasks, represents the j-th test task in the n groups, represents the weight of the j-th test task in the n groups.
[0181] Optionally, the central server includes a display screen, and the display screen is used to display the test information and test results of each test task to display the execution status and test results of the test tasks in real time.
[0182] In the embodiment of the present application, by dynamically adjusting the parallel test scheme of the test tasks by the central server, the flexibility and test efficiency of the parallel test are improved.
[0183] Figure 8The flowchart of another method for executing a test task provided by an embodiment of the present application is shown as follows Figure 8 As shown, an embodiment of the present application provides another method for executing a test task, and the method will be described in detail as follows:
[0184] S801: The central server receives at least one test task and the first test information of each test task; wherein, the first test information includes an estimated test duration, a test type, and a weight.
[0185] S802: The central server generates a parallel test plan based on the first test information of each test task; the parallel test plan includes the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same.
[0186] S803: The central server sends the parallel test plan to the test server.
[0187] S804: The test server generates multiple first test queues based on the parallel test plan, and writes the test tasks of each group into the corresponding first test queue in sequence.
[0188] S805: The test server executes the test tasks in each first test queue in parallel, and generates the first test result of each test task when all the test tasks are executed.
[0189] S806: The test server sends the first test result to the central server.
[0190] Optionally, the central server generates a parallel test plan based on the first test information of each test task, and sends the parallel test plan to the test server. The test server generates corresponding first test queues based on the number of groups in the parallel test plan, writes the test tasks of each group into the corresponding first test queue in sequence, executes the test tasks in each first test queue in parallel, generates the first test result of each test task when all the test tasks are executed, and then sends the first test result to the central server. For specific implementation details, reference can be made to the relevant descriptions in the above embodiments, which will not be elaborated here.
[0191] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.
[0192] Figure 9 The structural schematic diagram of an apparatus for executing a test task provided by an embodiment of the present application is shown as follows. Figure 9 As shown, an embodiment of the present application further provides an apparatus for executing a test task, including:
[0193] The first acquisition module 901 is configured to acquire a parallel test plan from a central server; wherein, the parallel test plan includes the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same;
[0194] The first generation module 902 is configured to generate a plurality of first test queues based on the parallel test plan, and write the test tasks of each group into the corresponding first test queue in sequence;
[0195] The first execution module 903 is configured to execute the test tasks in each first test queue in parallel, and generate first test results of each test task when all the test tasks are executed;
[0196] The first sending module 904 is configured to send the first test results to the central server.
[0197] Optionally, the first generation module includes:
[0198] The first generation unit is configured to generate corresponding first test queues based on the number of groups in the parallel test plan;
[0199] The first writing unit is configured to write the multiple test tasks in each group into the corresponding first test queue in sequence based on the execution order of the test tasks in each group.
[0200] Optionally, the first generation module further includes:
[0201] The first acquisition unit is configured to acquire the first utilization rate of the processor and the second utilization rate of the memory;
[0202] The first determination unit is configured to determine a comprehensive utilization rate based on the first utilization rate and the second utilization rate;
[0203] The second determination unit is configured to delete the first number of first test queues when the comprehensive utilization rate is greater than the first threshold, and determine the test tasks corresponding to the deleted first test queues as the first candidate test tasks;
[0204] The first execution unit is configured to execute the first candidate test tasks based on each first test queue when the test tasks in each first test queue are executed;
[0205] Or,
[0206] The second generation unit is configured to generate the second number of second test queues when the comprehensive utilization rate is less than the second threshold; wherein, the first threshold is greater than the second threshold;
[0207] A second execution unit, configured to select at least one second candidate test task from each first test queue and execute each second candidate test task based on each second test queue; wherein, the correlation coefficient between the second candidate test task and the test tasks in each first test queue is less than a third threshold.
[0208] Optionally, the execution device for test tasks further includes:
[0209] A second acquisition module, configured to acquire a new test plan from the central server when it is detected that there is a new test plan in the central server; wherein, the new test plan includes at least one second group, the second group includes at least one test task to be measured, the test types of the test tasks to be measured in the second group are the same, and the test tasks to be measured include test tasks and / or new test tasks;
[0210] A third generation module, configured to generate at least one third test queue based on the new test plan when the test task to be measured is a new test task, and write the new test tasks of each second group into the corresponding third test queue in sequence;
[0211] A second execution module, configured to execute each new test task in each third test queue in parallel;
[0212] A second sending module, configured to feedback the second test results of each new test task to the central server when all the new test tasks are executed.
[0213] For the description of the features in the embodiments corresponding to the execution device of test tasks, reference can be made to the relevant descriptions in the embodiments corresponding to the execution method of test tasks, which will not be elaborated here one by one.
[0214] Figure 10 This is a schematic structural diagram of another execution device for test tasks provided by the embodiments of the present application. As Figure 10 shown, the embodiments of the present application further provide an execution device for test tasks, including:
[0215] A receiving module 1001, configured to receive at least one test task and the first test information of each test task; wherein, the first test information includes an estimated test duration, a test type, and a weight;
[0216] A second generation module 1002, configured to generate a parallel test plan based on the first test information of each test task; wherein, the parallel test plan is used to indicate the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same.
[0217] Optionally, the second generation module includes:
[0218] A grouping unit for grouping each test task based on the test type of each test task to obtain at least one candidate grouping scheme; wherein, the candidate grouping scheme includes multiple groups and at least one test task in each group;
[0219] A first calculation unit for calculating the running time of each group based on the estimated test duration and weight of each test task in each group under each candidate grouping scheme;
[0220] A second calculation unit for calculating the total running time of each candidate grouping scheme based on the running time of each group under each candidate grouping scheme;
[0221] A third determination unit for determining, among each candidate grouping scheme, the candidate grouping scheme with the minimum total running time as the parallel test scheme.
[0222] Optionally, the execution device of the test task further includes:
[0223] A first determination module for determining the test task corresponding to the test result when receiving the test result; the test result includes the test task ID, the start test time, and the end test time;
[0224] A second determination module for determining the actual test duration of the test task corresponding to the test result based on the start test time and the end test time of the test task corresponding to the test result;
[0225] A first update module for updating the parallel test scheme based on the actual test duration, test type, and weight of each test task to obtain a first test scheme;
[0226] A second update module for updating the parallel test scheme based on the new first test information of the test task when detecting that the first test information of at least one test task has changed to obtain a second test scheme;
[0227] And / or,
[0228] A third determination module for determining the second test information of each new test task when receiving at least one new test task;
[0229] A third update module for updating the parallel test scheme based on the second test information of each new test task to obtain a third test scheme.
[0230] For the description of the features in the embodiments corresponding to the execution device of the test task, reference may be made to the relevant descriptions in the embodiments corresponding to the execution method of the test task, which will not be elaborated here one by one.
[0231] Figure 11 This is a schematic structural diagram of the server provided by the present application. As Figure 11As shown in the figure, the server provided in this embodiment includes at least one processor 1101 and a memory 1102. Optionally, the server further includes a communication component 1103. Among them, the processor 1101, the memory 1102, and the communication component 1103 are connected by a bus.
[0232] In the specific implementation process, at least one processor 1101 executes the computer-executable instructions stored in the memory 1102, so that at least one processor 1101 executes the execution method embodiment of the above test task.
[0233] For the specific implementation process of the processor 1101, reference can be made to the above method embodiment, and its implementation principle and technical effect are similar, so they will not be elaborated here in this embodiment.
[0234] In the above embodiment, it should be understood that the processor may be a central processing unit (Central Processing Unit, abbreviated as: CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, abbreviated as: DSP), application-specific integrated circuits (Application Specific Integrated Circuit, abbreviated as: ASIC), etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the application can be directly embodied as being executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.
[0235] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0236] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.
[0237] The embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored, and the computer program is set to execute the steps in any one of the above execution method embodiments of the test task when running.
[0238] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as USB flash drives, read-only memory (ROM for short), random access memory (RAM for short), external hard drives, magnetic disks, or optical discs that can store computer programs.
[0239] An embodiment of the present application also provides a computer program product. The above computer program product includes a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above embodiments of the execution method of the test task.
[0240] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements the steps in any of the above embodiments of the execution method of the test task.
[0241] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals 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 this application.
[0242] The above has introduced in detail a method for executing a test task, a server, a medium, and a program product provided by this application. Specific examples are used herein to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A method for executing a test task, characterized in that including: obtaining a parallel test plan from a central server; wherein, the parallel test plan includes the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same; generating multiple first test queues based on the parallel test plan, and sequentially writing the test tasks of each group into the corresponding first test queue; executing the test tasks in each of the first test queues in parallel, and generating first test results of each of the test tasks when each of the test tasks is completed; sending the first test results to the central server.
2. The method for executing a test task according to claim 1, wherein The generating multiple first test queues based on the parallel test plan and sequentially writing the test tasks of each group into the corresponding first test queue includes: generating corresponding first test queues based on the number of groups in the parallel test plan; sequentially writing multiple test tasks in each group into the corresponding first test queue based on the execution order of each test task in each group.
3. The method for executing the test task according to claim 2, wherein, After sequentially writing multiple test tasks in each group into the corresponding first test queue based on the execution order of each test task in each group, it further includes: obtaining a first utilization rate of the processor and a second utilization rate of the memory; determining a comprehensive utilization rate based on the first utilization rate and the second utilization rate; when the comprehensive utilization rate is greater than a first threshold, deleting a first number of first test queues, and determining each test task corresponding to the deleted first test queue as a first candidate test task; when the test tasks in each of the first test queues are completed, executing the first candidate test tasks based on each of the first test queues; or, when the comprehensive utilization rate is less than a second threshold, generating a second number of second test queues; wherein, the first threshold is greater than the second threshold; selecting at least one second candidate test task from each of the first test queues, and executing each of the second candidate test tasks based on each of the second test queues; wherein, the correlation coefficient between the second candidate test task and the test tasks in each of the first test queues is less than a third threshold.
4. The method for executing the test task according to claim 3, wherein, After sending the first test results to the central server, it further includes: when it is detected that there is a new test plan in the central server, obtaining the new test plan from the central server; wherein, the new test plan includes at least one second group, the second group includes at least one to-be-tested task, the test types of the to-be-tested tasks in the second group are the same, and the to-be-tested tasks include the test tasks and / or new test tasks; when the to-be-tested task is a new test task, generating at least one third test queue based on the new test plan, and sequentially writing the new test tasks of each second group into the corresponding third test queue; executing each of the new test tasks in each of the third test queues in parallel; when each of the new test tasks is completed, feeding back second test results of each of the new test tasks to the central server.
5. A method for executing a test task, characterized in that including: Receive at least one test task and first test information of each of the test tasks; wherein, the first test information includes an estimated test duration, a test type, and a weight; Generate a parallel test plan based on the first test information of each of the test tasks; wherein, the parallel test plan is used to indicate the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same.
6. The method for executing the test task according to claim 5, wherein The generating a parallel test plan based on the first test information of each of the test tasks includes: Group the test tasks based on the test types of the test tasks to obtain at least one candidate grouping plan; wherein, the candidate grouping plan includes multiple groups and at least one test task in each of the groups; Under each of the candidate grouping plans, calculate the running time of each of the groups based on the estimated test duration and weight of each of the test tasks in each of the groups; Calculate the total running time of each of the candidate grouping plans based on the running time of each of the groups under each of the candidate grouping plans; Among each of the candidate grouping plans, determine the candidate grouping plan with the minimum total running time as the parallel test plan.
7. The method for executing the test task according to claim 5, characterized in that, After generating the parallel test plan based on the first test information of each of the test tasks, it further includes: When receiving a test result, determine the test task corresponding to the test result; the test result includes a test task ID, a start test time, and an end test time; Based on the start test time and the end test time of the test task corresponding to the test result, determine the actual test duration of the test task corresponding to the test result; Update the parallel test plan based on the actual test duration, test type, and weight of each of the test tasks to obtain a first test plan; When detecting that the first test information of at least one test task changes, update the parallel test plan based on the new first test information of the test task to obtain a second test plan; And / or, When receiving at least one new test task, determine the second test information of each of the new test tasks; Update the parallel test plan based on the second test information of each of the new test tasks to obtain a third test plan.
8. A method for executing a test task, characterized in that, It includes: The central server receives at least one test task and first test information of each of the test tasks; wherein, the first test information includes an estimated test duration, a test type, and a weight; The central server generates a parallel test plan based on the first test information of each of the test tasks; the parallel test plan includes the grouping of multiple test tasks and the execution order of the test tasks in each group, and the test types of the test tasks in each group are the same; The central server sends the parallel test plan to the test server; The test server generates multiple first test queues based on the parallel test plan and writes the test tasks of each group into the corresponding first test queue in sequence; The test server executes the test tasks in each of the first test queues in parallel and generates a first test result of each of the test tasks when each of the test tasks is completed; The test server sends the first test result to the central server.
9. A server, characterized in that, Including: A memory for storing a computer program; A processor for implementing the steps of the execution method of the test task according to any one of claims 1 to 4 or 5 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of the execution method of the test task according to any one of claims 1 to 4 or 5 to 7 when executed by a processor.
11. A computer program product, comprising a computer program, characterized in that, The computer program implements the steps of the execution method of the test task according to any one of claims 1 to 4 or 5 to 7 when executed by a processor.
Citation Information
Patent Citations
Task processing method, task processing device, task processing system, task distribution method and task distribution device
CN112650590A
Test task execution method and device, equipment and storage medium
CN116225937A
Test method and device, computer equipment and readable storage medium
CN119493724A
Testing method and testing system
US10598730B1
Data Center Environment Architecture Including System Under Test Component Analysis For Use When Performing Test Automation Orchestration
US20240248821A1