[go: up one dir, main page]

CN112540914A - Execution method, execution device, server and storage medium for unit test - Google Patents

Execution method, execution device, server and storage medium for unit test Download PDF

Info

Publication number
CN112540914A
CN112540914A CN202011359878.6A CN202011359878A CN112540914A CN 112540914 A CN112540914 A CN 112540914A CN 202011359878 A CN202011359878 A CN 202011359878A CN 112540914 A CN112540914 A CN 112540914A
Authority
CN
China
Prior art keywords
task
target test
execution
test task
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011359878.6A
Other languages
Chinese (zh)
Inventor
陶世博
蓝翔
成瑜娟
严春伟
骆涛
刘续东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202011359878.6A priority Critical patent/CN112540914A/en
Publication of CN112540914A publication Critical patent/CN112540914A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本申请公开了一种单元测试的执行方法、执行装置、服务器和存储介质,涉及深度学习领域。具体实现方案为:获取任务队列;其中,任务队列中包括多个单元测试任务;对任务队列中的多个单元测试任务进行任务调度,以确定待执行的目标测试任务;查询目标测试任务的历史执行信息,以确定执行目标测试任务失败的第一设备;调度设备集合中除第一设备以外的第二设备执行目标测试任务。由此,通过该方法可以有效地提升单元测试的执行效率,提高资源利用率,提升开发者的开发效率。

Figure 202011359878

The present application discloses a unit test execution method, execution device, server and storage medium, and relates to the field of deep learning. The specific implementation scheme is: obtaining a task queue; wherein the task queue includes multiple unit test tasks; performing task scheduling on multiple unit test tasks in the task queue to determine the target test task to be executed; querying the history of the target test task The execution information is used to determine the first device that fails to execute the target test task; and the second device other than the first device in the device set is scheduled to execute the target test task. Therefore, the method can effectively improve the execution efficiency of the unit test, improve the resource utilization rate, and improve the development efficiency of the developer.

Figure 202011359878

Description

单元测试的执行方法、执行装置、服务器和存储介质Unit test execution method, execution device, server and storage medium

技术领域technical field

本申请涉及计算机领域,具体涉及深度学习领域,尤其涉及一种单元测试的执行方法、执行装置、服务器和存储介质。The present application relates to the field of computers, in particular to the field of deep learning, and in particular to a unit test execution method, execution device, server and storage medium.

背景技术Background technique

大型软件项目开发过程中,为了保证软件质量,开发者会开发大量测试函数功能是否正常的测试程序,即单元测试。通常情况下,单元测试的代码量会占到总代码量的50%以上,随着项目的推进,单元测试的数量会越来越多。因此,如何快速、高效地完成单元测试,至关重要。During the development of large-scale software projects, in order to ensure software quality, developers will develop a large number of test programs to test whether the functions are normal, that is, unit tests. Under normal circumstances, the code volume of unit tests will account for more than 50% of the total code volume. As the project progresses, the number of unit tests will increase. Therefore, how to complete unit testing quickly and efficiently is very important.

发明内容SUMMARY OF THE INVENTION

本申请提供了一种单元测试的执行方法、执行装置、服务器和存储介质。The present application provides a unit test execution method, execution device, server and storage medium.

根据本申请的一方面,提供了一种单元测试的执行方法,包括:According to an aspect of the present application, a method for executing a unit test is provided, comprising:

获取任务队列;其中,所述任务队列中包括多个单元测试任务;Obtain a task queue; wherein, the task queue includes multiple unit test tasks;

对所述任务队列中的多个单元测试任务进行任务调度,以确定待执行的目标测试任务;performing task scheduling on a plurality of unit test tasks in the task queue to determine the target test task to be executed;

查询所述目标测试任务的历史执行信息,以确定执行所述目标测试任务失败的第一设备;query the historical execution information of the target test task to determine the first device that fails to execute the target test task;

调度设备集合中除所述第一设备以外的第二设备执行所述目标测试任务。A second device other than the first device in the device set is scheduled to execute the target test task.

根据本申请的另一方面,提供了一种单元测试的执行装置,包括:According to another aspect of the present application, a unit test execution device is provided, comprising:

获取模块,用于获取任务队列;其中,所述任务队列中包括多个单元测试任务;an acquisition module for acquiring a task queue; wherein, the task queue includes a plurality of unit test tasks;

调度模块,用于对所述任务队列中的多个单元测试任务进行任务调度,以确定待执行的目标测试任务;a scheduling module, configured to perform task scheduling on a plurality of unit test tasks in the task queue to determine the target test task to be executed;

查询模块,用于查询所述目标测试任务的历史执行信息,以确定执行所述目标测试任务失败的第一设备;a query module, configured to query the historical execution information of the target test task to determine the first device that fails to execute the target test task;

执行模块,用于调度设备集合中除所述第一设备以外的第二设备执行所述目标测试任务。An execution module, configured to schedule a second device in the device set other than the first device to execute the target test task.

根据本申请的另一方面,提供了一种服务器,包括:According to another aspect of the present application, a server is provided, comprising:

至少一个处理器;以及at least one processor; and

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行上述的执行方法。The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described execution method.

根据本申请的另一方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其特征在于,所述计算机指令用于使所述计算机执行上述的执行方法。According to another aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the above execution method.

上述可选方式所具有的其他效果将在下文中结合具体实施例加以说明。Other effects of the above-mentioned optional manners will be described below with reference to specific embodiments.

附图说明Description of drawings

附图用于更好地理解本方案,不构成对本申请的限定。其中:The accompanying drawings are used for better understanding of the present solution, and do not constitute a limitation to the present application. in:

图1是根据本申请实施例提供的一种单元测试的执行方法的流程示意图;1 is a schematic flowchart of a method for executing a unit test provided according to an embodiment of the present application;

图2是根据本申请一个实施例提供的单元测试的执行方法的流程示意图;2 is a schematic flowchart of a unit test execution method provided according to an embodiment of the present application;

图3是根据本申请另一个实施例提供的单元测试的执行方法的流程示意图;3 is a schematic flowchart of a method for executing a unit test provided according to another embodiment of the present application;

图4是根据本申请实施例提供的一种单元测试的执行装置的结构示意图;4 is a schematic structural diagram of a unit test execution device provided according to an embodiment of the present application;

图5是根据本申请实施例的单元测试的执行方法的服务器的框图。FIG. 5 is a block diagram of a server of a unit test execution method according to an embodiment of the present application.

具体实施方式Detailed ways

以下结合附图对本申请的示范性实施例做出说明,其中包括本申请实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本申请的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted from the following description for clarity and conciseness.

