Dynamic adaptive test case management methods, electronic devices and media
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-28
- Publication Date
- 2026-08-14
AI Technical Summary
[0039]其有益效果在于:将时间分为两个阶段:学习阶段和运行阶段,对应不同的算法,根据测试用例执行的实际情况,动态调整测试用例的执行策略,优先执行高成功率的用例,及早释放测试资源,优化测试过程,提高测试的成功率。解决了在优化过程中数据累计不足的问题,避免了一般算法中,忽视了历史数据不全造成的计算偏差问题。
Smart Images

Figure CN115437919B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computers, and more specifically, to a dynamic adaptive test case management method, electronic device, and medium. Background Technology
[0002] State Grid Corporation of China is actively promoting the construction of smart grids and practicing the concept of "metering first." With the continuous advancement and improvement of smart energy meters and electricity consumption information collection systems, the construction goals of "full coverage, full data collection, and full cost control" have been achieved. In order to further optimize and expand the application of the new generation of metering instruments and serve the marketing metering and data collection business and smart distribution area management business, State Grid has successively launched new integrated terminals, energy controllers, and 2022 version terminals, among other smart terminals.
[0003] Before being connected to the network, smart terminals need to undergo a series of tests. The main testing equipment consists of various testing platforms. The general procedure is as follows: the user develops a test plan suitable for the terminal, which includes a certain number of test cases.
[0004] The current testing method mainly involves manually creating test plans, specifying attributes such as test cases, test case execution order, number of test case executions, and execution time within the plan.
[0005] However, given the rapid pace of product updates and replacements, users increasingly expect testing devices to offer more intelligent testing functions, enabling them to analyze and optimize testing plans and improve testing efficiency.
[0006] Therefore, it is necessary to develop a dynamic adaptive test case management method, electronic device, and medium.
[0007] The information disclosed in the background section of this invention is intended only to enhance the understanding of the general background of this invention, and should not be construed as an admission or in any way implying that such information constitutes prior art known to those skilled in the art. Summary of the Invention
[0008] This invention proposes a dynamic adaptive test case management method, electronic device, and medium, which can improve the execution strategy of test cases based on the success rate of test case execution, prioritize the confirmation of high-level test cases, so as to release test resources as early as possible and improve test efficiency.
[0009] In a first aspect, embodiments of this disclosure provide a dynamic adaptive test case management method, including:
[0010] Set the number of learning rounds and the number of loss calculation rounds;
[0011] Determine the initial list of test cases U listAssign initial execution weights to each test case and determine the calculation parameters;
[0012] If the number of learning rounds is not reached, then the time loss function is calculated after the number of loss calculation rounds is reached.
[0013] Update the execution weights and calculation parameters of the test cases in the learning rounds, and sort U in descending order of weight. list Reorder the operations to obtain a new execution list;
[0014] Repeat the above steps until the required number of learning rounds is reached, and then run the rounds.
[0015] Update the execution weights and calculation parameters in the running rounds, and reorder the test case list according to the weights from largest to smallest to obtain a new execution list.
[0016] Preferably, the calculation parameters include a weighted value W for successful execution. suc The weighted value W for execution failure fail Execution duration weight W exe Expected execution time .
[0017] Preferably, if the number of learning rounds is not reached, the execution time t and the number of successful executions k for each test case in each learning round are recorded; if the execution fails, only the number of failures x is recorded.
[0018] The time loss function is calculated after the number of loss calculation rounds is reached.
[0019] Preferably, if t> Then the time loss function is a negative loss:
[0020] SD1= (1)
[0021] If t < Then the time loss function is a positive loss:
[0022] SD2= (2)
[0023] Where p is t> The number of , q is t < The number of.
[0024] Preferably, the execution weights of the test cases in the learning rounds are updated using formula (3):
[0025] W'= +W exe (SD2-SD1)- (3)
[0026] Where W' is the updated execution weight in the learning round, W is the execution weight of the current test case, SD1 is the negative loss, and SD2 is the positive loss.
[0027] Preferably, if the execution round is successful, the execution weight of the test case in the execution round is updated using formula (4):
[0028] W''=W+W suc +W exe (T- (4)
[0029] If the execution of the aforementioned run round fails, the execution weight of the test case in the aforementioned run round is updated using formula (5):
[0030] W''=WW fail (5)
[0031] Where W'' is the updated execution weight in the running round, and W is the execution weight of the current test case.
[0032] Preferably, if the updated execution weight is greater than 100%, the updated execution weight is assigned a value of 100%; if the updated execution weight is less than 0%, the updated execution weight is assigned a value of 0%.
[0033] Preferably, the number of learning rounds is set to 40, and the number of loss calculation rounds is set to 5.
[0034] As one specific implementation of this disclosure,
[0035] Secondly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:
[0036] Memory, which stores executable instructions;
[0037] A processor that executes the executable instructions in the memory to implement the dynamic adaptive test case management method.
[0038] Thirdly, embodiments of this disclosure also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the described dynamic adaptive test case management method.
[0039] Its beneficial effects are as follows: It divides time into two phases: a learning phase and an execution phase, corresponding to different algorithms. Based on the actual execution of test cases, it dynamically adjusts the execution strategy, prioritizing high-success-rate test cases, releasing test resources early, optimizing the testing process, and improving the success rate. It solves the problem of insufficient data accumulation during optimization and avoids the calculation bias caused by incomplete historical data, a problem common in general algorithms.
[0040] The methods and apparatus of the present invention have other features and advantages that will be apparent from or will be set forth in detail in the accompanying drawings and following detailed description, which together serve to explain the particular principles of the invention. Attached Figure Description
[0041] The above and other objects, features and advantages of the present invention will become more apparent from the more detailed description of exemplary embodiments of the invention in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same parts.
[0042] Figure 1 A flowchart illustrating the steps of a dynamic adaptive test case management method according to an embodiment of the present invention is shown. Detailed Implementation
[0043] Preferred embodiments of the invention will now be described in more detail. While preferred embodiments of the invention are described below, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein.
[0044] To facilitate understanding of the solutions and effects of the embodiments of the present invention, three specific application examples are given below. Those skilled in the art should understand that these examples are merely for the purpose of understanding the present invention, and any specific details therein are not intended to limit the present invention in any way.
[0045] Example 1
[0046] Figure 1 A flowchart illustrating the steps of a dynamic adaptive test case management method according to an embodiment of the present invention is shown.
[0047] like Figure 1 As shown, the dynamic adaptive test case management method includes: Step 101, setting the number of learning rounds and the number of loss calculation rounds; Step 102, determining the initial test case list U. listStep 103: Assign initial execution weights to each test case and determine calculation parameters; Step 104: If the number of learning rounds has not been reached, calculate the time loss function after reaching the number of loss calculation rounds; Step 105: Update the execution weights and calculation parameters of the test cases in the learning rounds, and adjust U according to the weights from largest to smallest. list Reorder the test cases to obtain a new execution list; Step 105, repeat steps 102-104 until the number of learning rounds is reached, and run the rounds; Step 106, update the execution weights and calculation parameters in the running rounds, and reorder the test case list according to the weights from largest to smallest to obtain a new execution list.
[0048] In one example, the calculated parameters include the weighted value W for successful execution. suc The weighted value W for execution failure fail Execution duration weight W exe Expected execution time .
[0049] In one example, if the number of learning rounds has not been reached, the execution time t and the number of successful executions k for each test case in each learning round are recorded; if the execution fails, only the number of failures x is recorded.
[0050] The time loss function is calculated after the number of loss calculation rounds is reached.
[0051] In one example, if t> Then the time loss function is a negative loss:
[0052] SD1= (1)
[0053] If t < Then the time loss function is a positive loss:
[0054] SD2= (2)
[0055] Where p is t> The number of , q is t < The number of.
[0056] In one example, the execution weights of test cases in the learning rounds are updated using formula (3):
[0057] W'= +W exe (SD2-SD1)- (3)
[0058] Where W' is the updated execution weight in the learning round, W is the execution weight of the current test case, SD1 is the negative loss, and SD2 is the positive loss.
[0059] In one example, if the run round is successful, the execution weights of the test cases in the run round are updated using formula (4):
[0060] W''=W+W suc +W exe (T- (4)
[0061] If a test round fails, the execution weights of the test cases in that round are updated using formula (5):
[0062] W''=WW fail (5)
[0063] Where W'' is the updated execution weight in the running round, and W is the execution weight of the current test case.
[0064] In one example, if the updated execution weight is greater than 100%, the updated execution weight is assigned the value of 100%; if the updated execution weight is less than 0%, the updated execution weight is assigned the value of 0%.
[0065] In one example, the number of learning rounds is set to 40, and the number of loss calculation rounds is set to 5.
[0066] Specifically, the number of learning rounds is set to 40, and the number of loss calculation rounds is set to 5. The initial test case list U is then determined. list = {u1,u2,u3,…u n Assign an initial execution weight W to each test case and determine the calculation parameters, including the weighted value W for successful execution. suc The weighted value W for execution failure fail Execution duration weight W exe Expected execution time .
[0067] If the required number of learning rounds has not been reached, record the execution time t and the number of successful executions k for each test case in each round. If execution fails, only record the number of failures x. After reaching 5 rounds, calculate the time loss function. If t > 0. Then the time loss function is a negative loss, which is formula (1). If t < If the time loss function is positive, then it is formula (2).
[0068] The execution weights of test cases in the learning rounds are updated using formula (3). If the updated execution weight is greater than 100%, it is set to 100%; if the updated execution weight is less than 0%, it is set to 0%. This yields the test case list U. list The corresponding weight list W list = {W1, W2, W3,…W n}, sort U from highest to lowest weight value list Rearrange the list to obtain a new execution list U' list == {u'1,u'2,u'3,…u' n}; Adjust the expected execution value to = - SD2+ SD1, as the expected execution time for the next round.
[0069] It can also calculate the mean square value based on the execution time of multiple rounds of test cases, and adjust the order of test cases to prioritize test cases with high success rates. Factors for modifying weights include the success or failure of test case execution, and the time taken for successful execution. The learning cycle, execution rounds, initial weights, weight additions / subtractions, and execution time weights can all be set and modified.
[0070] Repeat the above steps until the required number of learning rounds are reached, then run the rounds.
[0071] In each execution round, if the execution is successful and the execution time of the test case is T, the execution weight in the execution round is updated using formula (4). If the execution fails, the execution weight in the execution round is updated using formula (5). If the updated execution weight is greater than 100%, the updated execution weight is assigned the value of 100%. If the updated execution weight is less than 0%, the updated execution weight is assigned the value of 0%. The test case list is then reordered according to the weight from largest to smallest to obtain a new execution list.
[0072] Based on the test case execution success rate, the order of test cases is adjusted, prioritizing those with high success rates. Factors considered when modifying weights include the success or failure of test case execution, and the time taken for successful execution. Weighting values, including additions / subtractions and execution time weights, can all be set and modified.
[0073] After each learning cycle, each run executes the test cases according to the previously sorted test case execution list. Each run generates new parameters for adjusting the test case list so that it can be used in the next run, and the test case list is updated once for each run.
[0074] Example 2
[0075] This disclosure provides an electronic device comprising: a memory storing executable instructions; and a processor executing the executable instructions in the memory to implement the aforementioned dynamic adaptive test case management method.
[0076] An electronic device according to an embodiment of the present disclosure includes a memory and a processor.
[0077] This memory is used to store non-transitory computer-readable instructions. Specifically, the memory may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may, for example, include random access memory (RAM) and / or cache memory. The non-volatile memory may, for example, include read-only memory (ROM), hard disk, flash memory, etc.
[0078] The processor may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. In one embodiment of this disclosure, the processor is used to execute computer-readable instructions stored in the memory.
[0079] Those skilled in the art will understand that, in order to solve the technical problem of how to achieve a good user experience, this embodiment may also include well-known structures such as communication buses and interfaces, and these well-known structures should also be included within the protection scope of this disclosure.
[0080] For a detailed description of this embodiment, please refer to the corresponding descriptions in the foregoing embodiments, which will not be repeated here.
[0081] Example 3
[0082] This disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the dynamic adaptive test case management method.
[0083] A computer-readable storage medium according to embodiments of the present disclosure stores non-transitory computer-readable instructions. When these non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the methods described in the foregoing embodiments of the present disclosure are performed.
[0084] The aforementioned computer-readable storage media include, but are not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or portable hard drive), media with built-in rewritable non-volatile memory (e.g., memory card), and media with built-in ROM (e.g., ROM cartridge).
[0085] Those skilled in the art should understand that the above description of the embodiments of the present invention is only intended to illustrate the beneficial effects of the embodiments of the present invention, and is not intended to limit the embodiments of the present invention to any of the examples given.
[0086] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments.
Claims
1. A dynamic adaptive test case management method, characterized in that, include: Step 101: Set the number of learning rounds and the number of loss calculation rounds; Step 102, determine the initial list of test cases U list Assign initial execution weights to each test case and determine the calculation parameters; Step 103: If the number of learning rounds has not been reached, then calculate the time loss function after the number of loss calculation rounds has been reached; Step 104: Update the execution weights and calculation parameters of the test cases in the learning rounds, and sort U according to the weights from largest to smallest. list Reorder the operations to obtain a new execution list; Step 105: Repeat steps 102-104 until the number of learning rounds is reached, and run the rounds. Step 106: Update the execution weights and calculation parameters in the running rounds, and reorder the test case list according to the weights from largest to smallest to obtain a new execution list; The calculation parameters include the weighted value W for successful execution. suc The weighted value W for execution failure fail Execution duration weight W exe Expected execution time ; If the number of learning rounds is not reached, record the execution time t and the number of successful executions k for each test case in each learning round; if the execution fails, only record the number of failures x. The time loss function is calculated after the number of loss calculation rounds is reached. If t> Then the time loss function is a negative loss: SD1= (1) If t < Then the time loss function is a positive loss: SD2= (2) Where p is t> The number of , q is t < The number of; The execution weights of the test cases in the learning rounds are updated using formula (3): W'= +W exe (SD2-SD1)- (3) Where W' is the updated execution weight in the learning round, W is the execution weight of the current test case, SD1 is the negative loss, and SD2 is the positive loss; the adjusted expected execution value is... = - SD2 + SD1, representing the expected execution time for the next round; If the execution round is successful, the execution weight of the test case in the execution round is updated using formula (4): W’’=W+W suc +W exe (T- ) (4) In each execution round, if the execution is successful, the execution time of the test case is T. If the execution of the aforementioned run round fails, the execution weight of the test case in the aforementioned run round is updated using formula (5): W''=WW fail (5) Where W'' is the updated execution weight in the running round, and W is the execution weight of the current test case.
2. The dynamic adaptive test case management method according to claim 1, wherein, If the updated execution weight is greater than 100%, then the updated execution weight is assigned a value of 100%; if the updated execution weight is less than 0%, then the updated execution weight is assigned a value of 0%.
3. The dynamic adaptive test case management method according to claim 1, wherein, The number of learning rounds is set to 40, and the number of loss calculation rounds is set to 5.
4. An electronic device, characterized in that, The electronic device includes: Memory, which stores executable instructions; A processor that executes the executable instructions in the memory to implement the dynamic adaptive test case management method according to any one of claims 1-3.
5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the dynamic adaptive test case management method according to any one of claims 1-3.
Citation Information
Patent Citations
Dynamic proportion test case sorting selection method and system based on machine learning
CN113672506A
Dynamic test case prioritization for relational database systems
US20160328405A1