A test task scheduling method and related equipment

By obtaining the test attributes and the number of tests of the test task, deciding whether to add or discard the test task, the problem of waiting time due to backlog of test tasks is solved, and the test effect is improved.

CN114625511BActive Publication Date: 2024-11-29BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210278732.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-21
Publication Date
2024-11-29
Estimated Expiration
2042-03-21

AI Technical Summary

Technical Problem

In some application fields, the phenomenon of backlog of test tasks often leads to the waiting time of test tasks that will affect the test results.

Method used

By obtaining the test attributes of the test task when receiving a new test task enqueue request, determining the number of tests that have been tested by the test object, and determining whether to add the task to the test task queue or discard the task based on the preset threshold.

Benefits of technology

It effectively reduces the waiting time of the test task, improves the testing effect of the test task, and avoids the phenomenon of the waiting time of other test tasks due to frequent execution of the test task of a certain test object.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114625511B_ABST
    Figure CN114625511B_ABST
Patent Text Reader

Abstract

The present application discloses a test task scheduling method and related equipment, the method comprising: after receiving a new task queue entry request triggered for a new test task, first obtaining the test attributes of the new test task; then determining the number of times the test object has been tested based on the test attributes; finally, judging whether the number of times the test has been tested exceeds a preset number threshold, if not, the new test task can be directly added to the test task queue, so that the test process for the test object can be implemented by automatically executing the new test task later; however, if it exceeds the preset number threshold, the new test task can be directly discarded to avoid the test task for the test object from occupying the test resources again, so that the phenomenon of other test tasks waiting for too long due to frequent execution of test tasks for a certain test object can be effectively avoided, thereby effectively improving the test effects of these test tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a test task scheduling method and related equipment. Background Art

[0002] With the development of automatic testing technology, its application fields are becoming more and more extensive.

[0003] At present, in some application fields, a large number of test tasks usually need to be executed, which easily leads to a backlog of test tasks, and thus the test effects of some test tasks are relatively poor due to the long waiting time of some test tasks. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides a test task scheduling method and related equipment, which can effectively reduce the waiting time of some test tasks, thereby effectively improving the test effects of these test tasks.

[0005] In order to achieve the above purpose, the technical solutions provided by the embodiments of the present application are as follows:

[0006] The present application provides a test task scheduling method, the method comprising:

[0007] After receiving a new task queue entry request triggered by a new test task, obtaining a test attribute of the new test task; wherein the test attribute is used to describe a test object of the new test task;

[0008] Determining the number of times the test object has been tested according to the test attribute;

[0009] When it is determined that the number of tests has exceeded a preset number threshold, the new test task is abandoned;

[0010] When it is determined that the number of tests does not exceed a preset number threshold, the new test task is added to a test task queue.

[0011] In a possible implementation manner, determining the number of times the test object has been tested according to the test attribute includes:

[0012] The statistical number of test tasks corresponding to the test attribute is queried from a pre-constructed mapping relationship to obtain the number of times the test object has been tested; wherein the mapping relationship includes a correspondence between the test attribute and the number of times the test object has been tested.

[0013] In a possible implementation, the method further includes:

[0014] Obtain the current queue length of the test task queue;

[0015] When it is determined that the current queue length exceeds a preset length threshold, abandoning the new test task;

[0016] When it is determined that the number of tests does not exceed a preset number threshold, adding the new test task to the test task queue includes:

[0017] When it is determined that the number of tests does not exceed the preset number threshold and when it is determined that the current queue length does not exceed the preset length threshold, the new test task is added to the test task queue.

[0018] In a possible implementation, obtaining the current queue length of the test task queue includes:

[0019] The predicted execution times of all tasks in the test task queue are added together to obtain the current queue length of the test task queue.

[0020] In a possible implementation, the method further includes:

[0021] When it is determined that the test attribute of the new test task is the same as the test attribute of the task to be deleted in the test task queue, the task to be deleted is deleted from the test task queue.

[0022] In a possible implementation manner, adding the new test task to the test task queue includes:

[0023] According to the queue position of the task to be deleted, the new test task is added to the test task queue.

[0024] In a possible implementation manner, after adding the new test task to the test task queue, the method further includes:

[0025] Determine the current weight value of each task in the test task queue;

[0026] According to the current weight value of each task in the test task queue, the queue position of each task in the test task queue is updated.

[0027] In one possible implementation, the test task queue includes N tasks; the current weight value of the nth task is determined based on the predicted execution time of the nth task, the current waiting time of the nth task, and the test attribute coefficient of the nth task; wherein the test attribute coefficient of the nth task is used to indicate the importance of the test object of the nth task; n is a positive integer, n≤N, and N is a positive integer.

[0028] The present application provides a test task scheduling device, including:

[0029] An attribute acquisition unit, configured to acquire a test attribute of a new test task after receiving a new task queue entry request triggered by the new test task; wherein the test attribute is used to describe a test object of the new test task;

[0030] A times determination unit, used to determine the number of times the test object has been tested according to the test attribute;

[0031] A task abandoning unit, used to abandon the new test task when it is determined that the number of tests has exceeded a preset number threshold;

[0032] The task enqueuing unit is used to add the new test task to the test task queue when it is determined that the number of tests done does not exceed a preset number threshold.

