A task scheduling method and system

By receiving heartbeat information for task scheduling, the problems of poor testing results and low efficiency in automated testing systems are solved, achieving precise task scheduling and an efficient testing process.

CN115827466BActive Publication Date: 2026-11-27HARBIN ANTIY TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202211582586.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-09
Publication Date
2026-11-27
Estimated Expiration
2042-12-09

AI Technical Summary

Technical Problem

Existing automated testing systems have poor testing performance, low testing efficiency, inaccurate test results, or operational blockages, and troubleshooting failures is time-consuming and labor-intensive.

Method used

By receiving heartbeat information from the server and client, the execution status of test tasks is determined, and task scheduling is performed based on the execution status, including dynamic adjustment of task type and status, to avoid inaccurate test results or blockage caused by unexpected factors.

Benefits of technology

It enables precise scheduling of automated tests, reduces waiting time, improves testing efficiency and accuracy, and saves testing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115827466B_ABST
    Figure CN115827466B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a task scheduling method and system, the method is applied to a task scheduling system connected with a service end and a client, the method comprises: receiving first heartbeat information sent by the service end and / or second heartbeat information sent by the client; determining the execution condition of a test task of the service end and / or the client according to the first heartbeat information and / or the second heartbeat information; and performing task scheduling on the service end and / or the client according to the execution condition of the test task. The present disclosure can accurately schedule each test task of the service end and / or the client according to the execution condition of the test task of the service end and / or the client, avoid the situation that the automatic case result is inaccurate or the running is blocked due to unexpected factors; at the same time, the waiting time of program execution can be reduced through dynamic task scheduling, so that the automatic test is more intelligent and efficient, and the automatic test time is saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer testing technology, specifically to a task scheduling method and system. Background Technology

[0002] With the increasing adoption of automated testing, the number of automated testing machines and test cases is growing, the testing volume is increasing, and the frequency of operation is becoming more frequent. Existing automated testing systems have poor testing performance; some unexpected factors may lead to inaccurate test results or test execution blockages, and troubleshooting test failures is time-consuming and laborious, affecting testing efficiency. Summary of the Invention

[0003] In view of the above-mentioned problems in the prior art, the purpose of this disclosure is to provide a task scheduling method and system that can solve the technical problems of poor automated testing effect and low testing efficiency in the prior art.

[0004] To achieve the above objectives, this disclosure provides a task scheduling method applied to a task scheduling system connecting a server and a client, the method comprising:

[0005] Receive the first heartbeat information sent by the server and / or the second heartbeat information sent by the client;

[0006] The execution status of the test task of the server and / or the client is determined based on the first heartbeat information and / or the second heartbeat information;

[0007] Task scheduling is performed on the server and / or client based on the execution status of the test tasks.

[0008] In some embodiments, determining the execution status of the test task of the server and / or the client based on the first heartbeat information and / or the second heartbeat information includes:

[0009] The task type of the test task of the server and / or client is determined based on the task identifier carried in the first heartbeat information and / or the second heartbeat information;

[0010] The execution status of the test task is determined based on the first heartbeat information and / or the second heartbeat information.

[0011] In some embodiments, task scheduling is performed on the server and / or client based on the execution status of the test task, including:

[0012] Task scheduling is performed based on the task type and the execution status of the test task.

[0013] In some embodiments, task scheduling is performed on the server and / or client based on the execution status of the test task, including:

[0014] It is determined that the first task of the server and the second task of the client are both independent tasks, and the first task and the second task are executed simultaneously;

[0015] Obtain the execution times of the first task and the second task;

[0016] The subsequent test tasks for the server and the client are scheduled based on the execution time.

[0017] In some embodiments, scheduling subsequent test tasks for the server and the client based on the execution time includes:

[0018] If the end time of the first task is earlier than the end time of the second task, after the first task is completed, the server is controlled to execute an independent third task, wherein the third task is different from the first task.

[0019] If the end time of the first task is later than the end time of the second task, the client is instructed to wait until the first task is completed.

[0020] In some embodiments, task scheduling is performed on the server and / or client based on the execution status of the test task, including:

[0021] The server's first task and the client's second task are determined to be linked tasks;

[0022] Obtain the first execution result corresponding to the first task;

[0023] Based on the first execution result, subsequent test tasks for the server and the client are scheduled.

[0024] In some embodiments, scheduling subsequent test tasks for the server and the client based on the first execution result includes:

[0025] If the first execution result indicates that the first task has been successfully executed, the client is controlled to execute the second task in conjunction with it, and the second execution result of the second task is monitored;

[0026] If the first execution result indicates that the first task was not successfully executed, determine whether other linked tasks besides the first task have been completed. If they have been completed, control the server to execute the corresponding first independent task and control the client to execute the corresponding second independent task.

[0027] In some embodiments, the method further includes:

[0028] It is confirmed that both the server and the client are connected to the task scheduling system;

[0029] Control the server to execute the first pre-processing task, and control the client to wait;

[0030] Receive the first heartbeat information fed back by the server and the second heartbeat information fed back by the client;