下面参考附图描述本申请实施例的单元测试的执行方法、执行装置、服务器和存储介质。The following describes the execution method, execution device, server, and storage medium of a unit test according to the embodiments of the present application with reference to the accompanying drawings.

在描述本申请的单元测试的执行方法之前,先来说明下单元测试。Before describing the execution method of the unit test of the present application, the unit test will be described first.

大型软件项目开发过程中,为了保证软件质量,开发者会开发大量测试函数功能是否正常的测试程序,即单元测试。特别是在由多人协作的开源社区中,开发者众多,代码量庞大,此时,单元测试就成了保证软件质量的重要手段,是持续集成过程中不可或缺的一环。During the development of large-scale software projects, in order to ensure software quality, developers will develop a large number of test programs to test whether the functions are normal, that is, unit tests. Especially in the open source community that is coordinated by many people, there are many developers and a huge amount of code. At this time, unit testing has become an important means to ensure software quality and an indispensable part of the continuous integration process.

通常情况下,单元测试的代码量会占到总代码量的50%以上,随着项目的推进,单元测试的数量会越来越多,通过所有单元测试需要的时间就会越来越长。如果不加以控制,低效的单元测试环节会极大地制约开发者的开发效率。Usually, the unit test code will account for more than 50% of the total code. As the project progresses, the number of unit tests will increase, and the time required to pass all unit tests will become longer and longer. If not controlled, inefficient unit testing will greatly restrict the development efficiency of developers.

除了单元测试数量的激增之外,单元测试执行过程中,还会产生一些不影响程序正确性的随机错误。产生的原因包括:并发量过大,导致内存溢出;磁盘空间不够;网络中断;单元测试执行顺序不固定等。这些错误虽然不会影响程序的正确性,但会导致单元测试环节执行失败,进而导致开发者重新执行单元测试环节。随着单元测试数量的增多,所需的资源也会越来越多,出现随机错误的概率也会越来越大。这会浪费大量的硬件资源和开发者的宝贵时间。In addition to the surge in the number of unit tests, some random errors that do not affect the correctness of the program are generated during the execution of unit tests. The reasons include: excessive concurrency, leading to memory overflow; insufficient disk space; network interruption; unfixed execution order of unit tests, etc. Although these errors will not affect the correctness of the program, they will cause the unit testing process to fail, which in turn causes the developer to re-execute the unit testing process. As the number of unit tests increases, more resources are required and the probability of random errors increases. This wastes a lot of hardware resources and valuable developer time.

为此,本申请提出了一种新的单元测试的执行方法,该方法可以有效地提升单元测试的执行效率,提高资源利用率,提升开发者的开发效率。To this end, the present application proposes a new unit test execution method, which can effectively improve the unit test execution efficiency, the resource utilization rate, and the developer's development efficiency.

图1是根据本申请实施例提供的一种单元测试的执行方法的流程示意图。FIG. 1 is a schematic flowchart of a method for executing a unit test according to an embodiment of the present application.

本申请实施例的单元测试的执行方法,可由本申请实施例提供的单元测试的执行装置执行,该装置可配置于服务器中。The unit test execution method of the embodiment of the present application may be executed by the unit test execution apparatus provided by the embodiment of the present application, and the apparatus may be configured in a server.

如图1所示,本申请实施例的单元测试的执行方法,包括:As shown in FIG. 1, the execution method of the unit test according to the embodiment of the present application includes:

步骤S101,获取任务队列;其中,所述任务队列中包括多个单元测试任务。Step S101, acquiring a task queue; wherein, the task queue includes a plurality of unit test tasks.

可以理解的是,每个单元测试任务均具有单元测试名称、需要执行的命令和在设备上发生随机错误的概率等。Understandably, each unit test task has a unit test name, commands that need to be executed, probability of random errors on the device, etc.

作为一种获取任务队列的可实现方式,服务器先获取每个单元测试任务在设备上发生随机错误的概率,然后根据每个单元测试任务在设备上发生随机错误概率的高低,对所有单元测试任务进行排序,以形成任务队列。例如,可将发生随机错误概率比较高的单元测试设置更高的优先级,这样,这个发生随机错误概率比较高的单元测试就会优先执行。As an achievable way to obtain the task queue, the server first obtains the probability of random errors occurring on the device for each unit test task, and then, according to the probability of random errors occurring on the device for each unit test task, analyzes all unit test tasks. Sort to form the task queue. For example, a unit test with a high probability of random errors can be set higher priority, so that the unit test with a high probability of random errors will be executed first.

需要说明的是,如果存在多个发生随机错误的概率一样的单元测试,则可根据程序执行的顺序,由高至低的优先级对单元测试任务进行列队,以便依次执行单元测试任务。It should be noted that if there are multiple unit tests with the same probability of occurrence of random errors, the unit test tasks can be queued from high to low priority according to the sequence of program execution, so as to execute the unit test tasks in sequence.

步骤S102,对任务队列中的多个单元测试任务进行任务调度,以确定待执行的目标测试任务。Step S102: Perform task scheduling on a plurality of unit test tasks in the task queue to determine target test tasks to be executed.

也就是说,服务器从任务队列中调度出一个单元测试任务如优先级最高的单元测试任务,作为待执行的目标测试任务。That is, the server schedules a unit test task from the task queue, such as the unit test task with the highest priority, as the target test task to be executed.

步骤S103,查询目标测试任务的历史执行信息,以确定执行目标测试任务失败的第一设备。Step S103, query the historical execution information of the target test task to determine the first device that fails to execute the target test task.

其中,历史执行信息可包括历史执行次数和历史执行任务失败的第一设备,即在该次执行目标测试任务之前已经执行过几次该目标测试任务和执行该目标测试任务失败的设备。Wherein, the historical execution information may include the historical execution times and the first device that failed the historical task execution, that is, the device that has executed the target test task several times before executing the target test task this time and failed to execute the target test task.

本实施例中,服务器在确定了待执行的目标测试任务之后,判断该目标测试任务是否执行失败过,如果执行失败过,则获取执行该目标测试任务失败的第一设备。In this embodiment, after determining the target test task to be executed, the server determines whether the target test task has failed to be executed, and if the execution fails, acquires the first device that failed to execute the target test task.

步骤S104,调度设备集合中除第一设备以外的第二设备执行目标测试任务。Step S104 , schedule the second device other than the first device in the device set to execute the target test task.