[0033] An embodiment of the present application provides a device, the device comprising a processor and a memory:

[0034] The memory is used to store computer programs;

[0035] The processor is used to execute any implementation of the test task scheduling method provided in the embodiments of the present application according to the computer program.

[0036] An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and the computer program is used to execute any implementation of the test task scheduling method provided in the embodiment of the present application.

[0037] An embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes any implementation of the test task scheduling method provided in the embodiment of the present application.

[0038] Compared with the prior art, the embodiments of the present application have at least the following advantages:

[0039] In the technical solution provided by the embodiment of the present application, after receiving a new task queue request triggered by a new test task, the test attribute of the new test task is first obtained, so that the test attribute is used to describe the test object of the new test task (for example, XXX application); then, according to the test attribute, the number of times the test object has been tested is determined, so that the number of times the test object has been tested can represent the frequency of testing for the test object; finally, it is determined whether the number of times the test object has been tested exceeds a preset number threshold. If it does not exceed the preset number threshold, it can be determined that the test for the test object is not frequent, so the new test task can be directly added to the test task queue, so that it can be automatically executed later. The test process for the test object is implemented by means of a new test task; however, if the preset number of times exceeds the threshold, it can be determined that the test for the test object is too frequent, so the new test task can be directly discarded (that is, the new test task is refused to be added to the test task queue) to avoid the test task for the test object occupying the test resources again. This can effectively reduce the frequency of testing for the test object, thereby effectively avoiding the phenomenon that other test tasks have to wait too long due to frequent execution of test tasks for a certain test object, and then effectively reduce the waiting time of these test tasks, so as to effectively improve the test effect of these test tasks. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 A flowchart of a test task scheduling method provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of the engineering architecture of a test task scheduling system provided in an embodiment of the present application;

[0043] Figure 3 A schematic diagram of the structure of a test task scheduling device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In the research on test tasks, the inventor found that due to the high triggering frequency of test tasks for a certain test object (for example, the YYY application), the test tasks for this test object occupied a large amount of test resources, which easily led to a longer waiting time for test tasks for other test objects, thus easily resulting in poor test effects of some test tasks due to the long waiting time of these test tasks.

[0045] Based on the above findings, in order to solve the technical problems shown in the background technology part, the embodiment of the present application provides a test task scheduling method, which may specifically include: after receiving a new task queue entry request triggered by a new test task, first obtain the test attributes of the new test task, so that the test attributes are used to describe the test object of the new test task (for example, XXX application); then determine the number of times the test object has been tested based on the test attributes, so that the number of times the test object has been tested can represent the frequency of testing for the test object; finally, determine whether the number of times the test object has been tested exceeds a preset number threshold. If it does not exceed the preset number threshold, it can be determined that the test for the test object is not frequent, so the new test task can be directly added to the test queue. test task queue, so that the test process for the test object can be implemented later by automatically executing the new test task; however, if the preset number of times exceeds the threshold, it can be determined that the test for the test object is too frequent, so the new test task can be directly discarded (that is, the new test task is refused to be added to the test task queue) to avoid the test task for the test object occupying test resources again, which can effectively reduce the frequency of testing for the test object, thereby effectively avoiding the phenomenon that other test tasks have to wait too long due to frequent execution of test tasks for a certain test object, and then effectively reduce the waiting time of these test tasks, so as to effectively improve the test effect of these test tasks.

[0046] In addition, the embodiment of the present application does not limit the execution subject of the test task scheduling method. For example, the test task scheduling method provided in the embodiment of the present application can be applied to data processing devices such as terminal devices or servers. Among them, the terminal device can be a smart phone, a computer, a personal digital assistant (PDA) or a tablet computer. The server can be an independent server, a cluster server or a cloud server.

[0047] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0048] Method Example 1

[0049] See also Figure 1 , which is a flowchart of a test task scheduling method provided in an embodiment of the present application.

[0050] The test task scheduling method provided in the embodiment of the present application includes S1-S5:

[0051] S1: After receiving a new task queue request triggered by a new test task, obtain the test attributes of the new test task.

[0052] The new test task refers to a newly triggered test task, and the new test task is used to perform functional testing on the target object. It can be seen that the test object of the new test task is the target object.

[0053] It should be noted that the embodiments of the present application do not limit the above-mentioned "target object". For example, it can specifically be an application (Application, APP).

[0054] The new task enqueue request is used to request that a new test task be added to the test task queue so that functional testing of the target object can be implemented later by automatically executing the new test task.

[0055] In addition, the embodiment of the present application does not limit the triggering method of the new task queue request. For example, any existing or future method that can trigger the new task queue request can be implemented.

[0056] The above-mentioned “test attributes of the new test task” are used to describe the test object of the new test task (that is, the “target object” above); and the embodiment of the present application does not limit the “test attributes of the new test task”. For example, when the above-mentioned “test object of the new test task” is an application (for example, XXX application), the “test attributes of the new test task” can be the name identifier of the application (for example, XXX).

[0057] In addition, the embodiment of the present application does not limit the method for obtaining the above-mentioned "test attributes of the new test task". For ease of understanding, the following is an explanation combining two situations.

[0058] In case 1, when the above-mentioned "new task queue request" carries the task identifier of the new test task, the acquisition process of the "test attribute of the new test task" can be specifically: querying the test attribute corresponding to the task identifier from the pre-built information database to obtain the test attribute of the new test task. The information database is used to record relevant information (e.g., test attributes, etc.) of a large number of test tasks.

[0059] Case 2, when the above-mentioned "new task queue request" carries the test attributes of the new test task, the acquisition process of the "test attributes of the new test task" may specifically be: extracting the test attributes of the new test task from the new task queue request.

[0060] Based on the relevant content of S1 above, it can be known that after receiving the new task enqueue request triggered by the new test task, it can be known that the new test task has applied to enter the test task queue. At this time, in order to avoid introducing those high-frequency triggered test tasks into the test task queue, the test attributes of the new test task can be obtained first, so that it can be judged whether the new test task belongs to a high-frequency triggered test task based on the test attributes.

[0061] S2: Determine the number of times the test object of the new test task has been tested according to the test attribute of the new test task.

[0062] Among them, the number of tests refers to the number of tests that have been completed for the above-mentioned "test object of the new test task", so that the "number of tests" can indicate the frequent testing procedure for the "test object of the new test task", so that the "number of tests" can characterize whether the new test task belongs to a high-frequency triggered test task.

[0063] In addition, the embodiment of the present application does not limit the implementation method of S2. For example, it can be specifically: counting the number of test tasks for the "test object of the new test task" in the historical time period, and determining the number of times the test object of the new test task has been tested. The historical time period refers to the preset time before the triggering moment of the above-mentioned "new task queue request".

[0064] It should be noted that the embodiments of the present application do not limit the above-mentioned "preset duration", for example, it can be pre-set according to the application scenario.

[0065] In fact, in order to improve the efficiency of obtaining the above-mentioned "number of times the test object of the new test task has been tested", the embodiment of the present application also provides another possible implementation of S2, which can be specifically: querying the statistical number of test tasks corresponding to the above-mentioned "test attributes of the new test task" from the pre-constructed mapping relationship to obtain the number of times the test object of the new test task has been tested.

[0066] The above-mentioned "mapping relationship" is used to record the statistical quantity of test tasks corresponding to each candidate test attribute; and the embodiment of the present application does not limit the "mapping relationship", for example, it may specifically include: the correspondence between the first candidate test attribute and the statistical quantity of the first test task; the correspondence between the second candidate test attribute and the statistical quantity of the second test task; ... (and so on); the correspondence between the Mth candidate test attribute and the statistical quantity of the Mth test task.

[0067] It can be seen that after the test attributes of the new test task are obtained, the "test attributes of the new test task" can be matched with the M candidate test attributes in the mapping relationship, so that after determining that the "test attributes of the new test task" successfully matches the mth candidate test attribute, the number of mth test tasks corresponding to the mth candidate test attribute is counted and determined as the number of times the test object of the new test task has been tested. It can be seen that the above "mapping relationship" includes the corresponding relationship between the above "test attributes of the new test task" and the number of times the test object of the new test task has been tested. Wherein, m is a positive integer, m∈{1, 2, 3, ..., M}.

[0068] In addition, the embodiments of the present application do not limit the update timing of the above-mentioned "mapping relationship". For example, it can be that after each execution of a test task is completed, the mapping relationship is updated according to the test attributes of the test task, which can improve the real-time performance of the mapping relationship.

[0069] Based on the relevant content of S2 above, it can be known that after obtaining the test attributes of the new test task, you can refer to the test attributes to query the number of times the test object of the new test task has been tested, so that the number of times tested can represent the frequent test procedures for the "test object of the new test task", so that the number of times tested can characterize whether the new test task is a high-frequency triggered test task.

[0070] S3: Determine whether the number of times the test object of the new test task has been tested exceeds a preset number threshold. If so, execute S4; if not, execute S5.

[0071] Among them, the preset number threshold can be preset.

[0072] S4: Abandon the new test task.

[0073] In an embodiment of the present application, after determining that the number of times the test object of the new test task has been tested exceeds a preset number threshold, it can be determined that the test on the test object is too frequent, and thus it can be determined that the new test task is a high-frequency triggered test task, so the new test task can be directly discarded (that is, refusing to add the new test task to the test task queue) to avoid the test task for the test object occupying test resources again, which can effectively reduce the frequency of testing on the test object, thereby effectively avoiding the phenomenon that other test tasks have to wait too long due to frequent execution of test tasks for a certain test object, and then effectively reduce the waiting time of these test tasks, so as to effectively improve the test effect of these test tasks.

[0074] S5: Add the new test task to the test task queue.

[0075] In an embodiment of the present application, after determining that the number of times the test object of the new test task has been tested is lower than or equal to a preset number threshold, it can be determined that the test on the test object is not frequent, and thus it can be determined that the new test task does not belong to a high-frequency triggered test task. Therefore, the new test task can be directly added to the test task queue (for example, the new test task can be directly added to the tail of the test task queue) so that the purpose of automatically executing the new test task can be achieved subsequently by automatically executing each task in the test task queue from beginning to end.

[0076] Based on the relevant contents of S1 to S5 above, it can be known that for the test task scheduling method provided in the embodiment of the present application, after receiving a new task queue entry request triggered by a new test task, the test attributes of the new test task are first obtained, so that the test attributes are used to describe the test object of the new test task (for example, XXX application); then, based on the test attributes, the number of times the test object has been tested is determined, so that the number of times the test object has been tested can represent the frequency of testing of the test object; finally, it is determined whether the number of times the test has been tested exceeds a preset number threshold. If it does not exceed the preset number threshold, it can be determined that the test of the test object is not frequent, so the new test task can be directly added to the test task queue. Then, the test process for the test object can be implemented by automatically executing the new test task; however, if the preset number threshold is exceeded, it can be determined that the test for the test object is too frequent, so the new test task can be directly discarded (that is, the new test task is refused to be added to the test task queue) to avoid the test task for the test object occupying test resources again. This can effectively reduce the frequency of testing for the test object, thereby effectively avoiding the phenomenon that other test tasks have to wait too long due to frequent execution of test tasks for a certain test object, and then effectively reduce the waiting time of these test tasks, so as to effectively improve the test effect of these test tasks.

[0077] Method Example 2

[0078] In fact, in order to better avoid the backlog of test tasks, the queue length of the test task queue can be controlled. Based on this, the embodiment of the present application also provides another possible implementation method of the test task scheduling method, which can specifically include steps 11 to 17:

[0079] Step 11: Receive a new task queue request triggered by a new test task.

[0080] It should be noted that for the relevant content of step 11, please refer to the relevant content of "New task joining request" in S1 above.

[0081] Step 12: Get the current queue length of the test task queue.

[0082] The current queue length refers to the queue length of the test task queue as of the triggering moment of the above-mentioned “new task queue entry request”.

[0083] In addition, the embodiments of the present application do not limit the determination process of the above-mentioned "current queue length". For example, the number of tasks in the test task queue can be determined as the current queue length.

[0084] In addition, in order to further improve the accuracy of the above-mentioned "current queue length", the embodiment of the present application also provides another possible implementation of step 12, which can be specifically: adding up the predicted execution time of all tasks in the test task queue to obtain the current queue length of the test task queue.

[0085] The above-mentioned "predicted execution time" is used to indicate the predicted execution time consumption for a test task; and the embodiment of the present application does not limit the determination process of the "predicted execution time", for example, it can be pre-set, or it can be implemented with the help of a pre-built machine learning model with execution time prediction function for test tasks.

[0086] Step 13: When it is determined that the current queue length of the test task queue exceeds a preset length threshold, the new test task is discarded.

[0087] In an embodiment of the present application, when it is determined that the current queue length of the test task queue exceeds a preset length threshold, it can be determined that there are too many test tasks waiting to be executed. Therefore, in order to avoid serious test task backlogs in the test task queue, new test tasks can be directly discarded (that is, new test tasks are refused to be added to the test task queue). This can effectively avoid the test task backlog caused by the test task queue being too long, thereby effectively avoiding the phenomenon of certain test tasks waiting for too long due to the test task queue being too long, and then effectively reducing the waiting time of these test tasks, so as to effectively improve the test effect of these test tasks.

[0088] It should be noted that the execution time of step 12-step 13 is later than the execution time of step 11, and the embodiment of the present application does not limit the specific execution time of the above steps 12-step 13.

[0089] Step 14: Get the test properties of the new test task.

[0090] It should be noted that for the relevant content of step 14, please refer to the relevant content of "Test properties of new test task" in S1 above.

[0091] Step 15: According to the test attribute of the new test task, determine the number of times the test object of the new test task has been tested.

[0092] It should be noted that for the relevant content of step 15, please refer to the relevant content of S2 above.

[0093] Step 16: When it is determined that the number of times the test object of the new test task has been tested exceeds a preset number threshold, the new test task is discarded.

[0094] It should be noted that for the relevant content of step 16, please refer to the relevant content of S4 above.

[0095] It should also be noted that the execution time of steps 14 to 16 is later than the execution time of step 11, and the embodiment of the present application does not limit the specific execution time of the above steps 14 to 16.

[0096] Step 17: When it is determined that the number of times the test object of the new test task has been tested does not exceed the preset number threshold, and when it is determined that the current queue length of the test task queue does not exceed the preset length threshold, the new test task is added to the test task queue.

[0097] In an embodiment of the present application, after determining that the number of times the test object of the new test task has been tested is lower than or equal to the preset number threshold, and determining that the current queue length of the test task queue is lower than or equal to the preset length threshold, it can be determined that the new test task does not belong to a high-frequency triggered test task, and it can be determined that there are not many test tasks waiting to be executed, so the new test task can be directly added to the test task queue (for example, the new test task can be directly added to the tail of the test task queue) so that the purpose of automatically executing the new test task can be achieved subsequently by automatically executing each task in the test task queue from beginning to end.

[0098] Based on the relevant contents of steps 11 to 16 above, it can be known that for the test task scheduling method provided in the embodiment of the present application, after receiving a new task queue entry request triggered for a new test task, it is possible to simultaneously refer to the number of times the test object of the new test task has been tested and the current queue length of the test task queue to determine whether to add the new test task to the test task queue. This can effectively avoid the occurrence of test task backlogs, thereby effectively reducing the waiting time of some test tasks, and further effectively improving the test effects of these test tasks.

[0099] Method Example 3

[0100] In addition, in order to further save test resources, the embodiment of the present application also provides another possible implementation of the test task scheduling method. In this implementation, in addition to the above steps (for example, S1-S5 or steps 11-16), the test task scheduling method may also include S6:

[0101] S6: When it is determined that the test attribute of the new test task is the same as the test attribute of the task to be deleted in the test task queue, the task to be deleted is deleted from the test task queue.

[0102] The tasks to be deleted refer to tasks existing in the test task queue that have the same test attributes as the new test task.

[0103] In addition, the embodiment of the present application does not limit the determination process of the above-mentioned "task to be deleted". For example, when the test task queue includes Q tasks, the determination process of the "task to be deleted" may specifically include: judging whether the test attributes of the qth task in the test task queue are the same as the test attributes of the new test task. If they are the same, it can be determined that the qth task and the new test task have the same test attributes, so that it can be determined that the qth task and the new test task are both functionally tested for the same test object, so the qth task can be marked as a task to be deleted so that the task to be deleted can be deleted from the test task queue later; however, if they are different, it can be determined that the qth task and the new test task have different test attributes, so that it can be determined that the qth task and the new test task are functionally tested for different test objects, so there is no need to mark the qth task. Wherein, q is a positive integer, q≤Q, and Q is a positive integer.

[0104] In addition, the execution time of S6 is later than that of S1 above (or, step 14 above); and the embodiment of the present application does not limit the specific execution time of S6.

[0105] Based on the relevant content of S6 above, it can be known that for the test task scheduling method provided in the embodiment of the present application, after obtaining the test attributes of the new test task, it is determined whether there is already a task with the test attributes in the test task queue. If so, the task with the test attributes already existing in the test task queue can be directly deleted. This can effectively avoid the appearance of two tasks for the target object in the test task queue after the new test task is added to the test task queue, thereby effectively avoiding the test process for the target object from occupying too many test resources, and then effectively reducing the waiting time of certain test tasks, so as to effectively improve the test effect of these test tasks.

[0106] In fact, in order to further reduce the waiting time of the new test task, the embodiment of the present application also provides another possible implementation of the test task scheduling method. In this implementation, in addition to the above steps (for example, S1-S6; or, steps 11-16, S6), the test task scheduling method may also include S7:

[0107] S7: Add the new test task to the test task queue according to the queue position of the task to be deleted.

[0108] The queue position of the task to be deleted refers to the arrangement position of the task to be deleted in the test task queue before the task to be deleted is deleted from the test task queue.

[0109] Based on the relevant content of S7 above, it can be known that for the test task scheduling method provided in the embodiment of the present application, when it is determined that there is a task to be deleted in the test task queue, the queue position of the task to be deleted can be obtained first, and the task to be deleted can be deleted from the test task queue; then, according to the queue position of the task to be deleted, the new test task is added to the test task queue, so as to achieve the purpose of replacing the task to be deleted in the test task queue with the new test task, thereby achieving the purpose of having the new test task inherit the queue information of the task to be deleted (for example, the waiting time in the test task queue, the arrangement position in the test task queue, etc.), so that the new test task can be effectively avoided from being re-queued, thereby effectively reducing the waiting time of the new test task, which is beneficial to improving the test effect of the new test task.

[0110] Method Example 4

[0111] In addition, in order to further improve the test effect of different test tasks, the embodiment of the present application also provides another possible implementation method of the test task scheduling method. In this implementation method, in addition to including all or part of the above steps (for example, S1-S5; or, step 11-step 16; or, S1-S6; or, step 11-step 16, S6; or, S1-S7; or, step 11-step 16, S6, S7, etc.), the test task scheduling method may also include S8-S9:

[0112] S8: Determine the current weight value of each task in the test task queue.

[0113] The current weight value of the nth task in the test task queue is used to indicate the probability of the nth task being executed first; and the larger the current weight value of the nth task is, the more likely it is that the nth task will be executed first. n is a positive integer, n≤N, N is a positive integer, and N represents the number of tasks in the test task queue.

[0114] In addition, the above-mentioned “current weight value of the nth task” can be determined according to the predicted execution time of the nth task, the current waiting time of the nth task, and the test attribute coefficient of the nth task.

[0115] The above “predicted execution time of the nth task” is used to indicate the predicted execution time consumption of the nth task in the test task queue.

[0116] The above “current waiting time of the nth task” is used to indicate the waiting time of the nth task as of the triggering moment of the above “new task queue entry request” (that is, the time the nth task has experienced after entering the test task queue).

[0117] The above-mentioned "test attribute coefficient of the nth task" is used to indicate the importance of the test object of the nth task; and the larger the "test attribute coefficient of the nth task", the more important the test object of the nth task is. In addition, the above-mentioned "test attribute coefficient of the nth task" can be preset.

[0118] In addition, the embodiments of the present application do not limit the determination process of the above-mentioned "current weight value of the nth task". For example, it can be specifically: the current weight value of the nth task = (predicted execution time of the nth task + current waiting time of the nth task + test attribute coefficient of the nth task) ÷ predicted execution time of the nth task.

