Test method, device, electronic device, and storage medium
By repeatedly weighting and updating the test case library, and selecting appropriate test case packages for software testing, the problem of low efficiency in regression testing is solved, achieving low-cost and high-efficiency testing results.
Patent Information
- Application Number
- CN202411867314.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2044-12-17
AI Technical Summary
In the regression testing phase, existing technologies suffer from low efficiency and accuracy when using test cases, especially after software code updates, which require a large amount of unstrategized execution, resulting in a waste of time and human resources.
The test case library is weighted multiple times based on the impact factors of software testing to calculate the adoption weight of the test cases. Test cases are then selected proportionally within different weight ranges to form a test case package. These test cases are executed to test the software, and the weights are updated based on the test results.
It effectively reduces software testing costs, improves testing efficiency, and has lower requirements for software locality, thus simplifying the testing process.
Smart Images

Figure CN119718945B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software testing technology, specifically to a testing method, apparatus, electronic device, and storage medium. Background Technology
[0002] Regression testing refers to retesting software after code updates to verify whether defects have been resolved and whether the resolution has introduced other potential defects. As an integral part of the software lifecycle, regression testing constitutes a significant portion of the software testing process, and multiple regression tests are required at each stage of software development.
[0003] Since a large number of test cases are used in the regression testing phase, executing existing test cases without a strategy will waste a lot of time and human resources, resulting in low efficiency and low accuracy in detecting software defects. Summary of the Invention
[0004] To address the aforementioned technical problems, this application provides a testing method, apparatus, electronic device, and storage medium, aiming to provide a low-cost, high-efficiency software testing solution with low requirements for software locality.
[0005] According to a first aspect of this application, a testing method is provided, comprising:
[0006] The test cases in the test case library are weighted multiple times based on the impact factors of software testing.
[0007] The adoption weight of each test case in the test case library is calculated based on the weights in the multiple weightings.
[0008] Test cases are selected proportionally from different weighting ranges 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 some of the weighted operations are updated based on the execution results of each test case in the test case package.
[0011] Optionally, the influencing factors include at least one of the following: quality factor, risk factor, and version update factor.
[0012] Optionally, the test cases in the test case library are weighted multiple times based on the impact factors of software testing, including:
[0013] Match quality weights to each test case in the test case library according to the product quality objectives;
[0014] According to historical execution of the test cases, risk weights are matched for each test case in the test case library;
[0015] According to an update iteration type of the software version, change weights are matched for each test case in the test case library.
[0016] Optionally, the update iteration type of the software version includes at least two of the following: a new function release type, an old function change type, an old function enhancement type, and an 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 maintenance 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, the test cases are selected in different adoption weight intervals in proportion, including:
[0020] According to quality requirements and test requirements of the product, a plurality of adoption weight thresholds are determined.
[0021] According to the plurality of adoption weight thresholds, a plurality of adoption weight intervals are divided.
[0022] For each of the adoption weight intervals, a corresponding adoption proportion is matched.
[0023] According to a preset number of test cases in the test case package and the adoption proportion, a random corresponding number of test cases are selected in the plurality of adoption weight intervals.
[0024] Optionally, according to the execution results of each test case in the test case package, the weights in at least part of the weighting operations are updated, including:
[0025] The risk weight corresponding to the test case that is executed successfully is reduced by one level.
[0026] The risk weight corresponding to the test case that is executed unsuccessfully is updated to the highest level.
[0027] The higher the level of the risk weight is, the greater the risk weight is.
[0028] According to the second aspect of the present application, a test device is provided, including:
[0029] a weighting unit, which weights the test cases in the test case library multiple times according to the influence factors of the software test;
[0030] a weight calculation unit, which calculates the adoption weights of the test cases in the test case library according to the weights in the multiple weightings;
[0031] a test case selection unit, which selects the test cases in different adoption weight intervals in proportion to form a test case package;
[0032] an execution unit, which executes the test cases in the test case package to test the software;
[0033] a weight updating unit, which updates the weights in at least part of the weighting operations according to the execution results of the test cases in the test case package.
[0034] According to a third aspect of the present application, an electronic device is provided, which comprises a processor, a memory, and a program stored in the memory and executable on the processor, and when the program is executed by the processor, the steps of the test method according to any of the embodiments of the present application are implemented.
[0035] According to a fourth aspect of the present application, a storage medium is provided, which stores a computer program or instructions, and when the computer program or instructions are executed by a processor, the steps of the test method according to any of the embodiments of the present application are implemented.
[0036] The software test scheme provided by the embodiments of the present application can effectively reduce the software test cost and improve the test efficiency, and the entire test process has a lower requirement for the locality of the software.
[0037] It should be noted that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present application. BRIEF DESCRIPTION OF DRAWINGS
[0038] Figure 1 an implementation flowchart of the test method provided by the embodiments of the present application is shown;
[0039] Figure 2 an implementation flowchart of the multiple weightings of the test cases provided by the embodiments of the present application is shown;
[0040] Figure 3 an implementation flowchart of the selection of the test cases in different adoption weight intervals in proportion provided by the embodiments of the present application is shown;
[0041] Figure 4 a structural block diagram of the test device provided by the embodiments of the present application is shown;
[0042] Figure 5A structural block diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0043] In order to facilitate the understanding of the present application, a more complete understanding of the present application can be had by reference to the following description and the accompanying drawings, in which preferred embodiments of the present application are illustrated. The present application can, however, be embodied in many 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 application to those skilled in the art.
[0044] In this specification, the reference to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places in the specification are not necessarily all referring to the same embodiment, although it can. Furthermore, the terms "comprises," "comprising," "includes," "including," "has," "having" and the like are intended to be open-ended terms that specify the presence of the stated elements or features, but do not preclude the presence or addition of one or more other elements or features.
[0045] In the description of the present application, the word "exemplary" or "for example" is used to mean "an example of" or "an example, only. Any implementation described herein as "exemplary" or "for example" is not necessarily to be construed as preferred or advantageous over other implementations. The term "and / or" as used herein refers to three possible relationships: both, separate, or both. The term "multiple" means two or more than two. In addition, in order to clearly describe the technical solutions of the embodiments of the present application, the same items or similar items with substantially the same functions and effects are distinguished by using "first", "second", etc. The skilled in the art can understand that "first", "second", etc. do not limit the quantity and execution order, and "first", "second", etc. do not necessarily mean different.
[0046] In addition, the same reference signs indicate the same or similar structures in the drawings, and thus repeated descriptions will be omitted, that is, each part of the present specification is described in a combination of parallel and progressive manners, and each part mainly describes the differences from other parts. The same or similar parts between each part can be understood by referring to each other.
[0047] With the continuous iteration and update of software, the functions and application interfaces of the software and the implementation of the software will continue to evolve, and the test cases in the test case library can lose pertinence and effectiveness, become obsolete, or even completely unable to run. In order to ensure the effectiveness of the 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 refers to the retesting of previously tested content by a tester after a developer has modified the code of a software project to fix a bug that has been found, in order to confirm that the modification has not introduced new errors. As a component of the software life cycle, regression testing accounts for a large proportion of the work in 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, several regression tests are required to be performed every day. Therefore, it is meaningful to improve the efficiency and effectiveness of regression testing by selecting the correct regression testing strategy.
[0049] Even in the case of a well-maintained test case library, the test case library can become quite large, and if the complete test case package is re-run for each regression test, the time required for testing will gradually increase, and the efficiency of testing will decrease. In actual work, the test case library is often refined by selecting part of the test cases to generate a regression test case package, and the refinement process can often use safe reduction techniques such as code dependency analysis to determine which test cases can be deleted without destroying the intent of the regression test.
[0050] The regression test case package not only needs to include tests of existing functions and features, but also needs to include tests of new functions and features, and for different stages of testing requirements, if the regression test case package cannot meet the testing coverage, new test cases need to be selected from the previous test case library to supplement to meet the coverage requirements. Test case selection relying on code dependency analysis limits regression testing to the changed modules and their interfaces, has a higher requirement for the localization of code modification, and is not suitable for more software with high global quality requirements.
[0051] To solve the above problems, an embodiment of the present application provides a regression test case selection strategy based on risk, quality, and version update iteration of software, which refers to Figure 1 , Figure 1 An embodiment of the present application provides a test method, and a flowchart of an implementation process of the test method is shown, which specifically includes 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 software testing.
[0053] In this step, the influencing factors of software testing refer to the key influencing factors in the software testing process or the software test case extraction process, which can be determined by analyzing the test requirements of the software testing.
[0054] In this embodiment, the influencing factors for software testing include, but are not limited to, at least one of the following: quality factors, risk factors, and version update factors. The quality factor represents the software's product quality objectives, the risk factor represents the historical execution status of test cases, and the version update factor represents the update iteration status of the software version under test relative to the previous version. Of course, in other embodiments of this application, other types or combinations of influencing factors can be selected to weight the test cases in the test case library according to actual testing needs. For example, based on the specific product quality requirements and testing requirements of the software, more influencing factors (or weighting attributes) can be added to weight the test cases, such as test difficulty factors, test input factors, etc.
[0055] Weighting test cases based on influence factors includes matching (or assigning) corresponding weights to test cases. In other words, the weighting operation of test cases in this embodiment does not involve processing 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. In this embodiment of the application, there are no special requirements for the execution order of steps 210 to 230, that is, it can be any execution order.
[0057] In step 210, quality weights are matched to each test case in the test case library according to the product quality objectives.
[0058] In some optional examples, the software's product quality objectives include: full commercial use, limited commercial use, and test demonstration or limited applicability. Based on different product quality objectives, different quality weights are assigned to each test case in the test case library. For example, when the software's product quality objective is full commercial use, α1 is assigned (or assigned) as a quality weight to each test case in the test case library; when the software's product quality objective is limited commercial use, α2 is assigned (or assigned) as a quality weight to each test case in the test case library; and when the software's product quality objective is test demonstration or limited applicability, α3 is assigned (or assigned) as a quality weight to each test case in the test case library. Where α1 > α2 > α3.
[0059] In the case that the product quality target does not change, i.e. the product quality target of the software product to be tested (hereinafter also referred to as "software" or "product" for short) is the same as that of the previous version of the software, the quality weight matched for each test case will not change. For example, if the product quality target of the software to be tested and that of the previous version of the software are both full commercial use, the quality weight matched for each test case will remain unchanged at a1.
[0060] In the case that the product quality target changes, i.e. the product quality target of the software to be tested changes relative to that of the previous version of the software, for example, from full commercial use to limited commercial use, the quality weight matched for each test case will be matched (or assigned) to the changed quality weight. For example, if the product quality target of the software to be tested changes from full commercial use to limited commercial use relative to that of the previous version of the software, the quality weight matched for each test case will change from a1 to a2. Other cases can be similarly deduced.
[0061] In step 220, a risk weight is matched for each test case in the test case library according to the historical execution of the test case.
[0062] The historical execution of the test case represents the execution result of the test case when it is executed in the testing of multiple old versions of the software. According to the execution result, a risk level is divided for each test case. For example, for a test case that has not failed in the testing of three consecutive versions, it 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 testing of N and more consecutive versions of the software, corresponding to low risk; being successfully executed in the testing of M consecutive versions of the software, corresponding to lower risk; being successfully executed in the testing of K consecutive versions of the software, corresponding to higher risk; not being successfully executed in the testing of the previous version of the software, or not being executed at all, corresponding to high risk. Wherein K, M, N are 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 a test case that is successfully executed in continuous N and above versions of software testing (i.e., a test case corresponding to a low risk), β0 is matched (or assigned) as a risk weight; for a test case that is successfully executed in continuous M versions of software testing (i.e., a test case corresponding to a lower risk), β1 is matched (or assigned) as a risk weight; for a test case that is successfully executed in continuous K versions of software testing (i.e., a test case corresponding to a higher risk), β2 is matched (or assigned) as a risk weight; for a test case that is not successfully executed in the last version of software testing or has not been executed (i.e., a test case corresponding to a high risk), β3 is matched (or assigned) as a risk weight. Wherein, β0<β1<β2<β3, that is, the higher the risk level of the test case, the greater the risk weight matched (or assigned) for the test case.
[0065] In the embodiment, the risk weight of each test case needs to be updated according to the execution situation of the test case.
[0066] In addition, in some embodiments, for a test case associated with a new requirement or a test case newly added to the test case library, the corresponding risk weight of the test case can be initialized as β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 can also be set to other numerical values.
[0068] In step 230, the 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.
[0069] For a scenario requiring regression testing of software, since the scenario usually involves release of new functions or change of old functions, in some optional examples, 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. Among them, the new function release type means that the current version of the software releases a brand-new function compared with the last version (for example, the last 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 changes the old function compared with the last version (for example, the last version of the software has function A, and the software to be tested has function B changed from function A), and testing the current version of the software includes testing the changed function (such as function B); the old function enhancement type means that the current version of the software enhances the old function compared with the last version (for example, the last version of the software has function A1, and the software to be tested has function A2 enhanced from function A1), and testing the current version of the software includes testing the enhanced function (such as function A2); and the old function maintenance type means that the current version of the software and the last version of the software have the same function (for example, the last version of the software has function A, and the software to be tested also has function A), and testing the current version of the software includes testing the original function (such as function A).
[0070] According to different update iteration types of software versions, 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; and 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, other more or less types of division of the software to be tested and their corresponding change weight matching can also be performed, as long as the basic inventive concept of being able to reflect the influence of the degree of functional change in software update on the weight matching of test cases is met.
[0072] In step 120, the adoption weight of each test case in the test case library is calculated according to the weight in the multiple weighting.
[0073] In the embodiment, the adoption weight (denoted as λ) 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, i.e. λ = (α + γ) * β, and the calculation method is simple.
[0074] It can be understood that the adoption weight set in the embodiment of the present application can be regarded as an attribute attached to the test case, which can clearly and accurately represent the comprehensive influence of each influence factor on the test case. Since the calculation of the adoption weight does not involve the content analysis of each test case, the adoption weight can be used to conveniently, quickly and accurately realize the selection of test cases in the software testing process, which is beneficial to reduce the time cost and improve the testing efficiency, and has lower requirements for the locality of the software.
[0075] Of course, in other embodiments of the present application, other calculation formulas can also be used to calculate the adoption weight λ of each test case, as long as the influence of the weighted weight corresponding to each influence factor on the selection of test cases can be highlighted and comprehensively represented.
[0076] In step 130, test cases are selected in different adoption weight intervals in proportion to form a test case package.
[0077] In some examples, as shown in FIG. 3, the implementation of step 130 includes performing steps 310-340: Figure 3
[0078] In step 310, a plurality of adoption weight thresholds are determined according to the quality requirements and testing requirements of the product.
[0079] In this step, the plurality of adoption weight thresholds can be determined by matching and combining different levels of quality weight, change weight and risk weight according to the calculation formula of the adoption weight.
[0080] For example, in some embodiments, four adoption weight thresholds can be set according to the following formula:
[0081] The first adoption weight threshold λ0= (α3+ γ4) * β0;
[0082] The second adoption weight threshold λ1= (α2+ γ4) * β0;
[0083] The third adoption weight threshold λ2=(α3+γ4)*β3 is adopted.
[0084] The fourth adoption weight threshold λ3=(α1+γ1)*β3 is adopted.
[0085] Of course, the above four setting modes of the adoption weight threshold are only exemplary, and in other embodiments of the present application, other combination modes can also be used to determine more or different adoption weight thresholds.
[0086] In step 320, a plurality of adoption weight intervals are divided according to the plurality of adoption weight thresholds.
[0087] After the plurality of adoption weight thresholds are determined by performing step 310, the plurality of adoption weight thresholds are arranged in ascending order or descending order, so that the adjacent two adoption weight thresholds are used as the boundary values of the adoption weight interval to divide a plurality of adoption weight intervals.
[0088] For example, taking the four adoption weight thresholds λ0, λ1, λ2 and λ3 as an example, the adoption weight intervals divided in this step include:
[0089] The first adoption weight interval δ0 corresponds to [λ0, λ1];
[0090] The second adoption weight interval δ1 corresponds to [λ1, λ2];
[0091] The third adoption weight interval δ2 corresponds to [λ2, λ3].
[0092] In step 330, a corresponding adoption proportion is matched for each adoption weight interval.
[0093] In this step, the adoption proportion is the test case selection proportion corresponding to the selection of test cases in the adoption weight interval.
[0094] For example, a% is matched as the adoption proportion of the first adoption weight interval δ0, b% is matched as the adoption proportion of the second adoption weight interval δ1, and c% is matched as the adoption proportion of the third adoption weight interval δ2. Wherein a, b, c are greater than or equal to 0 and less than or equal to 100, and any two of a, b, c can be the same or different.
[0095] In step 340, according to the preset number of test case coverage and the adoption proportion, a random corresponding number of test cases are selected from the plurality of adoption weight intervals.
[0096] Optionally, in some embodiments, assuming that the number of use case coverage of the test case package required by the software test requirement is Σ0, the adoption ratio a% of the first adoption weight interval δ0 matched is 20%, the adoption ratio b% of the second adoption weight interval δ0 matched is 80%, and the adoption ratio c% of the third adoption weight interval δ0 matched is 100%, then:
[0097] In the third adoption weight interval δ2, all the test cases Σ1 are selected;
[0098] In the second adoption weight interval δ1, the test cases Σ2 randomly selected are 80%*(Σ0-Σ1);
[0099] In the first adoption weight interval δ0, the test cases Σ3 randomly selected are 20%*(Σ0-Σ1), wherein Σ1+Σ2+Σ3=Σ0. Further, by combining the test cases Σ1, the test cases Σ2, and the test cases Σ3, the test case package can be formed.
[0100] It can be understood that the selection priority of each test case in the third adoption weight interval δ2 is higher than that in the second adoption weight interval δ1, and the selection priority of each test case in the second adoption weight interval δ1 is higher than that in the first adoption weight interval δ0. When the test cases are selected by using the above adoption ratio combination, the test cases in the higher adoption weight interval can be preferentially met, so that the test cases of the new function release with high quality requirements and high risks can be better covered for regression testing when the test cases are selected.
[0101] It should be noted that, according to the product quality requirements of the specific software, the settings of the adoption weight thresholds and the adoption ratios corresponding to the adoption weight intervals can be flexibly changed, as long as the adoption ratio matched is greater when the adoption weight interval is higher.
[0102] It should be further noted that the test case selection strategies disclosed in the above embodiments can not only be applied to the test case selection process of the software regression test, but also be applicable to all processes requiring test case selection within the software test 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 to test the software, and the execution results of each test case are recorded. The execution results include: execution success and execution failure.
[0105] In step 150, the weight in at least part of the weighted operations is updated according to the execution results of each test case in the test case package.
[0106] In some examples, step 150 specifically comprises updating the risk weight corresponding to each test case in the test case package according to the execution result of each test case in step 140. For example, the risk weight corresponding to a test case that is successfully executed is reduced by one level; the risk weight corresponding to a test case that is unsuccessfully executed is updated to the highest level.
[0107] Suppose a test case in the test case package has a risk level of low risk before being executed, and the risk weight corresponding thereto is β1. 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 low risk to low risk, and the risk weight corresponding thereto is also reduced from β1 to β0. If the test case is unsuccessfully executed in step 140, the risk level of the test case is updated to the highest level, such as from low risk to high risk, and the risk weight corresponding thereto is also updated from β1 to β3.
[0108] By analogy, suppose a test case in the test case package has a risk level of high risk before being executed, and the risk weight corresponding thereto 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 high risk, and the risk weight corresponding thereto is also reduced from β3 to β2. If the test case is unsuccessfully executed in step 140, the risk level of the test case is updated to the highest level, such as remaining at high risk, and the risk weight corresponding thereto remains unchanged at β3.
[0109] Suppose a test case in the test case package has a risk level of high risk before being executed, and the risk weight corresponding thereto 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 high risk, and the risk weight corresponding thereto is also reduced from β3 to β2. If the test case is unsuccessfully executed in step 140, the risk level of the test case is updated to the highest level, such as remaining at high risk, and the risk weight corresponding thereto remains unchanged at β3.
[0110] Suppose a test case in the test case package has a risk level of high risk before being executed, and the risk weight corresponding thereto 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 high risk, and the risk weight corresponding thereto is also reduced from β3 to β2. If the test case is unsuccessfully executed in step 140, the risk level of the test case is updated to the highest level, such as remaining at high risk, and the risk weight corresponding thereto remains unchanged at β3.
[0111] In conclusion, the embodiments of the present application adopt the mode of multiple weighting selection to form the test case package, which can realize the weighting operation on each test case without analyzing the content of the test case, reduces the complexity of the selection of the test case in the software testing process, simplifies the software testing process, makes the time cost lower, is beneficial to improve the testing efficiency, and the entire testing process has lower locality requirement for the software.
[0112] Further, the embodiments of the present application also provide a testing device which can be used to execute the embodiments of the testing method as disclosed above. In particular implementation, as shown in the figure, Figure 4 the testing device comprises a weighting unit 410, an adoption 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 configured to perform multiple weighting on the test cases in the test case library according to the influence factor of the software testing.
[0114] The adoption weight calculation unit 420 is configured to calculate the adoption weight of each test case in the test case library according to the weight in the multiple weighting.
[0115] The test case selection unit 430 is configured to select the test cases in different adoption weight intervals in proportion to form the test case package.
[0116] The execution unit 440 is configured 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 configured to update the weight in at least part of the weighting operation according to the execution result of each test case in the test case package by the execution unit 440.
[0118] In some examples, the influence factor of the software testing comprises at least one of a quality factor, a risk factor and a version update factor. The multiple weighting operation performed by the weighting unit 410 comprises quality weighting (i.e. matching the quality weight of each test case in the test case library according to the product quality target), risk weighting (i.e. matching the risk weight of each test case in the test case library according to the historical execution of the test case) and update change weighting (i.e. matching the change weight of each test case in the test case library according to the update iteration type of the software version).
[0119] Further, the weight updating unit 150 is 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 be combined as the same or several entities. Meanwhile, the specific implementation of each module / unit in the test device and the technical effects achieved thereby can be referred to the above-mentioned embodiments of the test method, which will not be repeated here.
[0121] The embodiment of the present application also provides an electronic device, which comprises a memory 510, a processor 520 and a program stored in the memory 510 and capable of running on the processor 520, wherein the program is executed by the processor 520 to implement each process of each embodiment of the above-mentioned test method and achieve the same technical effects. To avoid repetition, the above will not be repeated here. Figure 5
[0122] Those skilled in the art can understand that all or part of the steps of the various methods in the above-mentioned embodiments can be completed by instructions or by relevant hardware controlled by the instructions, and the instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, the embodiment of the present application also provides a storage medium, which stores a computer program or instructions, and the computer program or instructions are executed by the processor to implement each process of each embodiment of the above-mentioned test method. The storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk and various media capable of storing program codes.
[0123] Since the instructions stored in the storage medium can execute the steps in the test method provided by the embodiment of the present application, the beneficial effects achieved by the test method provided by the embodiment of the present application can be achieved, which will be described in detail in the above-mentioned embodiments and will not be repeated here. The specific implementation of each operation can be referred to the above-mentioned embodiments and will not be repeated here.
[0124] Finally, it should be noted that: obviously, the above-mentioned embodiments are only examples for clearly illustrating the present application, and are not limitations on the embodiments. For those skilled in the art, other different forms of changes or modifications can be made on the basis of the above-mentioned description. Here, all the embodiments need not and cannot be exhausted. The obvious changes or modifications derived therefrom are still within the protection scope of the present application.
Claims
1. A test method, comprising: weighting test cases in a test case library multiple times according to influence factors of software testing, the influence factors comprising at least one of a quality factor, a risk factor, and a version update factor; calculating an adoption weight of each test case in the test case library according to the weights in the multiple times of weighting; selecting test cases in different adoption weight intervals in proportion to form a test case package; executing each test case in the test case package to test the software; updating the weights in at least part of the weighting operations according to execution results of each test case in the test case package; wherein the weighting test cases in the test case library multiple times according to influence factors of software testing comprises: matching a quality weight for each test case in the test case library according to a product quality target; matching a risk weight for each test case in the test case library according to a historical execution situation of the test case; determining an update iteration type of a software version, and matching a change weight for each test case in the test case library according to the update iteration type of the software version, the adoption weight of each test case being equal to a sum of the quality weight and the change weight of the test case, multiplied by the risk weight of the test case.
2. The test method of claim 1, wherein, the update iteration type of the software version comprising at least two of a new function release type, an old function change type, an old function enhancement type, and an old function maintenance type; the change weight corresponding to the new function release type being greater than the change weight corresponding to the old function change type, the change weight corresponding to the old function change type being greater than the change weight corresponding to the old function enhancement type, and the change weight corresponding to the old function enhancement type being greater than the change weight corresponding to the old function maintenance type.
3. The test method of claim 1, wherein, the selecting test cases in different adoption weight intervals in proportion comprises: determining a plurality of adoption weight thresholds according to quality requirements and test requirements of a product; dividing a plurality of adoption weight intervals according to the plurality of adoption weight thresholds; matching a corresponding adoption proportion for each of the adoption weight intervals; selecting a random corresponding number of test cases in the plurality of adoption weight intervals according to a preset number of test cases in the test case package and the adoption proportion.
4. The test method of claim 1, wherein, the updating the weights in at least part of the weighting operations according to execution results of each test case in the test case package comprises: decreasing the risk weight corresponding to a test case that is executed successfully by one level; updating the risk weight corresponding to a test case that is executed unsuccessfully to a highest level, wherein the higher the level of the risk weight, the greater the risk weight.
5. A test device for implementing the test method of any one of claims 1 to 4, the test device comprising: a weighting unit for weighting test cases in a test case library multiple times according to influence factors of software testing; an adoption weight calculation unit for calculating an adoption weight of each test case in the test case library according to the weights in the multiple times of weighting; a test case selection unit for selecting test cases in different adoption weight intervals in proportion to form a test case package; an execution unit configured to execute each test case in the test case package to test the software; a weight updating unit configured to update the weight in the at least partially weighted operation according to an execution result of each test case in the test case package.
6. An electronic device, comprising: comprising: a processor, a memory, and a program stored on the memory and executable on the processor, the program, when executed by the processor, implementing the steps of the method of any one of claims 1 to 4.
7. A storage medium, characterized by a storage medium having stored thereon a computer program or instructions, the computer program or instructions, when executed by a processor, implementing the steps of the method of any one of claims 1 to 4.
Citation Information
Patent Citations
Test case selection method and device
CN118606218A
Software testing method and device, computer equipment and readable storage medium
CN118779234A