[0031] The execution status of the first task is determined based on the first heartbeat information;

[0032] The execution of the client's second task is determined based on the execution status of the first task and the second heartbeat information.

[0033] In some embodiments, the method further includes:

[0034] After all test tasks on the server and client have been completed, the task execution results on the server and client are integrated to generate corresponding script test results.

[0035] This disclosure also provides a task scheduling system, including:

[0036] The receiving module is configured to receive the first heartbeat information sent by the server and / or the second heartbeat information sent by the client;

[0037] The determination module is configured to determine the execution status of the test task of the server and / or the client based on the first heartbeat information and / or the second heartbeat information;

[0038] The scheduling module is configured to schedule tasks for the server and / or client based on the execution status of the test tasks.

[0039] This disclosure also provides an electronic device, including at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program in the memory.

[0040] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0041] Compared with existing technologies, the task scheduling method and system provided in this disclosure obtain first heartbeat information sent by the server and / or second heartbeat information sent by the client, determine the execution status of the test tasks of the server and / or the client based on the first heartbeat information and / or the second heartbeat information, and then accurately schedule each test task of the server and / or the client based on the execution status of the test tasks, avoiding inaccurate results or execution blockage of automated test cases due to unexpected factors; at the same time, dynamic task scheduling can reduce the waiting time of program execution, making automated testing more intelligent and efficient, and saving automated testing time. Attached Figure Description

[0042] In drawings that are not necessarily drawn to scale, the same reference numerals may describe similar parts in different views. The same reference numerals with or without letter suffixes may indicate different instances of similar parts. The drawings generally illustrate various embodiments by way of example rather than limitation and are used, together with the description and claims, to illustrate the claimed embodiments. Where appropriate, the same reference numerals are used in all drawings to refer to the same or similar parts. Such embodiments are illustrative and not intended to be exhaustive or exclusive embodiments of the apparatus or method.

[0043] Figure 1 This is a flowchart of a task scheduling method according to an embodiment of the present disclosure;

[0044] Figure 2 This is another flowchart of the task scheduling method according to an embodiment of the present disclosure;

[0045] Figure 3 This is a schematic diagram of the structure of a task scheduling system according to an embodiment of the present disclosure. Detailed Implementation

[0046] The specific embodiments of this disclosure will now be described in detail with reference to the accompanying drawings, but these are not intended to limit the scope of this disclosure.

[0047] It should be understood that various modifications can be made to the embodiments disclosed herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this disclosure will be apparent to those skilled in the art.

[0048] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present disclosure and, together with the general description of the disclosure given above and the detailed description of the embodiments given below, serve to explain the principles of the disclosure.

[0049] These and other features of this disclosure will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.

[0050] It should also be understood that although this disclosure has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this disclosure, which have the features described in the claims and are therefore all within the scope of protection defined herein.

[0051] The above and other aspects, features and advantages of this disclosure will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.

[0052] Specific embodiments of the present disclosure are described thereafter with reference to the accompanying drawings; however, it should be understood that the disclosed embodiments are merely examples of the present disclosure and can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the present disclosure. Therefore, the specific structural and functional details disclosed herein are not intended to be limiting, but merely to serve as the basis and representative basis for the claims to teach those skilled in the art to use the present disclosure in a variety of substantially any suitable detailed structures.

[0053] First, a brief description of the automated testing based on the C / S architecture involved in the embodiments of this disclosure will be given.

[0054] C / S architecture, short for Client / Server architecture, is a network architecture in which the client is the PC or workstation where the user runs the application, and the client relies on the server to obtain resources.

[0055] When UI automation testing is required for a client / server architecture system, the following testing scenarios exist depending on business needs:

[0056] 1. The client needs to be deployed on multiple systems / machines, and the time required for different machines to execute the same task varies;

[0057] 2. The server has only one administrator who needs to manage all the servers simultaneously;

[0058] 3. Due to the interaction between the C / S side, after the server sends a task to the client, the client will execute the task and report the execution result to the server. After receiving the execution result, the server will display it on the server page.

[0059] 4. Some tasks depend on the execution results of other tasks, that is, there is a strong correlation between the order of some tasks;

[0060] 5. Some functions of the server / client do not need to interact with the other party and can be executed normally on their own.

[0061] Due to the limitations of scenarios 1 and 2, the server-side automation scripts and client-side automation scripts are usually combined into one. However, executing them on a single machine cannot meet the requirements of different scenarios. Therefore, it is necessary to separate the server-side automation scripts and client-side automation scripts into two sets, which are executed in the server-side environment and the client-side environment respectively.

[0062] Based on the above prerequisites, automated test scripts need to consider the following issues:

[0063] 1. Server-side automation scripts

[0064] (1) After a task is issued, when should the task execution result on the client be verified?

[0065] (2) When task B depends on the execution result of task A, if some machines fail to execute task A, how to dynamically determine which machines have successfully executed task A and send task B to them?

[0066] (3) How to efficiently utilize the idle time while the server is waiting for the client to execute the result, and execute independent test scripts to shorten the overall automated test time.

[0067] 2. Client-side automation scripts

