Test method and device, electronic equipment and storage medium

By performing multiple weighting and weight updates on the test cases in the software test case library and selecting the test case package for testing, the problem of low software regression testing efficiency and accuracy is solved, and low-cost and high-efficiency software testing is achieved.

CN119718945AActive Publication Date: 2025-03-28WUHAN COMPUTING ECOLOGY TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411867314.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-03-28
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

During the software regression testing phase, using existing test cases is wasted a lot of time and human resources, resulting in low efficiency and accuracy in detecting software defects.

Method used

By weighting the test cases in the test case library multiple times based on the influencing factors of software testing (quality factor, risk factor and version update factor), calculate the adoption weights of each test case, and select test cases proportionally in different weight intervals to form a test case package, and then conduct tests, and update the weights based on the test results.

Benefits of technology

Low-cost and high-efficiency software testing is realized, reducing time and human resource consumption during the testing process, improving testing efficiency, and reducing the localization requirements for software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718945A_ABST
    Figure CN119718945A_ABST
Patent Text Reader

Abstract

The invention provides a testing method and device, electronic equipment and a storage medium, and the method comprises the steps: in a software testing process, calculating the adoption weight of each test case according to multiple times of weighting on the test cases, selecting the test cases according to the adoption weights to form a test case package, and executing the test cases, and updating the weight in the partial weighting operation according to the execution result of each test case in the test case package. According to the method, the test case is selected in the software testing process in the mode of multiple times of weighted selection, the software testing cost is effectively reduced, the testing efficiency is improved, and the requirement for locality of software in the whole testing process is low.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing technology, and in particular to a testing method, device, electronic equipment and storage medium. Background Art

[0002] Regression testing refers to retesting after the software code is updated to verify whether the defects are resolved and whether the resolution of defects causes the emergence of other potential defects. As an integral part of the software life cycle, regression testing accounts for a large proportion of the software testing process. Multiple regression tests are required at each stage of software development.

[0003] Since more test cases are used in the regression testing phase, if the existing test cases are executed without strategy, a lot of time and human resources will be wasted, resulting in low efficiency and low accuracy in detecting software defects. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides a testing method, device, electronic device and storage medium, aiming to provide a low-cost, high-efficiency software testing solution with low requirements on the locality of the software.

[0005] According to a first aspect of the present application, a testing method is provided, comprising:

[0006] The test cases in the test case library are weighted multiple times according to the impact factors of software testing;

[0007] Calculate the adoption weight of each test case in the test case library according to the weights in multiple weightings;

[0008] Select test cases in proportion in different adoption weight intervals to form a test case package;

[0009] Execute each test case in the test case package to test the software;

[0010] The weights in at least part of the weighting operation are updated according to the execution results of each test case in the test case package.

[0011] Optionally, the influencing factor includes at least one of a quality factor, a risk factor, and a version update factor.

[0012] Optionally, the test cases in the test case library are weighted multiple times according to the impact factors of the software test, including:

[0013] Matching a quality weight for each test case in the test case library according to a product quality goal;

[0014] Matching a risk weight for each test case in the test case library according to the historical execution status of the test case;

[0015] An update iteration type of the software version is determined, and a change weight is matched for each test case in the test case library according to the update iteration type of the software version.

[0016] Optionally, the update iteration type of the software version includes at least two of the following: new function release type, old function change type, old function enhancement type, and old function maintenance type;

[0017] The change weight corresponding to the new function release type is greater than the change weight corresponding to the old function change type, the change weight corresponding to the old function change type is greater than the change weight corresponding to the old function enhancement type, and the change weight corresponding to the old function enhancement type is greater than the change weight corresponding to the old function unchanged type.

[0018] Optionally, the adoption weight of each test case is equal to the sum of the quality weight and the change weight of the test case multiplied by the risk weight of the test case.

[0019] Optionally, test cases are selected proportionally in different adoption weight intervals, including:

[0020] Determine multiple adoption weight thresholds based on product quality requirements and testing needs;

[0021] Dividing a plurality of adopted weight intervals according to the plurality of adopted weight thresholds;

[0022] Matching a corresponding adoption ratio for each adoption weight interval;

[0023] According to the preset number of case coverage of the test case package and the adoption ratio, a corresponding number of test cases are randomly selected from a plurality of adoption weight intervals.

[0024] Optionally, updating the weights in at least part of the weighted operations according to the execution results of each test case in the test case package includes:

[0025] Lowering the risk weight corresponding to the successfully executed test case by one level;

[0026] Update the risk weight corresponding to the test case that failed to execute to the highest level,

[0027] Among them, the higher the level of the risk weight, the greater the risk weight.

[0028] According to a second aspect of the present application, a testing device is provided, comprising:

[0029] A weighting unit, which performs multiple weightings on the test cases in the test case library according to the influencing factors of the software test;

[0030] A weight calculation unit is used to calculate the adoption weight of each test case in the test case library according to the weights in multiple weightings;

[0031] A test case selection unit selects test cases in proportion in different adoption weight intervals to form a test case package;

[0032] An execution unit, executing each test case in the test case package to test the software;

[0033] The weight updating unit updates the weights in at least part of the weighting operation according to the execution results of each test case in the test case package.

[0034] According to a third aspect of the present application, an electronic device is provided, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein the program, when executed by the processor, implements the steps of the test method described in any embodiment of the present application.

[0035] According to a fourth aspect of the present application, a storage medium is provided, on which a computer program or instructions are stored. When the computer program or instructions are executed by a processor, the steps of the test method described in any embodiment of the present application are implemented.

[0036] The software testing solution provided in the embodiment of the present application can effectively reduce software testing costs, improve testing efficiency, and the entire testing process has low requirements on the locality of the software.

[0037] It should be noted that the above general description and the following detailed description are merely exemplary and explanatory and do not limit the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram showing an implementation flow of a testing method provided according to an embodiment of the present application is shown;

[0039] Figure 2 A schematic diagram of an implementation process of performing multiple weightings on test cases according to an embodiment of the present application is shown;

[0040] Figure 3 A schematic diagram of an implementation process of selecting test cases in proportion in different adoption weight intervals provided in accordance with an embodiment of the present application is shown;

[0041] Figure 4 A structural block diagram of a testing device provided according to an embodiment of the present application is shown;

[0042] Figure 5A structural block diagram of an electronic device provided according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0043] In order to facilitate the understanding of the present application, the present application will be described more comprehensively below with reference to the relevant drawings. The preferred embodiments of the present application are given in the drawings. However, the present application can be implemented in different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive.

[0044] References to "one embodiment" or "some embodiments" etc. described in this specification mean that a particular feature, structure or characteristic described in conjunction with the embodiment is included in one or more embodiments of the present application. Thus, the phrases "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear at different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0045] In the description of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments. "And / or" herein is a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone. "Multiple" refers to two or more than two. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, the words "first", "second" and the like are used to distinguish between the same items or similar items with substantially the same functions and effects. Those skilled in the art will understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not limit them to be necessarily different.

[0046] In addition, the same figure marks in the figures represent the same or similar structures, and thus their repeated description will be omitted. That is, the various parts in this specification are described in a combination of parallel and progressive manners, and each part focuses on the differences from other parts. The same or similar parts between the various parts can be referenced to each other.

[0047] As software is continuously updated, its functions, application interfaces, and implementation will continue to evolve. Test cases in the test case library may lose their relevance and effectiveness, become obsolete, or even fail to run at all. In order to ensure the effectiveness of test cases in the test case library, the test case library must be maintained. The maintenance of the test case library mainly includes the following aspects: deleting obsolete test cases; improving uncontrolled test cases; deleting redundant test cases; and adding new test cases.

[0048] Regression testing means that in a software project, after the developer has modified the software code to fix the discovered bugs, the tester needs to retest the previously tested content to confirm that the modification has not introduced new errors. As an integral part of the software life cycle, regression testing accounts for a large proportion of the entire software testing process, and multiple regression tests are performed at each stage of software development. In incremental and rapid iterative development, the continuous release of new versions makes regression testing more frequent, and in extreme programming methods, regression testing is required to be performed several times a day. Therefore, it is very meaningful to improve the efficiency and effectiveness of regression testing by choosing the right regression testing strategy.

[0049] Even if the test case library is well maintained, it may become quite large. If the entire test case package is rerun for each regression test, the time required for testing will gradually increase and the test efficiency will decrease. In actual work, the entire test case library is often streamlined by selecting some test cases to generate regression test case packages. The streamlining process can often use safe reduction techniques such as code dependency analysis to determine which test cases can be deleted without destroying the intention of regression testing.

