Disclosure of Invention
The invention aims to provide an automatic testing method, device and equipment of a distributed system and a storage medium, which are used for improving the efficiency of the automatic testing of the distributed system.
In order to solve the technical problems, the invention provides an automatic testing method of a distributed system, which comprises the following steps:
acquiring test cases of a system to be tested and test setting parameters of the test cases;
determining the execution relation among the test cases according to the test setting parameters of the test cases;
dividing each test case into test case groups according to the execution relationship;
Sequentially executing each test case group to test the system to be tested;
The test case group comprises one or more test cases, and each test case in the test case group is a test case which can be executed simultaneously.
Optionally, the method includes obtaining test setting parameters of each test case, specifically:
obtaining labels of all the test cases;
Correspondingly, the determining the execution relationship between the test cases according to the test setting parameters of the test cases specifically includes:
and determining the execution relationship among the test cases according to the preset execution relationship among the labels.
Optionally, the method includes obtaining test setting parameters of each test case, specifically:
And receiving the input test setting parameters of each test case.
Optionally, the method includes obtaining test setting parameters of each test case, specifically:
And identifying the information of the preset position of the test case to obtain the test setting parameters of the test case.
Optionally, the dividing each test case into test case groups according to the execution relationship specifically includes:
dividing all the test cases into an initial test case group;
according to the execution relation, from the first test case, removing the test case which cannot be executed simultaneously with the test case from the initial test case group until processing of all the test cases in the initial test case group is completed, and generating one test case group from the rest test cases in the initial test case group;
And after the test cases removed from the initial test case group are recombined into the initial test case group, entering the step of removing the test cases which cannot be executed simultaneously with the test cases from the initial test case group from the first test case according to the execution relation until all the test cases are divided.
Optionally, the generating the test case group from the test cases remaining in the initial test case group specifically includes:
Determining system resources of the system to be tested, which are divided into test tasks;
If the resources occupied by the rest of the test cases in the initial test case group exceed the system resources, removing the excess test cases from the initial test case group, and generating one test case group by the rest of the test cases in the initial test case group;
and if the resources occupied by the rest of the test cases in the initial test case group do not exceed the system resources, generating one test case group by using the rest of the test cases in the initial test case group.
Optionally, the sequentially executing each test case group to test the system to be tested specifically includes:
Outputting information of each test case group;
when an adjustment command for the test case group is received, adjusting the corresponding test case group according to the adjustment command;
And after receiving the test command, sequentially executing each test case group to test the system to be tested.
In order to solve the technical problem, the invention also provides an automatic testing device of the distributed system, which comprises:
The system comprises an acquisition unit, a control unit and a control unit, wherein the acquisition unit is used for acquiring test cases of a system to be tested and test setting parameters of the test cases;
a determining unit, configured to determine an execution relationship between the test cases according to the test setting parameters of the test cases;
the grouping unit is used for dividing each test case into test case groups according to the execution relationship;
The test unit is used for sequentially executing each test case group so as to test the system to be tested;
The test case group comprises one or more test cases, and each test case in the test case group is a test case which can be executed simultaneously.
In order to solve the technical problem, the present invention further provides an automated testing device of a distributed system, including:
a memory for storing instructions comprising the steps of the automated test method of a distributed system of any of the above;
and the processor is used for executing the instructions.
To solve the above technical problem, the present invention further provides a storage medium having stored thereon a computer program, which when executed by a processor, implements the steps of the automated test method of a distributed system according to any one of the above.
According to the automatic test method for the distributed system, after the test cases of the system to be tested and the test setting parameters of the test cases are obtained, the execution relation among the test cases is determined according to the test setting parameters of the test cases, so that the test cases are divided into test case groups according to the execution relation, one test case group comprises one or more test cases, the test cases in the test case group are test cases which can be executed simultaneously, and then the test case groups are executed in sequence to test the system to be tested, so that compared with the mode of executing the test cases singly in the prior art, the resources of the system to be tested are fully utilized, the whole test time is saved, and the automatic test efficiency of the distributed system is greatly improved.
The invention also provides an automatic testing device, equipment and storage medium of the distributed system, which have the beneficial effects and are not repeated here.
Detailed Description
The invention provides an automatic testing method, device and equipment of a distributed system and a storage medium, which are used for improving the efficiency of the automatic testing of the distributed system.
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Fig. 1 is a flowchart of an automated testing method for a distributed system according to an embodiment of the present invention.
As shown in fig. 1, the method for automatically testing a distributed system according to the embodiment of the present invention includes:
s101: and acquiring test cases of the system to be tested and test setting parameters of each test case.
S102: and determining the execution relation among the test cases according to the test setting parameters of the test cases.
S103: and dividing each test case into test case groups according to the execution relationship.
S104: and executing each test case group in sequence so as to test the system to be tested.
The test case group comprises one or more test cases, and each test case in the test case group is a test case which can be executed simultaneously.
In a specific implementation, for step S101, a test case for the system under test is obtained from the test host to the specified address, or a test case uploaded by a tester is received. And then determining the test setting parameters of each test case. The method specifically can receive the input test setting parameters of each test case or the information of the preset position of the test case to obtain the test setting parameters of the test case. The test setting parameters herein may include the type of operation performed by the test case, the number of nodes that need to be occupied, the type of nodes that need to be occupied, and the like.
In step S102, the execution relationship between the test cases is determined according to the test setting parameters of the test cases by using the pre-written determination script. For example, if the test case 1 includes an instruction of "query node" and the test case 2 includes an instruction of "shutdown node", then the test case 1 and the test case 2 cannot be executed simultaneously; test case 3 and test case 4 are the same type of test case, but they both need to be executed by a particular node, and test case 3 and test case 4 cannot be executed at the same time. According to the method, each test case is analyzed, and the execution relation between each test case and the other test cases is obtained, for example, the test case 1 and the test case 2 can not be executed at the same time, the test case 1 and the test case 3 can be executed at the same time, and the like.
For step S103, according to the execution relationship among the test cases, the test cases are divided into test case groups, and the test cases in one test case group are test cases that can be executed simultaneously, so that the test case group contains multiple test cases as much as possible, thereby saving the total test time. Step S103 may specifically include:
Dividing all test cases into an initial test case group;
According to the execution relation, from the first test case, the test cases which cannot be executed simultaneously with the test cases are removed from the initial test case group until the processing of all the test cases in the initial test case group is completed, and the rest test cases in the initial test case group are generated into a test case group;
After the test cases removed from the initial test case group are recombined into the initial test case group, entering a step of removing the test cases which cannot be executed simultaneously with the test cases from the initial test case group from the first test case according to the execution relation until all the test cases are divided.
By using the specific implementation manner, the test cases which cannot be executed simultaneously can be ensured not to be divided into the same test case group. However, because the resources provided by the system to be tested for automatic testing are limited, even if the test setting parameters indicate the test cases which can be executed simultaneously, the test cases are too many and exceed the resource conditions of the system to be tested, so that the conditions of the simultaneous execution cannot be executed. Therefore, the generating a test case group from the rest test cases in the initial test case group specifically includes:
determining system resources of a system to be tested, which are divided into test tasks;
if the resources occupied by the rest of the test cases in the initial test case group exceed the system resources, removing the excess test cases from the initial test case group, and generating a test case group by the rest of the test cases in the initial test case group;
if the resources occupied by the rest of the test cases in the initial test case group do not exceed the system resources, generating a test case group by the rest of the test cases in the initial test case group.
In step S104, after the test case groups are divided, each test case group is executed one by one, that is, only one test case in the test case group is executed at the same time.
It should be noted that, whether the test case group is divided in step S103 or executed in step S104, the problem of execution time is involved. Step S103 and step S104 can randomly process each test case and randomly execute each test case group; the step S103 may process each test case according to the priority order of the test cases, so as to divide the test cases with high priority into the preceding test case groups, and then the step S104 may execute each test case group according to the generation order of the test case groups; the processing sequence of the test cases can be determined according to the bearing relation among the test items of the test cases, so that the bearing commands among the test case groups are reduced, and the test efficiency of the system to be tested is further improved.
Because the execution relationship between the test cases is very complex, the pre-written judgment script is likely to be unable to be accurately identified, so step S104 may specifically include:
Outputting information of each test case group;
When an adjustment command for the test case group is received, adjusting the corresponding test case group according to the adjustment command;
and after receiving the test command, sequentially executing each test case group to test the system to be tested.
And (3) checking the test case group obtained in the step (S103) by a tester, determining whether the test can be performed according to the current divided test case group according to the checking result, adjusting an improper dividing result, and finally issuing a test command to ensure the execution effectiveness of the test case group.
According to the automatic test method for the distributed system, after the test cases of the system to be tested and the test setting parameters of the test cases are obtained, the execution relation among the test cases is determined according to the test setting parameters of the test cases, so that the test cases are divided into test case groups according to the execution relation, one test case group comprises one or more test cases, the test cases in the test case group are test cases capable of being executed simultaneously, and then the test case groups are executed in sequence to test the system to be tested, so that compared with the mode of executing the test cases singly in the prior art, the resources of the system to be tested are fully utilized, the overall test time is saved, and the automatic test efficiency of the distributed system is greatly improved.
Based on the foregoing embodiments, in the method for automatically testing a distributed system according to the embodiment of the present invention, in step S101, test setting parameters of each test case are obtained, which specifically includes:
and obtaining the labels of the test cases.
Accordingly, step S102: determining the execution relation among the test cases according to the test setting parameters of the test cases, wherein the execution relation is specifically as follows:
and determining the execution relationship among the test cases according to the preset execution relationship among the labels.
In a specific implementation, the automatic test method for the distributed system provided by the embodiment of the invention designs the corresponding labels according to the test setting parameters of each test case in advance, each test case can have a plurality of corresponding labels, one label can also correspond to a plurality of test case types, and the execution relationship before each label is set, so that the complexity of judging the execution relationship among the test cases in the step S102 can be reduced, and the efficiency of determining the execution relationship among the test cases is improved. The labels of the test cases can be stored in the appointed address in an associated mode according to the types of the test cases, and can be input by a tester. With the increase of test items, the types of test cases are increased, the types of labels are also increased, and correspondingly, the execution relationship between labels is also increased, so that a characteristic relationship library of the execution relationship between a label library and the labels is established for calling during testing.
In the embodiment of the invention, a storage system is exemplified according to the division of functional modules, and four test cases are assumed, and the labels of the test cases are shown in table 1:
table 1 test case label example table in one-time automated test
Test case labels |
Label (Label) |
Test case 1 |
Node management and query node |
Test case 2 |
Node management and newly added nodes |
Test case 3 |
Performance queries |
Test case 4 |
Node management and shutdown node |
The corresponding feature relation library stores the execution relation among the labels as follows:
1. The query node label and the newly added node label and the shutdown node label cannot be executed at the same time;
2. The performance query label and the shutdown node label can not be executed at the same time;
3. the "new node" tag and the "shutdown node" tag may not be executed at the same time.
It can be determined that test case 1 and test case 2 cannot be executed simultaneously, test case 1 and test case 3 cannot be executed simultaneously, test case 1 and test case 4 cannot be executed simultaneously, test case 2 and test case 2 cannot be executed simultaneously, test case 2 and test case 4 cannot be executed simultaneously, and test case 3 and test case 4 cannot be executed simultaneously.
When each test case is divided into test case groups according to the execution relationship in step S103, all test cases enter an initial test case group by default, from test case 1, test case 2 and test case 4 which cannot be executed simultaneously with test case 1 are moved out of the initial test case group, and the remaining test case 1 and test case 3 generate test case group one; taking test case 2 and test case 4 as initial test case groups, starting from test case 2, removing test case 4 which cannot be executed simultaneously with test case 2 from the initial test case group, and taking the left test case 2 as test case group II; and taking the test case 4 as an initial test case group, entering the test case group III by the test case 4, and completing the processing of all the test cases.
The invention further discloses an automatic testing device, equipment and storage medium of the distributed system corresponding to the method.
Fig. 2 is a schematic structural diagram of an automated testing apparatus for a distributed system according to an embodiment of the present invention.
As shown in fig. 2, an automated testing apparatus for a distributed system according to an embodiment of the present invention includes:
an obtaining unit 201, configured to obtain test cases for a system to be tested and test setting parameters of each test case;
a determining unit 202, configured to determine an execution relationship between the test cases according to the test setting parameters of the test cases;
A grouping unit 203, configured to divide each test case into test case groups according to an execution relationship;
the test unit 204 is configured to sequentially execute each test case group to test the system to be tested;
The test case group comprises one or more test cases, and each test case in the test case group is a test case which can be executed simultaneously.
Since the embodiments of the apparatus portion and the embodiments of the method portion correspond to each other, the embodiments of the apparatus portion are referred to the description of the embodiments of the method portion, and are not repeated herein.
Fig. 3 is a schematic structural diagram of an automated testing apparatus for a distributed system according to an embodiment of the present invention.
As shown in fig. 3, an automated test apparatus for a distributed system according to an embodiment of the present invention includes:
a memory 310 for storing instructions comprising the steps of the automated testing method of a distributed system according to any of the embodiments described above;
And a processor 320 for executing the instructions.
Processor 320 may include one or more processing cores, such as a 3-core processor, an 8-core processor, etc. The processor 320 may be implemented in at least one hardware form of a digital signal Processing DSP (DIGITAL SIGNAL Processing), a Field-Programmable gate array FPGA (Field-Programmable GATE ARRAY), and a Programmable logic array PLA (Programmable Logic Array). Processor 320 may also include a main processor, which is a processor for processing data in an awake state, also referred to as a central processor CPU (Central Processing Unit), and a coprocessor; a coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 320 may be integrated with an image processor GPU (Graphics Processing Unit), a GPU for use in responsible for rendering and rendering of the content that is to be displayed by the display screen. In some embodiments, the processor 320 may also include an artificial intelligence AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 310 may include one or more storage media, which may be non-transitory. Memory 310 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In this embodiment, the memory 310 is at least used for storing a computer program 311, where the computer program 311, after being loaded and executed by the processor 320, can implement relevant steps in the automated testing method of the distributed system disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 310 may further include an operating system 312, data 313, and the like, where the storage may be transient storage or permanent storage. The operating system 312 may be Windows. The data 313 may include, but is not limited to, data related to the above-described method.
In some embodiments, the automated test equipment of the distributed system may further comprise a display 330, a power supply 340, a communication interface 350, an input-output interface 360, a sensor 370, and a communication bus 380.
Those skilled in the art will appreciate that the architecture shown in fig. 3 does not constitute a limitation of the automated test equipment of the distributed system and may include more or fewer components than illustrated.
The automatic test equipment of the distributed system provided by the embodiment of the application comprises the memory and the processor, wherein the processor can realize the automatic test method of the distributed system when executing the program stored in the memory, and the effects are the same as the above.
It should be noted that the apparatus and device embodiments described above are merely exemplary, and for example, the division of modules is merely a logic function division, and there may be other division manners in actual implementation, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms. The modules illustrated as separate components may or may not be physically separate, and components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed over a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
The integrated modules may be stored in a storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium for performing all or part of the steps of the method according to the embodiments of the present invention.
To this end, an embodiment of the present invention further provides a storage medium having a computer program stored thereon, which when executed by a processor implements steps of an automated test method, such as a distributed system.
The storage medium may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory RAM (Random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The computer program included in the storage medium provided in this embodiment can implement the steps of the automated testing method of the distributed system described above when executed by the processor, and the effects are the same as above.
The method, the device, the equipment and the storage medium for automatically testing the distributed system provided by the invention are described in detail. In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. The apparatus, device and storage medium disclosed in the embodiments are relatively simple to describe, and the relevant parts refer to the description of the method section since they correspond to the methods disclosed in the embodiments. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.
It should also be noted that in this specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.