[0068] (1) How to know that the server has issued a task and how to verify the task execution result after the task is completed;

[0069] (2) After the server issues a task, the client should not execute other tasks to avoid inaccurate test results due to conflicts between the two tasks.

[0070] The traditional solutions to the above problems are mainly the following two:

[0071] (1) Predetermine the approximate task execution time and formulate a test case execution schedule so that the client and server strictly follow the schedule to execute the test cases.

[0072] In this context, a use case describes how a system responds to external requests; it's a technique for understanding requirements through user scenarios. Each use case provides one or more scenarios that illustrate how the system interacts with end users or other systems—that is, who can use the system and what they can do—thereby achieving a clear business objective.

[0073] This approach is too restrictive and cannot handle unexpected situations effectively. For example, during a test execution, if unforeseen circumstances such as system performance or network issues cause the task execution time to exceed expectations, strictly adhering to the schedule will result in the test process being delayed by a particular task, preventing subsequent tasks from proceeding normally, and the automated test results failing to reflect the true state of the product.

[0074] (2) After the server issues a task or the client completes a task, a flag is generated at a specified location. Subsequent tasks will only continue when the flag is detected.

[0075] While this approach solves the problem of subsequent tasks failing to execute properly due to timeouts of one or more tasks in method (1), it also introduces new problems. Since there is more than one client, the server needs to determine that the flags of all clients have been generated before continuing execution. At this time, a situation may occur where a machine cannot continue executing the automated test cases due to program problems or other reasons, and cannot generate the flags properly. The server will then "wait indefinitely," causing all subsequent tasks to be blocked.

[0076] Both of the above solutions suffer from inaccurate results or runtime blockages due to unforeseen factors, making subsequent troubleshooting of automation failures more time-consuming and labor-intensive, thus defeating the purpose of automated testing. Therefore, this disclosure provides a task scheduling method and system.

[0077] Figure 1 This is a flowchart of a task scheduling method according to an embodiment of this disclosure. Figure 1 As shown in the figure, this disclosure provides a task scheduling method, which is applied to a task scheduling system connecting a server and a client. The method includes:

[0078] S101: Receive the first heartbeat information sent by the server and / or the second heartbeat information sent by the client.

[0079] The task scheduling system communicates with both the server and client, and can schedule the execution of automated test cases on both sides. Test scripts are executable program files that execute test cases, and can include server-side scripts and client-side scripts. In this embodiment, a test case refers to a description of a testing task for a specific software product, embodying the test plan, methods, techniques, and strategies, and is used to execute the corresponding test task (referred to as a task).

[0080] Test tasks issued by the server can be sent to the client for execution through the task scheduling system. When the corresponding test tasks are executed on the server and / or client, the task scheduling system can also send relevant information about the execution status of the test tasks on the server and / or client to the task scheduling system in the form of heartbeats, so that the task scheduling system can process and analyze the data and then perform task scheduling.

[0081] For example, when the server wants to issue a test task to the client, it first sends a notification to the task scheduling system. Upon receiving this notification, the task scheduling system checks the client's script execution status. If the client is idle, the system sends this status information to the server, notifying it that the client is idle and ready to issue a test task. After receiving confirmation, the server issues the test task to the client via the task scheduling system for execution. During task execution, the client can monitor the task status and other execution details in real-time or periodically, and report these details to the task scheduling system in real-time via heartbeats (reporting the first heartbeat).

[0082] The server can not only send test tasks to the client for execution, but also execute test tasks (test scripts) that do not depend on the client. The test tasks executed by the server can also be determined by the task scheduling system, and during the task execution process, the task execution status is reported to the task scheduling system in real time in the form of heartbeats (reporting second heartbeat information).

[0083] In this step, the received first heartbeat information and / or second heartbeat information can be the heartbeat information corresponding to the test task to be executed, or the heartbeat information corresponding to the currently executed test task.

[0084] For example, when only the server executes the test task (such as during the server initialization phase when the client has not started), the task scheduling system only receives the server's first heartbeat information. When the client receives and executes the test task issued by the server, it can receive both the server's first heartbeat information and the client's second heartbeat information. When there is a certain order in which the server and client tasks are executed, after the server's test task is completed, the task scheduling system can obtain only the second heartbeat information sent by the client when the client executes the test task.

[0085] S102: Determine the execution status of the test task of the server and / or the client based on the first heartbeat information and / or the second heartbeat information.

[0086] After receiving the first heartbeat information sent by the server and / or the second heartbeat information sent by the client, the task scheduling system can extract relevant information to determine the execution status of the test task currently being executed by the server and / or the client. The execution status may include the task type of the currently executed test task, the relationship between the server's first task and the client's second task, and the execution status of the test task.

[0087] Task types can be categorized by execution order into pre-tasks, post-tasks, and parallel tasks; based on whether the first task on the server is linked to other test tasks on the server or the second task on the client, task types can be categorized into independent tasks (which can be executed separately) and linked tasks; task types can also be categorized by execution steps into installation tasks, running tasks, etc.