[0050] The regression test case package needs to include not only the testing of existing functions and features, but also the testing of new functions and features. At the same time, if the regression test case package cannot meet the test coverage requirements of different stages, it is still necessary to select new test cases from the previous test case library to supplement it in order to meet the coverage requirements. The test case selection based on code dependency analysis limits the regression test to the changed module and its interface, has high requirements for the localization of code modification, and is not suitable for more software with higher requirements for global quality goals.

[0051] In view of the above problems, the present application embodiment provides a regression test case selection strategy based on risk, quality, and software version update iteration. Figure 1 , Figure 1 The following is a schematic diagram of an implementation flow of a test method according to an embodiment of the present application. The test method specifically includes executing the following steps:

[0052] In step 110, the test cases in the test case library are weighted multiple times according to the impact factors of the software test.

[0053] In this step, the influencing factor of software testing represents the key influencing factor in the software testing process or the software test case extraction process, which can be determined by analyzing the test requirements of software testing.

[0054] In this embodiment, the influencing factors of software testing include, but are not limited to, at least one of: quality factors, risk factors, and version update factors. Among them, the quality factor represents the product quality goal of the software, the risk factor represents the historical execution of the test case, and the version update factor represents the update iteration of the software version to be tested relative to the previous version. Of course, in other embodiments of the present application, other types or combinations of influencing factors can also be selected according to actual testing requirements to perform weighted operations on each test case in the test case library. For example, according to the product quality requirements and test requirements of the specific software, more influencing factors (or weight attributes) are added to weight the test cases, such as test difficulty factors, test input factors, etc.

[0055] Weighting the test cases according to the influencing factors includes matching (or assigning) corresponding weights to the test cases, that is, the weighting operation on the test cases in this embodiment does not involve processing of the internal data of the test cases.

[0056] In some examples, such as Figure 2 As shown, the specific implementation of step 110 includes executing steps 210 to 230, wherein there is no special requirement for the execution order of steps 210 to 230 in the embodiment of the present application, that is, the execution order can be arbitrary.

[0057] In step 210, a quality weight is matched for each test case in the test case library according to the product quality target.

[0058] In some optional examples, the product quality goals of the software include: full commercial use, limited commercial use, and test demonstration or small-scale applicability. According to different product quality goals, different quality weights are matched for each test case in the test case library. For example, when the product quality goal of the software is full commercial use, each test case in the test case library is matched with (or assigned with) α1 as the quality weight; when the product quality goal of the software is limited commercial use, each test case in the test case library is matched with (or assigned with) α2 as the quality weight; when the product quality goal of the software is test demonstration or small-scale applicability, each test case in the test case library is matched with (or assigned with) α3 as the quality weight. Among them, α1>α2>α3.

[0059] In the case where the product quality target does not change, that is, the product quality target of the software product to be tested (also referred to as "software" or "product" in this article) is the same as the product quality target of the previous version of the software, the quality weights matched to each test case will not change. For example, if the product quality target of the software to be tested and the product quality target of the previous version of the software are both fully commercial, the quality weights matched to each test case will remain unchanged at α1.

[0060] In the case where the product quality target changes, that is, the product quality target of the software to be tested changes relative to the product quality target of the previous version of the software, for example, from complete commercial use to limited commercial use, then the quality weights matched to each test case will be matched to (or assigned to) the changed quality weights. For example, if the product quality target of the software to be tested changes relative to the product quality target of the previous version of the software from complete commercial use to limited commercial use, then the quality weights matched to each test case will change from α1 to α2. Other situations can be deduced accordingly.

[0061] In step 220, a risk weight is matched for each test case in the test case library according to the historical execution status of the test case.

[0062] The historical execution status of a test case indicates the execution results of the test case when it was executed in multiple old versions of software tests. The risk level of each test case is divided according to the execution results. For example, a test case that has no execution failure in three consecutive versions is considered to be low risk.

[0063] In some optional examples, the historical execution of the test case includes but is not limited to: being successfully executed in the software tests of N or more consecutive versions, corresponding to low risk; being successfully executed in the software tests of only M consecutive versions, corresponding to relatively low risk; being successfully executed in the software tests of only K consecutive versions, corresponding to relatively high risk; not being successfully executed in the software tests of the previous version, or not being executed, corresponding to high risk. Wherein, K, M, and N are all integers, and N>M>K>0.

