Test method, device, system, electronic device and storage medium

By updating tasks and device index cache queues in real time and dynamically adjusting test task allocations, the problem of uneven utilization of equipment resources is solved, and testing efficiency and equipment resource utilization are improved.

CN118585308BActive Publication Date: 2024-11-26INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411027552.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-11-26
Estimated Expiration
2044-07-30

AI Technical Summary

Technical Problem

In the prior art, uneven utilization of equipment resources leads to inefficient testing, and the single session management mechanism limits the concurrent testing capabilities of the equipment, resulting in a long test cycle of the full script.

Method used

Create the current task cache queue and the device index cache queue through real-time updates, intelligently select the test task list and the site to be called, dynamically adjust the test task allocation, and ensure the balanced utilization of device resources.

Benefits of technology

It significantly shortens the test execution time, improves the test efficiency, avoids the long-term high load or idleness of the equipment, and maximizes the utilization of equipment resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118585308B_ABST
    Figure CN118585308B_ABST
Patent Text Reader

Abstract

The present invention provides a test method, device, system, electronic device and storage medium, and relates to the field of computer technology. The method comprises: according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state, in multiple test scripts stored in the current task cache queue, a current test task list is obtained, and the current test task list includes at least one test script to be executed; according to the current running state and the current process identifier, in multiple sites stored in the current device index cache queue, a site to be called is obtained; according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue, the device to be tested of the site to be called is controlled to execute the test task corresponding to each test script to be executed. The present invention realizes the balanced utilization of equipment resources, thereby shortening the test execution time and improving the test efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a testing method, device, system, electronic equipment and storage medium. Background Art

[0002] Currently, many devices under test, such as storage management systems, are limited by a single-session management mechanism that only allows one valid session, meaning that multiple sessions will occupy each other and only one active session will be retained. Based on this single-session management mechanism, batch test tasks under a single device under test can only be executed serially, resulting in a lengthy full-script test cycle, which seriously affects test efficiency.

[0003] In order to shorten the execution time, the industry generally adopts the strategy of deploying multiple devices to be tested and dynamically allocating scripts according to the test requirements to perform concurrent tests on multiple devices. However, due to the uncontrollable environmental factors in the script execution process, the execution time of a single script will be disturbed, which will cause uneven utilization of device resources. For example, some devices are under high load for a long time, while others are relatively idle, resulting in low test efficiency. Summary of the invention

[0004] The present invention provides a testing method, device, system, electronic device and storage medium, which are used to solve the defect of uneven utilization of equipment resources in the prior art, resulting in low testing efficiency, achieve efficient utilization of equipment resources, shorten the execution time of the full script, and thus improve testing efficiency.

[0005] The present invention provides a testing method, comprising:

[0006] Obtaining a current task cache queue and a current device index cache queue, wherein the current task cache queue includes script information and a first real-time execution state of each test script, and the current device index cache queue includes a site identifier, a current running state, and a current process identifier of each site;

[0007] According to the script configuration mode corresponding to the current task cache queue and the first real-time execution state, a current test task list is obtained from a plurality of test scripts stored in the current task cache queue, wherein the current test task list includes at least one test script to be executed;

[0008] According to the current running state and the current process identifier, obtaining a site to be called from a plurality of sites stored in the current device index cache queue;

[0009] According to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue, the device to be tested of the site to be called is controlled to execute the test task corresponding to each test script to be executed.

[0010] According to a testing method provided by the present invention, the current task cache queue further includes module information of each script module and a second real-time execution state of each script module, and the script module includes a plurality of the test scripts;

[0011] The step of obtaining a current test task list from a plurality of test scripts stored in the current task cache queue according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state includes:

[0012] When the script configuration mode is the module-based configuration mode, searching the current task cache queue for a first script module whose second real-time execution state is an unexecuted state;

[0013] When the first script module is not found, searching the current task cache queue for a second script module whose second real-time execution status is an execution status;

[0014] In the second script module, searching for a first test script whose first real-time execution status is an unexecuted status;

[0015] When the first test script is found, the current test task list is obtained according to the first test script.

[0016] According to a testing method provided by the present invention, the method further comprises:

[0017] When the first script module is found, the current test task list is obtained according to all test scripts in the first script module.

[0018] According to a testing method provided by the present invention, obtaining a current test task list from a plurality of test scripts stored in the current task cache queue according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state includes:

[0019] When the script configuration mode is the full configuration mode, selecting a second test script whose first real-time execution state is an unexecuted state from among the multiple test scripts stored in the current task cache queue;

[0020] According to the second test script, obtain the current test task list.

[0021] According to a testing method provided by the present invention, obtaining a site to be called from a plurality of sites stored in the current device index cache queue according to the current running state and the current process identifier includes:

[0022] Among the multiple sites stored in the current device index cache queue, searching for a first site whose communication state in the current running state is an online state, whose occupied state in the current running state is an idle state, and whose current process identifier is empty;

[0023] When the first site is found, the first site is used as the site to be called.

[0024] According to a testing method provided by the present invention, the method further comprises:

[0025] When the first site is not found, entering a waiting state;

[0026] When the duration of the current waiting state reaches the current delay processing duration, the current running state and / or current process identifier of each site in the current device index cache queue is updated in real time according to the test task execution result corresponding to the device to be tested at each site, to obtain the first device index cache queue;

[0027] Searching, in the first device index cache queue, for a second site whose communication status in the updated running status is offline;

[0028] When the second site is found, if it is determined that the login status corresponding to the device to be tested of the second site is normal, the communication status of the second site in the first device index cache queue is updated to an online state, and a second device index cache queue is obtained;

[0029] Searching, in the index cache queue of the second device, a third site whose communication state in the updated running state is an online state, whose occupation state in the updated running state is an idle state, and whose updated process identifier is empty;

[0030] When the third site is found, the third site is used as the site to be called.

[0031] According to a testing method provided by the present invention, the login status corresponding to the device to be tested at the second site is obtained based on the following steps:

[0032] In the first device index cache queue, obtaining the site identifier of the second site;

[0033] Acquire device resource information of the second site in the device resource list according to the site identifier of the second site;

[0034] Verify, based on the device resource information of the second site, whether the device to be tested at the second site can log in successfully;

[0035] When it is verified that the device to be tested at the second site has successfully logged in, it is determined that the login status corresponding to the second site is a normal status.

[0036] According to a testing method provided by the present invention, the method further comprises:

[0037] When the second site is not found, or the third site is not found, or it is verified that the login status corresponding to the device to be tested at the second site is abnormal, return to the step of entering the waiting state until the third site is found.

[0038] According to a testing method provided by the present invention, the method further comprises:

[0039] When the duration of the current waiting state reaches the current delay processing duration, the count value of the counter is cumulatively increased by 1;

[0040] When the accumulated count result of the counter is less than or equal to the preset value, the current delay processing duration is used as the next delay processing duration;

[0041] When the accumulated count result of the counter is greater than the preset value, the current delay processing duration is extended by the preset duration to obtain the next delay processing duration.

[0042] According to a testing method provided by the present invention, the method controls the device to be tested of the site to be called to execute the test task corresponding to each test script to be executed according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue, including:

[0043] According to the site identifier of the site to be called, in the device resource list, obtain the device resource information of the site to be called;

[0044] When it is determined according to the device resource information of the site to be called that the access state of the device to be tested of the site to be called is normal, the current process identifier of the site to be called in the current device index cache queue is updated according to the identifier of the current process;

[0045] When it is determined that the update of the current process identifier of the site to be called is completed, the device to be tested of the site to be called is controlled to execute the test tasks corresponding to each test script to be executed according to the script information of each test script to be executed.

[0046] According to a testing method provided by the present invention, the method further comprises:

[0047] Determine, according to the execution results of each of the to-be-executed test scripts, a third test script that has been executed in the current test task list;

[0048] Deleting the script information and the first real-time execution status of each of the third test scripts in the current task cache queue to obtain an updated test task cache queue;

