Artificial intelligence-based test task distribution method and related equipment

By building a test case database and a custom distribution algorithm, combined with the heartbeat connection mechanism, the allocation of test tasks between test executors is optimized, which solves the problem of insufficient resources on the cloud test platform and improves the execution efficiency and resource utilization of test tasks.

CN114924981BActive Publication Date: 2025-08-19PING AN BANK CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210598121.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-30
Publication Date
2025-08-19
Estimated Expiration
2042-05-30

AI Technical Summary

Technical Problem

When faced with a large number of test tasks, the server performance of the existing cloud test platform is insufficient, resulting in inefficient testing services. How to reasonably distribute test tasks to improve the operating efficiency of the cloud test platform is an urgent problem.

Method used

By building a test case database, using custom distribution algorithms and heartbeat connection mechanisms, priority sorting and resource allocation strategies, we ensure that test tasks are distributed fairly among test executors and improve system resource usage efficiency.

Benefits of technology

It effectively improves the efficiency of system resources during software testing, ensures the smooth execution of test tasks and feedback of results, and improves the overall execution efficiency of test tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114924981B_ABST
    Figure CN114924981B_ABST
Patent Text Reader

Abstract

The present application proposes a test task distribution method, device, electronic device and storage medium based on artificial intelligence. The test task distribution method based on artificial intelligence includes: building a test case database, and calling test cases from the database to generate test tasks according to the user's test requirements; establishing a heartbeat connection between the server and the test executor to obtain the communication connection status between the server and the test executor; if the communication connection status is normal, distributing the test task to the test executor according to a custom distribution algorithm; executing the test task based on the test executor to obtain the test result; and generating a test report based on the test result for display. The present application ensures that system resources are allocated to test tasks as fairly as possible by obtaining test tasks and distributing the test tasks to the test executor according to a custom distribution algorithm, thereby effectively improving the efficiency of system resource utilization during software testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to an artificial intelligence-based test task distribution method, device, electronic device, and storage medium. Background Art

[0002] With the expansion and deepening of software applications, software systems are becoming more and more complex. In order to reduce costs, shorten software delivery time and improve software stability, software needs to be tested frequently.

[0003] Cloud testing is an automated testing solution developed based on cloud computing technology. Users only need to write test scripts and upload them to the cloud platform to perform automated testing. However, cloud testing platforms are limited by server performance. As software testing tasks increase, insufficient server performance will significantly impact testing services. Therefore, how to rationally distribute test tasks to effectively improve the operating efficiency of cloud testing platforms is an urgent problem to be solved. Summary of the Invention

[0004] In view of the above, it is necessary to propose an artificial intelligence-based test task distribution method and related equipment to solve the technical problem of how to improve the operating efficiency of the cloud testing platform. The related equipment includes an artificial intelligence-based test task distribution device, electronic equipment and storage medium.

[0005] This application provides a test task distribution method based on artificial intelligence, the method comprising:

[0006] Building a test case database and calling test case data from the test case database to generate test tasks according to the user's test requirements;

[0007] Establish a heartbeat connection between the server and the test executor to obtain the communication connection status between the server and the test executor;

[0008] If the communication connection status is normal, the test task is distributed to the test executor according to a custom distribution algorithm;

[0009] Executing the test task based on the test executor to obtain a test result;

[0010] A test report is generated based on the test results for presentation.

[0011] In this way, by obtaining test tasks and distributing them to test executors according to a custom distribution algorithm, it is ensured that the system resources of the automated testing system are allocated to the test tasks as fairly as possible, thereby effectively improving the efficiency of system resource utilization during software testing.

[0012] In some embodiments, constructing a test case database and calling test case data from the test case database to generate a test task according to a user's test requirements includes:

[0013] Generate test cases based on the test case automatic generation tool to build a test case database;

[0014] The corresponding test case in the test case database is called according to the user's test requirements to generate the test task.

[0015] In this way, the test case automatic generation tool can automatically generate test cases required for test tasks in large quantities, which is conducive to the rapid generation of test tasks and improves the efficiency of the entire test task distribution process.

[0016] In some embodiments, establishing a heartbeat connection between the server and the test executor to obtain a communication connection status between the server and the test executor includes:

[0017] The test executor sends a heartbeat request to the server every preset fixed period to obtain the heartbeat signal;

[0018] The communication connection status between the test executor and the server is determined based on the heartbeat signal.

[0019] In this way, it can be ensured that the test executor always maintains a communication connection with the server, preventing the failure of test task distribution due to connection interruption, and ensuring the smooth progress of test task distribution work.

[0020] In some embodiments, if the communication connection state is normal, distributing the test task to the test executor according to a custom distribution algorithm includes:

[0021] Prioritizing the test tasks to obtain a test task level data set;

[0022] Sorting the test tasks in the test task level dataset in descending order of priority to generate a test task queue;

[0023] Distribute the test tasks in the test task queue to the test executor according to a custom distribution algorithm.

[0024] In this way, by acquiring test tasks and distributing the test tasks to the test executors according to a custom distribution algorithm, it can be ensured that system resources are allocated to the test tasks as fairly as possible, thereby effectively improving the utilization efficiency of system resources during the software testing process.

[0025] In some embodiments, before distributing the test tasks in the test task queue to the test executor according to the custom distribution algorithm, the method further includes:

[0026] Counting the system resources required by each test task in the test task queue to obtain a task resource set;

[0027] Determine whether the priorities of the test tasks in the test task queue are consistent to obtain a determination result;

[0028] If the judgment result is consistent, the test tasks in the test task queue are distributed to the test executor according to the custom distribution algorithm and the task resource set;

[0029] If the judgment result is inconsistent, the priority of each test task in the test task queue is standardized, and then the test tasks in the test task queue are distributed to the test executor according to the custom distribution algorithm and the task resource set.

[0030] In this way, corresponding distribution strategies can be executed respectively according to whether the priorities of the test tasks in the test task queue are consistent, thereby ensuring that system resources are distributed to the test tasks as fairly as possible.

[0031] In some embodiments, executing the test task based on the test executor to obtain a test result includes:

[0032] Executing the test cases in the test task based on the test executor to obtain a test result, wherein the test result includes a test success, a test failure, and a test skip;

[0033] If the test result is a success, continue executing the next test case corresponding to the current test case in the test task;

[0034] If the test result is a test failure, the test task corresponding to the current test case is terminated;

[0035] If the test result is test skip, the test task corresponding to the current test case will be skipped and will not be executed further.

[0036] In this way, different operations can be performed according to the test results of the test cases in the test task. When the test results are test failure and test skip, a new test task can be started in time to improve the overall execution efficiency of the test task.

[0037] In some embodiments, generating a test report based on the test results for presentation includes:

[0038] The test executor feeds back the test result to generate a test result report;

[0039] The test result report is stored in the test case database for display.

[0040] In this way, the test results can be stored uniformly and displayed on the user front end, making it easier for users to monitor the test results in real time.

[0041] The embodiment of the present application further provides a test task distribution device based on artificial intelligence, the device comprising:

[0042] A generating unit, configured to construct a test case database and call test case data from the test case database to generate test tasks according to the user's test requirements;

[0043] a connection unit, configured to establish a heartbeat connection between the server and the test executor to obtain a communication connection status between the server and the test executor;

[0044] a distribution unit, configured to distribute the test task to the test executor according to a custom distribution algorithm if the communication connection state is normal;

[0045] an execution unit, configured to execute the test task based on the test executor to obtain a test result;

[0046] A display unit is used to generate a test report based on the test result for display.

[0047] An embodiment of the present application further provides an electronic device, comprising:

[0048] a memory storing at least one instruction;

[0049] The processor executes the instructions stored in the memory to implement the test task distribution method based on artificial intelligence.

[0050] An embodiment of the present application also provides a computer-readable storage medium, in which at least one instruction is stored. The at least one instruction is executed by a processor in an electronic device to implement the artificial intelligence-based test task distribution method. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 This is a flowchart of a preferred embodiment of the artificial intelligence-based test task distribution method involved in this application.

[0052] Figure 2 This is a flowchart of a preferred embodiment of the present application for distributing the test task to the test executor according to a custom distribution algorithm if the communication connection status is normal.

[0053] Figure 3 It is a functional module diagram of a preferred embodiment of the artificial intelligence-based test task distribution device involved in this application.

[0054] Figure 4 It is a structural diagram of an electronic device of a preferred embodiment of the artificial intelligence-based test task distribution method involved in this application. DETAILED DESCRIPTION

[0055] In order to more clearly understand the purpose, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the case of no conflict, the embodiments of the present application and the features in the embodiments can be combined with each other. In the following description, many specific details are set forth to facilitate a full understanding of the present application. The embodiments described are only a part of the embodiments of the present application, rather than all of the embodiments.

[0056] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the described features. Throughout the description of this application, "plurality" means two or more, unless otherwise specifically defined.

[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein in the specification of this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0058] An embodiment of the present application provides an artificial intelligence-based test task distribution method that can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. Its hardware includes but is not limited to a microprocessor, an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a digital signal processor (DSP), an embedded device, etc.

[0059] An electronic device can be any electronic product that can interact with a user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), game console, Internet Protocol Television (IPTV), smart wearable device, etc.

[0060] The electronic device may also include a network device and / or a client device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.

[0061] The network where the electronic device is located includes but is not limited to the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.

[0062] like Figure 1 FIG2 is a flowchart of a preferred embodiment of the test task distribution method based on artificial intelligence of the present application. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0063] S10, building a test case database, and calling test case data from the test case database to generate a test task according to the user's test requirements.

[0064] In an optional embodiment, the step of constructing a test case database and calling test case data from the test case database to generate a test task according to a user's test requirements includes:

[0065] S101, generating test cases according to a test case automatic generation tool to build a test case database.

[0066] In this optional embodiment, corresponding test cases can be generated for each test task based on the test case automatic generation tool, and all test cases are stored in the database to constitute the test case database. In this solution, the AutoTCG test case automatic generation platform can be used to generate the test cases because the platform is easy to use and the underlying three-dimensional algorithm results can meet the needs of high automation.

[0067] S102 , calling the corresponding test case in the test case database according to the user's test requirements to generate the test task.

[0068] In this optional embodiment, a coding tag can be set for the user's test requirements and corresponding test cases, so that the corresponding test cases in the test case database can be directly called based on the test requirements entered by the user on the client, thereby generating the test task. The coding tag can be in the form of numbers, symbols, or letters, which is not specifically required in this solution.

[0069] In this optional embodiment, when the user has a testing demand, the electronic device can receive the task information to be tested according to the user interface of the client, and call the corresponding test case from the test case database according to the task information, and send all the acquired test cases and corresponding test tasks to the server. Among them, the client is mainly a graphical user interface between the automated testing system and the tester. The tester can use the client to write test tasks, monitor the execution status, view reports, etc. One client can only establish a connection with one server, and one client can run multiple test tasks at the same time. Each test task can also call multiple test cases. For example, if you test the function of Baidu's homepage, the test case can be a series of automated test cases such as test login, test jump, test search, etc.

[0070] In this optional embodiment, the test task can be stored in the form of an XML file. In this XML file, each directory at the same level corresponds to a logical node. Each logical node has two ID identifiers, one as its own identifier, and the other identifier as the ID of the next logical node at the same level to be run. Each logical node supports scheduling rules such as loops and concurrency, and assists in scheduling with auxiliary scheduling rules such as delays and assignments.

[0071] In this way, the test case automatic generation tool can automatically generate test cases required for test tasks in large quantities, which is conducive to the rapid generation of test tasks and improves the efficiency of the entire test task distribution process.

[0072] S11, establishing a heartbeat connection between the server and the test executor to obtain the communication connection status between the server and the test executor.

[0073] In an optional embodiment, establishing a heartbeat connection between the server and the test executor to obtain the communication connection status between the server and the test executor includes:

[0074] S111, the test executor sends a heartbeat request to the server every preset fixed period to obtain a heartbeat signal.

[0075] In this optional embodiment, the test executor is a pre-written code program for executing the test tasks distributed by the test system.

[0076] In this optional embodiment, the heartbeat signal is a method of sending a very small data packet to the other party of the interconnection at regular intervals, and judging whether the communication link between the two parties of the interconnection has been disconnected by the response of the other party.

[0077] In this optional embodiment, the test executor sends a heartbeat request to the server every preset fixed period to obtain a heartbeat signal. This process is called "heartbeat". The preset fixed period may be 3s.

[0078] S112: Determine the communication connection status between the test executor and the server based on the heartbeat signal.

[0079] In this optional embodiment, the connection status between the test executor and the server can be determined based on the heartbeat signal. If the server receives a heartbeat request, it will also send a heartbeat signal to the test executor. The server will only store relevant information about the test executor that has a "heartbeat".

[0080] In this optional embodiment, the heartbeat signal is used to ensure that only the relevant information of the normally functioning test executors is stored in the server and the relevant information of the unavailable test executors is deleted in a timely manner, thereby ensuring that all the assigned test executors are normally available.

[0081] S12: If the communication connection state is normal, distribute the test task to the test executor according to a custom distribution algorithm.

[0082] See Figure 2 In an optional embodiment, if the communication connection state is normal, distributing the test task to the test executor according to a custom distribution algorithm includes:

[0083] S121, prioritizing the test tasks to obtain a test task level data set.

[0084] In this optional embodiment, each test task can be prioritized in advance, such as according to the chronological order of the test tasks, the earlier the test task is generated, the higher its priority; or according to the importance of the test task, the more important the test task, the higher its priority. In this solution, all the test tasks after priority division are used as the task level data set.

[0085] S122 , sorting the test tasks in the test task level data set in descending order of priority to generate a test task queue.

[0086] In this optional embodiment, after receiving a test task from a client, the server sequentially adds the test tasks in the test task level dataset to a task queue based on their priority, awaiting scheduling and execution by a test executor. The test executor refers to a physical machine, virtual machine, or the like specifically configured to execute tasks containing test cases in a cloud testing platform environment. This solution treats all test tasks added to the task queue in order of priority as the test task queue.

[0087] S123. Distribute the test tasks in the test task queue to the test executors according to a custom distribution algorithm.

[0088] In this optional embodiment, before distributing the test tasks in the test task queue to the test executors according to a custom distribution algorithm, it is necessary to count the system resources required for each test task in the test task queue to obtain a task resource set, and determine whether the priorities of the test tasks in the test task queue are the same to obtain a judgment result.

[0089] In this optional embodiment, this solution realizes a fair and reasonable allocation of the system resources of the current automated test system through a custom distribution algorithm, that is, to make the total system resources of the automated test system be allocated in ascending order of demand as much as possible, avoid the resources obtained by test tasks exceeding their own requirements, and for test tasks that have not yet met the performance requirements, equally share the remaining resources. Since there are multiple test tasks in the automated test system and each test task has a corresponding priority, the custom distribution algorithm in this solution includes two cases where the priorities of the test tasks are the same and different.

[0090] In this optional embodiment, if the priorities are the same, assuming there are m test tasks in total, sort the system resources of the automated test system required by these test tasks from small to large according to the task resource set, satisfying e1 < e2 <... < em, and the total resource is E. Then the specific allocation process of the custom allocation algorithm is as follows:

[0091] a. Allocate the resource E / m to the test task 1 with the smallest demand, and this may very likely exceed the demand of this test task.

[0092] b. Take back the excess part, and then evenly distribute the resource (E - e1) / (m - 1) to the other test tasks again.

[0093] c. Repeat the process of b in turn until the resource allocated to a test task does not meet the demand of this test task. Assume that when allocating to the kth test task, the allocated resource cannot meet the demand of this test task. Then evenly distribute the remaining resources to all the test tasks that have not obtained resources. Thus, the allocation is completed.

[0094] For example, suppose there are four test tasks A, B, C, and D, and the corresponding resource requirements for the automated test system are 1, 4, 4, and 10, and the total resource E is 16. Resource 16 / 4=4 is allocated to the test task A with the smallest requirement. At this time, the system resources allocated to task A exceed 3, so the excess part will be recovered and the remaining resources will be evenly distributed to B, C, and D. At this time, the system resources allocated to B, C, and D are 5, 5, and 5 respectively. At this time, B and C also exceed their required resources, so the excess part of B and C will be recovered and allocated to D. Finally, the amount of resources obtained by A, B, C, and D are 1, 4, 4, and 7 respectively.

[0095] In this optional embodiment, if the judgment result is inconsistent, the priority of each test task in the test task queue is first standardized. For ease of understanding, the process of allocation based on the custom allocation algorithm is exemplified as follows:

[0096] Assume there are four test tasks, and the corresponding resource requirements for the automated test system are 2, 4, 4, and 10. The corresponding priorities are 4, 2.5, 1, and 0.5 respectively. The total resource amount of the automated test system is 16.

[0097] First, the priorities need to be standardized. That is, the lowest priority is set to 1. Then the priorities are 8, 5, 2, and 1 respectively, and the total is 16. The total system resources of the automated test system are divided into 16 equal parts, and the four test tasks receive 8, 5, 2, and 1 resources respectively.

[0098] At this time, test task 1 obtains 6 more resources, test task 2 obtains 1 more resource, and test tasks 3 and 4 are in a resource shortage situation. Therefore, the extra 7 resources are also allocated to test tasks 3 and 4 according to the priority. The system resources of the automated test system obtained by test tasks 3 and 4 are 7×2 / 3 and 7×1 / 3 respectively.

[0099] Since test task 3 requires 4 resources and the allocated resources exceed its needs, test task 3 finally allocates the excess resources to test task 4, thus completing the allocation.

[0100] In this way, by obtaining test tasks and distributing them to test executors according to a custom distribution algorithm, it can be ensured that the system resources of the automated testing system are allocated to the test tasks as fairly as possible, thereby effectively improving the efficiency of system resource utilization during software testing.

[0101] S13: Execute the test task based on the test executor to obtain a test result.

[0102] In an optional embodiment, each test execution machine will feed back the test results after executing the test cases in the test task. The test results include test success, test failure and test skip.

[0103] In this optional embodiment, if the test result is a successful test, since each logical node has two ID identifiers, one as its own identifier and the other identifier as the ID of the next logical node of the same level to be scheduled to run, the next test case corresponding to the current test case in the test task will continue to be executed according to the ID identifier; if the test result of any test case in the test task is a test failure, the test task corresponding to the current test case will be terminated; if the test result of any test case in the test task is a test skip, the test task corresponding to the current test case will be skipped and will no longer be executed.

[0104] In this way, different operations can be performed according to the test results of the test cases in the test task. When the test results are test failure and test skip, a new test task can be started in time to improve the overall execution efficiency of the test task.

[0105] S14: Generate a test report based on the test results for display.

[0106] In an optional embodiment, generating a test report based on the test result for presentation includes:

[0107] S141, the test executor feeds back the test result to generate a test result report.

[0108] In this optional embodiment, the server sends multiple test tasks to the test executor for concurrent processing, and the test executor feeds back the test results obtained after executing the test to form the test result report.

[0109] S142: Store the test result report in the test case database for display.

[0110] In this optional embodiment, the test result report is stored in a database, and the user front end can call the result report API to display it so that the user can monitor it in real time. The user can also download the result report in the background.

[0111] In this optional embodiment, the test task is completed after the automated testing system obtains the test results and generates the test result report. When the next test is performed, if the test content has not changed, there is no need to delete the test case information of the previous test task. Only the test cases can be deleted or added based on the original test cases. This allows for the convenient and dynamic expansion of security test cases without modifying the system structure and avoiding redevelopment.

[0112] In this way, the test results can be stored uniformly and displayed on the user front end, making it easier for users to monitor the test results in real time.

[0113] See Figure 3 , Figure 3 This is a functional module diagram of a preferred embodiment of the artificial intelligence-based test task distribution device of the present application. The artificial intelligence-based test task distribution device 11 includes a generation unit 110, a connection unit 111, a distribution unit 112, an execution unit 113, and a presentation unit 114. The modules / units referred to herein are a series of computer-readable instruction segments that can be executed by the processor 13 and perform a fixed function, and are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.

[0114] In an optional embodiment, the generating unit 110 is configured to construct a test case database, and call test case data from the test case database to generate a test task according to a user's test requirements.

[0115] In an optional embodiment, the step of constructing a test case database and calling test case data from the test case database to generate a test task according to a user's test requirements includes:

[0116] Generate test cases based on the test case automatic generation tool to build a test case database;

[0117] The corresponding test case in the test case database is called according to the user's test requirements to generate the test task.

[0118] In this optional embodiment, corresponding test cases can be generated for each test task based on the test case automatic generation tool, and all test cases are stored in the database to constitute the test case database. In this solution, the AutoTCG test case automatic generation platform can be used to generate the test cases because the platform is easy to use and the underlying three-dimensional algorithm results can meet the needs of high automation.

[0119] In this optional embodiment, a coding tag can be set for the user's test requirements and corresponding test cases, so that the corresponding test cases in the test case database can be directly called based on the test requirements entered by the user on the client, thereby generating the test task. The coding tag can be in the form of numbers, symbols, or letters, which is not specifically required in this solution.

[0120] In this optional embodiment, when the user has a testing demand, the electronic device can receive the task information to be tested according to the user interface of the client, and call the corresponding test case from the test case database according to the task information, and send all the acquired test cases and corresponding test tasks to the server. Among them, the client is mainly a graphical user interface between the automated testing system and the tester. The tester can use the client to write test tasks, monitor the execution status, view reports, etc. One client can only establish a connection with one server, and one client can run multiple test tasks at the same time. Each test task can also call multiple test cases. For example, if you test the function of Baidu's homepage, the test case can be a series of automated test cases such as test login, test jump, test search, etc.

[0121] In this optional embodiment, the test task can be stored in the form of an XML file. In this XML file, each directory at the same level corresponds to a logical node. Each logical node has two ID identifiers, one as its own identifier, and the other identifier as the ID of the next logical node at the same level to be run. Each logical node supports scheduling rules such as loops and concurrency, and assists in scheduling with auxiliary scheduling rules such as delays and assignments.

[0122] In an optional embodiment, the connection unit 111 is configured to establish a heartbeat connection between the server and the test executor to obtain a communication connection status between the server and the test executor.

[0123] In an optional embodiment, establishing a heartbeat connection between the server and the test executor to obtain the communication connection status between the server and the test executor includes:

[0124] The test executor sends a heartbeat request to the server every preset fixed period to obtain the heartbeat signal;

[0125] The communication connection status between the test executor and the server is determined based on the heartbeat signal.

[0126] In this optional embodiment, the heartbeat signal is a method of sending a very small data packet to the other party of the interconnection at regular intervals, and judging whether the communication link between the two parties of the interconnection has been disconnected by the response of the other party.

[0127] In this optional embodiment, the test executor sends a heartbeat request to the server every preset fixed period to obtain a heartbeat signal. This process is called "heartbeat". The preset fixed period may be 3s.

[0128] In this optional embodiment, the connection status between the test executor and the server can be determined based on the heartbeat signal. If the server receives a heartbeat request, it will also send a heartbeat signal to the test executor. The server will only store relevant information about the test executor that has a "heartbeat".

[0129] In this optional embodiment, the heartbeat signal is used to ensure that only the relevant information of the normally functioning test executors is stored in the server and the relevant information of the unavailable test executors is deleted in a timely manner, thereby ensuring that all the assigned test executors are normally available.

[0130] In an optional embodiment, the distribution unit 112 is configured to distribute the test task to the test executor according to a custom distribution algorithm if the communication connection status is normal.

[0131] In an optional embodiment, if the communication connection state is normal, distributing the test task to the test executor according to a custom distribution algorithm includes:

[0132] Prioritizing the test tasks to obtain a test task level data set;

[0133] Sorting the test tasks in the test task level dataset in descending order of priority to generate a test task queue;

[0134] Distribute the test tasks in the test task queue to the test executor according to a custom distribution algorithm.

[0135] In this optional embodiment, each test task can be prioritized in advance, such as according to the chronological order of the test tasks, the earlier the test task is generated, the higher its priority; or according to the importance of the test task, the more important the test task, the higher its priority. In this solution, all the test tasks after priority division are used as the task level data set.

[0136] In this optional embodiment, after receiving a test task from a client, the server sequentially adds the test tasks in the test task level dataset to a task queue based on their priority, awaiting scheduling and execution by a test executor. The test executor refers to a physical machine, virtual machine, or the like specifically configured to execute tasks containing test cases in a cloud testing platform environment. This solution treats all test tasks added to the task queue in order of priority as the test task queue.

[0137] In this optional embodiment, before distributing the test tasks in the test task queue to the test executor according to the custom distribution algorithm, it is necessary to count the system resources of the automated test system required by each test task in the test task queue to obtain a task resource set, and determine whether the priorities of the test tasks in the test task queue are the same to obtain a judgment result.

[0138] In this optional embodiment, the present solution realizes a fair and reasonable allocation of the system resources of the current automated test system through a custom distribution algorithm, that is, to make the total system resources be allocated in the order of increasing demand as much as possible, to avoid the resources obtained by the test tasks exceeding their own requirements, and for the test tasks that have not yet met the performance requirements, to equally share the remaining resources. Since there are multiple test tasks in the automated test system at the same time, and each test task has a corresponding priority, the custom distribution algorithm in the present solution includes two cases where the priorities of the test tasks are the same and different.

[0139] In this optional embodiment, if the priorities are the same, assuming there are m test tasks in total, according to the task resource set, the system resources of the automated test system required by these test tasks are sorted from small to large, satisfying e1 < e2 <... < em, and the total resource is E. Then the specific allocation process of the custom allocation algorithm is as follows:

[0140] a. Allocate the resource E / m to user 1 with the smallest demand, and this move is likely to have exceeded the demand of this user;

[0141] b. Take back the excess part, and then evenly distribute the resource (E - e1) / (m - 1) to other users again;

[0142] c. Repeat the process of b in turn until the resource allocated to a user fails to meet the demand of this user at a certain time. Assume that when allocating to the kth user, the allocated resource cannot meet the demand of this user. Then evenly distribute the remaining resources to all users who have not obtained resources. Thus, the allocation is completed.

[0143] Exemplarily, assume that there are four test tasks A, B, C, and D, and the corresponding resource requirements for the automated test system are 1, 4, 4, and 10 respectively, and the total resource E is 16. Allocate the resource 16 / 4 = 4 to the test task A with the smallest demand. At this time, the system resources allocated to task A exceed 3. Therefore, take back the excess part and evenly distribute the remaining resources to B, C, and D. At this time, the system resources allocated to B, C, and D are 5, 5, and 5 respectively. At this time, B and C also exceed their required resources. Therefore, take back all the excess parts of B and C and allocate them to D. Finally, the resource amounts obtained by A, B, C, and D are 1, 4, 4, and 7 respectively.

[0144] In this optional embodiment, if the judgment result is inconsistent, the priority of each test task in the test task queue is first standardized. For ease of understanding, the process of allocation based on the custom allocation algorithm is exemplified as follows:

[0145] Assume there are four test tasks, and the corresponding resource requirements for the automated test system are 2, 4, 4, and 10. The corresponding priorities are 4, 2.5, 1, and 0.5 respectively. The total resource amount of the automated test system is 16.

[0146] First, the priorities need to be standardized. That is, the lowest priority is set to 1. Then the priorities are 8, 5, 2, and 1 respectively, and the total is 16. The total system resources of the automated test system are divided into 16 equal parts, and the four test tasks receive 8, 5, 2, and 1 resources respectively.

[0147] At this time, test task 1 obtains 6 more resources, test task 2 obtains 1 more resource, and test tasks 3 and 4 are in a resource shortage situation. Therefore, the extra 7 resources are also allocated to test tasks 3 and 4 according to the priority. The system resources of the automated test system obtained by test tasks 3 and 4 are 7×2 / 3 and 7×1 / 3 respectively.

[0148] Since test task 3 requires 4 resources and the allocated resources exceed its needs, test task 3 finally allocates the excess resources to test task 4, thus completing the allocation.

[0149] In an optional embodiment, the execution unit 113 is configured to execute the test task based on the test executor to obtain a test result.

[0150] In an optional embodiment, each test execution machine will feed back the test results after executing the test cases in the test task. The test results include test success, test failure and test skip.

[0151] In this optional embodiment, if the test result is a successful test, since each logical node has two ID identifiers, one as its own identifier and the other identifier as the ID of the next logical node of the same level to be scheduled to run, the next test case corresponding to the current test case in the test task will continue to be executed according to the ID identifier; if the test result of any test case in the test task is a test failure, the test task corresponding to the current test case will be terminated; if the test result of any test case in the test task is a test skip, the test task corresponding to the current test case will be skipped and will no longer be executed.

[0152] In an optional embodiment, the display unit 114 is configured to generate a test report based on the test result for display.

[0153] In an optional embodiment, generating a test report based on the test result for presentation includes:

[0154] The test executor feeds back the test result to generate a test result report;

[0155] The test result report is stored in the test case database for display.

[0156] In this optional embodiment, the server sends multiple test tasks to the test executor for concurrent processing, and the test executor feeds back the test results obtained after executing the test to form the test result report.

[0157] In this optional embodiment, the test result report is stored in a database, and the user front end can call the result report API to display it so that the user can monitor it in real time. The user can also download the result report in the background.

[0158] In this optional embodiment, once the automated testing system obtains the test results and generates the test result report, the test task is completed. When the next test is performed, if the test content has not changed, there is no need to delete the test case information from the previous test task. Instead, test cases can be deleted or added based on the existing test cases. This allows for convenient and dynamic expansion of security test cases without modifying the automated testing system's structure or redevelopment.

[0159] It can be seen from the above technical solution that the present application can ensure that the system resources of the automated testing system are allocated to the test tasks as fairly as possible by obtaining the test tasks and distributing the test tasks to the test executor according to a custom distribution algorithm, thereby effectively improving the utilization efficiency of system resources during the software testing process.

[0160] See Figure 4 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Electronic device 1 includes memory 12 and processor 13. Memory 12 is used to store computer-readable instructions, and processor 13 is used to execute the computer-readable instructions stored in the memory to implement the artificial intelligence-based test task distribution method described in any of the above embodiments.

[0161] In an optional embodiment, the electronic device 1 further includes a bus, a computer program stored in the memory 12 and executable on the processor 13 , such as an artificial intelligence-based test task distribution program.

[0162] Figure 4 Only the electronic device 1 having the memory 12 and the processor 13 is shown. It can be understood by those skilled in the art that Figure 4 The structure shown does not constitute a limitation on the electronic device 1 , and the electronic device 1 may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.

[0163] Combine Figure 1 The memory 12 in the electronic device 1 stores a plurality of computer-readable instructions to implement a test task distribution method based on artificial intelligence, and the processor 13 can execute the plurality of instructions to implement:

[0164] Building a test case database and calling test case data from the test case database to generate test tasks according to the user's test requirements;

[0165] Establish a heartbeat connection between the server and the test executor to obtain the communication connection status between the server and the test executor;

[0166] If the communication connection status is normal, the test task is distributed to the test executor according to a custom distribution algorithm;

[0167] Executing the test task based on the test executor to obtain a test result;

[0168] A test report is generated based on the test results for presentation.

[0169] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.

[0170] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may have a bus structure or a star structure. The electronic device 1 may also include more or less other hardware or software than shown in the figure, or a different arrangement of components. For example, the electronic device 1 may also include input and output devices, network access devices, etc.

[0171] It should be noted that the electronic device 1 is only an example, and other existing or future electronic products that are suitable for this application should also be included in the scope of protection of this application and incorporated herein by reference.

[0172] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium can be non-volatile or volatile. The readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example: SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 12 can also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. The memory 12 can not only be used to store application software and various types of data installed on the electronic device 1, such as the code of the test task distribution program based on artificial intelligence, but can also be used to temporarily store data that has been output or is to be output.

[0173] In some embodiments, the processor 13 may be composed of an integrated circuit, such as a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor 13 is the control core (Control Unit) of the electronic device 1. It utilizes various interfaces and circuits to connect the various components of the entire electronic device 1. It executes or runs programs or modules stored in the memory 12 (such as executing an artificial intelligence-based test task distribution program) and calls data stored in the memory 12 to perform various functions of the electronic device 1 and process data.

[0174] The processor 13 executes the operating system of the electronic device 1 and various installed applications. The processor 13 executes the applications to implement the steps in the above-mentioned embodiments of the test task distribution method based on artificial intelligence, such as Figures 1 to 2 Steps shown.

[0175] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules / units may be a series of computer-readable instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a generation unit 110, a connection unit 111, a distribution unit 112, an execution unit 113, and a presentation unit 114.