本实施例中,为了尽量降低目标测试任务再次失败的可能性,服务器在重新执行该目标测试任务的时候选择一个新的设备(设备集合中除第一设备以外的第二设备)来执行这个目标测试任务,即失败重试机制和多机并行机制。其中,失败重试机制可以降低单元测试任务出现随机错误的概率,提高了资源利用率,提升了开发者的开发效率;多机并行机制,可以提升单元测试环节的执行速度,从而提升了单元测试的执行效率,提升了开发者的开发效率。In this embodiment, in order to minimize the possibility of the target test task failing again, the server selects a new device (a second device other than the first device in the device set) to execute the target test task when re-executing the target test task Test tasks, namely failure retry mechanism and multi-machine parallel mechanism. Among them, the failure retry mechanism can reduce the probability of random errors in unit testing tasks, improve resource utilization, and improve the development efficiency of developers; the multi-machine parallel mechanism can improve the execution speed of unit testing, thereby improving unit testing. The execution efficiency improves the development efficiency of developers.

本申请实施例的单元测试的执行方法,先获取包括多个单元测试任务的任务队列,并对任务队列中的多个单元测试任务进行任务调度,以确定待执行的目标测试任务,然后查询目标测试任务的历史执行信息,以确定执行目标测试任务失败的第一设备,最后调度设备集合中除第一设备以外的第二设备执行目标测试任务。由此,通过该方法可以有效地提升单元测试的执行效率,提高资源利用率,提升开发者的开发效率。The unit test execution method of the embodiment of the present application first acquires a task queue including multiple unit test tasks, and performs task scheduling on the multiple unit test tasks in the task queue to determine the target test task to be executed, and then queries the target test task. The historical execution information of the test task is used to determine the first device that fails to execute the target test task, and finally the second device other than the first device in the device set is scheduled to execute the target test task. Therefore, the method can effectively improve the execution efficiency of the unit test, improve the resource utilization rate, and improve the development efficiency of the developer.

为了缩短单元测试环节的耗时,进一步提升单元测试的执行效率,提高资源利用率,提升开发者的开发效率,在本申请的一个示例中,如图2所示,在上述步骤S104调度设备集合中除第一设备以外的第二设备执行目标测试任务之后,还包括:In order to shorten the time-consuming of unit testing, further improve the execution efficiency of unit testing, improve resource utilization, and improve the development efficiency of developers, in an example of this application, as shown in FIG. 2 , in the above step S104, a set of devices is scheduled After the second device other than the first device performs the target test task, it also includes:

步骤S201,在第二设备执行目标测试任务失败的情况下,更新历史执行信息中的失败次数。Step S201, in the case that the second device fails to execute the target test task, update the number of failures in the historical execution information.

本实施例中,服务器在调度设备集合中除第一设备以外的第二设备执行目标任务之后,由第二设备执行目标测试任务,如果第二设备执行目标测试任务失败,则将历史执行信息中的失败次数叠加1,即对目标测试任务的历史执行信息中的失败次数进行更新。In this embodiment, after the server schedules the second device other than the first device in the device set to execute the target task, the second device executes the target test task, and if the second device fails to execute the target test task, the historical execution information The number of failures is superimposed by 1, that is, the number of failures in the historical execution information of the target test task is updated.

在对目标测试任务的历史执行信息中的失败次数更新之后,判断更新后的失败次数与次数阈值之间的关系,在更新后的失败次数小于次数阈值的情况下,执行步骤S202;在更新后的失败次数大于或等于次数阈值的情况下,执行步骤S203。After updating the number of failures in the historical execution information of the target test task, determine the relationship between the number of failures after the update and the number of times threshold, and if the number of times of failure after the update is less than the number of times threshold, execute step S202; after the update If the number of failures is greater than or equal to the number threshold, step S203 is executed.

其中,为了尽量降低单元测试再次执行失败的可能性,在本申请的实施例中,次数阈值小于或等于设备集合中的设备总数。具体是因为如果一个目标测试任务在一个设备上失败了,有可能是这个设备自身的问题,如网络中断,由于网络中断可能不会短时间恢复,那么这个目标测试任务在这个设备上再次执行失败的概率将高于其他设备。为了尽量降低目标测试任务再次执行失败的可能性,将在重新执行这个目标测试任务的时候选择一个新的设备来执行这个目标测试任务,所以本申请的实施例中,将次数阈值设置的小于或等于设备集合中的设备总数。Wherein, in order to minimize the possibility that the unit test fails to be executed again, in this embodiment of the present application, the number of times threshold is less than or equal to the total number of devices in the device set. Specifically, if a target test task fails on a device, it may be a problem with the device itself, such as a network interruption. Due to the network interruption, it may not recover in a short time, then the target test task fails to execute again on this device. The probability will be higher than other devices. In order to minimize the possibility that the target test task fails to be executed again, a new device will be selected to execute the target test task when the target test task is re-executed. Therefore, in the embodiment of the present application, the number of times threshold is set to be less than or Equal to the total number of devices in the device collection.

步骤S202,将目标测试任务添加至任务队列中,以及将第二设备添加到历史执行信息中执行失败设备的设备列表。Step S202, adding the target test task to the task queue, and adding the second device to the device list of failed devices in the historical execution information.

作为一种将目标测试任务添加至任务队列中的可实现方式,包括:根据更新后的失败次数,配置目标检测任务的优先级;根据优先级,将目标测试任务添加至任务队列的对应的位置。As an achievable way of adding the target test task to the task queue, it includes: configuring the priority of the target detection task according to the updated number of failures; adding the target test task to the corresponding position of the task queue according to the priority .

需要说明的是,可预先获取失败次数与目标测试任务的优先级之间的关系,并存储在服务器中。假设,最大的优先级为1,数值越大优先级越低。当失败次数为1时,目标测试任务的优先级为当前任务队列中包括的单元测试任务的数量除以2得到的商之后取整(也可以在取整的基础上加或减预设值如1)的值,大致任务队列中间的位置;当失败次数为2时,目标测试任务的优先级为当前任务队列中包括的单元测试任务的数量,任务队列末尾的位置,优先级最低。It should be noted that the relationship between the number of failures and the priority of the target test task may be acquired in advance and stored in the server. Assume that the maximum priority is 1, and the higher the value, the lower the priority. When the number of failures is 1, the priority of the target test task is the quotient obtained by dividing the number of unit test tasks included in the current task queue by 2 and then rounded up (you can also add or subtract the preset value based on the rounding, such as The value of 1) is roughly the position in the middle of the task queue; when the number of failures is 2, the priority of the target test task is the number of unit test tasks included in the current task queue, and the position at the end of the task queue has the lowest priority.