[0049] According to the difference between the updated test task cache queue and the current test task list, the current test task list is updated to obtain an updated test task list;

[0050] When it is determined that the updated test task list is empty, the occupied state in the current running state of the to-be-called site in the current device index cache queue is updated to an idle state, and the current process identifier is updated to empty.

[0051] The present invention also provides a testing device, comprising:

[0052] A first acquisition module is used to acquire a current task cache queue and a current device index cache queue, wherein the current task cache queue includes script information and a first real-time execution state of each test script, and the current device index cache queue includes a site identifier, a current running state, and a current process identifier of each site;

[0053] A second acquisition module is used to acquire a current test task list from a plurality of test scripts stored in the current task cache queue according to a script configuration mode corresponding to the current task cache queue and the first real-time execution state, wherein the current test task list includes at least one test script to be executed;

[0054] A third acquisition module is used to acquire a site to be called from a plurality of sites stored in the current device index cache queue according to the current running state and the current process identifier;

[0055] A testing module is used to control the tested device of the site to be called to execute the test tasks corresponding to each test script to be executed according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue.

[0056] The present invention also provides a test system, comprising a plurality of sites and a control system;

[0057] Each of the sites includes a device to be tested, a computing server and a switch;

[0058] The control system includes a plurality of processes, and the number of the processes is configured according to the number of the sites;

[0059] Each of the processes is used to execute any of the above-mentioned testing methods.

[0060] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned testing methods when executing the program.

[0061] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the test method described above is implemented.

[0062] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned testing methods.

[0063] The test method, device, system, electronic device and storage medium provided by the present invention create a current task cache queue and a current device index cache queue through real-time updating. According to the current task cache queue including script information of each test script and a first real-time execution status, the current device index cache queue includes the site identification, current operation status and current process identification of each site. The current test task list selection and idle and available to-be-called site selection are performed in real time and intelligently, so that the distribution of test tasks can be dynamically adjusted according to the execution status of the test script and the load status of the device in real time, thereby ensuring the balanced utilization of device resources, realizing the maximum utilization of device resources, avoiding the situation where some devices are in a high-load state for a long time while other devices are idle, significantly shortening the test execution time, and improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0065] Figure 1 It is one of the flow charts of the testing method provided by the present invention.

[0066] Figure 2 This is the second flow chart of the testing method provided by the present invention.

[0067] Figure 3 This is the third flow chart of the testing method provided by the present invention.

[0068] Figure 4 This is the fourth flow chart of the testing method provided by the present invention.

[0069] Figure 5 It is a structural schematic diagram of the testing device provided by the present invention.

[0070] Figure 6 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0071] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0072] There are many devices to be tested on the market, and the test environment corresponding to these devices to be tested is limited by the single-session management mechanism, which only allows one valid session in the same time period. For example, in a storage management system, multi-session login will squeeze out other sessions and only retain one active session. Based on the characteristics of this single-session management, batch job activities in a single test environment can only be serialized, and the execution cycle of a full script is very long. If you want to shorten the execution time, you need to prepare multiple test environments, that is, multiple devices to be tested, and dynamically allocate scripts according to test requirements to implement a strategy for concurrent execution of tests on multiple devices.

[0073] However, due to the limitations of script logic, such as query, setting, function verification, fault injection, performance and other logic, as well as uncontrollable environmental factors such as network bandwidth and execution failure points, the execution time of a single script will be affected, resulting in uneven utilization of device resources. Ultimately, the equipment will still be unevenly busy, which will lead to low testing efficiency.

[0074] In response to the above problems, the present embodiment provides a testing method, which creates a current task cache queue and a current device index cache queue through real-time updates, and intelligently selects the current test task list and idle and available sites to be called based on the current task cache queue and the current device index cache queue, so as to be able to dynamically adjust the allocation of test tasks in real time according to the execution status of the test script and the load status of the device, thereby ensuring the balanced utilization of device resources, achieving the maximum utilization of device resources, significantly shortening the test execution time, and improving the test efficiency.

[0075] Figure 1It is one of the flow charts of the test method provided by the present invention; the method can be applied to a control system, which includes multiple processes, and the number of processes can be adaptively configured according to the number of sites in the current device index cache queue, that is, the number of processes is consistent with the number of sites in the current device index cache queue; the method can be implemented based on the execution of each process, and the test method is described below taking the current process as the execution subject as an example.

[0076] This method can be used in batch operation scenarios such as device query, setting, function test, fault injection test, performance test, etc., and this embodiment does not specifically limit this. Figure 1 As shown, the method includes step 110 , step 120 , step 130 and step 140 .

[0077] Step 110, obtaining the current task cache queue and the current device index cache queue, wherein the current task cache queue includes script information and a first real-time execution status of each test script, and the current device index cache queue includes a site identifier, a current operating status, and a current process identifier of each site.

[0078] Among them, the current task cache queue is the task cache queue A formed by the current cycle update, which is used for task execution management; it is a multi-process processing queue, that is, test script acquisition and / or queue update can be performed through multiple processes concurrently; it can be configured according to the full configuration mode, or it can be configured according to the module configuration mode, and this embodiment does not make specific limitations on this.

[0079] For ease of understanding, the task cache queue formed according to the full configuration mode will be referred to as the full task cache queue, and the task cache queue formed according to the module configuration mode will be referred to as the module grouping task cache queue.

[0080] The full task cache queue includes script information and a first real-time execution status of each test script. The script information includes a script name and a script storage path, etc. This embodiment does not specifically limit this.

[0081] For example, the full task cache queue is specifically expressed as [{shellname, shellpath, status}…], where shellname is the script name, shellpath is the script storage path, and status is the first real-time execution status.

[0082] When the test task is executed based on the full task cache queue, each process may take a test script from the full task cache queue each time and apply to an available device for test task execution.

[0083] The module grouping task cache queue is an internal grouping of each test script in the full task cache queue to group multiple test scripts into one test script module. The module grouping task cache queue includes not only the script information and the first real-time execution status of each test script, but also the module information of each script module and the second real-time execution status of each script module, and the script information and the first real-time execution status of each test script are stored in the form of children under the script module to which it belongs. For example, the module grouping task cache queue can be expressed as [{model,mstatus,{shellname,shellpath,status}}…], where model is the module name, mstatus is the overall execution status of the script module, that is, the second real-time execution status, shellname is the script name, shellpath is the script storage path, and status is the first real-time execution status.

[0084] When executing test tasks based on the module grouping task cache queue, each process can take a test script combination under a script module from the module grouping task cache queue each time, execute it in a loop within the process and maintain real-time interaction with the module grouping task cache queue to ensure data synchronization.

[0085] The current device index cache queue is the device index cache queue B formed by the current periodic update, which is used to record the relationship between process and device occupancy and manage whether the device is used for task execution; the device index cache queue is a multi-process processing queue, which means that device calls and / or queue updates can be performed concurrently through multiple processes.

[0086] The device index cache queue B includes the site identifier, operation status and process identifier of each site. The operation status includes but is not limited to the communication status and the occupied status. The process identifier is used to mark whether the device to be tested at each site is occupied by the corresponding process, and the mark of the occupied process. For example, the device index cache queue B can be expressed as [{id: 1, busystatus, online, pid}…], where id is the site identifier, busystatus is the occupied status, which is used to indicate whether the site is occupied by other tasks, online indicates the communication status, which is used to indicate whether the site is online, and pid indicates the process identifier, which is used to indicate whether the site is assigned to the corresponding process, and the mark of the process.

[0087] Optionally, when the current cycle is the initial cycle, the device resource list M is loaded when the job task is started. The device resource list M is used to store the device resource information of each site, including but not limited to the site identifier, device type, device Internet Protocol Address (IP), device login password, device gateway address, etc., which is not specifically limited in this embodiment. For example, the device resource list M can be expressed as [{id: 1, type, ip, passwd, gw}, {id: 1, type, ip, passwd, gw}…], where id: 1 is the site identifier and type is the device type, which is used to distinguish the types of devices contained in the site, including but not limited to the device to be tested, computing servers such as Fiber Channel (FC) servers, and switches, etc., which is not specifically limited in this embodiment. ip is the IP of the device, passwd is the login password of the device, and gw is the gateway address of the device.

