CN115543765A - Test case scheduling method and device, computer equipment and readable medium - Google Patents

Test case scheduling method and device, computer equipment and readable medium Download PDF

Info

Publication number
CN115543765A
CN115543765A CN202110731649.0A CN202110731649A CN115543765A CN 115543765 A CN115543765 A CN 115543765A CN 202110731649 A CN202110731649 A CN 202110731649A CN 115543765 A CN115543765 A CN 115543765A
Authority
CN
China
Prior art keywords
test
test case
resource
plan
execution
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
CN202110731649.0A
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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN202110731649.0A priority Critical patent/CN115543765A/en
Publication of CN115543765A publication Critical patent/CN115543765A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The disclosure provides a test case scheduling method, which includes: determining the current allocable resource quantity, determining the resource demand quantity of the test case to be scheduled in the test plan, determining the resource allocation of the test case to be called according to the comparison result of the current allocable resource quantity and the resource demand quantity, and scheduling the test case to be scheduled. In the execution process of the test plan, the test resources can be distributed and the execution of the test cases can be dynamically scheduled according to the condition of the current available resources, so that the dynamic adjustment of the concurrency of the test cases is realized, even if the initial setting of the concurrency of the test cases in the test plan is unreasonable, the test is not influenced, the memory overflow of the test cases in the execution process can be avoided, the high-efficiency execution of the test cases is ensured, and the optimal and most effective test case scheduling scheme is customized for users on the existing test platform. The disclosure also provides a test case scheduling device, a computer device and a readable medium.

Description