[0088] The execution status of a test task can include not executed, executing, and executed. The executed status can include the execution result, which can be either successful or unsuccessful (not executed successfully).

[0089] S103: Perform task scheduling on the server and / or client based on the execution status of the test task.

[0090] Specifically, after determining the execution status of the test tasks on the server and / or client, corresponding task scheduling can be performed based on the execution status. For example, after confirming the successful execution of the first task on the server, the second task on the client, which is linked to the first task, can be determined based on the execution time of the first task, and the second task can be controlled to start execution, achieving automatic and precise execution of each test task. As another example, when the first task on the server and the second task on the client are executing synchronously, the start time of the third task on the server can be determined based on the first execution time of the first task and the second execution time of the second task, and the third task can be controlled to start execution, similarly achieving automatic and precise execution of each test task. Yet another example is that during the execution of the first task on the server, the execution of the second task on the client can be controlled at an appropriate time, thereby improving the overall testing efficiency of both the server and client.

[0091] Optionally, multiple clients can connect to the same server. The task scheduling system can determine the task execution status of all clients. When all test tasks are completed or some test tasks are abnormal, for example, if a client does not report the task execution status to the task scheduling system within a certain preset time period, the client (machine) is considered abnormal, and no further operations are performed on it. A notification message is sent to the server to confirm that the client is abnormal, and a list of clients that have completed the task is sent to the server. This allows the server to verify the test results of the clients that have completed the task so that it can perform subsequent operations. This can effectively avoid the technical problem that if one client cannot complete the test, other clients that have completed the test cannot be verified.

[0092] The task scheduling method provided in this embodiment obtains first heartbeat information sent by the server and / or second heartbeat information sent by the client, determines the execution status of the test tasks of the server and / or the client based on the first heartbeat information and / or the second heartbeat information, and then accurately schedules each test task of the server and / or the client based on the execution status of the test tasks, avoiding situations where the results of automated test cases are inaccurate or the operation is blocked due to unexpected factors; at the same time, dynamic task scheduling can reduce the waiting time of program execution, making automated testing more intelligent and efficient, and saving automated testing time.

[0093] In some embodiments, step S102, determining the execution status of the test task of the server and / or the client based on the first heartbeat information and / or the second heartbeat information, includes:

[0094] 0S1021: Determine the task type of the test task of the server and / or client based on the task identifier carried in the first heartbeat information and / or the second heartbeat information;

[0095] S1022: Determine the execution status of the test task based on the first heartbeat information and / or the second heartbeat information.

[0096] In step S103, task scheduling is performed on the server and / or client based on the execution status of the test task, including:

[0097] S1031: Perform task scheduling based on the task type and the execution status of the test task.

[0098] Specifically, the task type of the current server-side and / or client-side test task can be determined based on the task identifier carried by the first heartbeat information and / or the second heartbeat information. The execution status of the test task can be determined based on the relevant information regarding task execution in the first heartbeat information and / or the second heartbeat information. Then, task scheduling information is determined based on the task type and execution status of the test task, and corresponding task scheduling is performed based on the determined task scheduling information. For example, if it is determined that the first task corresponding to the first heartbeat information is an independent task, and the execution status of the first task is "in progress," and it is determined that the second task corresponding to the second heartbeat information is also an independent task, and the second task has not yet been executed, then it can be determined whether the second task starts execution after the first task is completed, or whether it can be executed simultaneously with the first task, based on whether there is a relationship between the first and second tasks (whether the execution of the second task will affect the execution of the first task). This allows control over the timing of the second task's start. For example, if the execution status of the independently executed second task is determined to be in progress, then the first remaining execution time of the first task and the second remaining execution time of the second task can be obtained. The two remaining execution times can be compared to determine whether it is necessary to wait for the other test task after one test task is completed; or whether the client or server can execute the next test task corresponding to a certain test task after a certain test task is completed in advance.

[0099] It is understood that when the first and second tasks are independent tasks, they can be executed separately on the server or client. However, the first and second tasks, executed separately, may still affect each other. For example, the client's installation task can only be executed after the server has completed the corresponding prerequisite tasks for the prerequisite use cases. The task identifier mentioned above can be a task name or a task characteristic used to characterize the task type, etc., and this disclosure does not specifically limit it.

[0100] Further, in step S1031, task scheduling is performed on the server and / or client based on the execution status of the test task, including:

[0101] S201: Determine that the first task of the server and the second task of the client are both independent tasks, and that the first task and the second task are executed simultaneously;

[0102] S202: Obtain the execution time of the first task and the second task;

[0103] S203: Schedule subsequent test tasks for the server and the client based on the execution time.

[0104] In steps S201 to S203, it is determined that the first task of the server and the second task of the client are both independent tasks, and after the first task and the second task are executed simultaneously, it is possible to obtain...

[0105] The aforementioned execution time can be the execution time of the first task and the second task (which can be the first execution time of the first task and the second execution time of the second task, respectively), or the remaining execution time of the first task and the second task, or the end time of the first task and the second task, etc.; the aforementioned execution time can also be the time difference between the execution of the first task and the second task, etc., so as to facilitate subsequent task scheduling arrangements based on the execution time of different tasks (for example, determining the execution time of the third task corresponding to the first task).