[0088] Then, the device resource list M is traversed to obtain the site identifier of each site, the occupancy status of each site is initialized to an idle state, which can be specifically represented as busystatus=idle, the communication status of each site is initialized to be empty, which can be specifically represented as online=null, and the process identifier of each site is initialized to be empty, which can be specifically represented as pid=null, thereby taking the initialized occupancy status and the initialized communication status of each site as the current operation status of each site, and taking the initialized process identifier of each site as the current process identifier, and constructing an initial device index cache queue;

[0089] Subsequently, the initial device index cache queue is traversed, and the device resource information of each site is queried in the device resource list based on the site identifier of each site in the initial device index cache queue to check whether the IP, user name, login password, gateway address, etc. of all devices to be tested are correct, and whether all configured devices can log in successfully. If the login is successful, the communication status of the site in the initial device index cache queue is modified to the online status, which can be specifically expressed as B.online=yes. If there is a situation where the device configured at any site cannot log in successfully, all associated data under the site in the initial device index cache queue are deleted, thereby obtaining the current device index cache queue.

[0090] When the current cycle is other than the initial cycle, the operating status and / or process identifier of each site in the previous device index cache queue can be updated in real time based on the test task execution results corresponding to the tested devices at each site in the previous cycle to obtain the current device index cache queue.

[0091] Optionally, when the current cycle is the initial cycle, if the script configuration mode is the full configuration mode, the script information of all test scripts is loaded at one time, and the execution status of the test script is initialized to the unexecuted state, which can be specifically expressed as status=0; and the initialized execution status of each test script is the first real-time execution status, and the script information and the first real-time execution status of each test script are stored in the full task cache queue in an unsorted form to obtain the current task cache queue.

[0092] When the current cycle is the initial cycle, if the script configuration mode is the module configuration mode, multiple test scripts are hierarchically combined according to the modules to obtain multiple script modules, and the overall execution status of the script module is initialized to the unexecuted state, which can be specifically expressed as mstatus=0, to indicate that the script module is not occupied by the process, that is, it has not been executed, and the execution status of the test script is initialized to the unexecuted state, which can be specifically expressed as status=0, to indicate that the test script has not been executed; and the initialized execution status of each script module is used as the second real-time execution status, and the initialized execution status of each test script is used as the first real-time execution status, and the associated information of the script modules and the associated information of the test scripts are hierarchically combined according to the module division and stored in the module grouping task cache queue to obtain the current task cache queue.

[0093] When the current cycle is other than the initial cycle, the first real-time execution status and / or the second real-time execution status of each test script in the previous task cache queue can be updated in real time based on the execution results of each test script in the previous cycle to obtain the current task cache queue.

[0094] Step 120, according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state, obtain a current test task list from multiple test scripts stored in the current task cache queue, and the current test task list includes at least one test script to be executed.

[0095] The current test task list is a list of test tasks that the current process needs to execute, which includes one or more to-be-executed test scripts that the current process needs to call.

[0096] It should be noted that, due to the different configuration methods of the test scripts of the current task cache queue under different script configuration modes, the corresponding script acquisition methods are also different. Therefore, when acquiring the current test task list, it is necessary not only to determine the test scripts to be executed based on the first real-time execution status of each test script, but also to obtain the script acquisition mode based on the script configuration mode, so as to adaptively and accurately determine the test scripts to be executed based on the first real-time execution status of each test script based on the corresponding script acquisition mode, thereby obtaining the current test task list.

[0097] Optionally, when making a current test task list, a selection method for the test scripts to be executed may be determined first according to the script configuration mode; the selection method includes selecting the test scripts one by one, or selecting in batches according to module divisions.

[0098] Then, based on the selection method of the test scripts to be executed and the first real-time execution status of each test script, one or more combined unexecuted test scripts to be executed are obtained from the multiple test scripts stored in the current task cache queue to construct a current test task list.

[0099] Step 130: Acquire a site to be called from a plurality of sites stored in the current device index cache queue according to the current running state and the current process identifier.

[0100] The site to be called is a site that can be called by the current process, which has available equipment to be tested. The equipment to be tested is various equipment required to be tested, such as a storage system, etc. This embodiment does not specifically limit this.

[0101] Optionally, when determining the site to be called, the current running status and current process identifier of each site in the current device index cache queue may be combined to select a callable site from multiple sites as the site to be called.

[0102] The selection method includes using logic judgment or pre-trained classification model classification. For example, for logic judgment, it can be to judge whether the current operation status and current process identification of each site meet the availability conditions, so as to select the site that meets the availability conditions as the site to be called. For another example, for classification model classification, it can be to collect a large number of historical operation status and historical process identification of each site, as well as historical site selection labels, and iteratively train the neural network model to obtain a classification model that can output available sites to be called based on the operation status and process identification of each site; then, the current operation status and current process identification of each site are input into the classification model to obtain the sites to be called that are available in the current cycle.

[0103] Step 140, based on the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue, control the device to be tested of the site to be called to execute the test task corresponding to each test script to be executed.

[0104] Optionally, after obtaining the test script to be executed and the site to be called, the script information of the test script to be executed can be searched in the current task cache queue to obtain the script name, script storage address, etc. of the test script to be executed; and the site identifier of the site to be called can be searched in the current device index cache queue to obtain the resource information of the site to be called based on the site identifier; thereby, a script execution task is created with the site identifier of the site to be called, resource information and script information of the test script to be executed as input parameters.

[0105] Then, according to the script execution task, the device to be tested of the site to be called is called, and the test task corresponding to each test script to be executed is executed.

[0106] The method provided in this embodiment creates a current task cache queue and a current device index cache queue through real-time updates. The current task cache queue includes the script information of each test script and the first real-time execution status, and the current device index cache queue includes the site identifier, the current operating status and the current process identifier of each site. The current test task list selection and the idle and available sites to be called are intelligently performed in real time, so that the allocation of test tasks can be dynamically adjusted in real time according to the execution status of the test script and the load status of the equipment, thereby ensuring the balanced utilization of equipment resources, realizing the maximum utilization of equipment resources, avoiding the situation where some equipment is in a high load state for a long time while other equipment is idle, significantly shortening the test execution time, and improving the test efficiency.

[0107] In some embodiments, the current task cache queue further includes module information of each script module and a second real-time execution state of each script module, and the script module includes a plurality of the test scripts;

[0108] The step of obtaining a current test task list from a plurality of test scripts stored in the current task cache queue according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state includes:

[0109] When the script configuration mode is the module-based configuration mode, searching the current task cache queue for a first script module whose second real-time execution state is an unexecuted state;

[0110] When the first script module is not found, searching the current task cache queue for a second script module whose second real-time execution status is an execution status;

[0111] In the second script module, searching for a first test script whose first real-time execution status is an unexecuted status;

[0112] When the first test script is found, the current test task list is obtained according to the first test script.

[0113] Optionally, when the script configuration mode is a module configuration mode, the current task cache queue obtained is a module grouping task cache queue. Therefore, in addition to the script information and the first real-time execution status of each test script, the task cache queue also includes the module information of each script module and the second real-time execution status of each script module, and the script information and the first real-time execution status of each test script are stored in the form of sub-levels under the script module to which it belongs. Correspondingly, the script selection method corresponding to the script configuration mode is batch selection according to module division, so the current test task list is obtained in batches according to the module.

[0114] Optionally, the steps of obtaining the current test task list include:

[0115] When the current task cache queue is a module grouping task cache queue, the current process first searches the current task cache queue for the first script module whose second real-time execution status is unexecuted, that is, mstatus=0, based on the second real-time execution status of each script module.

[0116] In some embodiments, the method further includes: when the first script module is found, obtaining the current test task list according to all test scripts in the first script module.