本实施例中,服务器在设备集合中第二设备如Host1第一次执行失败的情况下,将该第二设备如Host1添加到历史执行信息中执行失败设备的设备列表中,作为执行该单元测试任务失败的第一设备,并调整执行失败的单元测试任务的优先级,将其调整到大致任务队列中间的位置;在设备集合中第二设备如Host2第二次执行失败的情况下,将第二设备如Host2添加到历史执行信息中执行失败设备的设备列表中,同样将其作为执行该单元测试失败的第一设备,并调整失败的单元测试任务的优先级,将其调整至任务队伍末尾的位置,这样能够使得不同失败次数的任务,在任务队列中能够排布到不同位置上,避免队列中发生错误的单元测试任务集中,降低不同单元测试任务之间的相互干扰。In this embodiment, when the second device in the device set, such as Host1, fails to execute for the first time, the server adds the second device, such as Host1, to the device list of the failed devices in the historical execution information, as the execution of the unit test The first device that fails the task, and adjust the priority of the failed unit test task, and adjust it to roughly the middle of the task queue; if the second device in the device set, such as Host2, fails to execute the second time, the first device The second device, such as Host2, is added to the device list of the failed device in the historical execution information, and it is also regarded as the first device that failed to execute the unit test, and the priority of the failed unit test task is adjusted to the end of the task team. In this way, tasks with different failure times can be arranged in different positions in the task queue, avoiding the concentration of wrong unit test tasks in the queue, and reducing the mutual interference between different unit test tasks.

作为一种根据更新后的失败次数配置目标测试任务的优先级可实现的方式,包括:根据更新后的失败次数,确定对应的优先级取值范围;在优先级取值范围内,确定目标测试任务配置的优先级。As an achievable way to configure the priority of the target test task according to the updated number of failures, it includes: determining the corresponding priority value range according to the updated number of failures; within the priority value range, determining the target test task The priority of the task configuration.

需要说明的是,可预先设置失败次数与优先级取值范围之间的关系,并存储在服务器中。例如,当失败次数为1时,优先级的取值范围可以为1至当前任务队列中包括的单元测试任务的数量除以2得到的商之后取整(也可以在取整的基础上加或减预设值如1)的值,大致任务队列排头至中间的某位置;当失败次数为2时,优先级的取值范围可以为当前任务队列中包括的单元测试任务的数量除以2得到的商之后取整(也可以在取整的基础上加或减预设值如1)的值至当前任务队列中包括的单元测试任务的数量,大致任务队列中间至末尾的某位置。It should be noted that the relationship between the number of failures and the value range of the priority can be preset and stored in the server. For example, when the number of failures is 1, the value of the priority can be in the range of 1 to the quotient obtained by dividing the number of unit test tasks included in the current task queue by 2 and rounding up (or adding or Subtract the value of the default value such as 1), roughly from the top of the task queue to a certain position in the middle; when the number of failures is 2, the value range of the priority can be obtained by dividing the number of unit test tasks included in the current task queue by 2 The value of the quotient is rounded up (or a preset value such as 1 can be added or subtracted on the basis of rounding) to the number of unit test tasks included in the current task queue, roughly from the middle of the task queue to a certain position at the end.

本实施例中,服务器在设备集合中第二设备执行失败的情况下,将第二设备添加到历史执行信息中执行失败设备的设备列表中,作为第一设备,并获取对应的优先级取值范围。在这个取值范围最大值的基础上加上一个随机扰动,使得优先级在较小范围内浮动,从而避免了连续执行失败的几个单元测试任务,分布在任务队列的连续位置上。例如,几个占用内存高的单元测试任务,因为连续执行导致这几个单元测试任务均失败了,当再次对这几个单元测试任务执行时,应尽量使得这些单元测试任务分散,避免再次集中。由此,通过动态地调整任务队列中待执行的目标测试任务的位置,既可以充分利用单元测试环节的时间,又可以避免队列中发生错误的单元测试任务集中,尽可能地降低不同单元测试任务之间的相互干扰。In this embodiment, when the second device in the device set fails to execute, the server adds the second device to the device list of the failed devices in the historical execution information as the first device, and obtains the corresponding priority value scope. On the basis of the maximum value of this value range, a random perturbation is added to make the priority fluctuate within a small range, thereby avoiding the continuous execution of several failed unit test tasks, which are distributed in consecutive positions in the task queue. For example, several unit test tasks that take up a lot of memory have failed due to continuous execution. When these unit test tasks are executed again, these unit test tasks should be dispersed as much as possible to avoid re-concentration. . Therefore, by dynamically adjusting the position of the target test tasks to be executed in the task queue, it is possible to make full use of the time of the unit test process, and to avoid the concentration of unit test tasks that have errors in the queue, and reduce the number of different unit test tasks as much as possible. mutual interference between them.

步骤S203,删除目标测试任务。Step S203, delete the target test task.

也就是说,在更新后的失败次数大于或等于次数阈值的情况下,服务器将该目标测试任务的名称从任务队列中删除。That is to say, when the updated number of failures is greater than or equal to the number threshold, the server deletes the name of the target test task from the task queue.

本申请实施例的单元测试的执行方法,先获取包括多个单元测试任务的任务队列,并对任务队列中的多个单元测试任务进行任务调度,以确定待执行的目标测试任务,然后查询目标测试任务的历史执行信息,以确定执行目标测试任务失败的第一设备,最后调度设备集合中除第一设备以外的第二设备执行目标测试任务,在第二设备执行目标测试任务失败的情况下,更新历史执行信息中的失败次数,并在更新后的失败次数小于次数阈值的情况下,将目标测试任务添加至任务队列中,以及将第二设备添加到历史执行信息中执行失败设备的设备列表;在更新后的失败次数大于或等于次数阈值的情况下,删除目标测试任务。由此,通过该方法可以缩短单元测试环节的耗时,进一步提升单元测试的执行效率,提高资源利用率,提升开发者的开发效率。The unit test execution method of the embodiment of the present application first acquires a task queue including multiple unit test tasks, and performs task scheduling on the multiple unit test tasks in the task queue to determine the target test task to be executed, and then queries the target test task. The historical execution information of the test task to determine the first device that failed to execute the target test task, and finally schedule the second device other than the first device in the device set to execute the target test task, in the case that the second device fails to execute the target test task , update the number of failures in the historical execution information, and if the updated number of failures is less than the number of times threshold, add the target test task to the task queue, and add the second device to the historical execution information. List; if the updated number of failures is greater than or equal to the number threshold, delete the target test task. Therefore, the method can shorten the time-consuming of the unit testing process, further improve the execution efficiency of the unit testing, improve the resource utilization rate, and improve the development efficiency of the developer.

