Test task execution method, server, medium and program product
The central server generates a parallel test plan, and the test server executes tasks in the test queue in parallel, solving the problem of low testing efficiency in the existing technology, and achieving efficient test task execution and resource utilization.
Patent Information
- Application Number
- CN202510760427.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-06-09
AI Technical Summary
In the prior art, product testing methods cannot be applied to some test scenarios, resulting in low testing efficiency 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 based on the scheme, executes the test tasks in each test queue in parallel, and generates corresponding test results.
It realizes parallel and efficient testing task execution, improves testing efficiency, reduces resource waste, and reduces testing costs.
Smart Images

Figure CN120277000B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing technology, and in particular to a method for executing a testing task, a server, a medium, and a program product. Background Art
[0002] During the product development process, performance testing is a crucial step. Testing methods typically prioritize tasks and execute them sequentially to test the product's capabilities.
[0003] However, the above method is not applicable to some test scenarios, which makes product testing less efficient. Summary of the Invention
[0004] The present application provides a method for executing a test task, a server, a medium, and a program product to at least solve the problem of low test efficiency of related test methods in related technologies.
[0005] This application provides a method for executing a test task, including:
[0006] Obtaining a parallel testing plan from a central server; wherein the parallel testing plan includes 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;
[0007] 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;
[0008] Execute the test tasks in each first test queue in parallel, and generate a first test result for each test task when all test tasks are completed;
[0009] The first test result is sent to the central server.
[0010] This application also provides a method for executing a test task, including:
[0011] Receive 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] Based on the first test information of each test task, a parallel test plan is generated; 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.
[0013] This application also provides a method for executing a test task, including:
[0014] The central server receives 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;
[0015] The central server generates a parallel test plan based on the first test information of each test task; the parallel test plan includes grouping the 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 a plurality of first test queues based on the parallel test scheme, 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 the first test queues in parallel, and generates a first test result for each test task when all test tasks are completed;
[0019] The test server sends the first test result to the central server.
[0020] This application also provides a device for executing a test task, including:
[0021] A first acquisition module is configured to acquire a parallel test plan from a central server; wherein the parallel test plan includes 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 generating module is configured to generate a plurality of first test queues based on a parallel testing scheme, and to write the test tasks of each group into the corresponding first test queue in sequence;
[0023] A first execution module is used to execute the test tasks in the first test queues in parallel, and generate a first test result for each test task when each test task is completed;
[0024] The first sending module is used to send the first test result to the central server.
[0025] This application also provides a device for executing a test task, including:
[0026] A receiving module, configured to receive 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;
[0027] The second generation module is used 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 also provides a server, comprising: a memory for storing a computer program; and a processor for implementing the steps of the execution method of any of the above-mentioned test tasks when executing the computer program.
[0029] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the execution method of any of the above-mentioned test tasks are implemented.
[0030] The present application also provides a computer program product, including a computer program, which implements the steps of the execution method of any of the above-mentioned test tasks when the computer program is executed by a processor.
[0031] Through this application, since the test server can generate multiple test queues based on the parallel test plan generated by the central server to execute the test tasks in each test queue in parallel and generate corresponding test results, the technical problem of low test efficiency of related test methods can be solved, and the technical effect of parallel and efficient execution of test tasks and improved test efficiency can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0033] Figure 1 Schematic diagram of the application of relevant test methods;
[0034] Figure 2 A schematic diagram of the structure of a test task execution system provided in an embodiment of the present application;
[0035] Figure 3 A flowchart of a method for executing a test task provided in an embodiment of the present application;
[0036] Figure 4 An interactive diagram of a method for executing a test task provided in an embodiment of the present application;
[0037] Figure 5 A flowchart of another method for executing a test task provided in an embodiment of the present application;
[0038] Figure 6 This is one of the application diagrams of the method for executing a test task provided in an embodiment of the present application;
[0039] Figure 7 The second application diagram of the method for executing a test task provided in an embodiment of the present application;
[0040] Figure 8 A flowchart of another method for executing a test task provided in an embodiment of the present application;
[0041] Figure 9 A schematic diagram of the structure of a test task execution device provided in an embodiment of the present application;
[0042] Figure 10 A schematic diagram of the structure of another test task execution device provided in an embodiment of the present application;
[0043] Figure 11 A schematic diagram of the structure of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0045] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0046] Functional Circuit Test (FCT) is a testing method that provides a simulated operating environment for the unit under test (UUT). By applying stimulus and load, the UUT is made to operate under various design states, and parameters of each state are collected to verify its functional integrity.
[0047] Artificial Intelligence (AI) refers to a new technological science used to research and develop theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.
[0048] The processor (Central Processing Unit, CPU) refers to the computing and control core of a computer system and is the final execution unit for information processing and program execution.
[0049] Transmission Control Protocol / Internet Protocol (TCP / IP) refers to a suite of protocols that enables information transmission between multiple different networks.
[0050] During product production (such as server production), performance testing based on functional testing (FCT) is a crucial step. The more functions a product has, the more functional testing tasks it will perform. This increases the time it takes to complete functional testing, impacting production costs and efficiency.
[0051] The relevant testing methods are usually based on the order of each test task, which is executed in sequence to test the various capabilities of the product.
[0052] However, the above method is not applicable to some test scenarios, which makes product testing less efficient. Figure 1 An application diagram of the relevant test method is provided as an example.
[0053] See also Figure 1 When the product to be tested includes 9 test tasks such as P0 to P8 as shown in 101, the relevant test method can execute each test task serially in the order of the test tasks, as shown in 102, executing P0 first, and then executing P1, P2, P4...P8 in sequence.
[0054] In this way, the total test duration of the above test method is the sum of the durations of each test task. As the number of test tasks increases, the total test duration will show a linear growth trend, resulting in low resource utilization, increasing product testing costs and affecting test efficiency.
[0055] In response to the above problems, an embodiment of the present application provides a method, server, medium and program product for executing test tasks. The test server generates multiple test queues according to the parallel test plan generated by the central server to execute multiple test tasks in each test queue in parallel and generate corresponding test results, thereby realizing parallel and efficient execution of test tasks and improving test efficiency.
[0056] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0057] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the test task execution method depends, the specific application environment architecture or specific hardware architecture is described here. Figure 2 Schematic diagram of the structure of the execution system of the test task.
[0058] See also Figure 2 The test task execution system 200 includes a central server 201 and at least one test server ( Figure 2 Only two are shown, including test server 2011 and test server 2012), and the central server 201 is communicatively connected to each test server.
[0059] The central server 201 is configured to receive at least one test task and first test information for each test task, and generate a parallel test plan based on the first test information for each test task. The test server is configured to obtain the parallel test plan from the central server 201, generate multiple first test queues based on the parallel test plan, sequentially write the test tasks of each group into the corresponding first test queue, execute the test tasks in each first test queue in parallel, and generate a first test result for each test task when all test tasks are completed, and send the first test result to the central server 201.
[0060] Figure 3 A flowchart of a method for executing a test task provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the embodiment of the present application provides a method for executing a test task, and the method is described in detail as follows:
[0061] S301: Obtain a parallel testing plan from a central server; wherein the parallel testing plan includes grouping of multiple test tasks and an 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 test task execution method provided in this embodiment can be applied to a test server.
[0063] Optionally, the test server obtains a parallel testing plan from the central server. The parallel testing plan includes multiple groups, each group includes multiple test tasks and an execution order for the test tasks, and the multiple test tasks in each group have the same test type. The central server is configured to instruct a device (e.g., a server) to determine the parallel testing plan based on the test tasks. The test server is configured to instruct another device (e.g., another server) to execute the test tasks in parallel according to the parallel testing plan.
[0064] The test type is determined based on the correlation coefficient between the test tasks. For example, if 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 the second test task must be executed after the first test task is completed. Therefore, it is determined that the first test task and the second test task are of the same type. For another example, if the correlation coefficient between 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 between the first test task, the second test task and the third test task is weak, and there is no necessary connection between the execution order of 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. In this case, the first test task and the second test task are divided into test tasks within a group, and the third test task is divided into a test task within a group. The fourth threshold can be specifically set according to actual conditions. For example, the fourth threshold is 0.7, or the fourth threshold is 0.75.
[0065] S302: Generate multiple first test queues based on the parallel test solution, and write the test tasks of each group into the corresponding first test queue in sequence.
[0066] Optionally, a plurality of corresponding first test queues are generated based on the number of groups in the parallel test solution, with one test queue corresponding to one group, and a plurality of test tasks in each group are sequentially written into the corresponding first test queue.
[0067] S303: executing the test tasks in the first test queues in parallel, and generating a first test result for each test task when all the test tasks are completed;
[0068] S304: Send the first test result to the central server.
[0069] Optionally, the test server starts the test tasks in each first test queue in parallel, wherein the test tasks in each first test queue are executed in sequence according to the execution order of the test tasks, and when each test task in each test queue is completed, a first test result of each test task is generated.
[0070] The embodiments of the present application can realize the parallel execution of test tasks through multi-threaded concurrency, fully utilize the computing power resources of the server, reduce computing power costs, and improve test efficiency.
[0071] Optionally, generating multiple first test queues based on the parallel testing scheme and sequentially writing the test tasks of each group into the corresponding first test queue includes:
[0072] Based on the number of groups in the parallel testing scheme, generating a corresponding first test queue;
[0073] Based on the execution order of each test task in each group, multiple test tasks in each group are written into the corresponding first test queue in sequence.
[0074] Optionally, the number of groups in the parallel test scheme is determined, and a first test queue corresponding to the number of groups is generated, with one test queue corresponding to one group. Based on the execution order of each test task in each group, multiple test tasks in each group are sequentially written into the corresponding first test queue.
[0075] Optionally, after writing the multiple test tasks in each group into the corresponding first test queue in sequence based on the execution order of each test task in each group, the method further includes:
[0076] Obtaining a first usage rate of a processor and a second usage rate of a memory;
[0077] determining a combined usage rate based on the first usage rate and the second usage rate;
[0078] When the comprehensive usage rate is greater than a first threshold, a first number of first test queues are deleted, and each test task corresponding to the deleted first test queue is determined as a first candidate test task;
[0079] When the test tasks in each first test queue are completed, executing the first candidate test tasks based on each first test queue;
[0080] Optionally, a first usage rate of a processor (e.g., a central processing unit (CPU)) and a second usage rate of a memory in the test server are obtained. The first usage rate is the difference between 1 and the ratio of processor free space to total space, and the second usage rate is the difference between 1 and the ratio of memory free space to total space.
[0081] Optionally, a comprehensive utilization rate is determined based on the first utilization rate and the second utilization rate. When the comprehensive utilization rate is greater than a first threshold, it is determined that the utilization rates of the processor and memory are excessive, affecting the performance of the test server. A first number of first test queues are deleted to reduce the number of concurrent processes in the test server, and each test task included in the first number of deleted first test queues is determined as a first candidate test task. When the test tasks in each first test queue are completed, the first candidate test task is executed through each first test queue.
[0082] The first threshold value may be specifically set according to actual conditions, for example, the first threshold value is 70%, or the first threshold value is 80%.
[0083] Exemplarily, the first threshold may be determined according to the size of the comprehensive utilization rate. The first threshold is in direct proportion to 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 to the group to which the first candidate test task belongs, and the first candidate test task of each group is written into the first test queue in sequence, 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 sequence according to 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 queues one to four are executed in parallel. When the test tasks in queues one to four are completed, the first candidate test task in the group corresponding to queue five is assigned to queue one, and the first candidate test task in the group corresponding to queue six is assigned to queue two. The first candidate test tasks in queues one and two are executed in parallel until the first candidate test tasks in each queue are completed, and the first test results corresponding to the test tasks in queues one to four and the first candidate test tasks in queues one to two are generated.
[0086] For example, the comprehensive usage rate may be the maximum value of the first usage rate and the second usage rate. For another example, the comprehensive usage rate may be the average value of the first usage rate and the second usage rate.
[0087] Optionally, when the comprehensive usage rate is less than a 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 in 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 a third threshold.
[0089] Optionally, when the comprehensive utilization rate is less than a second threshold, the resource utilization of the test server is determined to be low, and a second number of test queues is generated. The first threshold is greater than the second threshold. The second threshold can be set specifically based on actual conditions, for example, the second threshold is 50% or 40%. The second number can also be set specifically based on actual conditions, for example, the second number is 2 or 3.
[0090] Exemplarily, the second threshold may be determined according to the size of the comprehensive usage rate. The first threshold is inversely proportional to the comprehensive usage rate. When the comprehensive usage rate is less than the second threshold, the smaller the comprehensive usage rate, the larger the second threshold.
[0091] Optionally, in the first test queue, the correlation coefficient between each test task and other test tasks (except the current test task) is determined, and at least one test task whose correlation coefficient with all other test tasks is less than a third threshold is selected and determined as the second candidate test task. The third threshold is greater than the fourth threshold. For example, when the fourth threshold is 0.7, the third threshold is 0.75; and when the fourth threshold is 0.75, the third threshold is 0.8.
[0092] The embodiment of the present application determines the comprehensive utilization rate by real-time querying the actual utilization rate of the processor and memory of the test server. When the comprehensive utilization rate is greater than a first threshold, the number of concurrently executed processes in the test server is reduced (i.e., a first number of first test queues are deleted). When the comprehensive utilization rate is less than a second threshold, the number of concurrently executed processes in the test server is increased (i.e., a second number of second test queues are generated) to improve the utilization rate of resources in the test server, reduce the problem of test server crash or test anomaly caused by overload operation, and thus improve 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] in, Indicates the first usage rate, Indicates the second usage rate, Indicates the processor free space, Indicates the total processor space, Indicates free memory space. Indicates the total memory space.
[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 to fully utilize the server's performance and improve test efficiency.
[0097] Optionally, after sending the first test result to the central server, the method further includes:
[0098] When a new test plan is detected in the central server, the new test plan is obtained 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, generating at least one third test queue based on the new test scheme, and writing the new test tasks of each second group into the corresponding third test queue in sequence;
[0100] executing each new test task in each third test queue in parallel;
[0101] When each new test task is completed, the second test result of each new test task is fed back to the central server.
[0102] Optionally, when a new test scheme is detected in the central server, the new test scheme is obtained from the central server, the new test scheme 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, based on the number of second groups in the new test scheme, a corresponding number of third test queues are generated, and the new test tasks of each second group are written into the corresponding third test queue in sequence. The new test tasks in each third test queue are executed in parallel, and when each new test task is completed, the second test result of each new test task is fed back to the central server.
[0103] Optionally, when the task to be tested is a test task, a new test plan is stored.
[0104] Figure 4 An interactive diagram of a test task execution system provided in an embodiment of the present application.
[0105] See also Figure 4 The test server is used to test the product to be tested based on the test task. The central server includes a processor 2 and a display screen. The processor 2 is used to generate and update the parallel test plan according to the test information of the test task. 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 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, as well as 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 to facilitate 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 result.
[0112] Optionally, when initialization is completed, the display screen of the central server sends the initialization result to the test server.
[0113] 403. Get product configuration information and parse it.
[0114] Optionally, the test server identifies the product to be tested, obtains product configuration information of the product to be tested, and performs analysis to obtain product configuration parameters.
[0115] 404. Get the parallel testing plan.
[0116] Optionally, the test server obtains the parallel solution from the processor 2 of the central server.
[0117] 405. Analyze the parallel test plan to obtain groups including multiple test tasks and the execution order of the test tasks in each group.
[0118] Optionally, the test server parses the parallel test plan to obtain a plurality of groups included in the parallel test plan, each group including a plurality of test tasks, and an execution order of the test tasks in each group.
[0119] Optionally, the parallel test plan further includes a unique test task ID of the test task.
[0120] 406. Generate multiple first test queues based on the parallel test solution, and write the test tasks of each group into the corresponding first test queue in sequence.
[0121] Optionally, the test server generates multiple first test queues according to the number of groups in the parallel test scheme, the first test queues correspond to the groups one by one, and writes the test tasks in each group into the first test queue one by one in sequence.
[0122] Optionally, the test server may determine a first usage rate of its processor and a second usage rate of its memory in real time, and modify the parallel test process according to the combined usage rates.
[0123] For example, when the comprehensive utilization rate is too high, for example, 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 state 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. Wherein, the fifth threshold is greater than the first threshold, for example, when the fifth threshold is 95%, or the fifth threshold is 98%,
[0124] 407. Execute the test tasks in the first test queues in parallel.
[0125] Optionally, the test server executes the test tasks in the first test queues in parallel to test the product to be tested.
[0126] 408. Obtain test data corresponding to each test task.
[0127] Optionally, the test server obtains test data corresponding to each test task based on the product to be tested.
[0128] Optionally, the test server may 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 on a display screen, allowing users to obtain the test status of each product to be tested in real time.
[0129] Optionally, one test server can be used to test one product under test, or can be used to test multiple products under test simultaneously.
[0130] 409. Whether all test tasks are completed.
[0131] Optionally, the test server determines whether each test task is completed. If it is determined that each test task is completed, step 410 is executed; if it is determined that each test task is not completed, the process returns to step 404 and subsequent steps.
[0132] 410. Generate and send first test results.
[0133] Optionally, when it is determined that each test task is completed, a first test result corresponding to each test task is generated and sent to the processor 2 of the central server.
[0134] Optionally, when sending data related to the test task to the central server, the test server carries the unique test task ID of the test task to facilitate 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 result 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 result of each test task, obtains a first test plan, and sends the first test plan to the test server.
[0142] Optionally, the processor 2 of the central server may recalculate the weights of the test duration of each test task according to the test start time and test end time of each test task, and update the parallel test plan.
[0143] Illustratively, the product to be tested may include, but is not limited to, a server mainboard, a server circuit board, a vehicle circuit board, and the like.
[0144] Figure 5 A flow chart of another method for executing a test task provided in an embodiment of the present application is shown as follows: Figure 5 As shown, the 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 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 test task execution method provided in this embodiment can be applied to a central server.
[0148] Optionally, the central server receives at least one test task and first test information of each test task, the first test information including but not limited to estimated test duration, test type and weight. The estimated test duration is used to indicate the estimated execution time of the test task before it is executed. The test type may include a correlation coefficient indicating 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, the central server determines the grouping of each test task and the execution order in each group based on information such as the estimated test duration, test type and weight of each test task, and generates a corresponding parallel test plan.
[0150] Optionally, when the central server is started, it obtains information about each test task, generates a corresponding parallel test plan, and sends the parallel test plan to the test server. When the test result is received from the test server, the test result of each test task is displayed on the display screen.
[0151] Optionally, generating a parallel testing plan based on the first test information of each test task includes:
[0152] Grouping the test tasks based on their test types to obtain at least one candidate grouping scheme; wherein the candidate grouping scheme includes a plurality of groups and at least one test task in each group;
[0153] Under each candidate grouping scheme, the running time of each group is calculated based on the estimated test duration and weight of each test task in each group;
[0154] Based on the running time of each group under each candidate grouping scheme, the total running time of each candidate grouping scheme is calculated;
[0155] Among the candidate grouping schemes, the candidate grouping scheme with the smallest total running time is determined as the parallel testing scheme.
[0156] Optionally, based on the test type of each test task, each test task is grouped to obtain at least one candidate grouping scheme, and each candidate grouping scheme includes multiple groups and at least one test task in each group. For each candidate grouping scheme, based on the estimated test duration and weight of each test task in each group, the running time of each group in each candidate grouping scheme is calculated, and then the sum of the running time of each group in each candidate grouping scheme is calculated as the total running time of each candidate grouping scheme, and the candidate grouping scheme with the smallest total running time is determined as the parallel test scheme.
[0157] Exemplarily, 4 candidate grouping schemes are generated based on the test task, the first candidate grouping scheme includes 5 groups, the candidate grouping scheme includes 3 groups, the candidate grouping scheme includes 4 groups, and the candidate scheme includes 3 groups. First, the estimated test duration of the test tasks in each group in the first candidate grouping scheme is calculated, and the running time of each group is calculated. Then, the sum of the running time of each group is calculated as the first total running time of the first candidate grouping scheme, and the second total running time of the second candidate grouping scheme, the third total running time of the third candidate grouping scheme, and the fourth total running time of the fourth candidate grouping scheme are obtained by analogy. From the above-mentioned first total running time, second total running time, third total running time, and fourth total running time, the candidate grouping scheme corresponding to the total running time with the smallest value is selected and determined as the parallel test scheme.
[0158] Optionally, after generating a parallel test plan based on the first test information of each test task, the method further includes:
[0159] Upon receiving the test result, determine the test task corresponding to the test result; the test result includes the test task ID, test start time, and test end time;
[0160] Determine the actual test duration of the test task corresponding to the test result based on the test start time and test end time of the test task corresponding to the test result;
[0161] Based on the actual test duration, test type, and weight of each test task, the parallel test plan is updated to obtain a first test plan;
[0162] When it is detected that the first test information of at least one test task changes, the parallel test plan is updated based on the new first test information of the test task to obtain a second test plan.
[0163] Optionally, upon receiving a test result sent by a test server, a test task corresponding to the test result is determined, where the test result includes a test task ID, a start test time of the test task, and a test end time of the test task. The difference between the start test time and the test end time of the test task corresponding to the test result is calculated as the actual test duration of the test task corresponding to the test result. The parallel test plan is updated according to the actual test duration, test type, and weight of each test task to obtain a first test plan.
[0164] Optionally, when a change in the first test information of one or more test tasks is detected, the parallel test plan is updated based on the new first test information of the test tasks to obtain a second test plan.
[0165] Optionally, upon receiving at least one new test task, determining second test information for each new test task;
[0166] Based on the second test information of each new test task, the parallel test plan is updated to obtain a third test plan.
[0167] Optionally, upon receiving at least one new test task, second test information of each new test task is determined, and the parallel test plan is updated to obtain a third test plan. The second test information includes a second estimated test duration, a second weight, and a second test type of the new test task.
[0168] Figure 6 This is one of the application diagrams of a method for executing a test task provided in an embodiment of the present application;
[0169] Still as Figure 1 Take the test tasks P0 to P8 shown in 101 as an example. Figure 6 As shown in Figure 601, the central server groups the test tasks directly based on the execution order. When the grouping results are obtained, the test server generates corresponding test queues based on the grouping results, namely queues 6011 to 601n. The test server sequentially writes the test tasks of each group into the corresponding queue and executes the test tasks in queues 6011 to 601n in parallel. At this point, test efficiency has been significantly improved.
[0170] The central server groups the test tasks based on the correlation indicated by the test type in each test task, generating multiple partitions, each of which includes multiple test tasks. When a corresponding parallel testing plan is obtained, the test server generates corresponding test queues based on the parallel testing plan, namely queues 6021 to 602n, as shown in 602. The test server sequentially writes the test tasks of each group into the corresponding test queue and executes the test tasks in test queues 6021 to 602n in parallel. A comparison shows that the total execution time of the test tasks in the test queue shown in 601 is greater than the total execution time of the test tasks in the test queue shown in 602.
[0171] Figure 7 The second application diagram of a method for executing a test task provided in an embodiment of the present application.
[0172] In such Figure 6 Based on the test queue and each test task (i.e., parallel test plan) shown in 602, the test server sends the parallel test results to the central server. The central server updates the parallel test plan based on the test results. When a new first test plan is obtained, the test server generates a corresponding test queue according to the first test plan as shown below. Figure 7 The test server writes the test tasks of each group into the corresponding queue in sequence and executes the test tasks in the test queues 7011 to 701n in parallel. Figure 7 The total execution time of the test tasks in the test queue shown is less than Figure 6 The total execution time of the test tasks in the test queue shown in 602.
[0173] Optionally, the central server can adjust the number of groups in the parallel test plan and the test tasks in each group multiple times based on the actual running time of the test task, the total running time of the parallel test plan, weight and other information until the parallel test plan with the shortest total running time is determined.
[0174] For example, the average running time of a group can be expressed by the following formula:
[0175] ;
[0176] Among them, n represents the number of n groups of test tasks, represents the i-th test task in n groups, represents the weight of the i-th test task in n groups.
[0177] Optionally, due to strong correlations (or dependencies) between some test tasks, some test tasks cannot be executed simultaneously and must wait for one task to complete before continuing to the next. Therefore, when grouping test tasks based on the test information of each test task, the central server can generate multiple candidate grouping schemes based on the correlation coefficients between the test tasks and select the candidate grouping scheme with the shortest total running time as the parallel testing scheme.
[0178] Exemplarily, the central server determines the candidate grouping scheme with the smallest sum of the average running time of the groups as the parallel testing scheme, as shown in the following formula:
[0179] ;
[0180] Among them, the candidate grouping schemes include m groups and n groups. Group M includes m test tasks, and group n includes n test tasks. represents the jth test task in n groups, represents the weight of the j-th test task in n groups.
[0181] Optionally, the central server includes a display screen, which is used to display the test information and test results of each test task, so as to display the execution status and test results of the test task in real time.
[0182] The embodiment of the present application improves the flexibility and efficiency of parallel testing by dynamically adjusting the parallel testing scheme of the test tasks through the central server.
[0183] Figure 8A flowchart of another method for executing a test task provided in an embodiment of the present application is shown as follows: Figure 8 As shown, the embodiment of the present application provides another method for executing a test task, which is described in detail as follows:
[0184] S801: The central server receives 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;
[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 grouping the multiple test tasks and the execution order of the test tasks in each group. The test tasks in each group have the same test type.
[0186] S803: The central server sends a parallel testing plan to the testing server;
[0187] S804: The test server generates multiple first test queues based on the parallel test solution, 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 the first test queues in parallel, and generates a first test result for each test task when all the test tasks are completed.
[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 a corresponding first test queue based on the number of groups in the parallel test plan, and 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, and generates a first test result for each test task when each test task is completed, and then sends the first test result to the central server. For specific implementation details, please refer to the relevant description in the above embodiment, which will not be repeated here.
[0191] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0192] Figure 9 This is a schematic diagram of the structure of a test task execution device provided in an embodiment of the present application. Figure 9 As shown, an embodiment of the present application further provides a device for executing a test task, including:
[0193] A first acquisition module 901 is configured to acquire a parallel testing plan from a central server. The parallel testing plan includes grouping of multiple test tasks and the execution order of the test tasks in each group. The test tasks in each group have the same test type.
[0194] A first generating module 902 is configured to generate a plurality of first test queues based on the parallel testing scheme, and to write the test tasks of each group into the corresponding first test queue in sequence;
[0195] A first execution module 903 is configured to execute the test tasks in the first test queues in parallel and generate a first test result for each test task when all test tasks are completed;
[0196] The first sending module 904 is configured to send the first test result to the central server.
[0197] Optionally, the first generation module includes:
[0198] A first generating unit, configured to generate a corresponding first test queue based on the number of groups in the parallel test scheme;
[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 each test task in each group.
[0200] Optionally, the first generating module further includes:
[0201] a first acquiring unit, configured to acquire a first usage rate of the processor and a second usage rate of the memory;
[0202] a first determining unit, configured to determine a comprehensive usage rate based on the first usage rate and the second usage rate;
[0203] a second determining unit, configured to delete a first number of first test queues when the comprehensive usage rate is greater than a first threshold, and determine each test task corresponding to the deleted first test queue as a first candidate test task;
[0204] a first execution unit, configured to execute first candidate test tasks based on each first test queue when execution of the test tasks in each first test queue is completed;
[0205] or,
[0206] A second generating unit is configured to generate a second number of second test queues when the comprehensive usage rate is less than a second threshold; wherein the first threshold is greater than the second threshold;
[0207] The second execution unit is used to select at least one second candidate test task in 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 task in each first test queue is less than a third threshold.
[0208] Optionally, the test task execution device further includes:
[0209] A second acquisition module is configured to acquire the new test plan from the central server upon detecting that a new test plan exists in 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 tasks to be tested in the second group have the same test type, and the tasks to be tested include test tasks and / or new test tasks;
[0210] A third generating module is configured to generate at least one third test queue based on the new test scheme when the task to be tested 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] The second sending module is used to feed back the second test result of each new test task to the central server when each new test task is completed.
[0213] For the description of the features in the embodiment corresponding to the test task execution device, please refer to the relevant description of the embodiment corresponding to the test task execution method, which will not be repeated here.
[0214] Figure 10 This is a schematic diagram of the structure of another test task execution device provided in an embodiment of the present application. Figure 10 As shown, an embodiment of the present application further provides a device for executing a test task, including:
[0215] Receiving module 1001, configured to receive at least one test task and first test information of each test task; wherein the first test information includes estimated test duration, test type, and weight;
[0216] The second generation module 1002 is used 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, configured to group each test task based on a test type of each test task to obtain at least one candidate grouping scheme; wherein the candidate grouping scheme includes a plurality of groups and at least one test task in each group;
[0219] The first calculation unit is configured to calculate 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 is configured to calculate the total running time of each candidate grouping scheme based on the running time of each group under each candidate grouping scheme;
[0221] The third determining unit is configured to determine, among the candidate grouping schemes, a candidate grouping scheme with the smallest total running time as a parallel testing scheme.
[0222] Optionally, the test task execution device further includes:
[0223] A first determination module is configured to determine a test task corresponding to a test result upon receiving the test result; the test result includes a test task ID, a test start time, and a test end time;
[0224] A second determining module is used to determine an actual test duration of the test task corresponding to the test result based on a start test time and a test end time of the test task corresponding to the test result;
[0225] A first updating module is configured to update the parallel testing plan based on the actual test duration, test type, and weight of each test task to obtain a first test plan;
[0226] A second updating module is configured to update the parallel test plan based on the new first test information of the test task to obtain a second test plan when detecting that the first test information of at least one test task has changed;
[0227] and / or,
[0228] A third determining module is configured to determine second test information of each new test task upon receiving at least one new test task;
[0229] The third updating module is used to update the parallel testing plan based on the second test information of each new test task to obtain a third testing plan.
[0230] For the description of the features in the embodiment corresponding to the test task execution device, please refer to the relevant description of the embodiment corresponding to the test task execution method, which will not be repeated here.
[0231] Figure 11 This is a schematic diagram of the server structure provided for this application. Figure 11As shown, 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. The processor 1101, the memory 1102, and the communication component 1103 are connected via a bus.
[0232] During the specific implementation process, at least one processor 1101 executes the computer-executable instructions stored in the memory 1102, so that the at least one processor 1101 executes the above-mentioned embodiment of the execution method of the test task.
[0233] The specific implementation process of the processor 1101 can be found in the above method embodiment. Its implementation principle and technical effects are similar and will not be repeated here in this embodiment.
[0234] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the application may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.
[0235] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.
[0236] A bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.
[0237] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned execution method embodiments of the test task when running.
[0238] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0239] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in the embodiment of the execution method of any of the above-mentioned test tasks are implemented.
[0240] An embodiment of the present application also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in the execution method embodiment of any of the above-mentioned test tasks.
[0241] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0242] The above is a detailed introduction to the execution method, server, medium and program product of a test task provided by the present application. Specific examples are used herein 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 and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A method for executing a test task, characterized in that: include: Obtaining a parallel testing plan from a central server; wherein the parallel testing plan includes grouping of multiple test tasks and the execution order of the test tasks in each group, the test tasks in each group have the same test type, and the parallel testing plan is generated by the central server based on the estimated test duration, test type, and weight of each test task; Generate multiple first test queues based on the parallel test scheme, and write the test tasks of each group into the corresponding first test queue in sequence; executing the test tasks in the first test queues in parallel, and generating first test results for each of the test tasks when the execution of each of the test tasks is completed; Sending the first test result to the central server, so that the central server updates the parallel testing plan according to the actual test duration, test type and weight of the first test result; When executing the test tasks in the first test queues in parallel, the method further includes: Obtaining a first usage rate of a processor and a second usage rate of a memory; determining a comprehensive usage rate based on the first usage rate and the second usage rate; When the comprehensive usage 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 usage 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; At least one second candidate test task is selected from each of the first test queues, and each of the second candidate test tasks is executed 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.
2. The method for executing a test task according to claim 1, wherein: 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: Based on the number of groups in the parallel testing scheme, generating a corresponding first test queue; Based on the execution order of each test task in each group, the multiple test tasks in each group are written into the corresponding first test queue in sequence.
3. The method for executing a test task according to claim 1, wherein: After sending the first test result to the central server, the method further includes: When a new test plan is detected in the central server, the new test plan is obtained 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 tasks to be tested in the second group have the same test type, and the tasks to be tested include the test tasks and / or new test tasks; When the task to be tested is a new test task, generating at least one third test queue based on the new test scheme, and writing the new test tasks of each second group into the corresponding third test queue in sequence; executing the new test tasks in the third test queues in parallel; When each of the new test tasks is completed, the second test result of each of the new test tasks is fed back to the central server.
4. A method for executing a test task, characterized in that: include: Receive 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; Generate a parallel test plan based on the estimated test duration, test type and weight 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 tasks in each group have the same test type; Send a parallel test plan to a test server so that the test server obtains a first usage rate of the processor and a second usage rate of the memory when executing the test tasks in each first test queue in parallel; determine a comprehensive usage rate based on the first usage rate and the second usage rate; when the comprehensive usage rate is greater than a first threshold, delete a first number of first test queues, and determine 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, execute the first candidate test task based on each of the first test queues; or, when the comprehensive usage rate is less than a second threshold, generate a second number of second test queues; wherein the first threshold is greater than the second threshold; select at least one second candidate test task in each of the first test queues, and execute 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 task in each of the first test queues is less than a third threshold; A first test result is received, and a parallel testing plan is updated based on an actual test duration, a test type, and a weight of the first test result.
5. The method for executing a test task according to claim 4, wherein: The generating of a parallel test plan based on the first test information of each test task includes: Based on the test type of each test task, each test task is grouped to obtain at least one candidate grouping scheme; wherein the candidate grouping scheme includes a plurality of groups and at least one test task in each group; Under each of the candidate grouping schemes, the running time of each of the groups is calculated based on the estimated test duration and weight of each of the test tasks in each of the groups; Calculating the total running time of each candidate grouping scheme based on the running time of each group under each candidate grouping scheme; Among the candidate grouping schemes, the candidate grouping scheme with the smallest total running time is determined as the parallel testing scheme.
6. The method for executing a test task according to claim 4, wherein: After generating a parallel test plan based on the first test information of each test task, the method further includes: Upon receiving the test result, determining the test task corresponding to the test result; the test result includes the test task ID, the test start time, and the test end time; Determine the actual test duration of the test task corresponding to the test result based on the test start time and test end time of the test task corresponding to the test result; Based on the actual test duration, test type and weight of each of the test tasks, the parallel test plan is updated to obtain a first test plan; When detecting that the first test information of at least one test task has changed, updating the parallel test plan based on the new first test information of the test task to obtain a second test plan; and / or, Upon receiving at least one new test task, determining second test information of each of the new test tasks; Based on the second test information of each of the new test tasks, the parallel test plan is updated to obtain a third test plan.
7. A method for executing a test task, characterized in that: include: The central server receives 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; The central server generates a parallel test plan based on the estimated test duration, test type and weight of each test task; the parallel test plan includes grouping the 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 testing plan to the testing server; The test server generates a plurality of first test queues based on the parallel test scheme, and writes the test tasks of each group into the corresponding first test queue in sequence; The test server executes the test tasks in the first test queues in parallel, and generates a first test result for each test task when the execution of each test task is completed; The test server sends the first test result to the central server, so that the central server updates the parallel testing plan according to the actual test duration, test type and weight of the first test result; The step of executing the test tasks in the first test queues in parallel on the test server further includes: Obtaining a first usage rate of a processor and a second usage rate of a memory; determining a comprehensive usage rate based on the first usage rate and the second usage rate; When the comprehensive usage 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 usage 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; At least one second candidate test task is selected from each of the first test queues, and each of the second candidate test tasks is executed 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.
8. A server, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for executing a test task as claimed in any one of claims 1 to 3 or 4 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method for executing a test task according to any one of claims 1 to 3 or 4 to 6.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method for executing a test task as claimed in any one of claims 1 to 3 or 4 to 6 are implemented.
Citation Information
Patent Citations
Test method and device, computer equipment and readable storage medium
CN119493724A