[0117] Optionally, when the first script module is found, it indicates that there is an idle module in the current task cache queue; at this time, the current process can generate a current test task list A0 based on all the test scripts under the first script module. If the length of the current test task list is greater than 0, which can be specifically expressed as len(A0)>0, the second real-time execution state of the first script module is updated to the execution state, that is, mstatus=1, to indicate that the module has been taken over by the current process to execute tasks.

[0118] When the first script module with mstatus=0 is not found, it indicates that there is no idle module in the current task cache queue; at this time, the current process needs to schedule the script tasks under the same module together with other processes. Therefore, the current process needs to continue to search for the second script module whose second real-time execution status is the execution status in the current task cache queue, that is, the second script module that has been taken over by other processes for execution. And in the second script module, search for the first test script whose first real-time execution status is the unexecuted status, so as to generate the current test task list A0 based on the found first test script. If the unexecuted first test script cannot be found in the second script module, that is, if the module whose second real-time execution status is the execution status cannot be found and there is an unexecuted test script, the current process executes the exit test operation.

[0119] The method provided in this embodiment is to execute the test task in the module grouping task cache queue. After the current process is started, an application is made to the idle and available devices to be tested to execute the script task. One device to be tested sends one script task under the same script module at a time. After the test script under the same script module is executed, other script modules are read from the current task cache queue to ensure that the test script under the same script module is executed preferentially in the devices to be tested at the same site. If all script modules are executed by devices to be tested, the idle and available devices to be tested can execute the test script of the same script module concurrently with other devices to be tested to realize multi-process concurrent processing of tasks under the module, balance the equipment resources to the maximum extent, shorten the release time difference of multiple sets of devices to be tested to within one script execution cycle, and maximize the use of multiple devices in parallel to shorten the script execution time, reduce the interference between scripts, increase the flexibility of equipment management and add emergency requisition attributes, thereby realizing efficient use of equipment, compressing the equipment release interval, shortening the overall script execution time, and thus improving the test operation efficiency.

[0120] In some embodiments, obtaining a current test task list from a plurality of test scripts stored in the current task cache queue according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state includes:

[0121] When the script configuration mode is the full configuration mode, selecting a second test script whose first real-time execution state is an unexecuted state from among the multiple test scripts stored in the current task cache queue;

[0122] According to the second test script, obtain the current test task list.

[0123] Optionally, when the script configuration mode is the full configuration mode, the current task cache queue obtained is the full task cache queue, and accordingly, the current test task list is obtained one by one according to the script.

[0124] Optionally, the steps of obtaining the current test task list include:

[0125] The current process directly searches for any second test script whose first real-time execution status is an unexecuted status among the multiple test scripts stored in the current task cache queue;

[0126] If the second test script is found, the current test task list is obtained according to the second test script.

[0127] It should be noted that the structure of the current test task list obtained in the full configuration mode and the current test task list obtained in the module configuration mode is the same as the structure of the full task cache queue, that is, they are all configured one by one in disorder based on the script information of the test script and the first real-time execution status.

[0128] The method provided in this embodiment, when executing test tasks for the full task cache queue, after the current process is started, applies for idle available devices to be tested to execute script tasks, and one device to be tested sends one script task at a time. After one script task is executed, other script tasks are read from the current task cache queue to avoid wasting device resources. At the same time, it can avoid resource competition or performance degradation caused by the same device processing multiple tasks at the same time. In this way, while ensuring balanced and effective use of device resources, it can ensure that all test tasks can be effectively executed, thereby improving test performance.

[0129] In some embodiments, acquiring the to-be-called site from the plurality of sites stored in the current device index cache queue according to the current running state and the current process identifier includes:

[0130] Among the multiple sites stored in the current device index cache queue, searching for a first site whose communication state in the current running state is an online state, whose occupied state in the current running state is an idle state, and whose current process identifier is empty;

[0131] When the first site is found, the first site is used as the site to be called.

[0132] Optionally, in the process of calling the site, first traverse the current device index cache queue to detect whether the communication status of each site stored in the current device index cache queue is online, whether the occupancy status is idle, and whether the current process identifier is empty; if the communication status in the current running state of any site is online, the occupancy status in the current running state is idle, and the current process identifier is empty, it means that the site is an available idle site, and it can be used as the site to be called at this time, so that the device to be tested of the site to be called can be called subsequently to execute the test task corresponding to the test script to be executed.

[0133] The method provided in this embodiment dynamically adjusts the sites to be called for executing the test tasks based on the status of each site in the current device index cache queue and the process allocation in real time, so that the test process can instantly obtain the site resources that are most suitable for the current cycle test, thereby ensuring the maximum utilization of device resources, reducing test interruptions or delays that may occur due to waiting for resources, and improving test coverage and test execution efficiency.

[0134] In some embodiments, when the first site is not found, entering a waiting state;

[0135] When the duration of the current waiting state reaches the current delay processing duration, the current running state and / or current process identifier of each site in the current device index cache queue is updated in real time according to the test task execution result corresponding to the device to be tested at each site, to obtain the first device index cache queue;

[0136] Searching, in the first device index cache queue, for a second site whose communication status in the updated running status is offline;

[0137] When the second site is found, if it is determined that the login status corresponding to the device to be tested of the second site is normal, the communication status of the second site in the first device index cache queue is updated to an online state, and a second device index cache queue is obtained;

[0138] Searching, in the index cache queue of the second device, a third site whose communication state in the updated running state is an online state, whose occupation state in the updated running state is an idle state, and whose updated process identifier is empty;

[0139] When the third site is found, the third site is used as the site to be called.

[0140] Optionally, if the first site whose communication state in the current running state is online, the occupied state in the current running state is idle, and the current process identifier is empty is not found, it indicates that there are no available idle sites in the current device index cache queue; at this time, it is necessary to enter the queue waiting state, and in each waiting cycle, the current process can execute the following steps:

[0141] First, the delay processing duration time corresponding to the current waiting cycle is obtained to obtain the current delay processing duration; the obtaining method here includes using the same delay processing duration for each waiting cycle, or adaptively determining the delay processing duration of each waiting cycle based on the total waiting duration of all waiting cycles.

[0142] Next, it is determined whether the duration of the current waiting state reaches the current delay processing duration. If it reaches the current delay processing duration, the current operation state and / or current process identifier of each site in the current device index cache queue is updated in real time according to the test task execution results corresponding to the devices to be tested at each site, and the first device index cache queue is obtained. Based on the first device index cache queue, it is further detected whether there is an offline site (second site) whose communication state is offline, that is, a site with online=no.

[0143] When the second site is found, it is further determined whether the login status corresponding to the device to be tested at the second site is normal. If the login status corresponding to the device to be tested at the second site is normal, the communication status of the site is updated to an online status, which can be updated to B[id].online=yes. And the current process stops detecting other offline sites, while other processes continue to detect offline sites. When there are still test scripts to be executed in the current test task list, the current process will continue to search for a third site that is online, idle, and has an empty process identifier in the second device index cache queue updated by the status recovery of the offline site. When the third site is found, the third site will be used as the site to be called.

[0144] In some embodiments, when the second site or the third site is not found, or it is verified that the login status corresponding to the device to be tested at the second site is abnormal, the process returns to the step of entering the waiting state until the third site is found.

[0145] Optionally, for the current waiting cycle, if, after all sites in the first device index cache queue are detected, the second site (or offline site) is not detected, and there are still unexecuted test scripts in the current task cache queue, then return to the step of entering the waiting state, and continue to detect the next waiting cycle to detect whether there are other processes that release or restore available idle sites, until a third site is found whose communication status is online and whose occupancy status in the updated running status is idle, then the site is used as the site to be called to execute the test task.

[0146] If, after completing the detection of all sites in the index cache queue of the first device, it is determined that the login status of the detected offline sites are all abnormal, and there are still unexecuted scripts to be tested in the current task cache queue, then return to the step of entering the waiting state, and continue the detection of the next waiting cycle to detect whether there are other processes that release or restore available idle sites, until a third site is found whose communication status is online and whose occupancy status in the updated running status is idle, then the site is used as the site to be called to execute the test task.

[0147] If, after the detection of all sites in the index cache queue of the second device is completed, a third site whose communication status is online and whose occupancy status in the updated running status is idle is not detected, then return to the step of entering the waiting state and continue to detect the next waiting cycle to detect whether there are other processes that release or restore available idle sites, until a third site whose communication status is online and whose occupancy status in the updated running status is idle is found, then the site will be used as the site to be called to execute the test task.

[0148] The method provided in this embodiment is that the current process performs cyclic acquisition of the sites to be called through delayed waiting to ensure that during the task execution, when a site is occupied or abnormal, the current process will continue to wait and perform cyclic acquisition of the callable sites until all test tasks in the current task cache queue are executed and then released, avoiding the lack of available processes after the site is available, thereby improving the utilization rate of test resources and test efficiency.

[0149] In some embodiments, the login status corresponding to the device to be tested at the second site is obtained based on the following steps:

[0150] In the first device index cache queue, obtaining the site identifier of the second site;

[0151] Acquire device resource information of the second site in the device resource list according to the site identifier of the second site;

[0152] Verify, based on the device resource information of the second site, whether the device to be tested at the second site can log in successfully;

[0153] When it is verified that the device to be tested at the second site has successfully logged in, it is determined that the login status corresponding to the second site is a normal status.

[0154] Optionally, when determining the login status corresponding to the second site, the site identifier of the second site can be obtained in the first device index cache queue, and the device resource information of the second site can be loaded in the device resource list based on the association between the site identifier and the device resource information.

[0155] According to the equipment resource information, the IP information of the device to be tested at the second site is obtained, and it is verified based on the IP information whether the device to be tested at the second site can log in successfully. After verifying that the device to be tested at the second site can log in successfully, it is determined that the login status corresponding to the second site is normal. At this time, the communication status of the second site can be updated to an online status to enable the site to perform test tasks and improve resource utilization.

[0156] In some embodiments, when the duration of the current waiting state reaches the current delay processing duration, the count value of the counter is cumulatively increased by 1;

[0157] When the accumulated count result of the counter is less than or equal to the preset value, the current delay processing duration is used as the next delay processing duration;

[0158] When the accumulated count result of the counter is greater than the preset value, the current delay processing duration is extended by the preset duration to obtain the next delay processing duration.

[0159] Optionally, in order to optimize resource allocation and reduce waiting time, the control system can be configured with a counter to record the number of waiting cycles, that is, when the duration of the current waiting state reaches the current delay processing duration, it indicates that the current waiting cycle is over and the counter is incremented by 1.

[0160] After the current waiting cycle ends, it can be determined whether the cumulative counting result of the counter is greater than the preset value. If it is greater than the preset value, the current delay processing time can be extended by the preset time to obtain the next delay processing time with a longer delay processing time, so as to adapt to abnormal situations such as network delays or site restarts that may occur at each site, thereby more evenly distributing the load of the sites and improving the overall testing efficiency.

[0161] The preset value and preset duration here can be adaptively set based on the actual needs of the system, the execution indicators of the test task, such as the minimum execution duration, and the operating performance of the site, such as the network recovery time and the restart time. For example, the preset value can be set to 15 and the preset duration to 60 seconds. That is, when the cumulative count value of the counter reaches 15, the waiting cycle needs to wait for an additional 60 seconds to achieve a more balanced load distribution of the site and improve the overall test efficiency.

[0162] In some embodiments, controlling the device to be tested of the site to be called to execute the test task corresponding to each test script to be executed according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue includes:

[0163] According to the site identifier of the site to be called, in the device resource list, obtain the device resource information of the site to be called;

[0164] When it is determined according to the device resource information of the site to be called that the access state of the device to be tested of the site to be called is normal, the current process identifier of the site to be called in the current device index cache queue is updated according to the identifier of the current process;

[0165] When it is determined that the update of the current process identifier of the site to be called is completed, the device to be tested of the site to be called is controlled to execute the test tasks corresponding to each test script to be executed according to the script information of each test script to be executed.

[0166] Optionally, when an available idle site to be called is obtained, the occupancy status of the site may be updated from idle to occupied; wherein the occupancy status of the site may be represented as B[id].busystatus=busy.

[0167] According to the site identifier of the site to be called, in the device resource list, the device resource information of the site to be called is obtained by association, so as to obtain the IP information of the device to be tested of the site to be called according to the device resource information, and verify whether the device to be tested of the site to be called can log in successfully according to the IP information. When it is verified that the device to be tested of the site to be called cannot log in successfully, the communication status of the site to be called is updated to the offline status, and the occupied status is updated to the idle status, that is, updated to B[id].online=no, B[id].busystatus=idle, and the site to be called is controlled to exit the script execution task.

[0168] When it is verified that the device to be tested at the site to be called can log in successfully, the process ID of the current process is obtained, and the current process ID of the site to be called in the current device index cache queue is updated to the process ID of the current process to indicate that the device to be tested at the site to be called can be scheduled by the current process.

[0169] Moreover, when the current task cache queue is the full task cache queue, there is only one test script to be executed in the current test task list. At this time, the first real-time execution status of the test script to be executed can be directly updated to the executing status, that is, updated to A[shellname].status=1, and, according to the script information of the test script to be executed, the storage path of the test script to be executed is obtained, and the test instructions are assembled according to the storage path; according to the test instructions, the device to be tested of the site to be called is controlled to execute the test task corresponding to the test script to be executed. After the test task corresponding to the test script to be executed is completed, the execution result and return information are written back to the database, the log is recorded, and the occupancy status in the current running status of the site to be called in the current device index cache queue is updated to the idle status, and the current process identifier is updated to empty, that is, updated to B[id].busystatus=idle, B[id].pid=null, so as to release the resources of the site to be called so that other processes can call the site, thereby improving resource utilization. At the same time, in the current task cache queue, the associated information of the test script to be executed is deleted to avoid repeated execution of the test script to be executed, and the test task execution of the current cycle is terminated.

[0170] When the current task cache queue is a module grouping task cache queue, there are multiple test scripts to be executed in the current test task list; at this time, the first real-time execution status of any unexecuted test script to be executed in the intersection of the current test task list and the current task cache queue can be updated to the executing status, that is, updated to A[shellname].status=1; and, according to the script information of the test script to be executed, the storage path of the test script to be executed is obtained, and the test instructions are assembled according to the storage path; according to the test instructions, the device to be tested at the site to be called is controlled to execute the test task corresponding to the test script to be executed, and after the test task corresponding to the test script to be executed is completed, the execution result and return information are written back to the database, the log is recorded, and the first real-time execution status of the next test script to be executed is returned to be updated to the executing status, so as to call the corresponding test instruction to continue the execution of the test task corresponding to the next test script to be executed, until the test tasks corresponding to all test scripts to be executed in the current test task list are completed.

[0171] The method provided in this embodiment intelligently selects the current test task list and the idle and available sites to be called for batch job behaviors of devices with single session management requirements, so as to dynamically adjust the allocation of test tasks in real time according to the execution status of the test script and the load status of the device, thereby ensuring the balanced utilization of device resources, achieving the maximum utilization of device resources, avoiding the situation where some devices are in a high-load state for a long time while other devices are idle, significantly shortening the test execution time, and improving the test efficiency.

[0172] In some embodiments, the method further comprises:

[0173] Determine, according to the execution results of each of the to-be-executed test scripts, a third test script that has been executed in the current test task list;

[0174] Deleting the script information and the first real-time execution status of each of the third test scripts in the current task cache queue to obtain an updated test task cache queue;

[0175] According to the difference between the updated test task cache queue and the current test task list, the current test task list is updated to obtain an updated test task list;

[0176] When it is determined that the updated test task list is empty, the occupied state in the current running state of the to-be-called site in the current device index cache queue is updated to an idle state, and the current process identifier is updated to empty.

[0177] Optionally, when the current task cache queue is a module grouping task cache queue, there are multiple test scripts to be executed in the current test task list, and during the test script execution process, one test script to be tested is executed each time; therefore, during each script execution process, it is necessary to determine whether each test script to be executed has been completed based on the execution result of each test script to be executed, so as to delete the script information and the first real-time execution status of the third test script that has been executed, and obtain an updated test task cache queue;

[0178] And determine whether the associated information of each test script to be executed still exists in the updated test task cache queue. If the associated information of any test script to be executed does not exist in the updated test task cache queue, it indicates that the test script to be executed has been executed. At this time, in the current test task list, delete the difference between the updated test task cache queue and the current test task list to avoid the problem of data asynchrony caused by multiple processes executing test scripts on the same script module together, thereby avoiding repeated execution of test tasks, reducing the number of repeated executions, narrowing the calculation scope, and improving test efficiency.

[0179] If the associated information of any test script to be executed exists in the updated test task cache queue, it indicates that the test script to be executed has not been executed. At this time, the execution status of the test script to be executed is re-updated to the unexecuted status to maintain data synchronization, avoid missing the test task of the test script to be executed, and thereby improve the integrity and accuracy of the test execution.

[0180] Continue to check whether the updated test task list is empty. If it is not empty, it indicates that there are still test scripts to be executed. You can continue to apply for the sites to be called to continue the execution of the test scripts to be executed until the updated test task list is empty.

[0181] If the updated test task list is empty, it means that the test tasks of the current cycle have been executed. At this time, the occupancy state of the current running state of the site to be called in the current device index cache queue can be updated to the idle state, and the current process identifier is updated to empty to execute the test tasks of the next cycle until all processes exit.

[0182] The method provided in this embodiment automatically removes the completed script information and its execution status from the task cache queue by real-time tracking and updating the execution results of the test script to be executed, and then synchronously updates the test task list. When all test tasks are completed, the occupied device resources can be automatically marked as idle and the relevant process identifiers can be cleared, which effectively improves the automation level and resource utilization efficiency of the test process, ensures the timely release and reallocation of the test environment, and effectively improves the test efficiency.

[0183] The complete execution process of the test method provided in this embodiment is described below with specific examples.

[0184] Figure 2 This is the second flow chart of the testing method provided by the present invention; Figure 3 This is the third flow chart of the testing method provided by the present invention; Figure 4 This is the fourth flow chart of the testing method provided by the present invention.

[0185] like Figure 2-4 As shown, the complete execution process of the test method includes the queue creation process, the test process for the full task cache queue, and the test process for the module group task cache queue.

[0186] like Figure 2 As shown in the figure, the queue creation process is implemented based on the following steps:

[0187] When the test task is started, the device resource list M is loaded. The device resource list M includes at least the site identifier, device type, device IP, device login password and gateway address, etc. For example, the device resource list M can be expressed as [{id: 1, type, ip, passwd, gw}, {id: 1, type, ip, passwd, gw}…].

[0188] Traverse the device resource list M to obtain the site identifier of each site, and initialize the occupancy state of each site to an idle state, initialize the communication state of each site to empty, and initialize the process identifier of each site to empty. Thus, the initialized occupancy state and initialized communication state of each site are used as the current operating state of each site, and the initialized process identifier of each site is used as the current process identifier to construct an initial device index cache queue.

[0189] The initial device index cache queue is traversed to test whether the devices configured at each site can log in successfully, and the initial device index cache queue is updated according to the test results, thereby obtaining the current device index cache queue. The update method includes: if the login is successful, the communication status of the site in the initial device index cache queue is changed to an online status, which can be specifically expressed as B.online=yes; if there is a situation where the device configured at any site cannot log in successfully, all the associated data under the site in the initial device index cache queue are deleted, thereby obtaining the current device index cache queue.

[0190] Determines whether to build the task cache queue by module grouping based on the script configuration mode.

[0191] If the task cache queue is constructed by module grouping, the overall execution status of the initialization script module is not executed, the execution status of the initialization test script is not executed, and the module information of each script module and the initialization execution status of each script module, as well as the script information and the initialization execution status of each test script are used to group and construct the module grouping task cache queue as the current task cache queue. For example, the module grouping task cache queue can be expressed as [{model, mstatus, {shellname, shellpath, status}}…].

[0192] If the task cache queue is not constructed by module grouping, but is constructed in full mode, the script information of all test scripts is loaded at one time, the execution status of the test script is initialized to the unexecuted state, and the script information of the test script and the initialized execution status are used to construct the full task cache queue in the form of no sorting conditions as the current task cache queue. For example, the full task cache queue can be specifically expressed as [{shellname, shellpath, status}…].

[0193] like Figure 3 As shown, based on Figure 2 After the process shown is constructed to form a full task cache queue and a current device index cache queue, the following steps can be performed to implement a test process for the full task cache queue:

[0194] Build the same number of processes as the number of valid sites in the current device index cache queue created.

[0195] Apply to obtain the device to be tested in the available idle site whose communication state is online, whose occupation state in the current running state is idle, and whose current process identifier is empty from the current device index cache queue B.

[0196] If the application is unsuccessful, it means that there is no idle device to be tested available in the current device index cache queue B. At this time, it enters the queue waiting and sets a counter num. It waits for one time cycle at a time, and the counter is accumulated by 1. When the counter reaches a multiple of 15, the time cycle is extended by 60s. When waiting for a time cycle, first check whether there is an offline site with onlie=no in the current device index cache queue B. If so, detect the IP of the device to be tested in the offline site to determine whether the device to be tested has been connected normally, that is, whether it can log in successfully. If it is connected normally (login successful), update the communication status of the offline site to the online state, stop the detection of other offline sites, and if there is still a task queue to be tested in A, continue to execute the step of applying for idle devices. If all offline sites are unavailable after all detections are completed, if it is determined that the length of the full task cache queue is greater than 0 and the counter has not reached a multiple of 15, continue to return to the step of the device to be tested in the available idle site to detect whether other processes release device resources. If there is no offline site with onlie=no in the current device index cache queue B, and the length of the full task cache queue is greater than 0, it is also necessary to return to the step of the device to be tested in the available idle site to detect whether there are other processes releasing device resources.

[0197] The above steps are iteratively executed until the device to be tested in an available idle site is applied for.

[0198] If a device to be tested (referred to as an available device) in an available idle site is applied for in the current device index cache queue B, the occupancy status of the idle site is updated to occupied, and the device resource information is obtained based on the site identifier of the idle site. Based on the device resource information, it is detected whether the IP of the available device can be logged in successfully to determine whether the available device is online normally.

[0199] If the available device can log in successfully, it is determined that the available device is online normally. At this time, the first real-time execution status of the test script to be executed in the current test task list is updated to the executing status. Get the identifier of the current process to update the current process identifier of the idle site in the current device index cache queue B to the identifier of the current process. Assemble the script path of the test script to be executed to call the available device to execute the script. After the execution is completed, write the execution result and return information back to the database and record the log. Update the current process identifier of the idle site in the current device index cache queue B to empty, and update the occupancy status of the idle site to idle status. At the same time, delete the associated information of the completed test script to be executed in the full task cache queue, and exit the script execution task.

[0200] If the available device cannot log in successfully, it is determined that the available device is not normally online. At this time, the communication status of the idle site in the current device index cache queue B is updated to an offline state, and the script execution task is exited.

[0201] After the execution script task of the current cycle returns, check whether there are any test scripts to be executed in the full task cache queue. If so, continue to return to the step of applying for the device to be tested in the available idle site with an online communication status, an idle occupancy status in the current running status, and an empty process identifier from the current device index cache queue B, and execute in a loop. If there are no test scripts to be executed, the process ends and exits.

[0202] like Figure 4 As shown, based on Figure 2 After the process shown is constructed to form the module group task cache queue and the current device index cache queue, the following steps can be performed to implement the test process for the module group task cache queue:

[0203] Build the same number of processes as the number of valid sites in the current device index cache queue created.

[0204] The current process extracts the test tasks corresponding to all the to-be-executed test scripts under the first script module whose second real-time execution status is not executed in the module group task cache queue, and constructs the current test task list A0. If the length of the current test task list A0 is greater than 0, the second real-time execution status of the first script module is updated to the executing state in the module group task cache queue, that is, updated to mstatus=1, to indicate that the first script module has a process to take over the execution task; if the unexecuted first script module is not found, that is, the length of the current test task list A0 is not greater than 0, the current process needs to execute the script task under the module together with other processes, detect the script module whose second real-time execution status is not executed in the module group task cache queue, and contains the to-be-executed test script whose first real-time execution status is not executed, extract the test tasks corresponding to all the unexecuted to-be-executed test scripts under the script module, and construct the current test task list A0. If the script module that satisfies the second real-time execution status of not executed and contains the to-be-executed test script whose first real-time execution status is not executed cannot be found, the current process exits.

[0205] Perform the steps for applying for devices to be tested in available idle sites separately. For details, see Figure 3 The application process of the equipment to be tested in the available idle sites shown in the figure will not be repeated here. After applying for the equipment to be tested, extract any test script to be executed whose first real-time execution status is not executed from the task intersection of the current test task list A0 and the script module between the module grouping task cache queue, update the first real-time status of the test script to be executed in the current test task list to the executing status, call the applied equipment to be tested to execute the test task corresponding to the test script to be executed, and refer to the specific execution steps. Figure 3 The test task execution process shown is not repeated here.

[0206] After the test task corresponding to the test script to be executed is completed, determine whether the test script to be executed in the current test task list A0 still exists in the module grouping task cache queue, that is, determine whether the test script to be executed in A0 with the first real-time execution state being executed still exists in the module grouping task cache queue. If the test script to be executed no longer exists in the module grouping task cache queue, it means that the test task corresponding to the test script to be executed has been completed. At this time, delete the difference data between the current test task list A0 and the module grouping task cache queue to reduce the data asynchrony that will occur in the module grouping task cache queue when multiple processes work together, which can effectively reduce the calculation range. If the test script to be executed still exists in the module grouping task cache queue, it means that the test script to be executed has not been executed, and re-update the first real-time execution state of the test script to be executed in the current test task list A0 to the unexecuted state, keep data synchronization, and then perform iterative execution in the next round.

[0207] Check whether there are still test scripts to be executed in the updated current test task list A0. If there are test scripts to be executed, return to the step of extracting any test script to be executed whose first real-time execution status is not executed in the task intersection corresponding to the script module between the current test task list A0 and the module grouping task cache queue, and iterate the execution of the next test script to be executed; if there are no test scripts to be executed, it means that all the test scripts to be executed under the script module have been executed, delete the associated information of all test scripts under the script module in the module grouping task cache queue, and continue to return to the current process to extract the test tasks corresponding to all test scripts to be executed under the first script module whose second real-time execution status is not executed in the script module in the module grouping task cache queue, build the current test task list A0, and iterate the execution of the test tasks of the next script module until all processes are completed.

[0208] In summary, the method provided in this embodiment, for batch job behaviors of systems with single session management requirements, calls multiple devices to be tested to execute script tasks in parallel, and provides a method of giving priority to one device to be tested for test tasks under the same script module, thereby effectively reducing test failures caused by interference between test scripts under different script modules. When the number of test scripts under the script module is large, it automatically switches to a single script module multi-process method to continue executing the test script, so as to compress the release interval of multiple devices to be tested to a maximum of 1 script execution cycle, thereby improving equipment utilization, shortening script execution time, and improving work efficiency.

[0209] The testing device provided by the present invention is described below. The testing device described below and the testing method described above can be referenced to each other.

[0210] Figure 5 is a schematic diagram of the structure of the test device provided by the present invention; Figure 5 As shown, the device includes a first acquisition module 510 , a second acquisition module 520 , a third acquisition module 530 and a testing module 540 .

[0211] The first acquisition module 510 is used to acquire a current task cache queue and a current device index cache queue, wherein the current task cache queue includes script information and a first real-time execution state of each test script, and the current device index cache queue includes a site identifier, a current running state, and a current process identifier of each site;

[0212] The second acquisition module 520 is used to acquire a current test task list from a plurality of test scripts stored in the current task cache queue according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state, wherein the current test task list includes at least one test script to be executed;

[0213] The third acquisition module 530 is used to acquire the site to be called from the multiple sites stored in the current device index cache queue according to the current running state and the current process identifier;

[0214] The test module 540 is used to control the tested device of the site to be called to execute the test tasks corresponding to each test script to be executed according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue.

[0215] The device provided in this embodiment creates a current task cache queue and a current device index cache queue through real-time updates. The current task cache queue includes the script information of each test script and the first real-time execution status, and the current device index cache queue includes the site identifier, current running status and current process identifier of each site. The current test task list selection and idle and available sites to be called are intelligently performed in real time, so that the allocation of test tasks can be dynamically adjusted in real time according to the execution status of the test script and the load status of the equipment, thereby ensuring the balanced utilization of equipment resources, realizing the maximum utilization of equipment resources, avoiding the situation where some equipment is in a high load state for a long time while other equipment is idle, significantly shortening the test execution time, and improving the test efficiency.

[0216] The device provided by the present invention is used to execute the above-mentioned method embodiments. Please refer to the above-mentioned embodiments for the specific processes and detailed contents, which will not be repeated here.

[0217] In some embodiments, the present embodiment further provides a test system, the system comprising a plurality of sites and a control system;

[0218] Each of the sites includes a device to be tested, a computing server and a switch;

[0219] The control system includes a plurality of processes, and the number of the processes is configured according to the number of the sites, that is, the number of processes is adaptively determined according to the number of sites; for example, the number of processes is consistent with the number of sites.

[0220] Each of the processes is used to execute the test methods provided in the above embodiments. Please refer to the above embodiments for the specific processes and detailed contents, which will not be repeated here.

[0221] The system provided in this embodiment creates a current task cache queue and a current device index cache queue through real-time updates. The current task cache queue includes the script information of each test script and the first real-time execution status, and the current device index cache queue includes the site identifier, current running status and current process identifier of each site. The current test task list selection and idle and available sites to be called are intelligently performed in real time, so that the allocation of test tasks can be dynamically adjusted in real time according to the execution status of the test script and the load status of the equipment, thereby ensuring the balanced utilization of equipment resources, realizing the maximum utilization of equipment resources, avoiding the situation where some equipment is in a high load state for a long time while other equipment is idle, significantly shortening the test execution time, and improving the test efficiency.

[0222] Figure 6 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 6As shown, the electronic device may include: a processor (processor) 610, a communication interface (Communications Interface) 620, a memory (memory) 630 and a communication bus 640, wherein the processor 610, the communication interface 620, and the memory 630 communicate with each other through the communication bus 640. The processor 610 can call the logic instructions in the memory 630 to execute the test method, which includes: obtaining a current task cache queue and a current device index cache queue, wherein the current task cache queue includes script information of each test script and a first real-time execution status, and the current device index cache queue includes a site identifier, a current running status, and a current process identifier of each site; according to the script configuration mode corresponding to the current task cache queue and the first real-time execution status, obtaining a current test task list from a plurality of test scripts stored in the current task cache queue, wherein the current test task list includes at least one test script to be executed; according to the current running status and the current process identifier, obtaining a site to be called from a plurality of sites stored in the current device index cache queue; according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue, controlling the device to be tested of the site to be called to execute the test task corresponding to each test script to be executed.

[0223] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0224] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the test methods provided by the above methods, and the method includes: obtaining a current task cache queue and a current device index cache queue, wherein the current task cache queue includes script information and a first real-time execution status of each test script, and the current device index cache queue includes a site identifier, a current running status, and a current process identifier of each site; according to the script configuration mode corresponding to the current task cache queue and the first real-time execution status, obtaining a current test task list from multiple test scripts stored in the current task cache queue, wherein the current test task list includes at least one test script to be executed; according to the current running status and the current process identifier, obtaining a site to be called from multiple sites stored in the current device index cache queue; according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue, controlling the device to be tested of the site to be called to execute the test task corresponding to each test script to be executed.

