[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN114297067A - Script testing method and device - Google Patents

Script testing method and device Download PDF

Info

Publication number
CN114297067A
CN114297067A CN202111633594.6A CN202111633594A CN114297067A CN 114297067 A CN114297067 A CN 114297067A CN 202111633594 A CN202111633594 A CN 202111633594A CN 114297067 A CN114297067 A CN 114297067A
Authority
CN
China
Prior art keywords
script
test
subtasks
target
scripts
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111633594.6A
Other languages
Chinese (zh)
Inventor
张萍
张峰
虞安虎
秦亭亭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hillstone Networks Co Ltd
Original Assignee
Hillstone Networks Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hillstone Networks Co Ltd filed Critical Hillstone Networks Co Ltd
Priority to CN202111633594.6A priority Critical patent/CN114297067A/en
Publication of CN114297067A publication Critical patent/CN114297067A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a script testing method and device. Wherein, the method comprises the following steps: determining a target test task to be tested, wherein the target task is used for testing all scripts in the script list; determining the specified test duration of the target test task and the total script duration required by all scripts in the script list for serial test; under the condition that the total script time length is longer than the specified test time length, splitting the target test task to obtain a plurality of subtasks, wherein each subtask comprises at least one script, and the running time length of each subtask is not longer than the specified test time length; in response to the trigger instruction, a plurality of subtasks are executed in parallel to execute the target test task. The technical problem that the test time for testing the script cannot be predicted and the test time is long so that the test cannot be completed within the specified time of a user is solved.

Description

Script testing method and device
Technical Field
The application relates to the field of testing, in particular to a script testing method and device.
Background
As virtualization technologies mature, more and more businesses begin to push out virtualized products. In the network security industry, the virtual product has a place in the market with its unique advantages, and the automatic regression test of the virtual network security product is an essential link before the product is released. When the number of test scripts is large, the test duration is long for a large test task of regression testing of the system version to be released, so that the release time is influenced.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the application provides a script testing method and device, and the technical problems that the testing time for testing the script cannot be predicted, and the testing time is long, so that the testing cannot be completed within the time length specified by a user are solved.
According to an aspect of an embodiment of the present application, there is provided a script testing method, including: determining a target test task to be tested, wherein the target test task is used for testing all scripts in the script list; determining the specified test duration of the target test task and the total script duration required by all scripts in the script list for serial test; under the condition that the total script time length is longer than the specified test time length, splitting the target test task to obtain a plurality of subtasks, wherein each subtask comprises at least one script, and the running time length of each subtask is not longer than the specified test time length; in response to the trigger instruction, a plurality of subtasks are executed in parallel to execute the target test task.
Optionally, splitting the target test task 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 the test cases, wherein the network topology attribute values are used for indicating the number of the devices to be tested and the number of the auxiliary devices; sequencing all scripts in the script list in a reverse order according to the network topology attribute values, wherein the larger the network topology attribute is, the more the scripts are in the sequencing result of the reverse order sequencing; and distributing the scripts after the reverse sequencing into a plurality of subtasks.
Optionally, determining test cases corresponding to all scripts in the script list, and determining a network topology attribute value corresponding to each test case, where the network topology attribute value is used to indicate the number of devices to be tested and the number of auxiliary devices includes: the larger the number of the devices to be tested is, the larger the network topology attribute value is; under the condition that the number of the devices to be tested is the same, the larger the number of the auxiliary devices is, the larger the network topology attribute is.
Optionally, before executing the plurality of subtasks in parallel in response to the trigger instruction, the method further includes: determining the maximum topological attribute value of each subtask according to the script in each subtask in the plurality of subtasks; determining target resources required for testing a plurality of subtasks; comparing the target resource with the current remaining available resources of the server; and generating prompt information for prompting the addition of the server or increasing the value of the specified test duration in the case that the target resource is larger than the remaining available resource.
Optionally, after comparing the target resource with the current remaining available resource of the server, the method further includes: and in the case that the target resource is smaller than the residual available resource, distributing the residual available resource to the plurality of subtasks to test the plurality of subtasks.
Optionally, in the process of executing a plurality of subtasks, after the target script in a subtask is executed, the target script is deleted from the script list, and the resource corresponding to the executed target script is released.
According to another aspect of the embodiments of the present application, there is provided a script testing apparatus, including: the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining a target test task to be tested, and the target test task is used for testing all scripts in a script list; the second determining module is used for determining the specified testing time length of the target testing task and the total script time length required by all scripts in the script list for serial testing; the splitting module is used for splitting the target test task to obtain a plurality of subtasks under the condition that the total script time length is greater than the specified test time length, wherein each subtask comprises at least one script, and the running time length of each subtask is not greater than the specified test time length; and the execution module is used for responding to the trigger instruction and executing a plurality of subtasks in parallel so as to execute the target test task.
Optionally, the splitting module is further configured to determine test cases corresponding to all scripts in the script list, and determine a network topology attribute value corresponding to each test case, where the network topology attribute value is used to indicate the number of devices to be tested and the number of auxiliary devices; sequencing all scripts in the script list in a reverse order according to the network topology attribute values, wherein the larger the network topology attribute is, the more the scripts are in the sequencing result of the reverse order sequencing; and distributing the scripts after the reverse sequencing into a plurality of subtasks.
According to another aspect of the embodiments of the present application, there is provided a nonvolatile storage medium, including a stored program, wherein a device in which the nonvolatile storage medium is located is controlled to execute the above-mentioned script testing method when the program is executed.
According to another aspect of the embodiments of the present application, there is provided an electronic device, including a processor and a memory, the processor being configured to execute a program stored in the memory, wherein the program executes the script test method.
In the embodiment of the application, a mode that a target test task is split into a plurality of subtasks based on the specified test duration and the plurality of subtasks are executed in parallel is adopted, so that the purpose of completing the test task within the specified test duration is achieved, the technical effect that a single automatic test task can simultaneously use a plurality of sets of server resources for parallel test is achieved, and meanwhile a plurality of automatic test tasks can share a plurality of server resources, and the technical problem that the test time for testing the script cannot be predicted and is long so that the test within the specified duration of a user cannot be ensured is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a block diagram of a hardware structure of a computer terminal for implementing a script test method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a script testing method according to an embodiment of the present application;
FIG. 3 is a flow diagram of an automated system triggering a script test task according to an embodiment of the present application;
FIG. 4 is a flow chart of a subtask operation process according to an embodiment of the present application;
FIG. 5 is a schematic diagram of a subtask splitting process in an automated test task according to an embodiment of the present application;
FIG. 6 is a flowchart of a subtask 1 to a subtask 4 applying for a test resource from a server according to an embodiment of the present application;
FIG. 7 is a flowchart illustrating equipment release during the sub-task 1 operation according to an embodiment of the present disclosure;
FIG. 8 is a detailed operation flow of subtasks 1 to 4 according to an embodiment of the present disclosure;
FIG. 9 is a flowchart of an automated test task 2 subtask applying for a test resource from a server according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a script testing apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with an embodiment of the present application, there is provided an embodiment of a script testing method, it should be noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
The script testing method provided by the embodiment of the application can be executed in a mobile terminal, a computer terminal or a similar operation device. Fig. 1 shows a hardware configuration block diagram of a computer terminal (or electronic device) for implementing the script test method. As shown in fig. 1, the computer terminal 10 (or electronic device 10) may include one or more (shown as 102a, 102b, … …, 102 n) processors 102 (the processors 102 may include, but are 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. Besides, the method can also comprise the following steps: 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 source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the electronic device. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuit may be a single stand-alone processing module, or incorporated in whole or in part into any of the other elements in the computer terminal 10 (or electronic device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of a variable resistance termination path connected to the interface).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the script testing method in the embodiment of the present application, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, so as to implement the script testing method. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission module 106 is used to receive or transmit data via a network. Specific examples of the network described above 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 (NIC) that can be connected to other Network devices through a base station 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 in a wireless manner.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the computer terminal 10 (or electronic device).
It should be noted here that in some alternative embodiments, the computer device (or electronic device) shown in fig. 1 may include hardware elements (including circuitry), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that fig. 1 is only one example of a particular specific example and is intended to illustrate the types of components that may be present in the computer device (or electronic device) described above.
Under the operating environment, the embodiment of the application provides a script testing method as shown in fig. 2.
Fig. 2 is a flowchart of a script testing method according to an embodiment of the present application, and as shown in fig. 2, the method includes the following steps:
step S202, determining a target test task to be tested, wherein the target test task is used for testing all scripts in a script list;
step S204, determining the specified test duration of the target test task and the total script duration required by all scripts in the script list to carry out serial test;
step S206, under the condition that 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 comprises at least one script, and the running duration of each subtask is not greater than the specified test duration;
step S208, responding to the trigger instruction, executing a plurality of subtasks in parallel to execute the target test task.
According to the method, the target test task is split into the plurality of subtasks based on the specified test duration, and the plurality of subtasks are executed in parallel, so that the purpose of completing the test task within the specified expected duration is achieved, and the technical problems that the test time for testing the script cannot be predicted, and the test time is long, so that the test cannot be completed within the specified duration of a user are solved.
Based on the above steps, fig. 3 is a flowchart of the automatic system triggering the script test task, and as shown in fig. 3, the flowchart mainly includes: starting an automatic test task; sequencing the test scripts according to the reverse order of the topology, and putting the test scripts into a script list to be processed; judging whether a script exists in the script list to be processed, if so, taking out one script and removing the script from the script list to be processed, and accumulating the estimated running time of the current script, otherwise, obtaining the split subtasks, scanning an available server, applying for each subtask according to the maximum topology of the subtasks and establishing test equipment; under the condition that the accumulated time length is greater than the specified test time length, splitting the current script into new subtasks, and resetting the accumulated time length; under the condition that the accumulated time length is less than the specified test time length, if the last script to be processed exists in the current script, splitting the rest scripts into the last subtasks, acquiring the split subtasks, scanning the available server, applying for each subtask according to the maximum topology of the subtasks and establishing test equipment; and triggering and running all subtasks, judging whether all subtasks are tested to be finished or not, if so, finishing the automatic test task, otherwise, triggering and running the subtasks which are not triggered until all subtasks are tested to be finished.
Based on the flow chart of the automatic system triggering script test task shown in fig. 3, fig. 4 is a flow chart of a subtask operation process, and as shown in fig. 4, in the subtask operation process, the scripts are classified according to the topology, and the scripts with the same topology are grouped together for operation, wherein the topologies operate in reverse order according to the number of devices required by the topology, the script with the largest topology operates first, and the script with the smallest topology operates last. When the small topology script is operated, redundant equipment is released in time and used for other automatic test tasks, and equipment resource idling and waste are avoided.
Optionally, in step S204, the specified test duration of the target test task and the total script duration required for performing serial test on all scripts in the script list are determined, where the total script duration is the sum of the running durations of the scripts.
Optionally, in step S206, the target test task is split to obtain a plurality of subtasks by the following method: determining test cases corresponding to all scripts in the script list, and determining network topology attribute values corresponding to the test cases, wherein the network topology attribute values are used for indicating the number of the devices to be tested and the number of the auxiliary devices; sequencing all scripts in the script list in a reverse order according to the network topology attribute values, wherein the larger the network topology attribute is, the more the scripts are in the sequencing result of the reverse order sequencing; and distributing the scripts after the reverse sequencing into a plurality of subtasks. Specifically, the larger the number of the devices to be tested is, the larger the network topology attribute value is; under the condition that the number of the devices to be tested is the same, the larger the number of the auxiliary devices is, the larger the network topology attribute is, wherein the auxiliary devices are used for auxiliary testing and are physical hardware devices or virtual testing computers created through a virtualization technology.
In some embodiments of the present application, a network topology attribute value DnPN is used to indicate the number of the devices to be tested VDUT and the auxiliary devices VPC, where Dn is used to indicate that the number of the devices to be tested VDUT is N, and PN is used to indicate that the number of the auxiliary devices VPC is N, where N and N are any non-negative integers.
In some optional embodiments of the present application, if the automated test task submitted by the target object includes 10 test scripts, where the script topology attributes are as shown in the following table:
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
Dn is used to indicate that the number of devices under test in the test script is n, where n is 1,2,3,4 in the above embodiment; PN is used to indicate that the number of slave devices in the test script is N, where N is 0,1,2,3,4 in the above embodiment.
And sequencing the scripts in a reverse order according to the network topology attribute values, wherein in the reverse order sequencing process, the scripts are sequenced based on the priority relation preset in the network topology attribute values DnPN. Specifically, the number D of the devices to be tested is a first priority, and the number P of the auxiliary devices VPC is a second priority, wherein when the number D of the devices to be tested in the first priority is the same, the scripts are sorted based on the number P of the auxiliary devices VPC in the second priority.
In some embodiments of the present application, the scripts S1-S10 are sorted in a reverse order, and the topological attributes of the sorted scripts are shown in the following table:
script S1 S2 S3 S4 S5 S6 S7 S8 S9 S10
Topology D4P4 D4P2 D3P3 D3P2 D2P4 D2P2 D1P4 D1P2 D1P1 D1P0
In some optional embodiments of the present application, the distributing the script after the reverse sorting to the plurality of subtasks may be implemented by the following processes: if the expected test duration of the target object is T, the width occupied by the reverse-ordered script Sn indicates the expected running duration of the script (n is 1,2,3, …,7,8,9,10), and the reverse-ordered scripts S1 to S10 and the topological attributes thereof are shown in the following table:
script S1 S2 S3 S4 S5 S6 S7 S8 S9 S10
Topology D4P4 D4P2 D3P3 D3P2 D2P4 D2P2 D1P4 D1P2 D1P1 D1P0
Specifically, the 10 scripts S1 to S10 in the original test task may be split based on the expected test duration T of the target object; because the sum of the estimated running time of the script possibly has a certain error with the testing time T, when the task is split, the estimated running time of the actually split task is about the testing time T; if the predicted test duration of a single script exceeds the test duration T, the script is separately allocated to a subtask.
Fig. 5 is a schematic diagram of a sub-task splitting process in the automated test task, and as shown in fig. 5, 4 sub-tasks can be split, and based on the maximum number of devices to be tested and the maximum number of auxiliary devices in each sub-task, the device topology finally required by each sub-task is determined. For example, if the subtask 1 includes scripts S1(D4P4), S2(D4P2), and S3(D3P3), the final required device topology of the subtask 1 is D4P 4; the subtask 2 includes scripts S4(D3P2) and S5(D2P4), so that the device topology finally required by the subtask 2 is D3P 4; the subtask 3 includes a test script S6(D2P2), S7(D1P4), S8(D1P2), and S9(D1P1), so that the device topology finally required by the subtask 3 is D2P 4; the subtask 4 includes the test script S10(D1P0), and the device topology finally required by the subtask 4 is D1P 0.
In some embodiments of the present application, all scripts in the script list are sorted based on a reverse sorting principle, so that the topologies of the scripts split into the same subtasks are similar, the maximum topology and the minimum topology span in each subtask are ensured to be small, and the large topology scripts are concentrated in one subtask as much as possible, thereby saving the total number of devices required by the subtasks.
Optionally, before executing the plurality of subtasks in parallel in response to the trigger instruction, the method further includes: determining the maximum topological attribute value of each subtask according to the script in each subtask in the plurality of subtasks; determining target resources required for testing a plurality of subtasks; comparing the target resource with the current remaining available resources of the server; and generating prompt information for prompting the addition of the server or increasing the value of the specified test duration in the case that the target resource is larger than the remaining available resource. Specifically, in the case that the target resource is smaller than the remaining available resource, the remaining available resource is allocated to the plurality of subtasks to test the plurality of subtasks.
In some optional embodiments of the present application, the maximum topology attribute value of each of the plurality of subtasks and the target resource required for each subtask to perform the test may be determined based on the schematic diagram of the automated test task subtask splitting process shown in fig. 5. Specifically, the network topology attribute value of each subtask in the test task is traversed, the topology attribute values are sorted in a reverse order, the maximum topology attribute value of each subtask is determined, and finally the target resource required by each subtask is determined based on the topology attribute values.
For example, if the subtask 1 includes scripts S1(D4P4), S2(D4P2), and S3(D3P3), the maximum topology attribute value of the subtask 1 is D4P4, and the target resources that the subtask 1 needs to occupy are 4 VDUTs and 4 VPCs; the subtask 2 contains scripts S4(D3P2) and S5(D2P4), so that the maximum topology attribute value of the subtask 2 is D3P4, and target resources required to be occupied are 3 VDUTs and 4 VPCs; the subtask 3 includes a test script S6(D2P2), S7(D1P4), S8(D1P2), and S9(D1P1), so that the maximum topology attribute value of the subtask 3 is D2P4, the maximum topology attribute value of the subtask 3 is D2P4, and target resources required to be occupied are 2 VDUTs and 4 VPCs; if the subtask 4 includes the test script S10(D1P0), the maximum topology attribute value of the subtask 4 is D1P0, and the target resources to be occupied are 1 VDUT and 0 VPC.
In some embodiments of the present application, if there are 4 servers, and each server can create 5 VDUTs and 10 VPCs, the available resources are 20 VDUTs and 40 VPCs. Fig. 6 is a flowchart of the subtasks 1 to 4 respectively applying for the test resource from the server, and as shown in fig. 6, the flowchart mainly includes: after the subtask 1 occupies 4 VDUTs and 4 VPCs of the server 1, the remaining resources of the server 1 do not meet the maximum topology of the subtask 2, and the subtask 2 continues to apply for testing resources from the server 2; after the subtask 2 occupies 3 VDUTs and 4 VPCs of the server 2, the remaining resources of the server 2 still meet the maximum topology of the subtask 3, and the subtask 3 continues to occupy 2 VDUTs and 4 VPCs of the server 2; when the remaining resources of the server 2 do not meet the maximum topology of the subtask 4, the subtask 4 continues to apply for the test resources from the server 3, and occupies 1 VDUT of the server 3. After the 4 subtasks are applied to the test equipment, the 4 subtasks are triggered to run one by one, wherein each subtask is tested according to the script topology in the running process. It is easily understood that, during operation, 1 VDUT and 6 VPCs remain in the server 1, 0 VDUT and 2 VPCs remain in the server 2, 4 VDUTs and 10 VPCs remain in the server 3, and the server 4 is not used.
In some optional embodiments of the present application, when there are only two servers available for the subtasks 1 to 4, where each server may create 5 VDUTs and 10 VPCs, the available resources are 20 VDUTs and 40 VPCs, and the subtasks 1 to 4 cannot all apply to the test equipment, the subtasks 1 to 4 may be run by increasing the value of the specified test duration.
Optionally, in the process of executing a plurality of subtasks, after the target script in a subtask is executed, the target script is deleted from the script list, and the resource corresponding to the executed target script is released.
In some embodiments of the present application, taking subtask 1 in automated testing task 1 as an example, fig. 7 is a flowchart of device release during the running process of subtask 1, as shown in fig. 7, the flowchart mainly includes: the subtask 1 has scripts S1(D4P4), S2(D4P2) and S3(D3P3), the task runs preferentially S1(D4P4), then runs S2(D4P2) and finally runs S3(D3P 3); when the operation S1(D4P4) is performed, 4 VDUTs and 4 VPCs are occupied, and after the operation S1(D4P4) is finished, the operation of the residual scripts S2(D4P2) and S3(D3P3) needs 4 VDUTs and 3 VPCs at most, so that 1 VPC can be released in time; after the script runs of S2(D4P2) are combined, the runs of the remaining scripts S3(D3P3) require at most 3 VDUTs and 3 VPCs, so that 1 VDUT can be released in time.
In some optional embodiments of the present application, a subtask splitting rule and an equipment early release rule are combined, fig. 8 is a specific operation flow of the subtasks 1 to 4, and as shown in fig. 8, finally, the automatic test task 1 will complete the entire test within about T duration.
In some embodiments of the present application, after all the subtasks are tested, all the subtask results are collected into the original task, and an automated test task test result report is sent.
In some optional embodiments of the present application, if the automated testing task 1 is running, the target object immediately submits the automated testing task 2, wherein the automated testing task 2 has been split into 4 subtasks, wherein the maximum topologies of the subtasks of the automated testing task 2 are D4P4, D3P2, D2P2, and D1P2, respectively. Fig. 9 is a flowchart of the application of each subtask of the automated testing task 2 for testing resources to the server, and as shown in fig. 9, the automated testing task 1 will finally complete the entire test within about T duration. It is easy to understand that, in the process of applying for the test equipment by each subtask of the automated test task 2, all servers are also scanned to see whether the remaining resources of the servers meet the maximum topology of the subtasks.
Fig. 10 is a schematic diagram of a script testing apparatus according to an embodiment of the present application, as shown in fig. 10, the apparatus includes the following modules:
the first determining module 1000 is configured to determine a target test task to be tested, where the target test task is used to test all scripts in the script list;
a second determining module 1002, configured to determine a specified test duration of the target test task, and a total script duration required for performing serial testing on all scripts in the script list;
the splitting module 1004 is configured to split the target test task to obtain a plurality of subtasks when the total script duration is greater than the specified test duration, where each subtask includes at least one script, and the running duration of each subtask is not greater than the specified test duration;
the execution module 1006 is configured to execute a plurality of subtasks in parallel in response to the trigger instruction to execute the target test task.
In the script testing apparatus, the splitting module further includes: the device comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining test cases corresponding to all scripts in a script list and determining network topology attribute values corresponding to all the test cases, and the network topology attribute values are used for indicating the number of devices to be tested and the number of auxiliary devices; the reverse ordering unit is used for performing reverse ordering on all scripts in the script list according to the network topology attribute values, wherein the larger the network topology attribute is, the more the scripts are in the ordering result of the reverse ordering; and the distribution unit is used for distributing the scripts after the reverse sequencing into the plurality of subtasks.
It should be noted that the script testing apparatus shown in fig. 10 is used for executing the script testing method shown in fig. 2 to fig. 9, and therefore the related explanation in the script testing method is also applicable to the script testing apparatus, and is not described herein again.
According to another aspect of the embodiments of the present application, there is also provided a non-volatile storage medium, where the non-volatile storage medium includes a stored program, where, when the program runs, a device in which the non-volatile storage medium is located is controlled to execute the above-mentioned script testing method, the method includes the following specific steps: determining a target test task to be tested, wherein the target test task is used for testing all scripts in the script list; determining the specified test duration of the target test task and the total script duration required by all scripts in the script list for serial test; under the condition that the total script time length is longer than the specified test time length, splitting the target test task to obtain a plurality of subtasks, wherein each subtask comprises at least one script, and the running time length of each subtask is not longer than the specified test time length; in response to the trigger instruction, a plurality of subtasks are executed in parallel to execute the target test task.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A script testing method, comprising:
determining a target test task to be tested, wherein the target test task is used for testing all scripts in a script list;
determining the specified test duration of the target test task and the total script duration required by all scripts in the script list for serial test;
under the condition that the total script time length is longer than the specified test time length, splitting the target test task to obtain a plurality of subtasks, wherein each subtask comprises at least one script, and the running time length of each subtask is not longer than the specified test time length;
in response to a trigger instruction, executing the plurality of subtasks in parallel to execute the target test task.
2. The method of claim 1, wherein splitting the target test task to obtain a plurality of subtasks comprises:
determining test cases corresponding to all scripts in the script list, and determining network topology attribute values corresponding to the test cases, wherein the network topology attribute values are used for indicating the number of devices to be tested and the number of auxiliary devices;
sequencing all scripts in the script list in a reverse order according to the network topology attribute values, wherein the larger the network topology attribute is, the more the scripts are in the sequencing result of the reverse order sequencing;
and distributing the scripts after the reverse sequencing into the plurality of subtasks.
3. The method according to claim 2, wherein the larger the number of the devices under test, the larger the network topology attribute value; and under the condition that the number of the devices to be tested is the same, the larger the number of the auxiliary devices is, the larger the network topology attribute is.
4. The method of claim 1, wherein prior to executing the plurality of subtasks in parallel in response to a trigger instruction, the method further comprises:
determining the maximum topology attribute value of each subtask according to the script in each subtask in the plurality of subtasks;
determining target resources required for testing the plurality of subtasks;
comparing the target resource with the current remaining available resources of the server;
and generating prompt information for prompting to increase a server or increasing the value of the specified test duration under the condition that the target resource is larger than the residual available resource.
5. The method of claim 4, further comprising: and under the condition that the target resource is smaller than the residual available resource, distributing the residual available resource to the plurality of subtasks to test the plurality of subtasks.
6. The method of claim 1, further comprising:
in the process of executing the plurality of subtasks, after the target script in the subtasks is executed, the target script is deleted from the script list, and the resource corresponding to the target script is released to be executed.
7. A script testing apparatus, comprising:
the device comprises a first determining module, a second determining module and a third determining module, wherein the first determining module is used for determining a target test task to be tested, and the target test task is used for testing all scripts in a script list;
the second determining module is used for determining the specified testing time length of the target testing task and the total script time length required by all scripts in the script list for serial testing;
the splitting module is used for splitting the target test task to obtain a plurality of subtasks under the condition that the total script time length is greater than the specified test time length, wherein each subtask comprises at least one script, and the running time length of each subtask is not greater than the specified test time length;
and the execution module is used for responding to a trigger instruction and executing the plurality of subtasks in parallel so as to execute the target test task.
8. The apparatus according to claim 7, wherein the splitting module is further configured to determine test cases corresponding to all scripts in the script list, and determine a network topology attribute value corresponding to each test case, where the network topology attribute value is used to indicate the number of devices to be tested and the number of auxiliary devices; sequencing all scripts in the script list in a reverse order according to the network topology attribute values, wherein the larger the network topology attribute is, the more the scripts are in the sequencing result of the reverse order sequencing; and distributing the scripts after the reverse sequencing into the plurality of subtasks.
9. A non-volatile storage medium, comprising a stored program, wherein the program, when executed, controls a device in which the non-volatile storage medium is located to execute the script testing method of any one of claims 1 to 6.
10. An electronic device comprising a processor and a memory, the processor being configured to execute a program stored in the memory, wherein the program when executed performs the script testing method of any one of claims 1 to 6.
CN202111633594.6A 2021-12-28 2021-12-28 Script testing method and device Pending CN114297067A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111633594.6A CN114297067A (en) 2021-12-28 2021-12-28 Script testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111633594.6A CN114297067A (en) 2021-12-28 2021-12-28 Script testing method and device

Publications (1)

Publication Number Publication Date
CN114297067A true CN114297067A (en) 2022-04-08

Family

ID=80972565

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111633594.6A Pending CN114297067A (en) 2021-12-28 2021-12-28 Script testing method and device

Country Status (1)

Country Link
CN (1) CN114297067A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115543806A (en) * 2022-10-08 2022-12-30 武汉赫尔墨斯智能科技有限公司 Method for supporting automatic calling and automatic matching automatic execution case test

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115543806A (en) * 2022-10-08 2022-12-30 武汉赫尔墨斯智能科技有限公司 Method for supporting automatic calling and automatic matching automatic execution case test
CN115543806B (en) * 2022-10-08 2024-06-07 武汉赫尔墨斯智能科技有限公司 Method for supporting automatic calling, automatic matching and automatic executing case test

Similar Documents

Publication Publication Date Title
CN110119306B (en) Method, device and equipment for balancing automatic scheduling of jobs and storage medium
CN112769810B (en) Firewall testing method and device, nonvolatile storage medium and electronic device
CN103346974A (en) Controlling method of service process and network device
CN114661462A (en) Resource allocation method, system, computer readable storage medium and electronic device
CN113656168A (en) Method, system, medium and equipment for automatic disaster recovery and scheduling of traffic
CN112527449B (en) Cluster node label creation method and system, electronic equipment and storage medium
CN112631919B (en) Contrast test method, device, computer equipment and storage medium
CN110427494B (en) Knowledge graph display method and device, storage medium and electronic device
CN112506581A (en) Method and device for rendering small program, electronic equipment and readable storage medium
CN114297067A (en) Script testing method and device
CN109406025B (en) Pressure testing method and device and electronic equipment
CN114647519A (en) Data transmission method and device between native platform and Flutter platform and storage medium
CN113885971A (en) State management method and device based on self-adaptive platform system
CN111831452A (en) Task execution method and device, storage medium and electronic device
CN112667498B (en) Server building method, device, computer equipment and readable storage medium
CN113504981A (en) Task scheduling method and device, storage medium and electronic equipment
CN114301805A (en) Method and device for determining number of devices and electronic device
US11323385B2 (en) Communication system and communication method
CN114466387A (en) Method and device for updating configuration file of base station, storage medium and electronic device
CN113110991A (en) Page element positioning method and device, storage medium and electronic device
CN112328487A (en) Parallel joint simulation scheduling method, device and equipment for fault injection use case
CN107818097B (en) Data processing method and device
CN110580248A (en) Data management method and device based on rule base expansion
CN112395081A (en) Resource online automatic recovery method, system, server and storage medium
CN110096255B (en) Rule degradation processing method, device and system and data processing method

Legal Events

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