[0119] Based on the relevant content of S8 above, it can be known that after adding a new test task to the test task queue, the current weight value of each task can be determined according to the predicted execution time, current waiting time, and test attribute coefficient of each task in the test task queue, so that the current weight value of each task can respectively represent the probability of priority execution of each task, so that these tasks can be re-sorted based on their current weight values.

[0120] It should be noted that the execution time of S8 is later than the execution time of the above step "adding a new test task to the test task queue", and the embodiment of the present application does not limit the specific execution time of S8.

[0121] S9: Update the queue position of each task in the test task queue according to the current weight value of each task in the test task queue.

[0122] In an embodiment of the present application, after obtaining the current weight value of each task in the test task queue, all tasks in the test task queue can be sorted in order from large to small according to these current weight values, and a new queue position of each task in the test task queue can be obtained. In this way, the purpose of reordering all tasks in the test task queue can be achieved, thereby ensuring that tasks with longer waiting times and larger test attribute coefficients are arranged in front positions, and further ensuring that tasks with longer waiting times and larger test attribute coefficients are executed earlier.

[0123] In some cases, the current weight values ​​of some tasks may be the same. Based on this, the embodiment of the present application also provides another possible implementation of S9, which may specifically include S91-S100:

[0124] S91: The current weight values ​​of the tasks in the test task queue are aggregated to obtain a weight value set.

[0125] S92: Set tamp=1.

[0126] S93: Perform maximum value screening on the weight value set to obtain the maximum weight value.

[0127] S94: Determine whether there is a single task in the test task queue whose current weight value is equal to the maximum weight value. If so, execute S95-S96; if not, execute S97-S100.

[0128] S95: Determine tamp as the arrangement sequence number of the task whose current weight value is equal to the maximum weight value in the test task queue, and delete the maximum weight value from the weight value set.

[0129] S96: Update tamp according to formula (1), and return to execute S93.

[0130] tamp'=tamp+1 (1)

[0131] Wherein, tamp' represents the updated tamp value; tamp represents the tamp value before the update.

[0132] S97: All tasks in the test task queue whose current weight value is equal to the maximum weight value are collected to obtain a task collection and the number of tasks to be sorted.

[0133] S98: Sort all tasks in the task set in descending order of the test attribute coefficient of each task in the task set to obtain an initial sequence number of each task in the task set.

[0134] It should be noted that the initial sequence number of each task in the task set is a positive integer.

[0135] S99: Add the initial serial number of each task in the task set to (tamp-1) respectively to obtain the arrangement serial number of each task in the task set, and delete the current weight value (that is, the maximum weight value) of all tasks in the task set from the weight value set.

[0136] S100: Update tamp according to formula (2), and return to execute S93.

[0137] tamp' = tamp + number of tasks to be sorted (2)

[0138] Wherein, tamp' represents the updated tamp value; tamp represents the tamp value before the update.

[0139] Based on the above-mentioned S91 to S100 related contents, it can be known that for each task in the test task queue, the current weight value of each task can be referred to first to determine the new arrangement position of each task; once there are at least two tasks with equal current weight values, the test attribute coefficients of these tasks with equal current weight values ​​can be further referred to to determine the new arrangement position of these tasks, so as to further ensure that the tasks with longer waiting time and larger test attribute coefficient are arranged in the front position, thereby ensuring that the tasks with longer waiting time and larger test attribute coefficient are executed earlier.

[0140] Based on the relevant contents of S8 to S9 above, it can be known that after adding a new test task to the test task queue, the current weight value of each task can be determined according to the predicted execution time, current waiting time, and test attribute coefficient of each task in the test task queue, so that the current weight value of each task can respectively represent the probability of priority execution of each task; then refer to the current weight values ​​(and test attribute coefficients) of these tasks to reorder these tasks and obtain new queue positions for these tasks, so as to achieve the purpose of reordering all tasks in the test task queue, thereby ensuring that tasks with longer waiting times and larger test attribute coefficients are arranged in front positions, and thus ensuring that tasks with longer waiting times and larger test attribute coefficients are executed earlier, which is conducive to improving the test effect of tasks with longer waiting times and larger test attribute coefficients.

[0141] System Example

[0142] In order to better understand the technical solution provided by the embodiments of the present application, Figure 2 The test task scheduling system shown in FIG. Figure 2 A schematic diagram of the engineering architecture of a test task scheduling system provided in an embodiment of the present application.

[0143] For Figure 2 For example, the test task scheduling system shown in FIG. 1 may include a task queue management module, a task queue management module, and a task execution module. The following describes the relevant contents of each module.

[0144] The task enqueue management module is responsible for calculating the current queue length and determining whether new tasks are allowed to enter the queue; it is responsible for identifying whether the current task has an equivalent task in the queue and deleting the old equivalent tasks in the queue; it is responsible for calculating whether the current task exceeds the test number threshold for the same attribute and refusing tasks that exceed the test number threshold to enter the queue; it is responsible for placing new tasks at the end of the queue.

[0145] The task queue management module is responsible for managing the sorting and deletion of tasks in the queue and submitting execution applications for the first task in the queue.

[0146] The task execution module is responsible for executing the test tasks and recording the running time of the test tasks.

[0147] To better understand Figure 2 The test task scheduling system shown is described below in conjunction with the working principle of the test task scheduling system.

[0148] Figure 2 The working principle of the test task scheduling system shown can be specifically as follows: when a new task applies to enter the queue, the task queue management module calculates the current queue length and determines whether the new task is allowed to enter the queue. If the current queue length has reached the maximum threshold, the new task is rejected from entering the queue; moreover, the task queue module identifies the test attribute of the new task and queries the number of test tasks (that is, the number of completed test tasks for the test object of the new task) to determine whether the number of test tasks has exceeded the test number threshold. If the number of test tasks with the current test attribute has exceeded the test number threshold, the new task is rejected from entering the queue; moreover, the task queue module requests the task queue management module to query whether there is a task with the same test attribute as the new task in the queue. If so, the task with the same test attribute in the queue is marked as an invalid task and deleted from the queue; then, the task queue module puts the new task at the end of the queue; finally, the task queue module requests the task queue management module to apply for reordering the tasks in the queue, so that the task queue management module calculates the weight of each task and reorders the tasks from large to small according to the weight value.

[0149] Based on the above-mentioned relevant contents of the test task scheduling system, it can be known that the test task scheduling system can control the task queue length to ensure that tasks in any queue can complete task execution within the queue length control range, which can effectively avoid the phenomenon that some test tasks are overloaded and the waiting time is too long due to task backlog. In addition, the test task scheduling system also avoids the waste of test resources caused by the execution of invalid test tasks and the invalid waiting of other tasks at the back of the queue by identifying test tasks with the same test attributes and deleting them from the queue, thus optimizing the time cost.

[0150] Based on the test task scheduling method provided by the above method embodiment, the embodiment of the present application also provides a test task scheduling device, which is explained and illustrated below in conjunction with the accompanying drawings.

[0151] Device Embodiment

[0152] For technical details of the test task scheduling device provided by the device embodiment, please refer to the above method embodiment.

[0153] See also Figure 3 , which is a structural diagram of a test task scheduling device provided in an embodiment of the present application.

[0154] The test task scheduling device 300 provided in the embodiment of the present application includes:

[0155] The attribute acquisition unit 301 is used to acquire the test attribute of the new test task after receiving the new task queue entry request triggered by the new test task; wherein the test attribute is used to describe the test object of the new test task;

[0156] A times determination unit 302, configured to determine the number of times the test object has been tested according to the test attribute;

[0157] The task abandoning unit 303 is used to abandon the new test task when it is determined that the number of tests has exceeded a preset number threshold;

[0158] The task queuing unit 304 is used to add the new test task to the test task queue when it is determined that the number of tests has not exceeded a preset number threshold.

[0159] In a possible implementation, the number determination unit 302 is specifically used to: query the statistical number of test tasks corresponding to the test attribute from a pre-constructed mapping relationship to obtain the number of times the test object has been tested; wherein the mapping relationship includes the correspondence between the test attribute and the number of times the test object has been tested.

[0160] In a possible implementation manner, the test task scheduling device 300 further includes:

[0161] A length acquisition unit, used to acquire the current queue length of the test task queue;

[0162] A task rejection unit, configured to discard the new test task when determining that the current queue length exceeds a preset length threshold;

[0163] The task enqueuing unit 304 is used to add the new test task to the test task queue when it is determined that the number of tests done does not exceed a preset number threshold and the current queue length does not exceed a preset length threshold.

[0164] In a possible implementation, the length acquisition unit is specifically configured to add up the predicted execution times of all tasks in the test task queue to obtain a current queue length of the test task queue.

[0165] In a possible implementation manner, the test task scheduling device 300 further includes:

[0166] The task deleting unit is used to delete the task to be deleted from the test task queue when it is determined that the test attribute of the new test task is the same as the test attribute of the task to be deleted in the test task queue.

[0167] In a possible implementation manner, the task enqueuing unit 304 is specifically configured to add the new test task to the test task queue according to the queue position of the task to be deleted.

[0168] In a possible implementation manner, the test task scheduling device 300 further includes:

[0169] A weight determination unit, used to determine the current weight value of each task in the test task queue;

[0170] The sorting update unit is used to update the queue position of each task in the test task queue according to the current weight value of each task in the test task queue.

[0171] In one possible implementation, the test task queue includes N tasks; the current weight value of the nth task is determined based on the predicted execution time of the nth task, the current waiting time of the nth task, and the test attribute coefficient of the nth task; wherein the test attribute coefficient of the nth task is used to indicate the importance of the test object of the nth task; n is a positive integer, n≤N, and N is a positive integer.