[0225] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented by a processor to execute the test method provided by the above-mentioned methods when the computer program is executed, the method comprising: obtaining a current task cache queue and a current device index cache queue, the current task cache queue comprising script information of each test script and a first real-time execution status, the current device index cache queue comprising a site identifier, a current running status and a current process identifier of each site; according to the script configuration mode corresponding to the current task cache queue and the first real-time execution status, obtaining a current test task list from a plurality of test scripts stored in the current task cache queue, the current test task list comprising at least one test script to be executed; according to the current running status and the current process identifier, obtaining a site to be called from a plurality of sites stored in the current device index cache queue; according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue, controlling the device to be tested of the site to be called to execute the test task corresponding to each test script to be executed.

[0226] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.

[0227] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0228] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A testing method, It is characterized in that include: Obtaining a current task cache queue and a current device index cache queue, wherein the current task cache queue includes script information and a first real-time execution state of each test script, and the current device index cache queue includes a site identifier, a current running state, and a current process identifier of each site; According to the script configuration mode corresponding to the current task cache queue and the first real-time execution state, a current test task list is obtained from a plurality of test scripts stored in the current task cache queue, wherein the current test task list includes at least one test script to be executed; According to the current running state and the current process identifier, obtaining a site to be called from a plurality of sites stored in the current device index cache queue; According to the script information of each of the to-be-executed test scripts stored in the current task cache queue and the site identifier of the to-be-called site stored in the current device index cache queue, control the to-be-tested device of the to-be-called site to execute the test task corresponding to each of the to-be-executed test scripts; The current task cache queue also includes module information of each script module and a second real-time execution state of each script module, and the script module includes a plurality of the test scripts; The step of obtaining a current test task list from a plurality of test scripts stored in the current task cache queue according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state includes: When the script configuration mode is the module-based configuration mode, searching the current task cache queue for a first script module whose second real-time execution state is an unexecuted state; When the first script module is not found, searching the current task cache queue for a second script module whose second real-time execution status is an execution status; In the second script module, searching for a first test script whose first real-time execution status is an unexecuted status; When the first test script is found, the current test task list is obtained according to the first test script.

2. The test method according to claim 1, It is characterized in that The method further comprises: When the first script module is found, the current test task list is obtained according to all test scripts in the first script module.

3. The testing method according to claim 1, It is characterized in that The step of obtaining a current test task list from a plurality of test scripts stored in the current task cache queue according to the script configuration mode corresponding to the current task cache queue and the first real-time execution state includes: When the script configuration mode is the full configuration mode, selecting a second test script whose first real-time execution state is an unexecuted state from among the multiple test scripts stored in the current task cache queue; According to the second test script, obtain the current test task list.

4. The test method according to any one of claims 1 to 3, It is characterized in that The acquiring, according to the current running state and the current process identifier, a site to be called from a plurality of sites stored in the current device index cache queue comprises: Among the multiple sites stored in the current device index cache queue, searching for a first site whose communication state in the current running state is an online state, whose occupied state in the current running state is an idle state, and whose current process identifier is empty; When the first site is found, the first site is used as the site to be called.

5. The test method according to claim 4, It is characterized in that The method further comprises: When the first site is not found, entering a waiting state; When the duration of the current waiting state reaches the current delay processing duration, the current running state and / or current process identifier of each site in the current device index cache queue is updated in real time according to the test task execution result corresponding to the device to be tested at each site, to obtain the first device index cache queue; Searching, in the first device index cache queue, for a second site whose communication status in the updated running status is offline; When the second site is found, if it is determined that the login status corresponding to the device to be tested of the second site is normal, the communication status of the second site in the first device index cache queue is updated to an online state, and a second device index cache queue is obtained; Searching, in the index cache queue of the second device, a third site whose communication state in the updated running state is an online state, whose occupation state in the updated running state is an idle state, and whose updated process identifier is empty; When the third site is found, the third site is used as the site to be called.

6. The test method according to claim 5, It is characterized in that The login status corresponding to the device to be tested at the second site is obtained based on the following steps: In the first device index cache queue, obtaining the site identifier of the second site; Acquire device resource information of the second site in the device resource list according to the site identifier of the second site; Verify, based on the device resource information of the second site, whether the device to be tested at the second site can log in successfully; When it is verified that the device to be tested at the second site has successfully logged in, it is determined that the login status corresponding to the second site is a normal status.

7. The testing method according to claim 5, It is characterized in that The method further comprises: When the second site is not found, or the third site is not found, or it is verified that the login status corresponding to the device to be tested at the second site is abnormal, return to the step of entering the waiting state until the third site is found.

8. The testing method according to claim 5, It is characterized in that The method further comprises: When the duration of the current waiting state reaches the current delay processing duration, the count value of the counter is cumulatively increased by 1; When the accumulated count result of the counter is less than or equal to the preset value, the current delay processing duration is used as the next delay processing duration; When the accumulated count result of the counter is greater than the preset value, the current delay processing duration is extended by the preset duration to obtain the next delay processing duration.

9. The test method according to any one of claims 1 to 3, It is characterized in that The method of controlling the device to be tested of the site to be called to execute the test task corresponding to each test script to be executed according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue includes: According to the site identifier of the site to be called, in the device resource list, obtain the device resource information of the site to be called; When it is determined according to the device resource information of the site to be called that the access state of the device to be tested of the site to be called is normal, the current process identifier of the site to be called in the current device index cache queue is updated according to the identifier of the current process; When it is determined that the update of the current process identifier of the site to be called is completed, the device to be tested of the site to be called is controlled to execute the test tasks corresponding to each test script to be executed according to the script information of each test script to be executed.

10. The test method according to claim 9, It is characterized in that The method further comprises: Determine, according to the execution results of each of the to-be-executed test scripts, a third test script that has been executed in the current test task list; Deleting the script information and the first real-time execution status of each of the third test scripts in the current task cache queue to obtain an updated test task cache queue; According to the difference between the updated test task cache queue and the current test task list, the current test task list is updated to obtain an updated test task list; When it is determined that the updated test task list is empty, the occupied state in the current running state of the to-be-called site in the current device index cache queue is updated to an idle state, and the current process identifier is updated to empty.

11. A testing device, It is characterized in that include: A first acquisition module is used to acquire a current task cache queue and a current device index cache queue, wherein the current task cache queue includes script information and a first real-time execution state of each test script, and the current device index cache queue includes a site identifier, a current running state, and a current process identifier of each site; A second acquisition module is used to acquire a current test task list from a plurality of test scripts stored in the current task cache queue according to a script configuration mode corresponding to the current task cache queue and the first real-time execution state, wherein the current test task list includes at least one test script to be executed; A third acquisition module is used to acquire a site to be called from a plurality of sites stored in the current device index cache queue according to the current running state and the current process identifier; A test module, used to control the device to be tested of the site to be called to execute the test task corresponding to each test script to be executed according to the script information of each test script to be executed stored in the current task cache queue and the site identifier of the site to be called stored in the current device index cache queue; The current task cache queue also includes module information of each script module and a second real-time execution state of each script module, and the script module includes a plurality of the test scripts; The second acquisition module is specifically used for: When the script configuration mode is the module-based configuration mode, searching the current task cache queue for a first script module whose second real-time execution state is an unexecuted state; When the first script module is not found, searching the current task cache queue for a second script module whose second real-time execution status is an execution status; In the second script module, searching for a first test script whose first real-time execution status is an unexecuted status; When the first test script is found, the current test task list is obtained according to the first test script.

12. A testing system, It is characterized in that Includes multiple sites and control systems; Each of the sites includes a device to be tested, a computing server and a switch; The control system includes a plurality of processes, and the number of the processes is configured according to the number of the sites; Each of the processes is used to execute the testing method according to any one of claims 1 to 10.

13. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the testing method according to any one of claims 1 to 10 is implemented.

14. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the testing method according to any one of claims 1 to 10 is implemented.