为使本领域技术人员更清楚的了解本申请,图3是根据本申请另一个实施例提供的单元测试的执行方法的流程示意图。如图3所述,该单元测试的执行方法,包括:To make the present application more clearly understood by those skilled in the art, FIG. 3 is a schematic flowchart of a unit test execution method provided according to another embodiment of the present application. As shown in Figure 3, the execution method of the unit test includes:

步骤S301,初始化单元测试任务列表和设备列表。Step S301, initialize a unit test task list and a device list.

步骤S302,将单元测试任务加入优先任务队列。Step S302, adding the unit test task to the priority task queue.

步骤S303,为单元测试任务挑选合适的设备。Step S303, select a suitable device for the unit test task.

步骤S304,判断设备是否在执行失败设备的列表中。如果是,返回步骤S303;如果否,执行步骤S305。Step S304, judging whether the device is in the list of failed devices. If yes, go back to step S303; if no, go to step S305.

步骤S305,将单元测试任务分发给设备。Step S305: Distribute the unit test task to the device.

步骤S306,由设备执行单元测试任务。Step S306, the unit test task is executed by the device.

步骤S307,判断单元测试任务是否执行成功。如果是,执行步骤S310;如果否,执行步骤S308。Step S307, it is judged whether the unit test task is executed successfully. If yes, go to step S310; if not, go to step S308.

S308,判断执行次数是否大于或等于3。如果是,执行步骤S310;如果否,执行步骤S309。S308, determine whether the number of executions is greater than or equal to 3. If yes, go to step S310; if no, go to step S309.

S309,将执行失败的设备加入执行失败设备的列表中,并循环执行步骤S302。S309 , adding the devices that fail to execute into the list of devices that fail to execute, and cyclically execute step S302 .

S310,从优先任务队列中移除单元测试任务。S310, remove the unit test task from the priority task queue.

S311,记录单元测试任务的执行结果。S311, record the execution result of the unit test task.

假设任务队列中包括的单元测试任务的数量是Nu,设备Host的数量是Nh,各设备之间相互独立,单元测试失败重试的次数是Nt,一个单元测试在设备上发生随机错误的概率是p。其中,Nh≥NhAssuming that the number of unit test tasks included in the task queue is N u , the number of device hosts is N h , each device is independent of each other, the number of unit test failures and retries is N t , and a random error occurs on the device for a unit test The probability is p. wherein, N h ≥ N h .

对于常规的单元测试的执行方法(只有一台设备,失败不重试)来说,单元测试环节成功的概率是

Figure BDA0002803683460000081
所有单元测试通过的耗时期望是:For the conventional unit test execution method (only one device, failure does not retry), the probability of unit test success is
Figure BDA0002803683460000081
The time-consuming expectation for all unit tests to pass is:

Figure BDA0002803683460000082
Figure BDA0002803683460000082

其中,ti表示第i个单元测试执行一次就成功需要的时间。使用本申请的单元测试的执行方法(加入失败重试机制),单元测试环节成功的概率是

Figure BDA0002803683460000083
所有单元测试通过的耗时期望是:Among them, t i represents the time it takes for the i-th unit test to be executed successfully once. Using the execution method of the unit test of this application (adding the failure retry mechanism), the probability of the success of the unit test link is
Figure BDA0002803683460000083
The time-consuming expectation for all unit tests to pass is:

Figure BDA0002803683460000084
Figure BDA0002803683460000084

相比较于常规的单元测试的执行方法来说,本申请节省的时间期望是ΔT=T1-T2Compared with the conventional unit test execution method, the expected time saving of the present application is ΔT=T 1 −T 2 .

例如,Nu=100,Nt=3,p=0.01,

Figure BDA0002803683460000085
由此可以得到单元测试环节成功的概率将从36.60%提升到99.99%,耗时期望从273.20min,缩短到100.01min,效率提升了63.4%。For example, Nu = 100, N t = 3, p = 0.01,
Figure BDA0002803683460000085
From this, it can be seen that the success probability of the unit test link will be increased from 36.60% to 99.99%, the time-consuming expectation will be shortened from 273.20min to 100.01min, and the efficiency will be increased by 63.4%.

综上,通过本申请的单元测试的执行方法,能够大幅减少单元测试过程中发生随机错误的概率,缩短任务排队时间;缩短单元测试的执行时间,提升单元测试的执行效率,提升资源利用率;提升开发者的开发效率,加快软件迭代速度。To sum up, the unit test execution method of the present application can greatly reduce the probability of random errors occurring in the unit test process, shorten the task queuing time, shorten the execution time of the unit test, improve the execution efficiency of the unit test, and improve the resource utilization rate; Improve developers' development efficiency and speed up software iteration.

为了实现上述实施例,本申请实施例还提出了一种单元测试的执行装置。In order to implement the above embodiments, the embodiments of the present application further provide an execution device for unit testing.

图4是根据本申请实施例提供的一种单元测试的执行装置的结构示意图。FIG. 4 is a schematic structural diagram of a device for executing a unit test according to an embodiment of the present application.

如图4所示,本申请实施例的单元测试的执行装置400,包括:获取模块410、调度模块420、查询模块430和执行模块440。As shown in FIG. 4 , the unit test execution apparatus 400 according to the embodiment of the present application includes an acquisition module 410 , a scheduling module 420 , a query module 430 and an execution module 440 .

其中,获取模块410,用于获取任务队列;其中,任务队列中包括多个单元测试任务;Wherein, the obtaining module 410 is used to obtain the task queue; wherein, the task queue includes a plurality of unit test tasks;

调度模块420,用于对任务队列中的多个单元测试任务进行任务调度,以确定待执行的目标测试任务;a scheduling module 420, configured to perform task scheduling on a plurality of unit test tasks in the task queue to determine the target test task to be executed;

查询模块430,用于查询目标测试任务的历史执行信息,以确定执行目标测试任务失败的第一设备;The query module 430 is configured to query the historical execution information of the target test task to determine the first device that fails to execute the target test task;

执行模块440,用于调度设备集合中除第一设备以外的第二设备执行目标测试任务。The execution module 440 is configured to schedule a second device other than the first device in the device set to execute the target test task.

在本申请实施例一种可能的实现方式中,上述的执行装置400,还包括:In a possible implementation manner of the embodiment of the present application, the above-mentioned execution device 400 further includes:

更新模块,用于在第二设备执行目标测试任务失败的情况下,更新历史执行信息中的失败次数;an update module, configured to update the number of failures in the historical execution information when the second device fails to perform the target test task;