[0172] Based on the relevant contents of the above-mentioned test task scheduling device 300, it can be known that for the test task scheduling device 300 provided in the embodiment of the present application, after receiving a new task queue entry request triggered by a new test task, the test attribute of the new test task is first obtained, so that the test attribute is used to describe the test object of the new test task (for example, XXX application); then, according to the test attribute, the number of times the test object has been tested is determined, so that the number of times the test object has been tested can represent the frequency of testing for the test object; finally, it is determined whether the number of times the test has been tested exceeds a preset number threshold. If it does not exceed the preset number threshold, it can be determined that the test for the test object is not frequent, so the new test task can be directly added to the test task. test task queue, so that the test process for the test object can be implemented later by automatically executing the new test task; however, if the preset number of times exceeds the threshold, it can be determined that the test for the test object is too frequent, so the new test task can be directly discarded (that is, the new test task is refused to be added to the test task queue) to avoid the test task for the test object occupying test resources again, which can effectively reduce the frequency of testing for the test object, thereby effectively avoiding the phenomenon that other test tasks have to wait too long due to frequent execution of test tasks for a certain test object, and then effectively reduce the waiting time of these test tasks, so as to effectively improve the test effect of these test tasks.

[0173] Furthermore, an embodiment of the present application also provides a device, the device comprising a processor and a memory:

[0174] The memory is used to store computer programs;

[0175] The processor is used to execute any implementation of the test task scheduling method provided in the embodiments of the present application according to the computer program.

[0176] Furthermore, an embodiment of the present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute any implementation of the test task scheduling method provided in the embodiment of the present application.

[0177] Furthermore, an embodiment of the present application also provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute any implementation of the test task scheduling method provided in the embodiment of the present application.

[0178] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0179] The above is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as above in the preferred embodiment, it is not used to limit the present invention. Any technician familiar with the art can make many possible changes and modifications to the technical solution of the present invention by using the methods and technical contents disclosed above without departing from the scope of the technical solution of the present invention, or modify it into an equivalent embodiment of equivalent changes. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of protection of the technical solution of the present invention.

Claims

1. A test task scheduling method, characterized in that: The method comprises: After receiving a new task queue request triggered for a new test task, obtaining a test attribute of the new test task; wherein the test attribute is used to describe a test object of the new test task, the new test task is used to perform a functional test on the test object, the test object is an application, and the new task queue request is used to request that the new test task be added to a test task queue; Determine, according to the test attribute, the number of times the test object has been tested, the number of times tested being used to indicate the frequency of testing of the test object; When it is determined that the number of tests has exceeded a preset number threshold, the new test task is abandoned; When it is determined that the number of tests does not exceed a preset number threshold, the new test task is added to a test task queue.

2. The method according to claim 1, characterized in that: The determining, according to the test attribute, the number of times the test object has been tested includes: The statistical number of test tasks corresponding to the test attribute is queried from a pre-constructed mapping relationship to obtain the number of times the test object has been tested; wherein the mapping relationship includes a correspondence between the test attribute and the number of times the test object has been tested.

3. The method according to claim 1, characterized in that The method further comprises: Obtain the current queue length of the test task queue; When it is determined that the current queue length exceeds a preset length threshold, abandoning the new test task; When it is determined that the number of tests does not exceed a preset number threshold, adding the new test task to the test task queue includes: When it is determined that the number of tests does not exceed the preset number threshold and when it is determined that the current queue length does not exceed the preset length threshold, the new test task is added to the test task queue.

4. The method according to claim 3, characterized in that The obtaining of the current queue length of the test task queue includes: The predicted execution times of all tasks in the test task queue are added together to obtain the current queue length of the test task queue.

5. The method according to claim 1, characterized in that The method further comprises: When it is determined that the test attribute of the new test task is the same as the test attribute of the task to be deleted in the test task queue, the task to be deleted is deleted from the test task queue.

6. The method according to claim 5, characterized in that The adding the new test task to the test task queue comprises: According to the queue position of the task to be deleted, the new test task is added to the test task queue.

7. The method according to any one of claims 1 to 6, characterized in that: After adding the new test task to the test task queue, the method further includes: Determine the current weight value of each task in the test task queue; According to the current weight value of each task in the test task queue, the queue position of each task in the test task queue is updated.

8. The method according to claim 7, characterized in that The test task queue includes N tasks; the current weight value of the nth task is determined based on the predicted execution time of the nth task, the current waiting time of the nth task, and the test attribute coefficient of the nth task; wherein the test attribute coefficient of the nth task is used to indicate the importance of the test object of the nth task; n is a positive integer, n≤N, and N is a positive integer.

9. A test task scheduling device, characterized in that: include: An attribute acquisition unit, configured to acquire the test attribute of the new test task after receiving a new task queue entry request triggered for the new test task; wherein the test attribute is used to describe the test object of the new test task, the new test task is used to perform a functional test on the test object, the test object is an application, and the new task queue entry request is used to request that the new test task be added to the test task queue; A number determination unit, used to determine the number of times the test object has been tested according to the test attribute, wherein the number of times the test object has been tested is used to indicate the frequency of testing of the test object; A task abandoning unit, used to abandon the new test task when it is determined that the number of tests has exceeded a preset number threshold; The task enqueuing unit is used to add the new test task to the test task queue when it is determined that the number of tests done does not exceed a preset number threshold.

10. A device, characterized in that: The device comprises a processor and a memory: The memory is used to store computer programs; The processor is configured to execute the method of any one of claims 1 to 8 according to the computer program.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 8.

12. A computer program product, characterized in that When the computer program product is executed on a terminal device, the terminal device executes the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Task processing method and device, server, equipment, system and storage medium

    CN113238868A

  • Test method and related equipment thereof

    CN114625654A