[0106] In some embodiments, step S203, scheduling subsequent test tasks for the server and the client based on the execution time, includes:

[0107] S301: If the end time of the first task is earlier than the end time of the second task, after the first task is completed, control the server to execute an independent third task, wherein the third task is different from the first task;

[0108] S302: If the end time of the first task is later than the end time of the second task, control the client to wait until the first task is completed.

[0109] Since server-side use cases generally have short execution times, if the server finishes executing the first task first, it is controlled to continue executing another independent task (the third task). If the client's second task finishes executing first, the client is notified to wait until the server's second task finishes executing, and then the server is notified to execute the fourth task (e.g., issue a linked task). Then, based on the task type and execution status of the fourth task, the task scheduling information of the client's fifth task is determined, and so on, until all tasks of the server and client are completed.

[0110] In some embodiments, step S1031, which involves scheduling tasks for the server and / or client based on the execution status of the test task, includes:

[0111] S401: Determine that the first task of the server and the second task of the client are linked tasks;

[0112] S402: Obtain the first execution result corresponding to the first task;

[0113] S403: Based on the first execution result, schedule subsequent test tasks for the server and the client.

[0114] When it is determined that the first task on the server and the second task on the client are linked tasks, the corresponding first execution result can be obtained from the first heartbeat information corresponding to the first task, and task scheduling can be performed based on the first execution result. Since the execution of the client's task depends on the task issued by the server, in this embodiment, the task execution of the server and the client can be scheduled and controlled according to the first execution result corresponding to the first task on the server. The first task can be the execution result of a specific linked task, or it can be used to issue the execution result of a linked task to the client.

[0115] It is understood that the first task of the server and the second task of the client are linked tasks, meaning that the first task and the second task require interaction between the server and the client to execute, or the execution of one task depends on the execution result of the other task, and a single server or client cannot complete the first task or the second task.

[0116] In some embodiments, step S404, based on the first execution result, schedules subsequent test tasks for the server and the client, including:

[0117] S501: If the first execution result indicates that the first task has been successfully executed, control the client to execute the second task in conjunction, and monitor the second execution result of the second task;

[0118] S502: If the first execution result indicates that the first task has not been successfully executed, determine whether other linked tasks besides the first task have been completed. If they have been completed, control the server to execute the corresponding first independent task and control the client to execute the corresponding second independent task.

[0119] After the first execution result indicates that the first task has been successfully executed, the client can be notified that the linked task executed on the server has been successfully executed, or that the linked task has been successfully issued. At this time, the client and server can be controlled to execute the second task in conjunction, and the execution status of the second task executed on the client can be monitored. At the same time, the server can be notified to wait for the execution result of the second task or to execute other independent tasks to improve the testing efficiency of the entire testing process. If the first execution result indicates that the first task has not been successfully executed (execution failed), the server is notified to execute other linked tasks that are not strongly related to the first task, and it is determined whether the other linked tasks have been completed. If all linked tasks on the server have been completed, the server is notified to execute the first independent task independently, and the client is notified to execute the second independent task independently. After each linked task has been completed, the server and client are controlled to execute the corresponding independent tasks independently, and each independent task is executed separately to ensure that each linked task is executed effectively while further improving the task execution efficiency. If all linked tasks on the server have not been completed, that is, there are linked tasks that have not been completed, the server can be notified to execute the linked task, and during the execution of the linked task, steps S501 to S502 are repeated. When the first execution result indicates that the first task has not been successfully executed, the client can be notified to wait for the execution results of other linked or independent tasks from the server.

[0120] In some embodiments, the method further includes:

[0121] S601: Determine that both the server and the client are connected to the task scheduling system;

[0122] S602: Control the server to execute the first pre-processing task and control the client to wait;

[0123] S603: Receive the first heartbeat information fed back by the server and the second heartbeat information fed back by the client;

[0124] S604: Determine the execution status of the first task based on the first heartbeat information;

[0125] S605: Determine the execution of the second task of the client based on the execution status of the first task and the second heartbeat information.

[0126] The client-side and server-side scripts executing automated tests need to be registered with the task scheduling system. The task scheduling system notifies the server-side script to start executing pre-test cases (the first pre-test task) and instructs the client to wait. The server-side script executes some pre-test cases and reports the execution results to the task scheduling system in real time along with the first heartbeat message. During the waiting period, the client-side script also sends a second heartbeat message to the task scheduling system to indicate that it is functioning correctly. When the server-side script finishes executing the pre-test cases, it reports the execution results of the first task to the task scheduling system along with the first heartbeat message. If the task scheduling system determines that some pre-test cases have failed, it notifies both the server-side and client-side scripts that this round of automated testing has failed and ends. If the task scheduling system determines that all pre-test cases have executed successfully, it notifies the client-side script to start executing the client installation task (the second task). The client-side script executes the client installation task based on the client's status (idle state in the waiting state) in the second heartbeat message and notifies the server to execute some other independent tasks (the third task) to save overall testing time.

[0127] In some embodiments, the method further includes:

[0128] S104: After all test tasks on the server and the client have been completed, the task execution results of the server and the client are integrated to generate corresponding script test results.

[0129] After all tasks on the server and client have been completed through steps S101 to S103, the task scheduling system can summarize the task execution results of the server and client respectively (regardless of whether the task was successfully executed), and obtain the final script test results based on the summarized execution results from both ends. Then, the script test results are sent to the server and client so that the server and client can understand the relevant test results, which will facilitate the subsequent optimization and upgrade of the client product.

[0130] To further illustrate this disclosure, the following will describe it further through embodiments of the server-client interaction process.

[0131] like Figure 2As shown, the task scheduling system first controls the server to execute the pre-existing test cases through steps S601 to S605. Then, based on the execution result of the pre-existing test cases, it determines the execution result of the server's first task. After the server successfully executes the first task (pre-existing test cases), it controls the client to execute the second task (client installation task) and controls the server to execute some other independent tasks (other first tasks). The task scheduling system receives task execution status reports from each client and server script via heartbeat information in real time or at regular intervals. Through step S203, it dynamically determines the next task instruction based on the task execution status. Since the server-side test cases generally have a short execution time, in step S301, if the server finishes first, it notifies the server to continue executing the independent first task (independent test cases); in step S302, if the client-side test cases finish first, it notifies the client to wait until the server-side test cases finish executing, and then notifies the server to execute the distributed linkage task. The server reports the execution result of the linked task to the task scheduling system along with the first heartbeat information. The task scheduling system judges the execution result through steps S501 and S502. If the task execution fails, it notifies the server to perform other linked tasks that are not strongly related to this task and notifies the client to wait. If the execution is successful, it notifies the client that the task was successfully issued and that it can start monitoring the client's task execution status and notifies the server to wait or execute other independent tasks. Each client monitors the execution status of the linked task locally and reports the status to the task scheduling system along with the second heartbeat information. When the task scheduling system determines that all clients have completed execution (regardless of success or failure, if the second heartbeat information is not reported within a certain period of time, it is considered a timeout failure), it sends the list of clients that have successfully executed and the corresponding test task clients to the server, allowing the server to verify the task results of the machines in the list of successfully executed clients for subsequent task issuance. The above steps are executed repeatedly until all tasks have been completed. Then, the task scheduling system integrates the task execution results of the server and the clients to generate the corresponding script test results.

[0132] For example, in one specific embodiment, in a C / S architecture product, the server must first execute task A (first task) independently before the client can execute installation task a (second task); the tasks that the server can execute also include: task B, which can be executed independently; task C, which needs to be completed by interacting with the client; and task D, which depends on the execution result of task C. The second task that the client can execute also includes: task b, which can be executed independently; task C, which needs to be completed by interacting with the server; and task D, which depends on the execution result of task C.

[0133] When the server and client connect to the task scheduling system and execute automated tests, both the server and client register with the task scheduling system. At this time, the scheduling system notifies the server to execute task A and instructs the client to wait. The server reports the execution status of task A to the scheduling system in real time (in progress, successful, failed). When the task scheduling system receives a notification from the server that task A has been successfully executed, it notifies the server that independent task B can continue to be executed, and simultaneously notifies the client that installation task a can be executed. The server and client report the execution status of task B and task a in real time (in progress, successful, failed). Based on the received execution status, the task scheduling system dynamically determines the next task instruction to be issued.

[0134] (1) First, receive the execution result of task B completed from the server. If there are still clients reporting that task a is being installed, notify the server to wait until all clients have reported that task a has been completed (regardless of success or failure; if a client does not report the execution result to the execution system for a period of time, it is considered as execution failure). Then, notify the server to execute task C.

[0135] A. If task C fails, the scheduling system notifies the client to execute task b and notifies the server that automated use case D does not need to be executed, and the result is directly set to failure.

[0136] B. If task C executes successfully, the scheduling system notifies the client that task C has been issued. Upon receiving this notification, the client checks the execution status of task C in real time and reports it to the scheduling system. Once all clients have reported their execution results (regardless of success or failure; if a client fails to report its results to the execution system within a certain period, it is considered a failure), the scheduling system sends a list of successfully executed clients to the server and notifies the server to check the execution status of task C. It also notifies the clients to execute task b. After the server finishes executing task C, it determines the execution result of task C:

[0137] a. If the result check of task C is successful, wait until all clients have reported the execution results (regardless of whether the execution was successful or failed, if a client does not report the execution result to the execution system for a period of time, it is considered as execution failure), and then notify the server to execute task D.

[0138] b. If the result check of task C fails, notify the server and client that task D does not need to be executed / checked and should be directly judged as failed.

[0139] (2) If all clients have completed the execution of task a, wait until the server has completed the execution of task B, and then notify the server to execute task C. The other scenarios are the same as described in (1) above, and will not be repeated here.

[0140] Figure 3This is a schematic diagram of the structure of a task scheduling system according to an embodiment of this disclosure. Figure 3 As shown, based on the above-described task scheduling method, this disclosure also provides a task scheduling system, including:

[0141] The receiving module 10 is configured to receive the first heartbeat information sent by the server and / or the second heartbeat information sent by the client;

[0142] The determination module 20 is configured to determine the execution status of the test task of the server and / or the client based on the first heartbeat information and / or the second heartbeat information;

[0143] The scheduling module 30 is configured to schedule tasks for the server and / or client based on the execution status of the test tasks.

[0144] In some embodiments, the determining module 20 is further configured to:

[0145] Determining the execution status of the test task of the server and / or the client based on the first heartbeat information and / or the second heartbeat information includes:

[0146] The task type of the test task of the server and / or client is determined based on the task identifier carried in the first heartbeat information and / or the second heartbeat information;

[0147] The execution status of the test task is determined based on the first heartbeat information and / or the second heartbeat information.

[0148] In some embodiments, the scheduling module 30 is further configured as follows:

[0149] Task scheduling is performed based on the task type and the execution status of the test task.

[0150] In some embodiments, the scheduling module 30 is further configured as follows:

[0151] It is determined that the first task of the server and the second task of the client are both independent tasks, and the first task and the second task are executed simultaneously;

[0152] Obtain the execution times of the first task and the second task;

[0153] The subsequent test tasks for the server and the client are scheduled based on the execution time.

[0154] In some embodiments, the scheduling module 30 is further configured as follows:

[0155] If the end time of the first task is earlier than the end time of the second task, after the first task is completed, the server is controlled to execute an independent third task, wherein the third task is different from the first task.

[0156] If the end time of the first task is later than the end time of the second task, the client is instructed to wait until the first task is completed.

[0157] In some embodiments, the scheduling module 30 is further configured as follows:

[0158] The server's first task and the client's second task are determined to be linked tasks;

[0159] Obtain the first execution result corresponding to the first task;

[0160] Based on the first execution result, subsequent test tasks for the server and the client are scheduled.

[0161] In some embodiments, the scheduling module 30 is further configured as follows:

[0162] If the first execution result indicates that the first task has been successfully executed, the client is controlled to execute the second task in conjunction with it, and the second execution result of the second task is monitored;

[0163] If the first execution result indicates that the first task was not successfully executed, determine whether other linked tasks besides the first task have been completed. If they have been completed, control the server to execute the corresponding first independent task and control the client to execute the corresponding second independent task.

[0164] In some embodiments, the scheduling module 30 is further configured to:

[0165] It is confirmed that both the server and the client are connected to the task scheduling system;

[0166] Control the server to execute the first pre-processing task, and control the client to wait;

[0167] Receive the first heartbeat information fed back by the server and the second heartbeat information fed back by the client;

[0168] The execution status of the first task is determined based on the first heartbeat information;

[0169] The execution of the client's second task is determined based on the execution status of the first task and the second heartbeat information.

[0170] In some embodiments, a test result generation module is also included, configured as follows:

[0171] After all test tasks on the server and client have been completed, the task execution results on the server and client are integrated to generate corresponding script test results.

[0172] It should be noted that the task scheduling system provided in this disclosure corresponds to the task scheduling method in the above embodiments. Based on the task scheduling method described above, those skilled in the art can understand the specific implementation of the task scheduling system in this disclosure and its various variations. Any option in the task scheduling method embodiments is also applicable to the task scheduling system, and will not be repeated here.

[0173] This disclosure also provides an electronic device, including at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program in the memory.

[0174] In some embodiments, the processor executing the computer program may be a processing device that includes one or more general-purpose processing devices, such as a microprocessor, a central processing unit (CPU), a graphics processing unit (GPU), etc. More specifically, the processor may be a Complex Instruction Set Computing (CISC) microprocessor, a Reduced Instruction Set Computing (RISC) microprocessor, a Very Long Instruction Word (VLIW) microprocessor, a processor that runs other instruction sets, or a processor that runs a combination of instruction sets. The processor may also be one or more special-purpose processing devices, such as an Application-Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), a System-on-Chip (SoC), etc.

[0175] The memory may be a read-only memory (ROM), random access memory (RAM), phase-change random access memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), electrically erasable programmable read-only memory (EEPROM), other types of random access memory (RAM), flash drives or other forms of flash memory, cache, registers, static memory, optical disc read-only memory (CD-ROM), digital versatile optical disc (DVD) or other optical storage, magnetic tape cassette or other magnetic storage device, or any other possible non-transitory medium used to store information or instructions that can be accessed by computer equipment.

[0176] Those skilled in the art will understand that electronic devices may include more or fewer components, for example, they may also include communication interfaces, or combine certain components, or have different component arrangements.

[0177] The electronic devices disclosed herein may include, but are not limited to, fixed terminal devices such as servers, desktop computers, and digital TVs, as well as mobile terminal devices such as in-vehicle devices (e.g., HUD devices), handheld devices (e.g., mobile phones, tablets, etc.), and wearable devices (e.g., smartwatches, smart bracelets, etc.).

[0178] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0179] The computer-readable storage medium of this disclosure can be any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device; for example, it can be the memory described above.