添加模块,用于在更新后的失败次数小于次数阈值的情况下,将目标测试任务添加至任务队列中,以及将第二设备添加到历史执行信息中执行失败设备的设备列表。The adding module is used for adding the target test task to the task queue and adding the second device to the device list of the failed devices in the historical execution information when the updated number of failures is less than the number threshold.

在本申请实施例一种可能的实现方式中,添加模块,包括:In a possible implementation manner of the embodiment of the present application, adding a module includes:

配置单元,用于根据更新后的失败次数,配置目标测试任务的优先级;The configuration unit is used to configure the priority of the target test task according to the updated number of failures;

添加单元,用于根据优先级,将目标测试任务添加至任务队列的对应的位置。Adding a unit is used to add the target test task to the corresponding position of the task queue according to the priority.

在本申请实施例一种可能的实现方式中,配置单元,包括:In a possible implementation manner of the embodiment of the present application, the configuration unit includes:

第一确定子单元,用于根据更新后的失败次数,确定对应的优先级取值范围;a first determination subunit, configured to determine the corresponding priority value range according to the updated number of failures;

第二确定子单元,用于在优先级取值范围内,确定目标测试任务配置的优先级。The second determination subunit is configured to determine the priority of the target test task configuration within the range of the priority value.

在本申请实施例一种可能的实现方式中,执行装置400,还包括:In a possible implementation manner of the embodiment of the present application, the execution device 400 further includes:

删除模块,用于在更新后的失败次数大于或等于次数阈值的情况下,删除目标测试任务。The deletion module is used to delete the target test task when the number of failures after the update is greater than or equal to the threshold of the number of times.

在本申请实施例一种可能的实现方式中,次数阈值小于或等于设备集合中的设备总数。In a possible implementation manner of the embodiment of the present application, the number of times threshold is less than or equal to the total number of devices in the device set.

需要说明的是,前述单元测试的执行方法实施例的解释说明,也适用于该实施例的单元测试的执行装置,故在此不再赘述。It should be noted that the explanations of the foregoing embodiment of the unit test execution method are also applicable to the unit test execution apparatus of this embodiment, and thus are not repeated here.

根据本申请实施例的单元测试的执行装置,通过获取模块获取任务队列;其中,任务队列中包括多个单元测试任务,通过调度模块对任务队列中的多个单元测试任务进行任务调度,以确定待执行的目标测试任务,通过查询模块查询目标测试任务的历史执行信息,以确定执行目标测试任务失败的第一设备,通过执行模块调度设备集合中除第一设备以外的第二设备执行目标测试任务。由此,该装置可以缩短单元测试环节的耗时,提升单元测试的执行效率,提高资源利用率,提升开发者的开发效率。According to the unit test execution device of the embodiment of the present application, the task queue is acquired through the acquisition module; wherein, the task queue includes a plurality of unit test tasks, and the scheduling module performs task scheduling on the plurality of unit test tasks in the task queue to determine For the target test task to be executed, the historical execution information of the target test task is inquired through the query module to determine the first device that fails to execute the target test task, and the second device other than the first device in the device set is scheduled by the execution module to execute the target test Task. Therefore, the device can shorten the time consumption of the unit testing process, improve the execution efficiency of the unit testing, improve the resource utilization rate, and improve the development efficiency of developers.

根据本申请的实施例,本申请还提供了一种服务器和一种可读存储介质。According to the embodiments of the present application, the present application further provides a server and a readable storage medium.

如图5所示,是根据本申请实施例的单元测试的执行方法的服务器的框图。服务器旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。服务器还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本申请的实现。As shown in FIG. 5 , it is a block diagram of a server of a unit test execution method according to an embodiment of the present application. A server is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Servers may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are by way of example only, and are not intended to limit implementations of the application described and/or claimed herein.

如图5所示,该服务器包括:一个或多个处理器501、存储器502,以及用于连接各部件的接口,包括高速接口和低速接口。各个部件利用不同的总线互相连接,并且可以被安装在公共主板上或者根据需要以其它方式安装。处理器可以对在服务器内执行的指令进行处理,包括存储在存储器中或者存储器上以在外部输入/输出装置(诸如,耦合至接口的显示设备)上显示GUI的图形信息的指令。在其它实施方式中,若需要,可以将多个处理器和/或多条总线与多个存储器和多个存储器一起使用。同样,可以连接多个服务器,各个设备提供部分必要的操作(例如,作为服务器阵列、一组刀片式服务器、或者多处理器系统)。图5中以一个处理器501为例。As shown in FIG. 5, the server includes: one or more processors 501, memory 502, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or otherwise as desired. The processor may process instructions executed within the server, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used with multiple memories and multiple memories, if desired. Likewise, multiple servers may be connected, with each device providing some of the necessary operations (eg, as an array of servers, a group of blade servers, or a multiprocessor system). A processor 501 is taken as an example in FIG. 5 .

存储器502即为本申请所提供的非瞬时计算机可读存储介质。其中,所述存储器存储有可由至少一个处理器执行的指令,以使所述至少一个处理器执行本申请所提供的单元测试的执行方法。本申请的非瞬时计算机可读存储介质存储计算机指令,该计算机指令用于使计算机执行本申请所提供的单元测试的执行方法。The memory 502 is the non-transitory computer-readable storage medium provided by the present application. Wherein, the memory stores instructions executable by at least one processor, so that the at least one processor executes the unit test execution method provided by the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, and the computer instructions are used to cause the computer to execute the execution method of the unit test provided by the present application.

存储器502作为一种非瞬时计算机可读存储介质,可用于存储非瞬时软件程序、非瞬时计算机可执行程序以及模块,如本申请实施例中的单元测试的执行方法对应的程序指令/模块(例如,附图4所示的获取模块410、调度模块420、查询模块430和执行模块440)。处理器501通过运行存储在存储器502中的非瞬时软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例中的单元测试的执行方法。As a non-transitory computer-readable storage medium, the memory 502 can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as program instructions/modules (for example, program instructions/modules corresponding to the execution method of the unit test in the embodiments of the present application). , the acquisition module 410, the scheduling module 420, the query module 430 and the execution module 440 shown in FIG. 4). The processor 501 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions and modules stored in the memory 502, that is, implementing the unit test execution method in the above method embodiments.

存储器502可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据单元测试的执行方法的服务器的使用所创建的数据等。此外,存储器502可以包括高速随机存取存储器,还可以包括非瞬时存储器,例如至少一个磁盘存储器件、闪存器件、或其他非瞬时固态存储器件。在一些实施例中,存储器502可选包括相对于处理器501远程设置的存储器,这些远程存储器可以通过网络连接至单元测试的执行方法的服务器。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 502 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the server of the execution method of the unit test Wait. Additionally, memory 502 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 502 may optionally include memory located remotely relative to the processor 501, and these remote memories may be connected over a network to a server that executes the method of unit testing. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