[0176] The above-mentioned integrated unit implemented in the form of a software functional module can be stored in a computer-readable storage medium. The above-mentioned software functional module is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, computer device, or network device, etc.) or a processor to execute the portion of the artificial intelligence-based test task distribution method described in various embodiments of the present application.

[0177] If the modules / units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment methods, and can also instruct the relevant hardware devices to complete them through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, it can implement the steps of each of the above-mentioned method embodiments.

[0178] The computer program includes computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory, or other memory.

[0179] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0180] The blockchain referred to in this application is a new application model for computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of this information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.

[0181] The bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 The diagram is represented by only one arrow, but it does not mean that there is only one bus or one type of bus. The bus is configured to implement connection and communication between the memory 12 and at least one processor 13, etc.

[0182] An embodiment of the present application also provides a computer-readable storage medium (not shown), in which computer-readable instructions are stored. The computer-readable instructions are executed by a processor in an electronic device to implement the artificial intelligence-based test task distribution method described in any of the above embodiments.

[0183] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the module division is merely a logical function division, and other division methods may be used in actual implementation.

[0184] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to achieve the purpose of the solution of this embodiment according to actual needs.

[0185] In addition, the functional modules in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0186] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices listed in the specification may also be implemented by a single unit or device through software or hardware. Terms such as first and second are used to indicate names and do not imply any particular order.

[0187] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit the present application. Although the present application has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present application.

Claims

1. A test task distribution method based on artificial intelligence, characterized in that: The method comprises: Building a test case database and calling test case data from the test case database to generate test tasks according to the user's test requirements; Establish a heartbeat connection between the server and the test executor to obtain the communication connection status between the server and the test executor; If the communication connection status is normal, the test task is distributed to the test executor according to a custom distribution algorithm, including: prioritizing the test task to obtain a test task level data set; sorting the test tasks in the test task level data set in descending order of priority to generate a test task queue; counting the system resources required for each test task in the test task queue to obtain a task resource set; judging whether the priorities of each test task in the test task queue are consistent to obtain a judgment result; distributing the test tasks in the test task queue to the test executor according to a custom distribution algorithm; if the judgment result is consistent, distributing the test tasks in the test task queue to the test executor according to the custom distribution algorithm and the task resource set; if the judgment result is inconsistent, standardizing the priorities of each test task in the test task queue, and then distributing the test tasks in the test task queue to the test executor according to the custom distribution algorithm and the task resource set; Executing the test task based on the test executor to obtain a test result, including: executing the test case in the test task based on the test executor to obtain a test result, the test result including test success, test failure and test skip; if the test result is test success, continuing to execute the next test case corresponding to the current test case in the test task; if the test result is test failure, ending the test task corresponding to the current test case; if the test result is test skip, the test task corresponding to the current test case will be skipped and will not continue to be executed; A test report is generated based on the test results for presentation.

2. The test task distribution method based on artificial intelligence according to claim 1, characterized in that: The step of constructing a test case database and calling test case data from the test case database to generate a test task according to the user's test requirements includes: Generate test cases based on the test case automatic generation tool to build a test case database; The corresponding test case in the test case database is called according to the user's test requirements to generate the test task.

3. The test task distribution method based on artificial intelligence according to claim 1, characterized in that: The establishing of a heartbeat connection between the server and the test executor to obtain the communication connection status between the server and the test executor includes: The test executor sends a heartbeat request to the server every preset fixed period to obtain the heartbeat signal; The communication connection status between the test executor and the server is determined based on the heartbeat signal.

4. The test task distribution method based on artificial intelligence according to claim 1, characterized in that: Generating a test report based on the test result for display includes: The test executor feeds back the test result to generate a test result report; The test result report is stored in the test case database for display.

5. An artificial intelligence-based test task distribution device for implementing the artificial intelligence-based test task distribution method according to claim 1, characterized in that: The device comprises: A generating unit, configured to construct a test case database and call test case data from the test case database to generate test tasks according to the user's test requirements; a connection unit, configured to establish a heartbeat connection between the server and the test executor to obtain a communication connection status between the server and the test executor; a distribution unit, configured to distribute the test task to the test executor according to a custom distribution algorithm if the communication connection state is normal; an execution unit, configured to execute the test task based on the test executor to obtain a test result; A display unit is used to generate a test report based on the test result for display.

6. An electronic device, characterized in that: The electronic device comprises: a memory storing computer-readable instructions; and A processor executes computer-readable instructions stored in the memory to implement the artificial intelligence-based test task distribution method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the test task distribution method based on artificial intelligence according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Automatic testing management method, device and facility of fund system and storage medium

    CN107885660A

  • A task detection method and device

    CN109922050A

  • Software testing method, equipment and readable medium

    CN110515833A

  • Distributed automatic software testing method and system based on MQTT

    CN112231223A