Test case scheduling method and device, computer equipment and readable medium
Technical Field
The disclosure relates to the technical field of software testing, in particular to a method and a device for scheduling a test case, computer equipment and a readable medium.
Background
In recent years, with the rapid development of cloud computing and virtualization technologies, virtualization and standardization of various test environments/platforms have been rapidly accepted and adopted. In many enterprises, many teams can complete corresponding testing tasks by applying for the test platform after cloud processing and standardization in the resource pool. However, different types of teams have different use scenes, and the test case sets under the test plan are naturally different, so that the test resource requirements of the teams are different finally. Before the test plan runs, how to accurately plan, allocate and schedule the test resources in advance, and how to effectively and quickly execute the test cases during the running period of the test plan are important for improving the test effectiveness and efficiency.
In the existing containerization test, the concurrency of test cases in a test plan is fixed, and the test cases cannot be changed in the test process. For a test plan including a large number of test cases, if the concurrency of the test cases is set unreasonably, direct memory overflow during the execution of the test cases can be caused during the execution of the test plan, and the expected test effect cannot be achieved.
Disclosure of Invention
The disclosure provides a test case scheduling method, a test case scheduling device, a computer device and a readable medium.
In a first aspect, an embodiment of the present disclosure provides a method for scheduling a test case, where the method includes:
determining the amount of resources which can be allocated currently;
determining the resource demand of a test case to be scheduled in a test plan;
and determining the resource allocation of the test case to be dispatched according to the comparison result of the current allocable resource amount and the resource demand amount, and dispatching the test case to be dispatched.
In some embodiments, the determining the amount of resources that can be currently allocated includes:
determining the current occupied resource quantity of the test plan, wherein the current occupied resource quantity of the test plan is the sum of the resource quantities occupied by all the test cases which are being executed in the test plan;
and determining the current allocable resource amount according to the total resource amount of the test plan and the current occupied resource amount of the test plan.
In some embodiments, the determining resource allocation of the test case to be called according to the comparison result between the current allocable resource amount and the resource demand amount, and scheduling the test case to be scheduled includes:
responding to the fact that the current allocable resource amount is larger than or equal to the resource demand amount, allocating resources for the test case according to the resource demand amount, and scheduling the test case to execute;
and in response to the fact that the current allocable resource amount is smaller than the resource demand amount, suspending the test case and waiting for resource allocation.
In some embodiments, after scheduling the test case to execute, the method further includes:
and responding to the completion of the execution of the test case, and releasing resources, wherein the resources are occupied by the test case.
In some embodiments, each test case in the test plan includes a resource occupation attribute, and the determining a resource demand of the test case to be scheduled in the test plan includes:
and determining the resource demand of the test case according to the resource occupation attribute of the test case to be scheduled in the test plan.
In some embodiments, the method further comprises:
responding to the preset first times of execution of the test case, and calculating the average resource occupation amount of the test case according to the resources released after each execution of the test case;
and updating the resource occupation attribute of the test case according to the average resource occupation amount.
In some embodiments, after updating the resource occupation attribute of the test case according to the average resource occupation amount, the method further includes:
calculating the total amount of the current resources of the test plan according to the resource occupation attributes of all test cases in the test plan;
and updating the total resource amount of the test plan according to the current total resource amount of the test plan.
In some embodiments, each test case in the test plan further includes a strongly associated test case attribute, where the strongly associated test case attribute is used to represent a test case having a valid strongly associated rule with a current test case, and after the test case is scheduled to be executed, the method further includes:
and responding to the execution failure of the test case, determining that the test case has a strong correlation test case according to the strong correlation test case attribute of the test case, and setting the execution result of the strong correlation test case as the execution failure.
In some embodiments, the method further includes a step of determining strongly associated test case attributes of each test case in the test plan, where determining the strongly associated test case attributes of each test case in the test plan includes:
establishing an item set comprising a plurality of subsets according to a preset second number of test cases which are obtained by executing the test plan and are failed to be executed, wherein each subset corresponds to one execution of the test plan, and elements of each subset are all the test cases which are failed to be executed;
determining a frequent itemset of the itemset;
determining a test case group with an effective strong association rule in the frequent item set, wherein the test case group comprises two test cases which are strong association test cases with each other;
and determining the strong association test case attribute of each test case in the test plan according to the test case group with the effective strong association rule.
In some embodiments, the method further comprises:
and updating the strong association test case attributes of the test cases in the test plan in response to the satisfaction of the updating conditions of the strong association test case attributes.
In some embodiments, each test case in the test plan further includes an execution duration attribute, and the method further includes:
and in response to the fact that the execution time length of the executing test case is larger than a preset threshold value according to the execution time length attribute, terminating the execution of the test case.
In some embodiments, the method further comprises:
responding to a preset third time of test case execution in the test plan, and calculating an average execution time according to the execution time of each time of the test case;
and updating the execution duration attribute of the test case according to the average execution duration.
In another aspect, an embodiment of the present disclosure further provides a test case scheduling apparatus, including a test resource management module and a scheduling module, where the test resource management module is configured to determine a current allocable resource amount;
determining the resource demand of a test case to be scheduled in a test plan;
determining the resource allocation of the test case to be called according to the comparison result of the current allocable resource amount and the resource demand amount;
and the scheduling module is used for scheduling the test case to be scheduled according to the comparison result of the current allocable resource quantity and the resource demand quantity.
In another aspect, an embodiment of the present disclosure further provides a computer device, including:
one or more processors;
a storage device having one or more programs stored thereon;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the test case scheduling method as previously described.
In another aspect, the embodiment of the present disclosure further provides a computer readable medium, on which a computer program is stored, where the program when executed implements the test case scheduling method as described above.
The test case scheduling method provided by the embodiment of the disclosure comprises the following steps: determining the current allocable resource quantity, determining the resource demand quantity of the test case to be scheduled in the test plan, determining the resource allocation of the test case to be called according to the comparison result of the current allocable resource quantity and the resource demand quantity, and scheduling the test case to be scheduled. In the execution process of the test plan, the test resources can be distributed and the execution of the test cases can be dynamically scheduled according to the condition of the current available resources, so that the dynamic adjustment of the concurrency of the test cases is realized, even if the initial setting of the concurrency of the test cases in the test plan is unreasonable, the test is not influenced, and the memory overflow of the test cases in the execution process can be avoided, so that the high-efficiency execution of the test cases is ensured, and the optimal and most effective test case scheduling scheme can be customized for users on the existing test platform.
Drawings
Fig. 1 is a schematic flowchart of a test case scheduling method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of determining the amount of resources that can be currently allocated according to the embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating the total amount of resources of a test plan according to an embodiment of the present disclosure;
fig. 4 is a schematic flowchart of determining a strongly-associated test case attribute of each test case in the test plan according to the embodiment of the present disclosure;
fig. 5 is a first schematic structural diagram of a test case scheduling apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of a test case scheduling apparatus according to an embodiment of the present disclosure;
fig. 7 is a third schematic structural diagram of a test case scheduling apparatus according to an embodiment of the present disclosure.
Detailed Description
Example embodiments will be described more fully hereinafter with reference to the accompanying drawings, but which may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," 8230; \8230 "; when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Embodiments described herein may be described with reference to plan and/or cross-sectional views in light of idealized schematic illustrations of the disclosure. Accordingly, the example illustrations can be modified in accordance with manufacturing techniques and/or tolerances. Accordingly, the embodiments are not limited to the embodiments shown in the drawings, but include modifications of configurations formed based on a manufacturing process. Thus, the regions illustrated in the figures have schematic properties, and the shapes of the regions shown in the figures illustrate specific shapes of regions of elements, but are not intended to be limiting.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The embodiment of the disclosure provides a test case scheduling method, which is used for flexibly scheduling test cases in the fields of computers, software, internet and communication in a container environment, and particularly relates to automatic serial-parallel and prospective scheduling of the test cases and automatic flexible application of test resources in a high-capacity test scene in the field of communication.
As shown in fig. 1, the test case scheduling method includes the following steps:
and step 11, determining the amount Pr of the resources which can be allocated currently.
The test plan comprises a plurality of test cases, and when testing is carried out, each test case is dispatched according to the serial or parallel execution sequence of the preset test cases. For a test container, if a test plan is executed, test resources (P) are allocated to the test plan all ) The test resources are the total amount of resources required for satisfying the execution of all test cases in the whole test plan. Before the test plan begins execution, the test resources are the maximum resources that the test container can use. With the progress of the test, once a test case is scheduled, the scheduled test case inevitably occupies test resources, and accordingly, the amount of resources which can be currently allocated in the test container is reduced.
And step 12, determining the resource demand Pn of the test case to be scheduled in the test plan.
The resource demand Pn of the test case to be scheduled refers to the amount of test resources required for scheduling the execution of the test case. If a plurality of test cases are executed in parallel, that is, a plurality of test cases to be scheduled are executed, in this step, the resource demand of each test case to be scheduled is determined respectively.
And step 13, determining the resource allocation of the test case to be called according to the comparison result of the current allocable resource amount Pr and the resource demand amount Pn, and scheduling the test case to be scheduled.
In this step, for each test case, the resource amount Pr which can be currently allocated is compared with the resource demand Pn of the test case, and it is determined whether resources can be allocated to the test case to be scheduled and how to schedule (execute or suspend) the test case according to the comparison result.
The test case scheduling method provided by the embodiment of the disclosure comprises the following steps: determining the current allocable resource quantity, determining the resource demand quantity of the test case to be scheduled in the test plan, determining the resource allocation of the test case to be called according to the comparison result of the current allocable resource quantity and the resource demand quantity, and scheduling the test case to be scheduled. In the execution process of the test plan, the test resources can be distributed and the execution of the test cases can be dynamically scheduled according to the condition of the current available resources, so that the dynamic adjustment of the concurrency of the test cases is realized, even if the initial setting of the concurrency of the test cases in the test plan is unreasonable, the test is not influenced, and the memory overflow of the test cases in the execution process can be avoided, so that the high-efficiency execution of the test cases is ensured, and the optimal and most effective test case scheduling scheme can be customized for users on the existing test platform.
In some embodiments, as shown in fig. 2, the determining the amount Pr of resources that can be currently allocated (i.e. step 11) includes the following steps:
and step 111, determining the resource amount Pc occupied by the test plan currently, wherein the resource amount occupied by the test plan currently is the sum of the resource amounts occupied by the test cases which are executed in the test plan.
In some embodiments, the amount of resources Pc currently occupied by the test plan may be estimated according to the following formula:
Figure BDA0003140017540000051
wherein i is the identification of the test case in the test plan, and m is the total number of the test cases currently executed in the test plan. It should be noted that the resource types may include: the test system comprises CPU resources, memory resources, storage resources, network resources and the like, wherein the resources occupied by each test case are one or more of the various types of resources, the test cases are different, and the required resource types are different. For example, if a test plan currently has 2 test cases (test case 1 and test case 2) being executed, and resources required by test case 1 include CPU resources, memory resources, and storage resources, then the amount of resources Pc currently occupied by test case 1 is Pc 1 Is the sum of the occupied CPU resource, memory resource and storage resource; the resources required for test case 2 include storage resources and network resources,the amount of resources Pc currently occupied by test case 2 2 The current occupied resource amount of the whole test plan is Pc = Pc which is the sum of the occupied storage resource and the network resource 1 +Pc 2
Step 112, the total amount of resources P according to the test plan all And determining the currently available resource amount Pr of the test plan according to the currently occupied resource amount Pc of the test plan.
Total amount of resources P of test plan all The sum of the current occupied resource amount Pc of the test plan is all the resources required by the execution of the test plan, therefore, the current allocable resource amount Pr = the total resource amount P of the test plan all The amount of resources Pc currently occupied by the test plan. Note that Pc =0, pr =0, p before the test plan is executed all The maximum amount of resources that can be used for the current test container.
In some embodiments, determining resource allocation of a test case to be called according to a comparison result between the current allocable resource amount Pr and the resource demand amount Pn, and scheduling the test case to be scheduled (i.e. step 13), includes the following steps: responding that the current allocable resource amount Pr is larger than or equal to the resource demand amount Pn, allocating resources for the test case according to the resource demand amount Pn, and scheduling the test case to execute; and in response to the fact that the current allocable resource amount Pr is smaller than the resource demand amount Pn, suspending the test case and waiting for resource allocation. That is, if Pr is greater than or equal to Pn, which indicates that the remaining test resources in the current test container are enough for the test case to be called to execute, then resources are allocated to the test case to be scheduled, and the test case is scheduled to execute. If Pr < Pn indicates that the residual test resources in the current test container are not enough to execute the test case to be dispatched, the test case to be dispatched is put into a test case alignment column to be dispatched, and test resources are waited to be allocated, wherein the test case in the test case alignment column to be dispatched is a test case which is hung up due to the shortage of the current test resources.
In some embodiments, after the test case is scheduled to be executed, the test case scheduling method may further include the steps of: and responding to the completion of the execution of the test case, and releasing the resources, wherein the resources are occupied by the test case. In this step, after the test case is executed, the resources are actively released, it should be noted that the test case execution completion includes the execution success and the execution failure, that is, the occupied resources are released no matter the test case is executed successfully or unsuccessfully, and the released resources are recovered to Pr, so as to ensure the dynamic allocation of the test resources.
In some embodiments, each test case in the test plan includes a resource occupancy attribute, i.e., the test case has a resource occupancy attribute field. Correspondingly, the determining a resource demand Pn of a test case to be scheduled in the test plan (i.e., step 12) includes: according to the resource occupation attribute of the test case to be scheduled in the test plan, the resource demand Pn of the test case is determined, that is, in this step, the resource demand Pn of the test case to be scheduled is determined by reading the value of the resource occupation attribute of the test case to be scheduled.
In the execution process of the test plan, the resource demand Pn of each test case is not fixed, but is adjusted according to the historical execution condition of the test case. Therefore, in some embodiments, the test case scheduling method further includes the following steps: responding to the test case execution for a preset first time, and calculating the average resource occupation amount of the test case according to the resources released after the test case is executed for each time; and updating the resource occupation attribute of the test case according to the average resource occupation amount. In the step, after the test case is executed for multiple times, the average resource occupation amount of the test case is obtained by calculation according to the resources released by the test case each time, and the average resource occupation amount is used as the value of the resource occupation attribute of the test case to realize the update of the resource occupation attribute of the test case. Therefore, in the subsequent test process, the judgment is carried out according to the resource demand Pn after the test case is updated and the current allocable resource amount Pr, the judgment result is more accurate, and the resource allocation and scheduling of other test cases are more accurate.
Existing containerization testingScenario, test resources (P) allocated for a test plan under a certain container all ) Although the containerized test environment itself supports flexible definition of resources, for a test plan with a large number of test cases, if half of the test cases are executed and then re-executed, the time overhead is relatively large, and for some scenarios, if resources are allocated, re-application of resources is not possible, so that the test is forced to be terminated.
In order to solve the above technical problem, in some embodiments, as shown in fig. 3, after the resource occupation attribute of the test case is updated according to the average resource occupation amount, the test case scheduling method further includes the following steps:
step 21, calculating the total amount P of the current resources of the test plan according to the resource occupation attributes of all the test cases in the test plan all ’。
In this step, the resource requirement Pn of each test case is obtained by obtaining the resource occupation attribute value of each test case, and the resource requirement Pn of each test case is summed up to estimate the total resource P of the test plan all '. Since the step occurs after the resource occupation attribute of the test case is updated, the acquired resource demand Pn of each test case has changed, and the current total resource amount P of the test plan obtained by the change of the resource demand Pn is obtained all ' with the original total amount of resources P of the test plan all Is different from, and P all The method is more accurate and more suitable for the real situation of the test case.
Step 22, according to the current total amount P of resources of the test plan all ' updating the Total amount of resources P of the test plan all
The embodiment of the disclosure updates the total amount of resources P of the test plan all The test resources of the whole test container can be dynamically adjusted along with the execution of the test plan, the dynamic adjustment is based on the historical execution condition of the test case, so that the resources allocated for the test plan are more reasonable, and under the condition that the resource environment in the cloud is limited, after the test plan is executed for a plurality of times, the test plan can be executed according to different user scenes and testsAnd the test plan is used for accurately adjusting test resources, avoiding forced termination of the test, ensuring the smooth test, and improving the test efficiency and the test effect.
In order to further improve the testing efficiency and shorten the testing time, in some embodiments, each test case in the test plan may further include a strongly associated test case attribute, where the strongly associated test case attribute is used to represent a test case having an effective strongly associated rule with the current test case and reflect an associated coupling relationship between the test cases. Correspondingly, after the test case is scheduled to be executed (i.e., step 13), the test case scheduling method further includes the following steps: and responding to the execution failure of the test case, determining that the test case has the strong association test case according to the strong association test case attribute of the test case, and setting the execution result of the strong association test case as the execution failure. In this step, when a certain test case fails to be executed, if it is determined that the test case has a strongly associated test case according to the strongly associated test case attribute of the test case, the strongly associated test case is not executed any more, but the execution result of the strongly associated test case is directly set as the execution failure. According to the embodiment of the invention, the execution of the test cases without value is accurately and forcibly interrupted according to the incidence coupling relation among the test cases, the high-efficiency execution of the test cases is ensured, the test resources can be saved, the feedback time of the test cases is also saved, and the test efficiency is improved.
In some embodiments, the method for scheduling test cases according to the embodiments of the present disclosure further includes a step of determining a strongly associated test case attribute of each test case in the test plan, as shown in fig. 4, where the determining the strongly associated test case attribute of each test case in the test plan includes the following steps:
and step 31, establishing an item set comprising a plurality of subsets according to the preset second number of test cases which are failed to be executed and obtained by executing the test plan, wherein each subset corresponds to one execution of the test plan, and elements of each subset are all the test cases which are failed to be executed.
The set of items is called a set of items, and the set of items containing k items is called a set of k-items. Let I = { I = { I } 1 ,i 2 ,…,i m Is a set of m different items, each element in the set being an item, the set of items I being called an item set, the number of elements being called the length of the item set, the length of the item set being k being called a k-item set.
In this step, multiple (e.g., the second number n 2) execution results of the test plan are obtained, and a set of test cases that fail to be executed at each time is obtained, where the set of n2 test cases that fail to be executed forms an item set, and the set of test cases that fail to be executed corresponding to each execution of the test plan is a subset of the item set. It should be noted that the test plan may be one test plan or different test plans in the test case library.
Step 32, determining a frequent item set of the item set.
The out-of-term frequency of an item set is the number of transactions that contain the item set, referred to as the frequency, support count or count of the item set, and the support represents the proportion of transactions that contain both A and B to all transactions. Item set I is a frequent item set if its support meets a predefined minimum support threshold.
And step 33, determining a test case group with an effective strong association rule in the frequent item set, wherein the test case group comprises two test cases which are strong association test cases.
In the step, a test case group with an effective strong association rule is determined according to the promotion degree among the test cases in the frequent item set. The degree of lifting represents the ratio of "the proportion of transactions containing B among the transactions containing a" to "the proportion of transactions containing B". The promotion degree reflects the correlation between A and B in the association rule, the promotion degree is greater than 1, and the higher the promotion degree is, the higher the positive correlation is; the degree of lift is <1 and a lower degree of lift indicates a higher negative correlation; the boost =1 indicates no correlation. Therefore, the promotion degree between two single item sets in the frequent item sets is greater than 1 as a screening condition, and the test case group with the effective strong association rule is determined.
And step 34, determining the strong association test case attribute of each test case in the test plan according to the test case group with the effective strong association rule.
Illustratively, if the test case a and the test case B form a test case group having an effective strong association rule, in this step, the strong association test case attribute of the test case a is written into the test case B, and the strong association test case attribute of the test case B is written into the test case a.
The following describes a detailed description of the process of determining strongly-associated test case attributes of each test case in the test plan with reference to a specific example.
Assume that the second number of tests, n2=4,4, failed the execution of the test plan, as shown in table 1:
TABLE 1
Number of executions Test case with execution failure
1 A,C,D
2 B,C,E
3 A,B,C,E
4 B,E
According to table 1, each element (i.e., test case) is an item, the set of items is I = { a, B, C, D, E, F }, and the length of the set of items I is 6.
The Support (Support) of the collection of individual items (individual item set) in the total item set is calculated separately. The support represents the probability that the set { X } of items X appears in the total set I of items, and the formula is: support (X) = P (X)/P (I). The support of each test case is shown in table 2:
TABLE 2
Single item set Degree of support
{A} 50%
{B} 75%
{C} 75%
{D} 25%
{E} 75%
Assuming that the minimum support degree is 50%, the single item set below the minimum support degree threshold is pruned to obtain 1-frequent item sets { A }, { B }, { C }, and { E }. The minimum support may be adjusted based on historical performance.
According to the 1-frequent item set and the dictionary order, respectively calculating a 2-order item set, wherein the 2-order item set is shown in a table 3:
TABLE 3
Item set of order 2 Degree of support
{A,B} 25%
{A,C} 50%
{A,E} 25%
{B,C} 50%
{B,E} 75%
{C,E} 50%
The set of 2 nd order terms that do not meet the minimum support (50%) are pruned, resulting in a set of 2-frequent terms { A, C }, { B, C }, { B, E }, { C, E }. According to the 2-frequent item set, a 3-order item set is calculated according to the dictionary order, wherein the 3-order item set is shown in a table 4:
TABLE 4
3 order item set Degree of support
{A,B,C} 25%
{A,C,E} 25%
{A,B,E} 25%
{B,C,E} 50%
And (4) the 3-order item set which does not meet the minimum support degree (50%) is pruned to generate a 3-frequent item set { B, C, E }, and the 3-frequent item set { B, C, E } is the final frequent item set.
And respectively calculating the confidence degrees among the single item sets in the frequent item set. The Confidence (Confidence) represents the probability of Y being deduced by the association rule "X- > Y" in the case of the occurrence of the precondition X, i.e. the probability of Y being contained in the set of terms containing X, and is calculated by the formula: configence (X- > Y) = P (Y | X) = P (X utoxy)/P (X). The confidence of each individual set of terms in the frequent set of terms is shown in table 5:
TABLE 5
B C E
B 66.6% 100%
C 66.6% 66.6%
E 100% 66.6%
Assuming that the minimum confidence threshold is 75%, pruning is performed on the items which do not meet the minimum confidence threshold, and a single item set { B } and { E } is obtained after pruning.
And calculating the lifting degree between the { B } and { E } of the single item set according to the confidence degree and the lifting degree, wherein the lifting degree (Lift) represents the ratio of the probability of containing Y under the condition of containing X and the probability of containing Y under the condition of not containing X, and the calculation formula is as follows:
Lift(X->Y)=Confidence(X->Y)/Support(Y)
the Lift level Lift (X- > Y) =1, which indicates that X and Y are independent from each other, i.e., whether X exists or not, has no influence on the appearance of Y. Although the support degree and the confidence degree are high, the promotion degree =1 is not a valid association rule.
The rule satisfying the minimum support degree and the minimum confidence degree is called a strong association rule, and the strong association rule comprises an effective strong association rule and an ineffective strong association rule.
If Lift (X- > Y) >1, then rule X- > Y is a valid strong association rule;
if Lift (X- > Y) < =1, then rule X- > Y is an invalid strongly associated rule;
in particular, if Lift (X- > Y) =1, it means that X and Y are independent of each other.
And calculating according to the lifting degree calculation formula to obtain:
Lift(B->E)=100%/75%=1.33;
Lift(E->B)=100%/75%=1.33;
and obtaining effective strong association rules B- > E and E- > B, thus obtaining test case groups (test case B and test case E) which mutually have effective strong association rules, and determining the strong association test case attributes of the test case B and the test case E according to the test case groups (test case B and test case E) with the effective strong association rules.
In some embodiments, the test case calling method further includes the following steps: and updating the strong association test case attributes of the test cases in the test plan in response to the satisfaction of the updating conditions of the strong association test case attributes. The condition that the update of the strongly associated test case attribute is satisfied may include that a preset period is reached or the test case is executed for a preset number of times.
The updating of the strong association test case attributes is the modification and supplement of the effective strong association rules, and the following describes in detail the process of modifying and supplementing the effective strong association rules with a specific example.
After the multiple test case executions are completed, the tests that fail are accumulated, for example, as shown in table 6:
TABLE 6
Number of executions Test case with execution failure
1 A,C,D
2 B,C,E
3 A,B,C,E
4 B,E
5 A,C
6 A,C,D
7 A,C
8 A,D
A frequent item set { A, C } is obtained according to the above method, and the confidence degrees of the individual item sets { A } and { C } are calculated, and the confidence degrees of the individual item sets { A } and { C } are shown in Table 7:
TABLE 7
A C
A 83.3%
C 83.3%
And calculating the promotion degree between the single item sets { A } and { C } according to the confidence degree and the support degree, wherein the promotion degree between the single item sets { A } and { C } is as follows:
Lift(A->C)=83.3%/75%=1.11;
Lift(C->A)=83.3%/75%=1.11;
therefore, effective strong association rules A- > C and C- > A are obtained, namely if the test case A fails to execute, the test case C will fail to execute, and then the test case C is filled in the strong association test case attribute of the test case A.
In some embodiments, each test case in the test plan further includes an execution duration attribute, and the test case calling method further includes the following steps: and in response to the fact that the execution time length of the executing test case is determined to be larger than a preset threshold value according to the execution time length attribute, terminating the execution of the test case. That is to say, if the executing test case is not executed for a long time, the test case is terminated forcibly, so that the efficient execution of the test case is ensured, and the test case feedback time is saved while the test resources are saved.
In some embodiments, the test case scheduling method may further include the following steps: responding to the test case in the test plan for executing the preset third times, calculating the average execution time length according to the execution time length of each time of the test case, and updating the execution time length attribute of the test case according to the average execution time length. After the test case is executed for multiple times, the value of the execution duration attribute of the test case is updated to the average value of the execution durations of the multiple executions of the test case, so that when the test case occupying the test resources for a long time is subsequently forcibly terminated, the judgment on the test case needing to be forcibly terminated is more accurate.
According to the test case scheduling method, the expression fields { resource occupation, execution time length and strongly-associated test cases } are newly added for each case in the test case library, the resource occupation is the resource situation occupied during the execution of the test cases, the execution time length is the time required for executing the test cases, and the strongly-associated test cases refer to the test cases which inevitably or with a higher probability cause execution failure if the test cases are failed to execute. Aiming at the inherent resources in the container environment, after the test plan is synthesized, the resource information needed to be used by the test plan can be calculated, and the environment initialization is automatically carried out according to the resource information. In the test case execution process, environmental resource information is monitored in real time, the execution of the test case is dynamically scheduled, further, the strongly-associated test case can be identified according to the effective strongly-associated rule, when the execution of a certain test case fails, the strongly-associated test case can directly skip the execution, and the execution result is set to fail.
And sequentially executing the test cases in the test plan according to the preset test case serial parallel execution sequence. If the existing resources in the container test environment can meet the requirements of the test case, resources are directly allocated to the test case, and the test case is started to execute, so that the resource allocation efficiency is improved; if the existing resources in the container test environment cannot meet the requirements of the test case, the test case is in a waiting queue to wait for resource allocation. And in the execution process of the test plan, monitoring the resource use in the current container test environment, and if the resource is insufficient, dynamically releasing the resource according to a predefined strategy. When the test case finishes executing and actively releases the resources, the system reinitializes the container test environment or releases the resources to the current allocable resource amount, thus ensuring the dynamic scheduling of the resources. Furthermore, the execution condition of the test cases including the execution time of the test cases, the dependency relationship among the test cases and the like can be recorded in the execution process of the test plan, effective strong association rules in the test cases are analyzed, when a certain test case fails to be executed, the effectively strong associated test case can directly skip execution, and the execution result is set to fail.
The test case scheduling method is a test case elastic scheduling scheme based on a container environment, relates to the fields of computers, software, internet and communication, and particularly relates to automatic elastic application of test resources, automatic serial-parallel and prospective scheduling of test cases in a high-capacity test scene in the field of communication.
The embodiment of the disclosure is suitable for an automatic test case scheduling scene in a container environment. For example, a scenario of containerization test environments in an IaaS (Infrastructure as a Service) type, a PaaS (Platform as a Service) type, and a SaaS (Software as a Service) type is particularly suitable for a large-capacity test scenario in which resources inside an enterprise are limited, and once a test resource is successfully applied, the capacity expansion or modification is inconvenient, but a large number of test cases need to be quickly performed for feedback.
Based on the same technical concept, an embodiment of the present disclosure further provides a test case scheduling apparatus, as shown in fig. 5, where the test case scheduling apparatus includes a test resource management module 101 and a scheduling module 102, and the test resource management module 101 is configured to determine a current amount of resources that can be allocated; determining the resource demand of a test case to be scheduled in a test plan; and determining the resource allocation of the test case to be called according to the comparison result of the current allocable resource amount and the resource demand amount.
The scheduling module 102 is configured to schedule the test case to be scheduled according to a comparison result between the current allocable resource amount and the resource demand amount.
In some embodiments, the test resource management module 101 is configured to determine a resource amount currently occupied by the test plan, where the resource amount currently occupied by the test plan is a sum of resource amounts occupied by each test case being executed in the test plan; and determining the current allocable resource amount according to the total resource amount of the test plan and the current occupied resource amount of the test plan.
In some embodiments, the test resource management module 101 is configured to, in response to that the current allocable resource amount is greater than or equal to the resource demand amount, allocate resources to the test case according to the resource demand amount; and responding to the current allocable resource quantity being less than the resource demand quantity, and waiting for resource allocation.
The scheduling module 102 is configured to schedule the test case to be executed in response to that the amount of the currently allocable resource is greater than or equal to the resource demand amount; and responding to the current allocable resource quantity smaller than the resource demand quantity, and suspending the test case.
In some embodiments, the test resource management module 101 is further configured to release a resource in response to completion of execution of the test case, where the resource is a resource occupied by the test case.
In some embodiments, each test case in the test plan includes a resource occupation attribute, and the test resource management module 101 is configured to determine the resource demand of the test case according to the resource occupation attribute of the test case to be scheduled in the test plan.
In some embodiments, as shown in fig. 6, the test case scheduling apparatus further includes an attribute management module 103, where the attribute management module 103 is configured to, in response to a preset first number of times of execution of the test case, calculate an average resource occupation amount of the test case according to resources released after each execution of the test case; and updating the resource occupation attribute of the test case according to the average resource occupation amount.
In some embodiments, the test resource management module 101 is further configured to, after the attribute management module 103 updates the resource occupation attribute of the test case according to the average resource occupation amount, calculate the current total amount of resources of the test plan according to the resource occupation attributes of all test cases in the test plan; and updating the total resource amount of the test plan according to the current total resource amount of the test plan.
In some embodiments, each test case in the test plan further includes a strongly associated test case attribute, where the strongly associated test case attribute is used to represent a test case having a valid strongly associated rule with a current test case, as shown in fig. 7, the test case scheduling apparatus further includes a monitoring module 104, and the monitoring module 104 is configured to respond to the test case execution failure after the scheduling module 102 schedules the test case for execution, determine that the test case has a strongly associated test case according to the strongly associated test case attribute of the test case, and set an execution result of the strongly associated test case as the execution failure.
In some embodiments, the attribute management module 103 is further configured to establish an item set including a plurality of subsets according to a preset second number of test cases that have failed to be executed and obtained by executing the test plan, where each subset corresponds to one execution of the test plan, and an element of each subset is each test case that has failed to be executed; determining a frequent itemset of the itemset; determining a test case group with an effective strong association rule in the frequent item set, wherein the test case group comprises two test cases which are strong association test cases; and determining the strong association test case attribute of each test case in the test plan according to the test case group with the effective strong association rule.
In some embodiments, the attribute management module 103 is further configured to update the strongly associated test case attributes of the test cases in the test plan in response to the update condition of the strongly associated test case attributes being satisfied.
In some embodiments, each test case in the test plan further includes an execution duration attribute, and the scheduling module 102 is further configured to terminate executing the test case in response to determining that the execution duration of the test case being executed is greater than a preset threshold according to the execution duration attribute.
In some embodiments, the attribute management module 103 is further configured to, in response to a preset third number of times of executing the test case in the test plan, calculate an average execution duration according to the execution duration of each time of the test case; and updating the execution duration attribute of the test case according to the average execution duration.
An embodiment of the present disclosure further provides a computer device, including: one or more processors and storage; when the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the test case scheduling method provided by the foregoing embodiments.
The embodiment of the present disclosure further provides a computer readable medium, on which a computer program is stored, where the computer program, when executed, implements the test case scheduling method provided in the foregoing embodiments.
It will be understood by those of ordinary skill in the art that all or some of the steps of the methods disclosed above, functional modules/units in the apparatus, may be implemented as software, firmware, hardware, and suitable combinations thereof. In a hardware implementation, the division between functional modules/units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by a computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.
Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted in a generic and descriptive sense only and not for purposes of limitation. In some instances, features, characteristics and/or elements described in connection with a particular embodiment may be used alone or in combination with features, characteristics and/or elements described in connection with other embodiments, unless expressly stated otherwise, as would be apparent to one skilled in the art. It will, therefore, be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the invention encompassed by the appended claims.

Claims (15)

1. A method for scheduling test cases is characterized by comprising the following steps:
determining the amount of resources which can be allocated currently;
determining the resource demand of a test case to be scheduled in a test plan;
and determining the resource allocation of the test case to be dispatched according to the comparison result of the current allocable resource amount and the resource demand amount, and dispatching the test case to be dispatched.
2. The method of claim 1, wherein the determining the amount of resources that can currently be allocated comprises:
determining the current occupied resource quantity of the test plan, wherein the current occupied resource quantity of the test plan is the sum of the resource quantities occupied by all the test cases which are being executed in the test plan;
and determining the current allocable resource amount according to the total resource amount of the test plan and the current occupied resource amount of the test plan.
3. The method of claim 2, wherein the determining resource allocation of the test case to be invoked according to the comparison result between the current allocable resource amount and the resource demand amount, and scheduling the test case to be scheduled, comprises:
responding to the fact that the current allocable resource amount is larger than or equal to the resource demand amount, allocating resources for the test case according to the resource demand amount, and scheduling the test case to execute;
and responding to the condition that the current allocable resource amount is less than the resource demand amount, suspending the test case and waiting for resource allocation.
4. The method of claim 3, after scheduling the test case execution, further comprising:
and responding to the completion of the execution of the test case, and releasing resources, wherein the resources are occupied by the test case.
5. The method of claim 4, wherein each test case in the test plan includes a resource occupancy attribute, and the determining the resource demand of the test case to be scheduled in the test plan includes:
and determining the resource demand of the test case according to the resource occupation attribute of the test case to be dispatched in the test plan.
6. The method of claim 5, wherein the method further comprises:
responding to the preset first times of execution of the test case, and calculating the average resource occupation amount of the test case according to the resources released after each execution of the test case;
and updating the resource occupation attribute of the test case according to the average resource occupation amount.
7. The method of claim 6, after updating the resource occupancy attributes of the test cases according to the average resource occupancy, further comprising:
calculating the total amount of the current resources of the test plan according to the resource occupation attributes of all test cases in the test plan;
and updating the total resource amount of the test plan according to the current total resource amount of the test plan.
8. The method of claim 3, wherein each test case in the test plan further includes strongly associated test case attributes, the strongly associated test case attributes being used to represent test cases having a valid strongly associated rule with a current test case, and after scheduling the test cases for execution, the method further comprises:
responding to the execution failure of the test case, determining that the test case has a strong correlation test case according to the strong correlation test case attribute of the test case, and setting the execution result of the strong correlation test case as the execution failure.
9. The method of claim 8, further comprising the step of determining strongly associated test case attributes for each test case in the test plan, the determining strongly associated test case attributes for each test case in the test plan comprising:
establishing an item set comprising a plurality of subsets according to a preset second number of test cases which are obtained by executing the test plan and are failed to be executed, wherein each subset corresponds to one execution of the test plan, and elements of each subset are all the test cases which are failed to be executed;
determining a frequent itemset of the itemset;
determining a test case group with an effective strong association rule in the frequent item set, wherein the test case group comprises two test cases which are strong association test cases with each other;
and determining the strong association test case attribute of each test case in the test plan according to the test case group with the effective strong association rule.
10. The method of claim 9, wherein the method further comprises:
and responding to the satisfaction of the updating condition of the strong correlation test case attribute, and updating the strong correlation test case attribute of each test case in the test plan.
11. The method of claim 1, wherein each test case in the test plan further includes an execution duration attribute, the method further comprising:
and in response to the fact that the execution time length of the executing test case is larger than a preset threshold value according to the execution time length attribute, terminating the execution of the test case.
12. The method of claim 11, wherein the method further comprises:
responding to a preset third time of test case execution in the test plan, and calculating an average execution time according to the execution time of each time of the test case;
and updating the execution duration attribute of the test case according to the average execution duration.
13. A test case scheduling device is characterized by comprising a test resource management module and a scheduling module, wherein the test resource management module is used for determining the amount of resources which can be allocated currently;
determining the resource demand of a test case to be scheduled in a test plan;
determining the resource allocation of the test case to be called according to the comparison result of the current allocable resource amount and the resource demand amount;
and the scheduling module is used for scheduling the test case to be scheduled according to the comparison result of the current allocable resource quantity and the resource demand quantity.
14. A computer device, comprising:
one or more processors;
a storage device having one or more programs stored thereon;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the test case scheduling method of any of claims 1-12.
15. A computer-readable medium, on which a computer program is stored, wherein the program, when executed, implements the test case scheduling method of any of claims 1-12.
CN202110731649.0A 2021-06-30 2021-06-30 Test case scheduling method and device, computer equipment and readable medium Pending CN115543765A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110731649.0A CN115543765A (en) 2021-06-30 2021-06-30 Test case scheduling method and device, computer equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110731649.0A CN115543765A (en) 2021-06-30 2021-06-30 Test case scheduling method and device, computer equipment and readable medium

Publications (1)

Publication Number Publication Date
CN115543765A true CN115543765A (en) 2022-12-30

Family

ID=84716890

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110731649.0A Pending CN115543765A (en) 2021-06-30 2021-06-30 Test case scheduling method and device, computer equipment and readable medium

Country Status (1)

Country Link
CN (1) CN115543765A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116955030A (en) * 2023-06-28 2023-10-27 珠海妙存科技有限公司 Test plan distribution method and system, electronic device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116955030A (en) * 2023-06-28 2023-10-27 珠海妙存科技有限公司 Test plan distribution method and system, electronic device and storage medium
CN116955030B (en) * 2023-06-28 2024-02-23 珠海妙存科技有限公司 Test plan distribution method and system, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US9043787B2 (en) System and method for automated assignment of virtual machines and physical machines to hosts
US9152443B2 (en) System and method for automated assignment of virtual machines and physical machines to hosts with right-sizing
CN110413412B (en) GPU (graphics processing Unit) cluster resource allocation method and device
US8914805B2 (en) Rescheduling workload in a hybrid computing environment
US9047083B2 (en) Reducing power consumption in a server cluster
US20140019964A1 (en) System and method for automated assignment of virtual machines and physical machines to hosts using interval analysis
CN114741207B (en) GPU resource scheduling method and system based on multi-dimensional combination parallelism
CN113377540A (en) Cluster resource scheduling method and device, electronic equipment and storage medium
US9250886B2 (en) Optimizing provisioning workflows in cloud computing
US8539494B2 (en) Method and system for scheduling threads
CN107291546A (en) A kind of resource regulating method and device
CN112114973B (en) Data processing method and device
CN112416585A (en) GPU resource management and intelligent scheduling method for deep learning
US8677375B2 (en) Selecting executing requests to preempt
CN111798113A (en) Resource allocation method, device, storage medium and electronic equipment
CN111190691A (en) Automatic migration method, system, device and storage medium suitable for virtual machine
CN115586961A (en) AI platform computing resource task scheduling method, device and medium
CN113051054A (en) Method, apparatus and computer readable storage medium for scheduling artificial intelligence platform resources
CN115543765A (en) Test case scheduling method and device, computer equipment and readable medium
CN112948109B (en) Quota flexible scheduling method, device and medium for AI computing cluster
CN117519930A (en) Method and device for executing batch tasks and electronic equipment
CN116483546B (en) Distributed training task scheduling method, device, equipment and storage medium
CN117056018A (en) Resource scheduling method, apparatus, device, program product and storage medium
CN113301087A (en) Resource scheduling method, device, computing equipment and medium
CN104794000A (en) Work scheduling method and system

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