单元测试的执行方法的服务器还可以包括:输入装置503和输出装置504。处理器501、存储器502、输入装置503和输出装置504可以通过总线或者其他方式连接,图5中以通过总线连接为例。The server for executing the method for unit testing may further include: an input device 503 and an output device 504 . The processor 501 , the memory 502 , the input device 503 and the output device 504 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 5 .

输入装置503可接收输入的数字或字符信息,以及产生与单元测试的执行方法的服务器的用户设置以及功能控制有关的键信号输入,例如触摸屏、小键盘、鼠标、轨迹板、触摸板、指示杆、一个或者多个鼠标按钮、轨迹球、操纵杆等输入装置。输出装置504可以包括显示设备、辅助照明装置(例如,LED)和触觉反馈装置(例如,振动电机)等。该显示设备可以包括但不限于,液晶显示器(LCD)、发光二极管(LED)显示器和等离子体显示器。在一些实施方式中,显示设备可以是触摸屏。The input device 503 can receive input numerical or character information, and generate key signal input related to user settings and function control of the server of the execution method of the unit test, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, a pointing stick , one or more mouse buttons, trackballs, joysticks and other input devices. Output devices 504 may include display devices, auxiliary lighting devices (eg, LEDs), haptic feedback devices (eg, vibration motors), and the like. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some implementations, the display device may be a touch screen.

此处描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、专用ASIC(专用集成电路)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described herein can be implemented in digital electronic circuitry, integrated circuit systems, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs executable and/or interpretable on a programmable system including at least one programmable processor that The processor, which may be a special purpose or general-purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device an output device.