[0064] According to different historical execution situations, different risk weights are matched for each test case in the test case library. For example, for test cases that have been successfully executed in N or more consecutive versions of software tests (i.e., test cases corresponding to low risks), β0 is matched (or assigned) as the risk weight; for test cases that have been successfully executed in M ​​consecutive versions of software tests (i.e., test cases corresponding to lower risks), β1 is matched (or assigned) as the risk weight; for test cases that have been successfully executed in K consecutive versions of software tests (i.e., test cases corresponding to higher risks), β2 is matched (or assigned) as the risk weight; for test cases that have not been successfully executed or have not been executed in the previous version of software tests (i.e., test cases corresponding to high risks), β3 is matched (or assigned) as the risk weight. Among them, β0<β1<β2<β3, that is, the higher the risk level of the test case, the greater the risk weight matched (or assigned) to it.

[0065] In this embodiment, the risk weight of each test case needs to be updated according to the execution status of the test case.

[0066] In addition, in some embodiments, for test cases associated with new requirements or test cases newly added to the test case library, their corresponding risk weights may be initialized to β3.

[0067] In some optional examples, N is equal to 3, M is equal to 2, and K is equal to 1. Of course, in other examples of the present application, N, M, and K may also be set to other values.

[0068] In step 230, the update iteration type of the software version is determined, and the change weight is matched for each test case in the test case library according to the update iteration type of the software version.

[0069] For scenarios where software regression testing is required, since such scenarios usually involve the release of new functions or changes to old functions, in some optional examples, the update iteration types of the software version include at least two of the following: new function release type, old function change type, old function enhancement type, and old function unchanged type. Among them, the new function release type means that the current version of the software has released a completely new function compared to the previous version (for example, the previous version of the software has function A, and the software to be tested has functions A and B), and testing the current version of the software includes testing the newly released brand-new function (such as function B); the old function change type means that the current version of the software has changed the old function compared to the previous version (for example, the previous version of the software has function A, and the function of the software to be tested has changed from function A to function B), and testing the current version of the software includes testing the changed function (such as function B); The enhanced type means that the current version of the software has enhanced the old functions compared with the previous version (for example, the previous version of the software has function A1, and the function of the software to be tested has been enhanced from function A1 to function A2), and testing the current version of the software includes testing the enhanced functions (such as function A2); the old function maintenance type means that the current version of the software and the previous version of the software have the same functions (for example, the previous version of the software has function A, and the function of the software to be tested is also function A), and testing the current version of the software includes testing the original functions (such as function A).

[0070] According to different software version update iteration types, different change weights are matched for each test case in the test case library. For example, when the software to be tested corresponds to the new function release type, γ1 is matched (or assigned) as the change weight for each test case in the test case library; when the software to be tested corresponds to the old function change type, γ2 is matched (or assigned) as the change weight for each test case in the test case library; when the software to be tested corresponds to the old function enhancement type, γ3 is matched (or assigned) as the change weight for each test case in the test case library; when the software to be tested corresponds to the old function maintenance type, γ4 is matched (or assigned) as the change weight for each test case in the test case library. Among them, γ1>γ2>γ3>γ4, that is, the change weight corresponding to the new function release type is greater than the change weight corresponding to the old function change type, the change weight corresponding to the old function change type is greater than the change weight corresponding to the old function enhancement type, and the change weight corresponding to the old function enhancement type is greater than the change weight corresponding to the old function maintenance type.

[0071] It should be noted that in other embodiments of the present application, the software to be tested may be divided into more or fewer types and their corresponding change weights may be matched, as long as it conforms to the basic inventive concept of being able to reflect the impact of the degree of functional change in software updates on the weight matching of test cases.

[0072] In step 120, the adoption weight of each test case in the test case library is calculated according to the weights in multiple weightings.

[0073] In this embodiment, the adoption weight (denoted as λ) of each test case is, for example, equal to the sum of the quality weight and the change weight of the test case multiplied by the risk weight of the test case, that is, λ=(α+γ)*β, ​​and the calculation method is simple.

[0074] It can be understood that the adoption weights set in the embodiments of the present application can be regarded as attributes attached to the test cases, which can clearly and accurately characterize the comprehensive influence of various influencing factors on the test cases. Since the calculation of the adoption weights does not involve content analysis of each test case, the use of the adoption weights can facilitate, quickly and readily implement test case selection in the software testing process, which is conducive to reducing time costs, improving testing efficiency, and has low requirements on the locality of the software.

[0075] Of course, in other embodiments of the present application, other calculation formulas may also be used to calculate the adoption weight λ of each test case, as long as the degree of influence of the weighted weights corresponding to each influencing factor on the selection of the test case can be highlighted and comprehensively expressed.

[0076] In step 130, test cases are selected in proportion in different adoption weight intervals to form a test case package.

[0077] In some examples, such as Figure 3 As shown, the specific implementation of step 130 includes executing steps 310 to 340:

[0078] In step 310, multiple adoption weight thresholds are determined based on product quality requirements and test requirements.

[0079] In this step, multiple adopted weight thresholds may be determined by combining quality weights, change weights, and risk weights of different levels according to the aforementioned calculation formula for adopted weights.

[0080] For example, in some embodiments, four adopted weight thresholds may be set according to the following formula:

[0081] First, the weight threshold λ0=(α3+γ4)*β0 is adopted;

[0082] The second weight threshold λ1=(α2+γ4)*β0 is adopted;

[0083] Third, the weight threshold λ2=(α3+γ4)*β3 is adopted;

[0084] Fourth, the weight threshold λ3=(α1+γ1)*β3 is adopted.

[0085] Of course, the above four methods of setting the adopted weight thresholds are merely exemplary. In other embodiments of the present application, other combinations may be used to determine more or different adopted weight thresholds.

[0086] In step 320, a plurality of adopted weight intervals are divided according to a plurality of adopted weight thresholds.

[0087] After multiple adopted weight thresholds are determined by executing step 310, the multiple adopted weight thresholds are arranged from small to large or from large to small, so as to divide multiple adopted weight intervals by using two adjacent adopted weight thresholds as boundary values ​​of the adopted weight intervals.

[0088] For example, taking the determination of four adopted weight thresholds λ0, λ1, λ2 and λ3 as an example, the adopted weight intervals divided in this step include:

[0089] First, the weight interval δ0 is used, corresponding to [λ0,λ1];

[0090] The second one adopts the weight interval δ1, corresponding to [λ1,λ2];

[0091] Third, the weight interval δ2 is adopted, corresponding to [λ2,λ3].

[0092] In step 330, a corresponding adoption ratio is matched for each adoption weight interval.

[0093] In this step, the adoption ratio is the corresponding use case selection ratio when selecting test cases in the adoption weight interval.

[0094] For example, the first weight interval δ0 is matched with a% as its adopted ratio, the second weight interval δ1 is matched with b% as its adopted ratio, and the third weight interval δ2 is matched with c% as its adopted ratio. Wherein, a, b, and c are all greater than or equal to 0 and less than or equal to 100, and any two of a, b, and c can be the same or different.

[0095] In step 340, a corresponding number of test cases are randomly selected from a plurality of adoption weight intervals according to the number of case coverage and adoption ratio of the preset test case package.

[0096] Optionally, in some embodiments, assuming that the number of case coverage of the test case package required by the software test is Σ0, the adoption ratio a% matched by the first adoption weight interval δ0 is 20%, the adoption ratio b% matched by the second adoption weight interval δ0 is 80%, and the adoption ratio c% matched by the third adoption weight interval δ0 is 100%, then:

[0097] In the third weight interval δ2, all test cases Σ1 are selected;

[0098] In the second test case Σ2=80%*(Σ0-Σ1) randomly selected from the weight interval δ1;

[0099] In the first adopted weight interval δ0, randomly selected test cases Σ3=20%*(Σ0-Σ1), where Σ1+Σ2+Σ3=Σ0. Then, by combining test case Σ1, test case Σ2, and test case Σ3, a test case package can be formed.

[0100] It can be understood that the selection priority of each test case in the third adopted weight interval δ2 is higher than that of the second adopted weight interval δ1, and the selection priority of each test case in the second adopted weight interval δ1 is higher than that of the first adopted weight interval δ0. When the above-mentioned adoption ratio combination is used for test case selection, the test cases in the higher adopted weight interval can be met first, so that when selecting test cases, the test cases for new function releases with high-quality requirements and high risks can be better covered for regression testing.

[0101] It should be noted that, according to the product quality requirements of the specific software, the settings of each adoption weight threshold and the adoption ratio corresponding to each adoption weight interval can be flexibly changed, as long as the higher the adoption weight interval, the greater the adoption ratio matched.

[0102] It should also be noted that the test case selection strategies disclosed in the above embodiments can be applied not only to the test case selection process of software regression testing, but also to all processes that require test case selection within the software testing cycle.

[0103] In step 140, each test case in the test case package is executed to test the software.

[0104] In this step, each test case in the test case package formed in step 130 is executed respectively to test the software, and the execution result of each test case is recorded. The execution result includes: execution success and execution failure.

[0105] In step 150, at least part of the weights in the weighting operation are updated according to the execution results of each test case in the test case package.

[0106] In some examples, step 150 specifically includes updating the risk weight corresponding to each test case according to the execution result of each test case in the test case package in step 140. For example, the risk weight corresponding to the successfully executed test case is reduced by one level; and the risk weight corresponding to the failed test case is updated to the highest level.

[0107] Assume that the risk level of a test case in the test case package before being executed is lower risk, and its corresponding risk weight is β1. If the test case is successfully executed in step 140, the risk level of the test case will be reduced by one level, such as from lower risk to low risk, and its corresponding risk weight will also be reduced from β1 to β0; if the test case fails to be executed in step 140, the risk level of the test case will be updated to the highest level, such as from lower risk to high risk, and its corresponding risk weight will also be updated from β1 to β3.

[0108] By analogy, assuming that the risk level of a test case in the test case package before being executed is high risk, and its corresponding risk weight is β3, if the test case is successfully executed in step 140, the risk level of the test case is reduced by one level, such as from high risk to higher risk, and its corresponding risk weight will also be reduced from β3 to β2; if the test case fails to be executed in step 140, the risk level of the test case is updated to the highest level, and if it is maintained at high risk, its corresponding risk weight will also remain unchanged at β3;

[0109] Assume that the risk level of a test case in the test case package before being executed is high risk, and its corresponding risk weight is β2. If the test case is successfully executed in step 140, the risk level of the test case is reduced by one level, such as from high risk to low risk, and its corresponding risk weight will also be reduced from β2 to β1; if the test case fails to be executed in step 140, the risk level of the test case is updated to the highest level, such as from high risk to high risk, and its corresponding risk weight will also be updated from β2 to β3;

[0110] Assume that the risk level of a test case in the test case package before being executed is low risk, and its corresponding risk weight is β0. If the test case is successfully executed in step 140, the risk level of the test case will be maintained at the lowest level unchanged. If it is maintained at low risk, its corresponding risk weight will also be maintained at β0 unchanged; if the test case fails to be executed in step 140, the risk level of the test case will be updated to the highest level. If it is updated from low risk to high risk, its corresponding risk weight will also be updated from β0 to β3.

[0111] In summary, the embodiment of the present application adopts multiple weighted selection methods to form a test case package, which can implement weighted operations on each test case without parsing the content of the test case, reducing the complexity of test case screening during the software testing process, simplifying the software testing process, and reducing the time cost required, which is conducive to improving testing efficiency, and the entire testing process has low requirements on the locality of the software.

[0112] Furthermore, the present application also provides a testing device, which can be used to execute the various embodiments of the testing method disclosed above. Figure 4 As shown, the testing device includes: a weighting unit 410 , a weight calculation unit 420 , a test case selection unit 430 , an execution unit 440 and a weight updating unit 450 .

[0113] The weighting unit 410 is used to perform multiple weightings on the test cases in the test case library according to the impact factors of the software test.

[0114] The adoption weight calculation unit 420 is used to calculate the adoption weight of each test case in the test case library according to the weights in multiple weightings.

[0115] The test case selection unit 430 is used to select test cases in proportion in different adoption weight intervals to form a test case package.

[0116] The execution unit 440 is used to execute each test case in the test case package formed by the test case selection unit 430 to test the software.

[0117] The weight updating unit 450 is used to update the weights in at least part of the weighting operations according to the execution results of each test case in the test case package by the executing unit 440.

[0118] In some examples, the influencing factors of software testing include at least one of a quality factor, a risk factor, and a version update factor. The multiple weighting operations performed by the weighting unit 410 include: quality weighting (i.e., matching a quality weight for each test case in the test case library according to the product quality target), risk weighting (i.e., matching a risk weight for each test case in the test case library according to the historical execution of the test case), and update change weighting (i.e., matching a change weight for each test case in the test case library according to the update iteration type of the software version).

[0119] Furthermore, the weight updating unit 150 is, for example, configured to update the risk weight in the risk weighting operation according to the execution result of each test case in the test case package by the execution unit 440 .

[0120] In specific implementation, each module / unit in the test device can be implemented as an independent entity, or can be arbitrarily combined and implemented as the same or several entities. At the same time, the specific implementation of each module / unit in the test device described above and the technical effects that can be obtained can be referred to the various embodiments of the aforementioned test method, which will not be repeated here.

[0121] The embodiment of the present invention further provides an electronic device, such as Figure 5 As shown, it includes a memory 510, a processor 520, and a program stored in the memory 510 and executable on the processor 520. When the program is executed by the processor 520, each process of each embodiment of the above-mentioned test method can be implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0122] It will be appreciated by those skilled in the art that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling related hardware through instructions, and the instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. To this end, an embodiment of the present invention further provides a storage medium on which a computer program or instruction is stored, and when the computer program or instruction is executed by a processor, each process of each embodiment of the above test method can be implemented. Among them, the storage medium, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.

[0123] Since the instructions stored in the storage medium can execute the steps in the test method provided in the embodiment of the present invention, the beneficial effects that can be achieved by the test method provided in the embodiment of the present invention can be achieved. For details, please refer to the previous embodiment, which will not be repeated here. The specific implementation of the above operations can be referred to the previous embodiment, which will not be repeated here.

[0124] Finally, it should be noted that: Obviously, the above embodiments are only examples for clearly explaining the present application, and are not intended to limit the implementation methods. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived from this are still within the scope of protection of the present application.

Claims

1. A testing method comprising: The test cases in the test case library are weighted multiple times according to the impact factors of software testing; Calculate the adoption weight of each test case in the test case library according to the weights in multiple weightings; Select test cases in proportion in different adoption weight intervals to form a test case package; Execute each test case in the test case package to test the software; The weights in at least part of the weighting operation are updated according to the execution results of each test case in the test case package.

2. The testing method according to claim 1, wherein: The influencing factors include: at least one of a quality factor, a risk factor, and a version update factor.

3. The testing method according to claim 2, wherein: The test cases in the test case library are weighted multiple times according to the impact factors of software testing, including: Matching a quality weight for each test case in the test case library according to a product quality goal; Matching a risk weight for each test case in the test case library according to the historical execution status of the test case; An update iteration type of the software version is determined, and a change weight is matched for each test case in the test case library according to the update iteration type of the software version.

4. The testing method according to claim 3, wherein: The update iteration types of the software version include at least two of the following: new function release type, old function change type, old function enhancement type, and old function maintenance type; The change weight corresponding to the new function release type is greater than the change weight corresponding to the old function change type, the change weight corresponding to the old function change type is greater than the change weight corresponding to the old function enhancement type, and the change weight corresponding to the old function enhancement type is greater than the change weight corresponding to the old function unchanged type.

5. The testing method according to claim 3, wherein: The adoption weight of each test case is equal to the sum of the quality weight and the change weight of the test case multiplied by the risk weight of the test case.

6. The testing method according to claim 1, wherein: Test cases are selected proportionally in different adoption weight intervals, including: Determine multiple adoption weight thresholds based on product quality requirements and testing needs; Dividing a plurality of adopted weight intervals according to the plurality of adopted weight thresholds; Matching a corresponding adoption ratio for each adoption weight interval; According to the preset number of case coverage of the test case package and the adoption ratio, a corresponding number of test cases are randomly selected from a plurality of adoption weight intervals.

7. The testing method according to claim 3, wherein: Updating at least part of the weighted operation weights according to the execution results of each test case in the test case package includes: Lowering the risk weight corresponding to the successfully executed test case by one level; Update the risk weight corresponding to the test case that failed to execute to the highest level, Among them, the higher the level of the risk weight, the greater the risk weight.

8. A testing device comprising: A weighting unit, which performs multiple weightings on the test cases in the test case library according to the influencing factors of the software test; A weight calculation unit is used to calculate the adoption weight of each test case in the test case library according to the weights in multiple weightings; A test case selection unit selects test cases in proportion from different adoption weight intervals to form a test case package; An execution unit, executing each test case in the test case package to test the software; The weight updating unit updates the weights in at least part of the weighting operation according to the execution results of each test case in the test case package.

9. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein the program implements the steps of the method according to any one of claims 1 to 7 when executed by the processor.

10. A storage medium, characterized in that: The storage medium stores a computer program or instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Defect-based regression test case processing method and device, and computing equipment

    CN110941545A

  • Test case selection method and device

    CN118606218A

  • Software testing method and device, computer equipment and readable storage medium

    CN118779234A