[0180] The computer programs of embodiments of this disclosure can be organized into one or more computer-executable components or modules. Various aspects of this disclosure can be implemented with any number and combination of such components or modules. For example, aspects of this disclosure are not limited to the specific computer-executable instructions or particular components or modules shown in the drawings and described herein. Other embodiments may include different computer-executable instructions or components having more or fewer functions than those shown and described herein.

[0181] The above embodiments are merely exemplary embodiments of this disclosure and are not intended to limit this disclosure. The scope of protection of this disclosure is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this disclosure within its substance and scope, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this disclosure.

Claims

1. A task scheduling method, characterized in that, The method is applied to a task scheduling system that connects a server and a client. The method includes: Receive the first heartbeat information sent by the server and the second heartbeat information sent by the client; The execution status of the test tasks of the server and the client is determined based on the first heartbeat information and the second heartbeat information, wherein the execution status of the test tasks includes the task type and the execution status of the test tasks; Task scheduling is performed on the server and / or client based on the execution status of the test tasks; The step of scheduling tasks for the server and / or client based on the execution status of the test tasks includes: The server's first task and the client's second task are determined to be linked tasks; Obtain the first execution result corresponding to the first task; Based on the first execution result of the first task, subsequent test tasks for the server and the client are scheduled; If the first execution result indicates that the first task was successfully executed, the client is controlled to execute the second task in conjunction with it, and the second execution result of the second task is monitored; if the first execution result indicates that the first task was not successfully executed, it is determined whether other linked tasks besides the first task have been completed. If they have been completed, the server is controlled to execute the corresponding first independent task, and the client is controlled to execute the corresponding second independent task. The step of determining the execution status of the test tasks of the server and the client based on the first heartbeat information and the second heartbeat information includes: The task type of the test task for the server and client is determined based on the task identifier carried in the first heartbeat information and the second heartbeat information; The execution status of the test task is determined based on the first heartbeat information and the second heartbeat information; The method further includes: It is confirmed that both the server and the client are connected to the task scheduling system; Control the server to execute the first pre-processing task and control the client to wait; Receive the first heartbeat information fed back by the server and the second heartbeat information fed back by the client; The execution status of the first task is determined based on the first heartbeat information; The execution of the client's second task is determined based on the execution status of the first task and the second heartbeat information.

2. The method according to claim 1, characterized in that, Based on the execution status of the test tasks, task scheduling is performed on the server and / or client, including: It is determined that the first task of the server and the second task of the client are both independent tasks, and the first task and the second task are executed simultaneously; Obtain the execution times of the first task and the second task; The subsequent test tasks for the server and the client are scheduled based on the execution time.

3. The method according to claim 2, characterized in that, The subsequent test tasks for the server and the client are scheduled based on the execution time, including: If the end time of the first task is earlier than the end time of the second task, after the first task is completed, the server is controlled to execute an independent third task, wherein the third task is different from the first task. If the end time of the first task is later than the end time of the second task, the client is instructed to wait until the first task is completed.

4. The method according to claim 1, characterized in that, The method further includes: After all test tasks on the server and client have been completed, the task execution results on the server and client are integrated to generate corresponding script test results.

5. A task scheduling system, characterized in that, include: The receiving module is configured to receive the first heartbeat information sent by the server and the second heartbeat information sent by the client; The determination module is configured to determine the execution status of the test tasks of the server and the client based on the first heartbeat information and the second heartbeat information, wherein the execution status of the test tasks includes the task type and the execution status of the test tasks; The scheduling module is configured to schedule tasks for the server and / or client based on the execution status of the test tasks. The scheduling module is also configured to: The server's first task and the client's second task are determined to be linked tasks; Obtain the first execution result corresponding to the first task; Based on the first execution result of the first task, subsequent test tasks for the server and the client are scheduled; If the first execution result indicates that the first task was successfully executed, the client is controlled to execute the second task in conjunction with it, and the second execution result of the second task is monitored; if the first execution result indicates that the first task was not successfully executed, it is determined whether other linked tasks besides the first task have been completed. If they have been completed, the server is controlled to execute the corresponding first independent task, and the client is controlled to execute the corresponding second independent task. The determining module is further configured to: The task type of the test task for the server and client is determined based on the task identifier carried in the first heartbeat information and the second heartbeat information; The execution status of the test task is determined based on the first heartbeat information and the second heartbeat information; The scheduling module is also configured to: It is confirmed that both the server and the client are connected to the task scheduling system; Control the server to execute the first pre-processing task and control the client to wait; Receive the first heartbeat information fed back by the server and the second heartbeat information fed back by the client; The execution status of the first task is determined based on the first heartbeat information; The execution of the client's second task is determined based on the execution status of the first task and the second heartbeat information.

Citation Information

Patent Citations

  • Heartbeat message sending method, device and system

    CN104301423A

  • Distributed automation software testing method and system

    CN106970880A

  • Monitoring system of presto cluster

    CN109977161A

  • High-availability task scheduling method based on distributed peer-to-peer architecture design

    CN113032110A