这些计算程序(也称作程序、软件、软件应用、或者代码)包括可编程处理器的机器指令,并且可以利用高级过程和/或面向对象的编程语言、和/或汇编/机器语言来实施这些计算程序。如本文使用的,术语“机器可读介质”和“计算机可读介质”指的是用于将机器指令和/或数据提供给可编程处理器的任何计算机程序产品、设备、和/或装置(例如,磁盘、光盘、存储器、可编程逻辑装置(PLD)),包括,接收作为机器可读信号的机器指令的机器可读介质。术语“机器可读信号”指的是用于将机器指令和/或数据提供给可编程处理器的任何信号。These computational programs (also referred to as programs, software, software applications, or codes) include machine instructions for programmable processors, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages calculation program. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or apparatus for providing machine instructions and/or data to a programmable processor ( For example, magnetic disks, optical disks, memories, programmable logic devices (PLDs)), including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein may be implemented on a computer having a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user ); and a keyboard and pointing device (eg, a mouse or trackball) through which a user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (eg, visual feedback, auditory feedback, or tactile feedback); and can be in any form (including acoustic input, voice input, or tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。The systems and techniques described herein may be implemented on a computing system that includes back-end components (eg, as a data server), or a computing system that includes middleware components (eg, an application server), or a computing system that includes front-end components (eg, a user's computer having a graphical user interface or web browser through which a user may interact with implementations of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system. The components of the system may be interconnected by any form or medium of digital data communication (eg, a communication network). Examples of communication networks include: Local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务("Virtual Private Server",或简称"VPS")中,存在的管理难度大,业务扩展性弱的缺陷。A computer system can include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or a cloud host. It is a host product in the cloud computing service system to solve the traditional physical host and VPS service ("Virtual Private Server", or "VPS" for short). , there are the defects of difficult management and weak business expansion.

根据本申请实施例的技术方案,涉及深度学习领域,通过该方法可以大幅减少单元测试过程中发生随机错误的概率,缩短了任务排队时间;缩短了单元测试的执行时间,提升单元测试的执行效率,提高了资源利用率;提升了开发者的开发效率,加快软件迭代速度。According to the technical solutions of the embodiments of the present application, which relate to the field of deep learning, the method can greatly reduce the probability of random errors occurring in the unit testing process, shorten the task queuing time, shorten the execution time of the unit testing, and improve the execution efficiency of the unit testing. , improve resource utilization, improve developer development efficiency, and speed up software iteration.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that steps may be reordered, added or deleted using the various forms of flow shown above. For example, the steps described in the present application can be performed in parallel, sequentially or in different orders, and as long as the desired results of the technical solutions disclosed in the present application can be achieved, no limitation is imposed herein.

上述具体实施方式,并不构成对本申请保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本申请的精神和原则之内所作的修改、等同替换和改进等,均应包含在本申请保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the protection scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of this application shall be included within the protection scope of this application.

Claims (14)

1. A method of performing a unit test, comprising:
acquiring a task queue; the task queue comprises a plurality of unit test tasks;
performing task scheduling on a plurality of unit test tasks in the task queue to determine a target test task to be executed;
querying historical execution information of the target test task to determine first equipment which fails to execute the target test task;
and scheduling second equipment in the equipment set except the first equipment to execute the target test task.
2. The execution method of claim 1, wherein, after scheduling a second device of the set of devices other than the first device to execute the target test task, further comprising:
updating the failure times in the historical execution information under the condition that the second equipment fails to execute the target test task;
and under the condition that the updated failure times are smaller than a time threshold value, adding the target test task into the task queue, and adding the second equipment into an equipment list of failed equipment executed in the historical execution information.
3. The execution method of claim 2, wherein said adding the target test task to the task queue comprises:
configuring the priority of the target test task according to the updated failure times;
and adding the target test task to a corresponding position of the task queue according to the priority.
4. The execution method of claim 3, wherein the configuring the priority of the target test task according to the updated number of failures comprises:
determining a corresponding priority value range according to the updated failure times;
and determining the priority of the target test task configuration within the priority value range.
5. The execution method of claim 2, wherein after the updating the number of failures in the historical execution information, further comprising:
and deleting the target test task under the condition that the updated failure times are greater than or equal to the time threshold.
6. The execution method of claim 2, wherein the threshold number of times is less than or equal to a total number of devices in the set of devices.
7. An apparatus for performing a unit test, comprising:
the acquisition module is used for acquiring the task queue; the task queue comprises a plurality of unit test tasks;
the scheduling module is used for performing task scheduling on the plurality of unit test tasks in the task queue so as to determine a target test task to be executed;
the query module is used for querying the historical execution information of the target test task so as to determine first equipment which fails to execute the target test task;
and the execution module is used for scheduling second equipment in the equipment set except the first equipment to execute the target test task.
8. The execution apparatus of claim 7, further comprising:
the updating module is used for updating the failure times in the historical execution information under the condition that the second equipment fails to execute the target test task;
and the adding module is used for adding the target test task into the task queue and adding the second equipment into an equipment list of the failed equipment executed in the historical execution information under the condition that the updated failure times are smaller than a time threshold.
9. The execution device of claim 8, wherein the adding module comprises:
the configuration unit is used for configuring the priority of the target test task according to the updated failure times;
and the adding unit is used for adding the target test task to the corresponding position of the task queue according to the priority.
10. The execution apparatus of claim 9, wherein the configuration unit comprises:
the first determining subunit is configured to determine a corresponding priority value range according to the updated failure times;
and the second determining subunit is used for determining the priority of the target test task configuration in the priority value range.
11. The execution apparatus of claim 8, further comprising:
and the deleting module is used for deleting the target test task under the condition that the updated failure times are greater than or equal to the time threshold.
12. The execution apparatus of claim 8, wherein the threshold number of times is less than or equal to a total number of devices in the set of devices.
13. A server, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any of claims 1-6.
14. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1-6.
CN202011359878.6A 2020-11-27 2020-11-27 Execution method, execution device, server and storage medium for unit test Pending CN112540914A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011359878.6A CN112540914A (en) 2020-11-27 2020-11-27 Execution method, execution device, server and storage medium for unit test

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011359878.6A CN112540914A (en) 2020-11-27 2020-11-27 Execution method, execution device, server and storage medium for unit test

Publications (1)

Publication Number Publication Date
CN112540914A true CN112540914A (en) 2021-03-23

Family

ID=75015199

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011359878.6A Pending CN112540914A (en) 2020-11-27 2020-11-27 Execution method, execution device, server and storage medium for unit test

Country Status (1)

Country Link
CN (1) CN112540914A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113127172A (en) * 2021-04-21 2021-07-16 上海销氪信息科技有限公司 Task execution method and device, electronic equipment and storage medium
CN113204478A (en) * 2021-04-06 2021-08-03 北京百度网讯科技有限公司 Method, device and equipment for running test unit and storage medium
CN115061759A (en) * 2022-05-24 2022-09-16 联想(北京)有限公司 Data acquisition method, related equipment and storage medium
CN117271501A (en) * 2023-11-23 2023-12-22 山东省国土空间数据和遥感技术研究院(山东省海域动态监视监测中心) Data quality inspection method and device, electronic equipment and storage medium
CN117785431A (en) * 2024-02-27 2024-03-29 云粒智慧科技有限公司 Task scheduling distribution method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150331779A1 (en) * 2014-05-13 2015-11-19 Unisys Corporation Framework to accommodate test plan changes without affecting or interrupting test execution
CN107943686A (en) * 2017-10-30 2018-04-20 北京奇虎科技有限公司 A kind of test dispatching method, apparatus, server and storage medium
CN107943684A (en) * 2017-10-30 2018-04-20 北京奇虎科技有限公司 A kind of test crash retries method, apparatus, server and storage medium
CN108459961A (en) * 2017-12-29 2018-08-28 微梦创科网络科技(中国)有限公司 The method, client and server of examination are resurveyed after a kind of failure of testing case

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150331779A1 (en) * 2014-05-13 2015-11-19 Unisys Corporation Framework to accommodate test plan changes without affecting or interrupting test execution
CN107943686A (en) * 2017-10-30 2018-04-20 北京奇虎科技有限公司 A kind of test dispatching method, apparatus, server and storage medium
CN107943684A (en) * 2017-10-30 2018-04-20 北京奇虎科技有限公司 A kind of test crash retries method, apparatus, server and storage medium
CN108459961A (en) * 2017-12-29 2018-08-28 微梦创科网络科技(中国)有限公司 The method, client and server of examination are resurveyed after a kind of failure of testing case

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204478A (en) * 2021-04-06 2021-08-03 北京百度网讯科技有限公司 Method, device and equipment for running test unit and storage medium
CN113204478B (en) * 2021-04-06 2022-05-03 北京百度网讯科技有限公司 Operating method, device, device and storage medium of test unit
CN113127172A (en) * 2021-04-21 2021-07-16 上海销氪信息科技有限公司 Task execution method and device, electronic equipment and storage medium
CN115061759A (en) * 2022-05-24 2022-09-16 联想(北京)有限公司 Data acquisition method, related equipment and storage medium
CN117271501A (en) * 2023-11-23 2023-12-22 山东省国土空间数据和遥感技术研究院(山东省海域动态监视监测中心) Data quality inspection method and device, electronic equipment and storage medium
CN117785431A (en) * 2024-02-27 2024-03-29 云粒智慧科技有限公司 Task scheduling distribution method and device, electronic equipment and storage medium
CN117785431B (en) * 2024-02-27 2024-06-04 云粒智慧科技有限公司 Task scheduling distribution method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111753997B (en) Distributed training method, system, device and storage medium
US11630762B2 (en) Method and apparatus for testing map service
CN112540914A (en) Execution method, execution device, server and storage medium for unit test
CN110806923B (en) Parallel processing method and device for block chain tasks, electronic equipment and medium
US20210208819A1 (en) Method and apparatus for scheduling memory access request, device and storage medium
CN111045985B (en) File storage processing method, server, electronic device and storage medium
US12093712B2 (en) Method and apparatus for handling memory failure, electronic device and storage medium
CN111782365A (en) Timing task processing method, device, device and storage medium
CN110505245A (en) Application login method, device and equipment
CN113868251B (en) Global secondary index method and device for distributed database
US11941055B2 (en) Method and apparatus for graph computing, electronic device and storage medium
US20210263912A1 (en) Method for data processing based on smart contract and device
CN111782341B (en) Method and device for managing clusters
CN110752968B (en) Performance benchmark test method and device, electronic equipment and storage medium
CN111831483A (en) Backup management method, system, electronic device and medium
CN111782147A (en) Method and device for cluster expansion and contraction
US11775309B2 (en) Exception stack handling method, system, electronic device and storage medium
US20210216212A1 (en) Method and apparatus for processing data
CN111258954B (en) Data migration method, device, equipment and storage medium
CN111782357B (en) Tag control method and device, electronic device and readable storage medium
CN112069137A (en) Method and device for generating information, electronic equipment and computer readable storage medium
CN111767126A (en) System and method for distributed batch processing
CN110750419A (en) Offline task processing method and device, electronic equipment and storage medium
CN112527368A (en) Cluster kernel version updating method and device, electronic equipment and storage medium
CN112084000A (en) Container cluster testing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination