Script testing method and device
By splitting the target test task into multiple sub -tasks and performing parallel execution, the script testing time is unpredictable, and the test task is completed within the specified time, and the test efficiency and resource utilization rate is improved.
Patent Information
- Application Number
- CN202111633594.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2041-12-28
AI Technical Summary
In the prior art, the test time of script testing is unpredictable and the test time is long, which makes it impossible to ensure that the test is completed within the specified time of the user.
By determining the specified test duration of the target test task, and growing according to the total script time than the specified test period, the target test task is split to obtain multiple sub -tasks. Multiple sub -tasks to complete the target test task.
Realize the test tasks within the specified test duration, improve the test efficiency, can use multiple sets of server resources in parallel testing at the same time, and can share multiple server resources between multiple automation test tasks.
Smart Images

Figure CN114297067B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing, and in particular, to a script testing method and device. Background Art
[0002] As virtualization technology matures, more and more companies are launching virtualization products. In the network security industry, virtualization products have a place in the market with their unique advantages, and automated regression testing of virtual network security products is an essential step before product release. When there are many test scripts, the regression test of the system version to be released is a large test task, which takes a long time to test and affects the release time.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide a script testing method and device to at least solve the technical problem that the test time for testing the script is unpredictable and the test time is long, so that it is impossible to ensure that the test is completed within the time specified by the user.
[0005] According to one aspect of an embodiment of the present application, a script testing method is provided, including: determining a target test task to be tested, wherein the target test task is used to test all scripts in a script list; determining a specified test duration of the target test task, and a total script duration required for serial testing of all scripts in the script list; when the total script duration is greater than the specified test duration, splitting the target test task to obtain a plurality of subtasks, wherein each subtask includes at least one script, and the running duration of each subtask is not greater than the specified test duration; and in response to a trigger instruction, executing the plurality of subtasks in parallel to execute the target test task.
[0006] Optionally, the target test task is split to obtain multiple subtasks, including: determining the test cases corresponding to all the scripts in the script list, and determining the network topology attribute value corresponding to each test case, wherein the network topology attribute value is used to indicate the number of devices to be tested and the number of auxiliary test devices; sorting all the scripts in the script list in reverse order according to the network topology attribute value, wherein the larger the network topology attribute, the higher the script is in the reverse order sorting result; and allocating the reverse sorted scripts to multiple subtasks.
[0007] Optionally, determine the test cases corresponding to all the scripts in the script list, and determine the network topology attribute values corresponding to each test case, wherein the network topology attribute values are used to indicate the number of devices to be tested and the number of auxiliary test devices, including: the larger the number of devices to be tested, the larger the network topology attribute value; when the number of devices to be tested is the same, the larger the number of auxiliary test devices, the larger the network topology attribute.
[0008] Optionally, in response to a trigger instruction, before executing multiple subtasks in parallel, it also includes: determining the maximum topological attribute value of each subtask based on the script in each of the multiple subtasks; determining the target resources required for testing the multiple subtasks; comparing the target resources with the current remaining available resources of the server; and when the target resources are greater than the remaining available resources, generating a prompt message for prompting to add a server, or increasing the value of the specified test duration.
[0009] Optionally, after comparing the target resource with the current remaining available resources of the server, the method further includes: when the target resource is smaller than the remaining available resources, allocating the remaining available resources to a plurality of subtasks to test the plurality of subtasks.
[0010] Optionally, in the process of executing multiple subtasks, after the target script in the subtask is executed, the target script is deleted from the script list, and the resources corresponding to the execution of the target script are released.
[0011] According to another aspect of an embodiment of the present application, a script testing device is provided, including: a first determination module, used to determine a target test task to be tested, wherein the target test task is used to test all scripts in a script list; a second determination module, used to determine a specified test duration of the target test task, and a total script duration required for serial testing of all scripts in the script list; a splitting module, used to split the target test task when the total script duration is greater than the specified test duration, to obtain a plurality of subtasks, wherein each subtask includes at least one script, and the running duration of each subtask is not greater than the specified test duration; an execution module, used to execute a plurality of subtasks in parallel in response to a trigger instruction to execute the target test task.
[0012] Optionally, the splitting module is also used to determine the test cases corresponding to all the scripts in the script list, and determine the network topology attribute value corresponding to each test case, wherein the network topology attribute value is used to indicate the number of devices to be tested and the number of auxiliary test devices; all the scripts in the script list are sorted in reverse order according to the network topology attribute value, wherein the larger the network topology attribute, the higher the script is in the reverse sorting result; and the scripts after reverse sorting are assigned to multiple subtasks.
[0013] According to another aspect of an embodiment of the present application, a non-volatile storage medium is provided, including a stored program, wherein when the program is running, a device where the non-volatile storage medium is located is controlled to execute the above-mentioned script testing method.
[0014] According to another aspect of an embodiment of the present application, an electronic device is provided, including a processor and a memory, wherein the processor is used to run a program stored in the memory, wherein the program executes the above-mentioned script testing method when running.
[0015] In an embodiment of the present application, a target test task is split into multiple subtasks based on a specified test duration, and multiple subtasks are executed in parallel, thereby achieving the purpose of completing the test task within the specified test duration, thereby achieving the technical effect that a single automated test task can use multiple sets of server resources for parallel testing at the same time, and multiple automated test tasks can share multiple server resources, thereby solving the technical problem that the test time for script testing is unpredictable and the test time is long, making it impossible to ensure that the test is completed within the user-specified time. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0017] Figure 1 is a hardware structure block diagram of a computer terminal for implementing a script testing method according to an embodiment of the present application;
[0018] Figure 2 is a schematic diagram of a script testing method according to an embodiment of the present application;
[0019] Figure 3 is a flowchart of an automated system triggering a script test task according to an embodiment of the present application;
[0020] Figure 4 is a flowchart of a subtask running process according to an embodiment of the present application;
[0021] Figure 5 is a schematic diagram of a subtask splitting process in an automated testing task according to an embodiment of the present application;
[0022] Figure 6 It is a flowchart of subtasks 1 to 4 respectively applying for test resources from a server according to an embodiment of the present application;
[0023] Figure 7 is a flowchart of device release during the execution of subtask 1 according to an embodiment of the present application;
[0024] Figure 8 This is a specific operation process of subtasks 1 to 4 according to an embodiment of the present application;
[0025] Fig. 9 It is a flowchart of each subtask of an automated test task 2 applying for test resources from a server according to an embodiment of the present application;
[0026] Fig.10 It is a schematic diagram of a script testing device according to an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] According to an embodiment of the present application, an embodiment of a script testing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] The script testing method provided in the embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 The hardware structure block diagram of a computer terminal (or electronic device) for implementing the script testing method is shown. Figure 1As shown, the computer terminal 10 (or electronic device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0031] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or electronic device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0032] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the script testing method in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the above-mentioned script testing method is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0033] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0034] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or electronic device).
[0035] It should be noted that, in some optional embodiments, the above Figure 1 The computer device (or electronic device) shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the above-described computer device (or electronic device).
[0036] Under the above operating environment, the embodiment of the present application provides the following Figure 2 The script test method shown.
[0037] Figure 2 is a flowchart of a script testing method according to an embodiment of the present application, such as Figure 2 As shown, the method comprises the following steps:
[0038] Step S202, determining a target test task to be tested, wherein the target test task is used to test all scripts in the script list;
[0039] Step S204, determining the specified test duration of the target test task and the total script duration required for serial testing of all scripts in the script list;
[0040] Step S206, when the total script duration is greater than the specified test duration, split the target test task into multiple subtasks, wherein each subtask includes at least one script, and the running time of each subtask is not greater than the specified test duration;
[0041] Step S208, in response to the trigger instruction, executing multiple subtasks in parallel to execute the target test task.
[0042] By splitting the target test task into multiple subtasks based on the specified test duration in the above steps and executing the multiple subtasks in parallel, the purpose of completing the test task within the specified expected duration is achieved, thereby solving the technical problem that the test time for script testing is unpredictable and the test time is long, making it impossible to ensure that the test is completed within the user-specified time.
[0043] Based on the above steps, Figure 3 It is a flowchart of the automated system triggering the script test task, such as Figure 3 As shown, the process mainly includes: starting the automated test task; sorting the test scripts in reverse order of topology and putting them into the list of pending scripts; judging whether there are any scripts in the list of pending scripts, if so, taking out a script and removing it from the list of pending scripts, and accumulating the expected running time of the current script, otherwise obtaining the split subtasks, scanning the available servers, and applying for and creating test equipment for each subtask according to the maximum topology of the subtasks; when the accumulated time is greater than the specified test time, splitting the current script into new subtasks, and clearing the accumulated time; when the accumulated time is less than the specified test time, if the current script is the last script to be processed, splitting the remaining scripts into the last subtask, obtaining the split subtasks, scanning the available servers, and applying for and creating test equipment for each subtask according to the maximum topology of the subtasks; triggering all subtasks to run, judging whether all subtasks have been tested, if so, the automated test task is completed, otherwise triggering the untriggered subtasks to run until all subtasks have been tested.
[0044] based on Figure 3 The flowchart of the automation system triggering the script test task is shown. Figure 4 It is a flowchart of the subtask running process, such as Figure 4 As shown in the figure, during the subtask running process, the scripts are classified by topology, and the scripts with the same topology are grouped together for running. The topologies are run in reverse order according to the number of devices required by the topology. The script with the largest topology is run first, and the script with the smallest topology is run last. When running to a small topology script, the redundant devices are released in time for use by other automated test tasks to avoid idle and wasted device resources.
[0045] Optionally, in step S204, the specified test duration of the target test task and the total script duration required for serial testing of all scripts in the script list are determined, wherein the total script duration is the sum of the running durations of the various scripts.
[0046] Optionally, in step S206, the target test task is split into multiple subtasks in the following manner: determine the test cases corresponding to all the scripts in the script list, and determine the network topology attribute value corresponding to each test case, wherein the network topology attribute value is used to indicate the number of devices to be tested and the number of auxiliary test devices; sort all the scripts in the script list in reverse order according to the network topology attribute value, wherein the larger the network topology attribute, the higher the script in the reverse order sorting result; and assign the scripts sorted in reverse order to multiple subtasks. Specifically, the larger the number of devices to be tested, the larger the network topology attribute value; when the number of devices to be tested is the same, the larger the number of auxiliary test devices, the larger the network topology attribute, wherein the auxiliary test device is used for auxiliary testing, and is a physical hardware device, or a virtual test computer created by virtualization technology.
[0047] In some embodiments of the present application, a network topology attribute value DnPN is used to indicate the number of devices under test VDUT and auxiliary test devices VPC, where Dn is used to indicate that the number of devices under test VDUT is n, and PN is used to indicate that the number of auxiliary test devices VPC is N, where n and N are any non-negative integers.
[0048] In some optional embodiments of the present application, if the automated test task submitted by the target object contains 10 test scripts, the script topology attributes are shown in the following table:
[0049] script Script 1 Script 2 Script 3 Script 4 Script 5 Script 6 Script 7 Script 8 Script 9 Script 10 Topology D1P0 D3P3 D3P2 D4P2 D1P1 D2P4 D2P2 D1P4 D4P4 D1P2
[0050] Dn is used to indicate that the number of devices to be tested in the test script is n, where n=1, 2, 3, 4 in the above embodiment; PN is used to indicate that the number of auxiliary test devices in the test script is N, where N=0, 1, 2, 3, 4 in the above embodiment.
[0051] The scripts are sorted in reverse order according to the network topology attribute value, wherein, in the reverse order process, the scripts are sorted based on the priority relationship preset in the network topology attribute value DnPN. Specifically, the number D of devices under test VDUT is the first priority, and the number P of auxiliary test devices VPC is the second priority, wherein, when the number D of devices under test VDUT is the same in the first priority, the scripts are sorted based on the number P of auxiliary test devices VPC in the second priority.
[0052] In some embodiments of the present application, scripts S1 to S10 are sorted in reverse order, and the topological properties of the sorted scripts are shown in the following table:
[0053] script S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 Topology D4P4 D4P2 D3P3 D3P2 D2P4 D2P2 D1P4 D1P2 D1P1 D1P0
[0054] In some optional embodiments of the present application, the reverse-ordered scripts are assigned to multiple subtasks, which can be achieved by the following process: if the expected test duration of the target object is T, the width occupied by the reverse-ordered script Sn represents the expected running duration of the script (n=1, 2, 3, ..., 7, 8, 9, 10), and the reverse-ordered scripts S1 to S10 and their topological attributes are shown in the following table:
[0055] script S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 Topology D4P4 D4P2 D3P3 D3P2 D2P4 D2P2 D1P4 D1P2 D1P1 D1P0
[0056] Specifically, the 10 scripts S1 to S10 in the original test task can be split based on the expected test duration T of the target object. Because the cumulative sum of the expected running time of the scripts may have a certain error with the test duration T, when splitting the tasks, the actual expected running time of the split tasks will be around the test duration T. If the expected test duration of a single script exceeds the test duration T, this script will be assigned to a subtask separately.
[0057] Figure 5 This is a schematic diagram of the subtask splitting process in the automated testing task, such as Figure 5 As shown, 4 subtasks can be split, and based on the maximum number of devices to be tested and the maximum number of auxiliary test devices of each subtask, the device topology required for each subtask is determined. For example, subtask 1 contains scripts S1 (D4P4), S2 (D4P2), and S3 (D3P3), so the device topology required for subtask 1 is D4P4; subtask 2 contains scripts S4 (D3P2) and S5 (D2P4), so the device topology required for subtask 2 is D3P4; subtask 3 contains test scripts S6 (D2P2), S7 (D1P4), S8 (D1P2), and S9 (D1P1), so the device topology required for subtask 3 is D2P4; subtask 4 contains test scripts S10 (D1P0), so the device topology required for subtask 4 is D1P0.
[0058] In some embodiments of the present application, all scripts in the script list are sorted based on the reverse sorting principle so that the topologies of the scripts split into the same subtask are similar, ensuring that the maximum topology and minimum topology spans in each subtask are small, and large topology scripts are concentrated in one subtask as much as possible, saving the total number of devices required for the subtask.
[0059] Optionally, in response to a trigger instruction, before executing multiple subtasks in parallel, the method further includes: determining the maximum topological attribute value of each subtask according to the script in each of the multiple subtasks; determining the target resources required for testing the multiple subtasks; comparing the target resources with the current remaining available resources of the server; and generating a prompt message for prompting to add a server or increasing the value of the specified test duration when the target resources are greater than the remaining available resources. Specifically, when the target resources are less than the remaining available resources, the remaining available resources are allocated to the multiple subtasks to test the multiple subtasks.
[0060] In some optional embodiments of the present application, based on Figure 5 The schematic diagram of the subtask splitting process of the automated test task determines the maximum topological attribute value of each subtask in multiple subtasks and the target resources required for each subtask to be tested. Specifically, the network topological attribute values of each subtask in the test task are traversed, and the topological attribute values are sorted in reverse order to determine the maximum topological attribute value of each subtask, and finally the target resources required for each subtask are determined based on the topological attribute values.
[0061] For example, subtask 1 includes scripts S1 (D4P4), S2 (D4P2), and S3 (D3P3). The maximum topology attribute value of subtask 1 is D4P4, and the target resources that subtask 1 needs to occupy are 4 VDUTs and 4 VPCs. Subtask 2 includes scripts S4 (D3P2) and S5 (D2P4). The maximum topology attribute value of subtask 2 is D3P4, and the target resources that need to be occupied are 3 VDUTs and 4 VPCs. Subtask 3 includes test scripts S6 (D2P2), S7 (D1P4), S8 (D1P2), and S9 (D1P1). The maximum topology attribute value of subtask 3 is D2P4, and the maximum topology attribute value of subtask 3 is D2P4. The target resources that need to be occupied are 2 VDUTs and 4 VPCs. Subtask 4 includes test script S10 (D1P0). The maximum topology attribute value of subtask 4 is D1P0, and the target resources that need to be occupied are 1 VDUT and 0 VPCs.
[0062] In some embodiments of the present application, if there are 4 servers in total, each server can create 5 VDUTs and 10 VPCs, then the available resources are 20 VDUTs and 40 VPCs. Figure 6 This is a flowchart of subtasks 1 to 4 applying for test resources from the server respectively, such as Figure 6As shown, the process mainly includes: after subtask 1 occupies 4 VDUTs and 4 VPCs of server 1, the remaining resources of server 1 do not meet the maximum topology of subtask 2, and subtask 2 continues to apply for test resources from server 2; after subtask 2 occupies 3 VDUTs and 4 VPCs of server 2, the remaining resources of server 2 still meet the maximum topology of subtask 3, and subtask 3 continues to occupy 2 VDUTs and 4 VPCs of server 2; when the remaining resources of server 2 do not meet the maximum topology of subtask 4, subtask 4 continues to apply for test resources from server 3, occupying 1 VDUT of server 3. After all 4 subtasks have applied for test equipment, the 4 subtasks will be triggered to run one by one, and each subtask will be tested in reverse order according to the script topology during the running process. It is easy to understand that during the running process, there are 1 VDUT and 6 VPCs left in server 1, 0 VDUTs and 2 VPCs left in server 2, 4 VDUTs and 10 VPCs left in server 3, and server 4 is not used.
[0063] In some optional embodiments of the present application, there are only two servers available for selection for subtasks 1 to 4, where each server can create 5 VDUTs and 10 VPCs, and the available resources are 20 VDUTs and 40 VPCs. If subtasks 1 to 4 cannot all apply for test equipment, subtasks 1 to 4 can be run by increasing the value of the specified test duration.
[0064] Optionally, in the process of executing multiple subtasks, after the target script in the subtask is executed, the target script is deleted from the script list, and the resources corresponding to the execution of the target script are released.
[0065] In some embodiments of the present application, taking subtask 1 in automated test task 1 as an example, Figure 7 This is the flow chart of the device release during the operation of subtask 1, such as Figure 7 As shown, the process mainly includes: subtask 1 has scripts S1 (D4P4), S2 (D4P2), and S3 (D3P3). When the task is running, S1 (D4P4) is run first, then S2 (D4P2), and finally S3 (D3P3); when S1 (D4P4) is running, 4 VDUTs and 4 VPCs are occupied. After the running of S1 (D4P4) is finished, the running of the remaining scripts S2 (D4P2) and S3 (D3P3) requires at most 4 VDUTs and 3 VPCs, so 1 VPC can be released in time; after the running of the script of S2 (D4P2) is combined, the running of the remaining script S3 (D3P3) requires at most 3 VDUTs and 3 VPCs, so 1 VDUT can be released in time.
[0066] In some optional embodiments of the present application, in combination with the subtask splitting rule and the device early release rule, Figure 8 It is the specific operation process of subtask 1 to subtask 4, such as Figure 8 As shown, the final automated test task 1 will complete the entire test within approximately T time.
[0067] In some embodiments of the present application, after all subtask tests are completed, all subtask results are summarized into the original task, and a test result report of the automated test task is sent.
[0068] In some optional embodiments of the present application, after the automated test task 1 is run, the target object immediately submits the automated test task 2, wherein the automated test task 2 has been split into 4 subtasks, wherein the maximum topologies of each subtask of the automated test task 2 are D4P4, D3P2, D2P2, and D1P2 respectively. Fig. 9 This is a flowchart of each subtask of automated test task 2 applying for test resources from the server, such as Fig. 9 As shown, the final automated test task 1 will complete the entire test within T time. It is easy to understand that in the process of applying for test equipment for each subtask of automated test task 2, all servers will also be scanned to check whether the remaining resources of the server meet the maximum topology of the subtask.
[0069] Fig.10 A schematic diagram of a script testing device according to an embodiment of the present application is shown in Fig.10 As shown, the device includes the following modules:
[0070] A first determination module 1000 is used to determine a target test task to be tested, wherein the target test task is used to test all scripts in the script list;
[0071] The second determination module 1002 is used to determine the specified test duration of the target test task and the total script duration required for serial testing of all scripts in the script list;
[0072] The splitting module 1004 is used to split the target test task into multiple subtasks when the total script duration is greater than the specified test duration, wherein each subtask includes at least one script and the running time of each subtask is not greater than the specified test duration;
[0073] The execution module 1006 is used to execute multiple subtasks in parallel in response to the trigger instruction to execute the target test task.
[0074] In the script testing device, the splitting module also includes: a determination unit, which is used to determine the test cases corresponding to all the scripts in the script list, and determine the network topology attribute value corresponding to each test case, wherein the network topology attribute value is used to indicate the number of devices to be tested and the number of auxiliary test devices; a reverse sorting unit, which is used to sort all the scripts in the script list in reverse order according to the network topology attribute value, wherein the larger the network topology attribute, the higher the script is in the reverse sorting result; and an allocation unit, which is used to allocate the reverse sorted scripts to multiple subtasks.
[0075] It should be noted that Fig.10 The script test fixture shown is used to execute Figures 2 to 9 The script testing method shown, therefore the relevant explanations in the above script testing method are also applicable to the script testing device, and will not be repeated here.
[0076] According to another aspect of an embodiment of the present application, a non-volatile storage medium is also provided, which includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the above-mentioned script testing method, and the method includes the following specific steps: determining a target test task to be tested, wherein the target test task is used to test all scripts in a script list; determining a specified test duration of the target test task, and a total script duration required for serial testing of all scripts in the script list; when the total script duration is greater than the specified test duration, splitting the target test task to obtain multiple subtasks, wherein each subtask includes at least one script, and the running duration of each subtask is not greater than the specified test duration; in response to a trigger instruction, executing multiple subtasks in parallel to execute the target test task.
[0077] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0078] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0079] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0080] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0081] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0082] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or 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 to enable 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 application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0083] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A script testing method, characterized in that: include: Determine a target test task to be tested, wherein the target test task is used to test all scripts in the script list; Determine the specified test duration of the target test task and the total script duration required for serial testing of all scripts in the script list; In the case where the total script duration is greater than the specified test duration, the target test task is split to obtain a plurality of subtasks, wherein each subtask includes at least one script, and the running time of each subtask is not greater than the specified test duration; The target test task is split to obtain a plurality of subtasks, including: determining test cases corresponding to all scripts in the script list, and determining network topology attribute values corresponding to each test case, wherein the network topology attribute values are used to indicate the number of devices to be tested and the number of auxiliary test devices; sorting all scripts in the script list in reverse order according to the network topology attribute values, wherein the larger the network topology attribute, the higher the script in the reverse order sorting result; allocating the scripts sorted in reverse order to the plurality of subtasks, and the network topology attribute values of the scripts split into the same subtask are similar; In response to a trigger instruction, the multiple subtasks are executed in parallel to execute the target test task.
2. The method according to claim 1, characterized in that The greater the number of the devices to be tested is, the greater the value of the network topology attribute is; when the number of the devices to be tested is the same, the greater the number of the auxiliary testing devices is, the greater the network topology attribute is.
3. The method according to claim 1, characterized in that In response to the trigger instruction, before executing the multiple subtasks in parallel, the method further includes: Determining a maximum topological attribute value of each subtask according to a script in each subtask of the plurality of subtasks; determining target resources required for testing the plurality of subtasks; Comparing the target resource with the remaining available resources of the server; In a case where the target resources are greater than the remaining available resources, a prompt message for prompting to add a server is generated, or a value of the designated test duration is increased.
4. The method according to claim 3, characterized in that The method further includes: when the target resource is less than the remaining available resource, allocating the remaining available resource to the plurality of subtasks to test the plurality of subtasks.
5. The method according to claim 1, characterized in that The method further comprises: In the process of executing the multiple subtasks, after the target script in the subtask is executed, the target script is deleted from the script list, and the resources corresponding to the execution of the target script are released.
6. A script testing device, characterized in that: include: A first determination module is used to determine a target test task to be tested, wherein the target test task is used to test all scripts in the script list; A second determination module is used to determine the specified test duration of the target test task and the total script duration required for serial testing of all scripts in the script list; A splitting module, used for splitting the target test task into multiple subtasks when the total script duration is greater than the specified test duration, wherein each subtask includes at least one script, and the running time of each subtask is not greater than the specified test duration; The splitting module is also used to determine the test cases corresponding to all the scripts in the script list, and determine the network topology attribute value corresponding to each test case, wherein the network topology attribute value is used to indicate the number of devices to be tested and the number of auxiliary test devices; all the scripts in the script list are sorted in reverse order according to the network topology attribute value, wherein the larger the network topology attribute, the higher the script is in the reverse sorting result; the scripts after reverse sorting are distributed to the multiple subtasks, and the network topology attribute values of the scripts split into the same subtask are similar; an execution module is used to execute the multiple subtasks in parallel in response to a trigger instruction to execute the target test task.
7. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored program, wherein when the program is running, the device where the non-volatile storage medium is located is controlled to execute the script testing method according to any one of claims 1 to 5.
8. An electronic device, characterized in that: It comprises a processor and a memory, wherein the processor is used to run a program stored in the memory, wherein the program executes the script testing method described in any one of claims 1 to 5 when running.
Citation Information
Patent Citations
Firewall testing method and device, nonvolatile storage medium and electronic device
CN112769810A