Test case selection method and device
By calculating the risk scores of multiple risk dimensions to select software test cases, the problem of large scale and low degree of importance in the prior art test cases is solved, and the efficiency and accuracy of software testing is achieved.
Patent Information
- Application Number
- CN202411079651.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-08-07
AI Technical Summary
During the regression testing phase, existing software testing methods have large test cases due to code changes, and cannot effectively distinguish the importance of the test, and cannot give appropriate regression strategies based on risk factors, resulting in inefficient time.
By determining the test case collection associated with the target software, obtain the information and software development information of each candidate test case, and calculate the risks corresponding to multiple risk dimensions (such as use case execution dimension, software development dimension, code change dimension, and historical execution dimension) Scores, select the target test case based on these scores.
It realizes accurate selection of test cases, improves test accuracy and efficiency, ensures that the test cases are more matched with the target software, and can provide appropriate regression strategies under limited time.
Smart Images

Figure CN118606218B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of software testing technology, and more particularly to a test case selection method and device. Background Art
[0002] With the development of computer and Internet technology, the iteration and update of software has become more frequent as user demand increases. In order to provide users with stable services through software, it is necessary to test before release. In the prior art, test cases are recommended according to demand in the regression test phase of software testing; the usual practice is to recommend test cases based on software code and configuration changes. After obtaining the corresponding code DIFF, the use case and the code are associated and mapped by means of precise testing, so as to recommend the corresponding test case. Although this method narrows the scope of regression to a certain extent, when the change code is the underlying code, all test cases will be recommended, resulting in a large scale of use cases and a large regression workload. In addition, the recommended use cases do not have appropriate differentiation, and the importance cannot be known. In the case of limited time, it is impossible to give a suitable regression strategy based on risk factors. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the invention
[0003] In view of this, the embodiments of this specification provide a test case selection method. One or more embodiments of this specification also relate to a test case selection device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0004] According to a first aspect of an embodiment of this specification, a test case selection method is provided, comprising:
[0005] Determine the set of test cases associated with the target software;
[0006] Acquire test case information corresponding to each candidate test case in the test case set, and software development information corresponding to the target software;
[0007] Calculate, according to the test case information and the software development information, the risk scores corresponding to each candidate test case in at least two risk dimensions, wherein the at least two risk dimensions include a test case execution dimension and a software development dimension;
[0008] A target test case is selected from the test case set based on the risk scores of each candidate test case corresponding to the at least two risk dimensions.
[0009] According to a second aspect of an embodiment of this specification, another test case selection method is provided, including:
[0010] Determine the set of test cases associated with the target software;
[0011] Acquire test case information corresponding to each candidate test case in the test case set, and software development information corresponding to the target software;
[0012] Calculate the risk scores of each candidate test case in the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively, based on the test case information and the software development information;
[0013] A target test case is selected from the test case set based on the risk scores of each candidate test case corresponding to the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively.
[0014] According to a third aspect of an embodiment of this specification, a test case selection device is provided, including:
[0015] a determination module configured to determine a set of test cases associated with the target software;
[0016] An acquisition module is configured to acquire test case information corresponding to each candidate test case in the test case set, and software development information corresponding to the target software;
[0017] A calculation module is configured to calculate the risk scores of each candidate test case corresponding to at least two risk dimensions according to the test case information and the software development information, wherein the at least two risk dimensions include a test case execution dimension and a software development dimension;
[0018] The selection module is configured to select a target test case from the test case set based on the risk scores of each candidate test case corresponding to the at least two risk dimensions.
[0019] According to a fourth aspect of the embodiments of this specification, another test case selection device is provided, including:
[0020] A determination set module is configured to determine a test case set associated with the target software;
[0021] An information acquisition module is configured to acquire test case information corresponding to each candidate test case in the test case set, and software development information corresponding to the target software;
[0022] A score calculation module is configured to calculate the risk scores of each candidate test case in the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively, according to the test case information and the software development information;
[0023] The use case selection module is configured to select a target test case from the test case set based on the risk scores of each candidate test case corresponding to the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively.
[0024] According to a fifth aspect of an embodiment of this specification, a computing device is provided, including:
[0025] Memory and processor;
[0026] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned test case selection method are implemented.
[0027] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the above-mentioned test case selection method are implemented.
[0028] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, including a computer program or instructions, which implement the steps of the above-mentioned test case selection method when executed by a processor.
[0029] The test case selection method provided in this embodiment is to select a test case with a higher matching degree for the target software, thereby ensuring the test accuracy; in the stage of selecting the target test case, the test case set associated with the target software can be first determined; at this time, the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software can be first obtained; thus, the risk score corresponding to each candidate test case in at least two risk dimensions can be calculated according to the test case information and the software development information; by combining the multi-dimensional information to complete the risk score calculation of different risk dimensions, the comprehensive performance of the score calculation can be guaranteed. On this basis, the target test case can be selected from the test case set based on the risk score corresponding to each candidate test case in at least two risk dimensions. When selecting the test case, the target test case can be selected in combination with the comprehensive score of multiple dimensions, so that the selection of the case is no longer dependent on the standard of a single dimension, thereby ensuring that the selected test case has a higher matching degree with the target software, so that the test of the target software can be completed accurately and efficiently, and the test accuracy can be guaranteed. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a schematic diagram of a test case selection method provided by an embodiment of this specification;
[0031] Figure 2 is a flow chart of a test case selection method provided by an embodiment of this specification;
[0032] Figure 3 is a process flow chart of a test case selection method provided by an embodiment of this specification;
[0033] Figure 4 is a flowchart of another test case selection method provided by an embodiment of this specification;
[0034] Figure 5 It is a structural schematic diagram of a test case selection device provided by an embodiment of this specification;
[0035] Figure 6 It is a structural schematic diagram of another test case selection device provided by an embodiment of this specification;
[0036] Figure 7 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0037] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0038] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0039] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0040] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0041] In this specification, a test case selection method is provided. This specification also relates to a test case selection device, a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0042] See also Figure 1 As shown in the schematic diagram, the test case selection method provided by this embodiment is to select a test case with a higher matching degree for the target software, thereby ensuring the test accuracy; in the stage of selecting the target test case, the test case set associated with the target software can be first determined; at this time, the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software can be first obtained; thus, the risk score corresponding to each candidate test case in at least two risk dimensions can be calculated according to the test case information and the software development information; by combining the multi-dimensional information to complete the risk score calculation of different risk dimensions, the comprehensive performance of the score calculation can be guaranteed. On this basis, the target test case can be selected from the test case set based on the risk score corresponding to each candidate test case in at least two risk dimensions. When selecting the test case, the target test case can be selected in combination with the comprehensive score of multiple dimensions, so that the selection of the case is no longer dependent on the standard of a single dimension, thereby ensuring that the selected test case has a higher matching degree with the target software, so that the test of the target software can be completed accurately and efficiently, and the test accuracy can be guaranteed.
[0043] See also Figure 2 , Figure 2A flow chart of a test case selection method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0044] Step S202, determining a set of test cases associated with the target software.
[0045] The test case selection method provided in this embodiment can be applied to the testing of any target software, wherein the target software can be payment software, transaction software, shopping software, information query software, etc., and the target software to be tested is the target software after iterative updates; that is, after updating the existing software, it is necessary to select matching test cases for testing, so as to determine whether the updated target software has bugs, so as to achieve the purpose of accurately testing the software.
[0046] Specifically, the test case set specifically refers to a set of candidate test cases that can be selected during the target software testing phase; in practical applications, the test case set can be pre-built by software testers for the target software; it can also be obtained after preliminary screening in the test case set based on the attribute information of the target software; it can also be obtained after multiple test case writers individually write for the target software. This embodiment does not make any limitation here.
[0047] Based on this, in order to select a test case with a higher matching degree for the target software, thereby ensuring the accuracy of the test; in the stage of selecting the target test case, the test case set associated with the target software can be first determined; thereafter, the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software can be obtained; thus, the risk score corresponding to each candidate test case in at least two risk dimensions can be calculated based on the test case information and software development information; by combining multi-dimensional information to complete the risk score calculation of different risk dimensions, the comprehensive performance of the score calculation can be guaranteed. On this basis, the target test case can be selected in the test case set based on the risk score corresponding to each candidate test case in at least two risk dimensions.
[0048] Step S204, obtaining test case information corresponding to each candidate test case in the test case set, and software development information corresponding to the target software.
[0049] Specifically, after determining the test case set associated with the target software as described above, further, in order to be able to screen out test cases with a higher degree of match with the target software in the test case combination, thereby improving the test accuracy of the target software, the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software can be obtained before selection. The test case information and software development information can be combined to score each candidate test case in multiple risk dimensions, so that the scoring results of multiple dimensions can be combined to select the target test case that has a higher degree of match with the target software and can accurately test the target software.
[0050] Among them, test case information specifically refers to the information corresponding to each candidate test case, which records the historical execution information and test rule information of the candidate test case, and is used to describe the performance information in the historical test behavior of the candidate test case, as well as the information for classifying the candidate test case. Correspondingly, software development information specifically refers to the information corresponding to the target software, which records the information used to describe the code changes of the target software and the attributes of the target software developer, reflecting the developer's development capability portrait.
[0051] Furthermore, in order to accurately calculate the scores corresponding to the candidate test cases in each risk dimension in the subsequent risk score calculation, different types of information can be combined to form test case information and software development information. In this embodiment, the determination of the test case information corresponding to any candidate test case in the test case set includes:
[0052] Obtain historical execution information and test rule information corresponding to a first candidate test case, and use the historical execution information and the test rule information as test case information of the first candidate test case; wherein, obtaining software development information corresponding to the target software comprises: determining a developer corresponding to the target software, and obtaining personnel attribute information corresponding to the developer; performing detection on the target software, and determining code change information according to the detection result; and using the personnel attribute information and the code change information as software development information corresponding to the target software.
[0053] Specifically, the first candidate test case specifically refers to any test case in the test case set; accordingly, the historical execution information specifically refers to the usage information of the first candidate test when testing other software, including but not limited to the number of times the first candidate test case is used, the number of defects in the test software after use, etc. Accordingly, the test rule information specifically refers to the rule description information for recording the test case level assessment, which can be released by the operator corresponding to the target software. Accordingly, the developer specifically refers to the person who develops the target software; accordingly, the personnel attribute information specifically refers to the attribute information that characterizes the developer's development ability, which can be the percentage of code defects when the developer writes the code. Accordingly, the code change information specifically refers to the information on the changes in the code of the target software compared to the last update, including but not limited to the number of code lines changed, the number of function changes, the number of conditional judgment changes, etc.
[0054] Based on this, for any candidate test case in the test case set, the historical execution information and test rule information corresponding to the first candidate test case can be obtained first, and the historical execution information and test rule information can be used as the test case information of the first candidate test case.
[0055] Furthermore, the software development information of the target software can be obtained by determining the developer corresponding to the target software and obtaining the personnel attribute information corresponding to the developer; and testing the target software, determining the code change information according to the test results, and using the personnel attribute information and the code change information as the software development information corresponding to the target software. In this way, the risk score calculation of each candidate test case can be completed by combining the test case information and software development information of each candidate test case.
[0056] This embodiment takes the target software as information query software as an example to illustrate the test case selection method. The test case selection process of other software can refer to the same or corresponding description in this embodiment, and this embodiment will not be repeated here. Specifically, after the information query software is updated from version 2.0.1 to version 2.0.2, in order to be able to release information query software with more stable functions, it is necessary to test the information query software after the version iteration.
[0057] For example, when testing the login function of information query software, the purpose of the test is to ensure that the user can successfully log in to the query system of the information query software after entering the correct username and password. Test steps: Open the browser and enter the URL of the system login page; enter "1234" in the username input box; enter "abcd" in the password input box; click the "Login" button; Expected results: The system should verify the username and password. If the username and password are correct, the user should be redirected to the system homepage or the corresponding user interface, and the page should display a successful login message or welcome message.
[0058] Based on this, considering that some test cases cannot be used again after the software is updated, it is necessary to select appropriate test cases from the existing test cases. A test case set is determined for the current version of the information query software, and the test case set contains n test cases, namely n1, n2...n; further, the developer information corresponding to the information query software can be determined, and the historical execution information of each test case can be obtained at the same time, the rules issued by the operator of the information query software for the test case can be determined, and the code information that has changed after the information query software is updated from version 2.0.1 to version 2.0.2 can be determined, so as to facilitate the subsequent combination of the above information to complete the score calculation of each test case in each risk dimension, so that the test case matching the information query software can be selected from the n test cases.
[0059] In summary, by combining multi-dimensional information to construct test case information and software development information, the information can be combined to complete risk score calculation in multiple dimensions, thereby effectively improving the accuracy of test case screening and accurately completing the test processing of the target software.
[0060] Step S206: Calculate the risk scores of each candidate test case corresponding to at least two risk dimensions according to the test case information and the software development information, wherein the at least two risk dimensions include a test case execution dimension and a software development dimension.
[0061] Specifically, after obtaining the test case information of each candidate test case and the software development information of the target software as mentioned above, the risk scores corresponding to each candidate test case in each dimension can be calculated in combination with the test case information and the software development information according to at least two preset risk dimensions, so as to subsequently complete the selection of the target test case by integrating at least two risk dimensions.
[0062] Among them, the risk dimension specifically refers to the risk dimension of the associated use case execution dimension and the software development dimension. Under each risk dimension, the risk score of the dimension to which each test case belongs can be calculated, so that the good or bad information of the test case in this dimension can be reflected according to the calculated risk score; the at least two risk dimensions include at least two of the following: developer risk dimension, code change risk dimension, test rule risk dimension, and historical execution risk dimension. Among them, the developer risk dimension and the code change risk dimension are sub-dimensions included in the software development dimension, and the test rule risk dimension and the historical execution risk dimension are sub-dimensions included in the use case execution dimension.
[0063] Among them, the developer risk dimension specifically refers to the dimension for calculating the risk score for the developer corresponding to the target software; the code change risk dimension specifically refers to the dimension for calculating the risk score in combination with the code size and complexity of the target software associated with the candidate test case; the test rule risk dimension specifically refers to the dimension for calculating the risk score in combination with the business attributes and test case attributes of the candidate test case; the historical execution risk dimension specifically refers to the dimension for calculating the risk score in combination with the execution frequency of the candidate test case and the historical defects found in the test case. Correspondingly, the risk score specifically refers to the score that represents the risk level of the candidate test case in each risk dimension. The higher the risk score, the higher the risk level, and thus the lower the probability of being selected.
[0064] In the first aspect, the risk score calculation of the developer risk dimension can be completed by combining the developer's capability parameters and personnel attribute information. In this embodiment, the determination of the risk score corresponding to the developer risk dimension for any candidate test case in the test case set includes:
[0065] Determine the personnel attribute information of the developer corresponding to the target software; and calculate the risk score of the second candidate test case corresponding to the risk dimension of the developer according to the personnel attribute information.
[0066] Specifically, the second candidate test case specifically refers to any test case in the test case set; the personnel attribute information specifically refers to the attribute description information that characterizes the development ability of the developer, such as years of experience, etc.; it can be the percentage of code defects when the developer writes the code. It should be noted that, considering that the target software may be developed by multiple developers in actual applications, when calculating the risk score corresponding to the developer risk dimension, the personnel attribute information of the developer corresponding to the code change part can be selected to calculate the risk score of this dimension, so as to ensure that the calculation of the risk score is more consistent with the actual situation.
[0067] Based on this, when calculating the risk score corresponding to the developer risk dimension of any candidate test case, the personnel attribute information of the developer corresponding to the target software can be determined; thereafter, the risk score corresponding to the developer risk dimension of any second candidate test case can be calculated based on the personnel attribute information. Since the developer is the developer corresponding to the target software, the risk score corresponding to the developer risk dimension of each subsequent test case is the same for subsequent use.
[0068] Using the above example, we determine the developer a1 of the information query software. At this time, we can refer to the software CMMI (Capability Maturity Model Integration) capability level 1-5 requirements of 0.32‰, 0.92‰, 2.39‰, 5.52‰, and 11.95‰ to calculate the risk level of the developer. The risk score for the developer risk dimension can be calculated using the following formula (1):
[0069] (1)
[0070] Where x represents the code defect rate per thousand ‰; A1(x) represents the risk score of the developer in the developer risk dimension. After calculation using the above formula (1), the risk score of the developer corresponding to the information query software can be obtained, which can be used in the subsequent screening of test cases.
[0071] In summary, by combining the developer's capability profile to calculate the risk score of the developer risk dimension, more dimensions can be considered when selecting test cases to ensure the rationality of the test case selection.
[0072] In the second aspect, the risk score calculation of the code change risk dimension can be completed by combining the code change information and the code mapping relationship. In this embodiment, the determination of the risk score corresponding to the code change risk dimension for any candidate test case in the test case set includes:
[0073] Establish a code mapping relationship between a third candidate test case and the target software, and extract code change information corresponding to the target software from the software development information; determine function information, code line information and condition judgment information corresponding to the target software based on the code change information; normalize the function information, code line information and condition judgment information according to the code mapping relationship to obtain a risk score corresponding to the third candidate test case in the code change risk dimension.
[0074] Specifically, the third candidate test case specifically refers to any test case in the test case set; correspondingly, the code mapping relationship specifically refers to the relationship between the candidate test case and the function in the code project; correspondingly, the function information specifically refers to the number of functions in the changed code of the target software. The code line information specifically refers to the number of lines of the changed code of the target software. The conditional judgment information specifically refers to the number of conditional-judgment branches in the changed code of the target software.
[0075] Based on this, when calculating the risk score corresponding to any candidate test case in the code change risk dimension, a code mapping relationship between the third candidate test case and the target software can be established, and the code change information corresponding to the target software can be extracted from the software development information; at this time, the function information, code line information and condition judgment information corresponding to the target software can be determined according to the code change information; on this basis, by normalizing the function information, code line information and the condition judgment information according to the code mapping relationship, the risk score corresponding to the third candidate test case in the code change risk dimension can be determined according to the processing result for subsequent use.
[0076] In actual applications, the establishment of code mapping relationships can be established through static code analysis and dynamic code analysis. Static code analysis can learn which APIs the code will affect from the calling relationship between code engineering functions, and the relationship between APIs and functions and services is directly maintained by developers; the test functions and services of test cases are known, and the APIs used are also known, so code mapping relationships can be established based on functions and test cases in the code. Dynamic code analysis can perform corresponding stubs in the source code, and the corresponding code path can be obtained during the execution of the test case, thereby establishing the relationship between the code path and the test case as a code mapping relationship.
[0077] Following the above example, we first establish the mapping relationship between n test cases and the functions in the code engineering of the information query software. Secondly, we can use Git's diff command to obtain the changed parts of the information query software code, which can include adding new code segments, modifying code segments, or deleting code segments. Thirdly, we determine the number of functions, the number of code lines, and the number of conditional-judgment branches in the changed code. Combined with the mapping relationship between each test case and the function, we can determine the number of impacts of each test case. Finally, we can use the maximum and minimum value normalization method to scale the risk score corresponding to the code change risk dimension to a standardized range. Among them, the risk score corresponding to the test case in the code change risk dimension can be calculated by the following formula (2):
[0078] 0+ + 0 (2)
[0079] Among them, A2 is the risk score corresponding to the test case in the code change risk dimension; F represents the number of functions, L represents the number of code lines, and C represents the number of condition-decision branches. According to the above formula (2), the risk score corresponding to the code change risk dimension of test case n1 is A2-1, the risk score corresponding to the code change risk dimension of test case n2 is A2-2... The risk score corresponding to the code change risk dimension of test case n is A2-n.
[0080] In summary, by combining the mapping relationship between the test case and the changed code of the target software to calculate the risk score of the code change risk dimension, the matching between the test case and the target software can be determined, so that the impact of this dimension can be considered when selecting the target test case in the future to improve the accuracy of the case selection.
[0081] In the third aspect, the candidate test cases can be evaluated in combination with the test rule information for the test rule risk dimension, thereby completing the risk score calculation for this dimension. In this embodiment, the determination of the risk score corresponding to the test rule risk dimension for any candidate test case in the test case set includes:
[0082] Extracting test rule information from the test case information; determining use case assessment information corresponding to a fourth candidate test case according to the test rule information; and calculating a risk score corresponding to the fourth candidate test case in the test rule risk dimension based on the use case assessment information.
[0083] Specifically, the fourth candidate test case specifically refers to any test case in the test case set; correspondingly, the case assessment information specifically refers to the risk level determined after evaluating the fourth candidate test case according to the test rule information, and then the risk score corresponding to the fourth candidate test case in the test rule risk dimension can be determined according to the mapping relationship between the risk level and the risk score.
[0084] Based on this, when calculating the risk score corresponding to any candidate test case in the test rule risk dimension, the test rule information can be extracted from the test case information; at this time, the test rule information can be used to evaluate the fourth candidate test case, and then the use case evaluation information corresponding to the fourth candidate test case can be determined; on this basis, the risk score corresponding to the fourth candidate test case in the test rule risk dimension can be calculated based on the use case evaluation information for subsequent use.
[0085] In actual applications, when determining the use case assessment information corresponding to the candidate test case based on the test rule information and then calculating the risk score, the assessment and score determination can be completed through the following table (1):
[0086] Table (1)
[0087]
[0088] Continuing with the above example, combined with the above table (1), the n test cases are scored in the test rule risk dimension, and the risk score corresponding to the test case n1 in the test rule risk dimension is determined to be A3-1, the risk score corresponding to the test case n2 in the test rule risk dimension is A3-2... The risk score corresponding to the test case n in the test rule risk dimension is A3-n.
[0089] In summary, by establishing the relationship between the test case level and the risk score, it is possible to quickly obtain the risk score corresponding to the test case in the test rule risk dimension when calculating the test case, and complete the calculation of the risk score in combination with this dimension. When selecting the target test case, it is possible to refer to the impact on the running effect of the target software, thereby ensuring a better balance of the test cases.
[0090] Fourthly, for the historical execution risk dimension, the risk score of the candidate test case can be calculated by combining the historical execution times and the number of defects associated with the case. In this embodiment, the determination of the risk score corresponding to the historical execution risk dimension for any candidate test case in the test case set includes:
[0091] Extract historical execution information corresponding to the fifth candidate test case from the test case information of the fifth candidate test case; determine the historical execution times and the number of use case associated defects of the fifth candidate test case according to the historical execution information; and calculate the risk score of the fifth candidate test case corresponding to the historical execution risk dimension based on the historical execution times and the number of use case associated defects.
[0092] Specifically, the fifth candidate test case specifically refers to any test case in the test case set; accordingly, the number of historical executions specifically refers to the number of times the fifth candidate test case is used. Accordingly, the number of case-associated defects specifically refers to the number of times a software defect is found when the candidate test case is tested against other software.
[0093] Based on this, when calculating the risk score corresponding to any candidate test case in the historical execution risk dimension, the historical execution information corresponding to the fifth candidate test case can be first extracted from the test case information of the fifth candidate test case; then, the historical execution times and the number of case-associated defects of the fifth candidate test case can be determined based on the historical execution information; on this basis, the risk score corresponding to the fifth candidate test case in the historical execution risk dimension can be calculated based on the historical execution times and the number of case-associated defects for subsequent use.
[0094] Using the above example, for n test cases, the historical execution times of each test case can be obtained from the test management platform, denoted as V; at the same time, the number of software defects associated with each test case can be obtained from the defect management platform, denoted as B; thereafter, according to the defect level classification, the DI (Density Index) value of each test case can be determined, with the most serious defect being 10 points, serious defects being 5 points, general defects being 3 points, and minor defects being 1 point. The value is denoted as D, and the risk score corresponding to each test case in the historical execution risk dimension can be calculated using the following formula (3):
[0095] + + 0 (3)
[0096] Among them, A4 is the risk score corresponding to the test case in the historical execution risk dimension. After calculation using the above formula (3), it can be obtained that the risk score corresponding to the historical execution risk dimension of test case n1 is A4-1, the risk score corresponding to the historical execution risk dimension of test case n2 is A4-2… The risk score corresponding to the historical execution risk dimension of test case n is A4-n.
[0097] In summary, by combining the historical execution information of the test cases, the execution effectiveness of the test cases can be referred to in the test case selection stage, thereby ensuring that the subsequently screened test cases are more compatible with the target software.
[0098] Step S208: selecting a target test case from the test case set based on the risk scores of each candidate test case corresponding to the at least two risk dimensions.
[0099] Specifically, after the above-mentioned calculation of the risk scores corresponding to each candidate test case in at least two risk dimensions is completed, further, in order to select the test case that matches the target software and ensure the test accuracy, each candidate test case can be evaluated according to the risk scores corresponding to each candidate test case in at least two risk dimensions, and then the target test case can be selected from the test case set according to the evaluation results, so that the target test case can be used later to test the target software. Among them, the target test case specifically refers to the candidate test case that matches the target software selected from the test case set. In practical applications, considering that if the test of the target software is completed using a single test case, there may be randomness in the test results, so in order to comprehensively test the target software, when selecting the target test case, a set number of test cases can be selected according to the needs, so as to ensure that the test results of the target software are more accurate. In specific implementation, the number of test cases selected can be set according to the needs, and this embodiment does not make any restrictions here.
[0100] Furthermore, when selecting target test cases, in order to be able to integrate multiple dimensional risk scores to improve the selection accuracy of test cases, a weighted sum method can be used to calculate the target risk score of each test case, and then the target test case is selected according to the sorting result. In this embodiment, the specific implementation method is as follows: Steps 1 to 3:
[0101] Step 1: Determine the risk weights corresponding to the at least two risk dimensions respectively.
[0102] Among them, determining the risk weight corresponding to any one of at least two risk dimensions includes: obtaining a test case sample, and determining a risk indicator corresponding to the risk dimension; calculating the proportion information, entropy information and difference information corresponding to the risk indicator based on the test case sample; and calculating the risk weight corresponding to the risk dimension based on the proportion information, the entropy information and the difference information.
[0103] Specifically, the test case samples specifically refer to the test cases needed to calculate the risk weights corresponding to each risk dimension; accordingly, the weight information specifically refers to the weight of the risk indicators corresponding to the risk dimension in each test case sample; the entropy value information specifically refers to the entropy value of the risk indicators corresponding to the risk dimension relative to each test case sample; wherein the entropy value reflects the degree of discreteness of the risk indicators; accordingly, the difference information specifically refers to the difference between the information entropy of the risk indicators and the information entropy of the completely ordered state.
[0104] Based on this, for the risk weight corresponding to any one of the at least two risk dimensions, it is possible to obtain a sample of test cases and determine the risk indicators corresponding to the risk dimensions, and then calculate the proportion information, entropy information and difference information corresponding to the risk indicators; on this basis, the risk weight corresponding to the risk dimension can be calculated by combining the proportion information, entropy information and difference information.
[0105] In practical applications, the risk weights corresponding to each risk dimension can be implemented using the Entropy Weight Method. Specifically, the data is standardized. Assuming there are n use case samples and m risk indicators, the standardized matrix is R=[r ij ], where i=1,2,3,...n,j=1,2,...m. Secondly, calculate the weight P of each indicator on each sample ij , the specific gravity can be calculated by the following formula (4):
[0106] (i=1,2,...,n) (4)
[0107] Next, the entropy value of the risk indicator can be calculated. The entropy value reflects the degree of dispersion of the indicator and can be calculated using the following formula (5):
[0108] (5)
[0109] Among them, e j is the entropy value of the j-th risk indicator.
[0110] Furthermore, the coefficient of variation of the risk indicator can be calculated. The coefficient of variation g j The difference between the information entropy of risk index j and the information entropy of the completely ordered state can be calculated by the following formula (6):
[0111] (6)
[0112] Finally, the risk weights of the risk indicators corresponding to each risk dimension can be calculated based on the above calculation results, which can be calculated by the following formula (7):
[0113] (7)
[0114] Among them, the sum of the risk weights of the risk indicators corresponding to each risk dimension is 1.
[0115] In summary, by using the entropy weight method to calculate risk weights, it is possible to judge the importance of indicators through effective information, thereby ensuring that the calculation of risk weights is more accurate.
[0116] Step 2: Calculate a target risk score corresponding to each candidate test case based on the risk scores of each candidate test case corresponding to the at least two risk dimensions and the risk weights corresponding to the at least two risk dimensions.
[0117] Step 3: sort the candidate test cases included in the test case set based on the target risk score, and select the target test case according to the sorting result.
[0118] Specifically, the target risk score refers to a risk score calculated by weighted summing the risk scores corresponding to each candidate test case in at least two risk dimensions.
[0119] Based on this, after determining the risk weights corresponding to at least two risk dimensions, the target risk score corresponding to each candidate test case can be calculated by weighted summation based on the risk scores corresponding to each candidate test case in at least two risk dimensions and the risk weights corresponding to at least two test case dimensions. After that, the candidate test cases included in the test case set can be sorted based on the target risk scores, and the sorting can be done in reverse order, so that the first test case can be selected as the target test case according to the sorting result to achieve testing of the target software.
[0120] In summary, by adopting the weighted summation method to select test cases, it can be ensured that the selected test cases are more matched with the target software, thereby effectively improving the accuracy of software testing.
[0121] In actual applications, when constructing a test case set for the target software, in order to reduce the scope of case selection, the test case set can be constructed according to the software attribute information. In this embodiment, the specific implementation method is as follows:
[0122] In response to a test request submitted for the target software, software attribute information of the target software is determined; based on the software attribute information, a set number of candidate test cases are selected from a test case library to form the test case set; based on the test case set, steps S202 to S208 are executed; thereafter, the target software is tested based on the target test case, and a software test report is generated according to the test results.
[0123] Specifically, software attribute information refers to the attribute description information describing the corresponding functions of the target software and the content to be tested. Correspondingly, the test case database refers to the database storing all test cases. Correspondingly, the software test report refers to the report content constructed based on the test results, which is used to ensure the results after the target test case tests the target software.
[0124] Based on this, when determining a test case set, the software attribute information of the target software can be determined in response to a test request submitted for the target software; then, a set number of candidate test cases can be selected from the test case library based on the software attribute information to form a test case set; thereafter, steps S202 to S208 can be executed based on the test case set; after obtaining the target test case, the target software can be tested based on the target test case, so that a software test report can be generated based on the test results for use by developers.
[0125] Following the above example, after obtaining the risk scores of n test cases in the developer risk dimension, code change risk dimension, test rule risk dimension, and historical execution risk dimension, weighted sum calculation is performed on n test cases in combination with the risk scores corresponding to each dimension, so that the comprehensive score corresponding to test case n1 is A1, the comprehensive score corresponding to test case n2 is A2… The comprehensive score corresponding to test case n is An; after sorting each test case according to the comprehensive score, it is determined that the comprehensive score of test case n5 is the lowest, then test case n5 can be selected as the target test case for the information query software. After that, the login function of the information query software can be tested based on the target test case.
[0126] The test case selection method provided in this embodiment is to select a test case with a higher matching degree for the target software, thereby ensuring the test accuracy; in the stage of selecting the target test case, the test case set associated with the target software can be first determined; at this time, the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software can be first obtained; thus, the risk score corresponding to each candidate test case in at least two risk dimensions can be calculated according to the test case information and the software development information; by combining the multi-dimensional information to complete the risk score calculation of different risk dimensions, the comprehensive performance of the score calculation can be guaranteed. On this basis, the target test case can be selected from the test case set based on the risk score corresponding to each candidate test case in at least two risk dimensions. When selecting the test case, the target test case can be selected in combination with the comprehensive score of multiple dimensions, so that the selection of the case is no longer dependent on the standard of a single dimension, thereby ensuring that the selected test case has a higher matching degree with the target software, so that the test of the target software can be completed accurately and efficiently, and the test accuracy can be guaranteed.
[0127] The following combination Figure 3 , taking the application of the test case selection method provided in this specification in the trading software testing scenario as an example, the test case selection method is further explained. Figure 3 A process flow chart of a test case selection method provided by an embodiment of the present specification is shown, which specifically includes the following steps.
[0128] Step S302, determining a set of test cases associated with the transaction software.
[0129] Step S304, obtaining historical execution information and development attribute information corresponding to each candidate test case in the test case set, as well as code change information and test rule information corresponding to the transaction software.
[0130] Step S306, calculating the risk score corresponding to the developer risk dimension for each candidate test case according to the development attribute information.
[0131] Step S308: Calculate the risk score of each candidate test case in the code change risk dimension according to the code change information.
[0132] Step S310, calculating the risk score corresponding to each candidate test case in the test rule risk dimension according to the test rule information.
[0133] Step S312, calculating the risk score corresponding to each candidate test case in the historical execution risk dimension according to the historical execution information.
[0134] Step S314, determining the risk weights corresponding to the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension respectively.
[0135] Step S316, calculating a target risk score corresponding to each candidate test case based on the risk scores corresponding to the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, and the risk weights corresponding to the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively;
[0136] Step S318, sorting the candidate test cases included in the test case set based on the target risk score, and selecting the target test case according to the sorting result.
[0137] Step S320, testing the transaction software based on the target test case, and generating a software test report according to the test result.
[0138] In summary, in order to select a test case with a higher matching degree for the target software, thereby ensuring the test accuracy; in the stage of selecting the target test case, the test case set associated with the target software can be first determined; at this time, the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software can be first obtained; thus, the risk score corresponding to each candidate test case in at least two risk dimensions can be calculated according to the test case information and the software development information; by combining the multi-dimensional information to complete the risk score calculation of different risk dimensions, the comprehensive performance of the score calculation can be guaranteed. On this basis, the target test case can be selected from the test case set based on the risk score corresponding to each candidate test case in at least two risk dimensions. When selecting the test case, the target test case can be selected in combination with the comprehensive score of multiple dimensions, so that the selection of the case is no longer dependent on the standard of a single dimension, thereby ensuring that the selected test case has a higher matching degree with the target software, so that the test of the target software can be completed accurately and efficiently, and the test accuracy can be guaranteed.
[0139] Corresponding to the above method embodiment, this specification also provides another test case selection method embodiment, Figure 4 FIG. 2 is a flowchart of another test case selection method provided by an embodiment of the present specification. Figure 4 As shown, the method includes:
[0140] Step S402, determining a set of test cases associated with the target software;
[0141] Step S404, obtaining test case information corresponding to each candidate test case in the test case set, and software development information corresponding to the target software;
[0142] Step S406, calculating the risk scores of each candidate test case in the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively, according to the test case information and the software development information;
[0143] Step S408 , selecting a target test case from the test case set based on the risk scores of each candidate test case corresponding to the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively.
[0144] The above is a schematic scheme of another test case selection method of this embodiment. It should be noted that the technical scheme of the test case selection method and the technical scheme of the test case selection method described above belong to the same concept, and the details of the technical scheme of the other test case selection method that are not described in detail can all be referred to the description of the technical scheme of the test case selection method described above.
[0145] Corresponding to the above method embodiment, this specification also provides a test case selection device embodiment, Figure 5 FIG. 1 is a schematic diagram showing the structure of a test case selection device provided by an embodiment of the present specification. Figure 5 As shown, the device comprises:
[0146] A determination module 502 is configured to determine a set of test cases associated with the target software;
[0147] The acquisition module 504 is configured to acquire the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software;
[0148] A calculation module 506 is configured to calculate risk scores corresponding to each candidate test case in at least two risk dimensions according to the test case information and the software development information, wherein the at least two risk dimensions include a test case execution dimension and a software development dimension;
[0149] The selection module 508 is configured to select a target test case from the test case set based on the risk scores of each candidate test case corresponding to the at least two risk dimensions.
[0150] In an optional embodiment, determining the test case information corresponding to any candidate test case in the test case set includes:
[0151] Obtain historical execution information and test rule information corresponding to a first candidate test case, and use the historical execution information and the test rule information as test case information of the first candidate test case; wherein, obtaining software development information corresponding to the target software comprises: determining a developer corresponding to the target software, and obtaining personnel attribute information corresponding to the developer; performing detection on the target software, and determining code change information according to the detection result; and using the personnel attribute information and the code change information as software development information corresponding to the target software.
[0152] In an optional embodiment, the at least two risk dimensions include at least two of the following:
[0153] Developer risk dimension, code change risk dimension, test rule risk dimension, and historical execution risk dimension.
[0154] In an optional embodiment, determining a risk score corresponding to the developer risk dimension for any candidate test case in the test case set includes:
[0155] Determine the personnel attribute information of the developer corresponding to the target software; and calculate the risk score of the second candidate test case corresponding to the risk dimension of the developer according to the personnel attribute information.
[0156] In an optional embodiment, determining a risk score corresponding to the code change risk dimension for any candidate test case in the test case set includes:
[0157] Establish a code mapping relationship between a third candidate test case and the target software, and extract code change information corresponding to the target software from the software development information; determine function information, code line information and condition judgment information corresponding to the target software based on the code change information; normalize the function information, code line information and condition judgment information according to the code mapping relationship to obtain a risk score corresponding to the third candidate test case in the code change risk dimension.
[0158] In an optional embodiment, determining the risk score corresponding to the risk dimension of the test rule for any candidate test case in the test case set includes:
[0159] Extracting test rule information from the test case information; determining use case assessment information corresponding to a fourth candidate test case according to the test rule information; and calculating a risk score corresponding to the fourth candidate test case in the test rule risk dimension based on the use case assessment information.
[0160] In an optional embodiment, determining a risk score corresponding to the historical execution risk dimension for any candidate test case in the test case set includes:
[0161] Extract historical execution information corresponding to the fifth candidate test case from the test case information of the fifth candidate test case; determine the historical execution times and the number of use case associated defects of the fifth candidate test case according to the historical execution information; and calculate the risk score of the fifth candidate test case corresponding to the historical execution risk dimension based on the historical execution times and the number of use case associated defects.
[0162] In an optional embodiment, the selection module 508 is further configured to:
[0163] Determine the risk weights corresponding to the at least two risk dimensions respectively; calculate the target risk score corresponding to each candidate test case based on the risk scores corresponding to each candidate test case in the at least two risk dimensions respectively, and the risk weights corresponding to the at least two risk dimensions respectively; sort the candidate test cases included in the test case set based on the target risk scores, and select the target test case according to the sorting result.
[0164] In an optional embodiment, the selection module 508 is further configured to:
[0165] Acquire a sample of test cases and determine the risk indicators corresponding to the risk dimensions; calculate the weight information, entropy information and difference information corresponding to the risk indicators based on the sample of test cases; calculate the risk weight corresponding to the risk dimensions based on the weight information, the entropy information and the difference information.
[0166] In an optional embodiment, the device further comprises:
[0167] A property information determination module is configured to determine the software property information of the target software in response to a test request submitted for the target software; select a set number of candidate test cases in a test case library based on the software property information to form the test case set;
[0168] The report generating module is configured to test the target software based on the target test case and generate a software test report according to the test result.
[0169] The test case selection device provided in this embodiment can select a test case with a higher matching degree for the target software, thereby ensuring the test accuracy; in the stage of selecting the target test case, the test case set associated with the target software can be first determined; at this time, the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software can be first obtained; thus, the risk score corresponding to each candidate test case in at least two risk dimensions can be calculated according to the test case information and the software development information; by combining the multi-dimensional information to complete the risk score calculation of different risk dimensions, the comprehensive performance of the score calculation can be guaranteed. On this basis, the target test case can be selected from the test case set based on the risk score corresponding to each candidate test case in at least two risk dimensions. When selecting the test case, the target test case can be selected in combination with the comprehensive score of multiple dimensions, so that the selection of the case is no longer dependent on the standard of a single dimension, thereby ensuring that the selected test case has a higher matching degree with the target software, so that the test of the target software can be completed accurately and efficiently, and the test accuracy can be guaranteed.
[0170] The above is a schematic scheme of a test case selection device of this embodiment. It should be noted that the technical scheme of the test case selection device and the technical scheme of the test case selection method described above belong to the same concept, and the details not described in detail in the technical scheme of the test case selection device can be found in the description of the technical scheme of the test case selection method described above.
[0171] Corresponding to the above method embodiment, this specification also provides another test case selection device embodiment, Figure 6 FIG. 2 shows a schematic diagram of the structure of another test case selection device provided by an embodiment of the present specification. Figure 6 As shown, the device comprises:
[0172] A determination set module 602 is configured to determine a test case set associated with the target software;
[0173] The information acquisition module 604 is configured to acquire the test case information corresponding to each candidate test case in the test case set and the software development information corresponding to the target software;
[0174] The score calculation module 606 is configured to calculate the risk scores of each candidate test case in the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively, according to the test case information and the software development information;
[0175] The case selection module 608 is configured to select a target test case from the test case set based on the risk scores of each candidate test case corresponding to the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively.
[0176] The above is a schematic scheme of another test case selection device of this embodiment. It should be noted that the technical scheme of the test case selection device and the technical scheme of the test case selection method described above belong to the same concept, and the details not described in detail in the technical scheme of the test case selection device can be found in the description of the technical scheme of the test case selection method described above.
[0177] Figure 7 The block diagram of a computing device 700 according to an embodiment of the present specification is shown. The components of the computing device 700 include but are not limited to a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and the database 750 is used to store data.
[0178] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0179] In one embodiment of the present specification, the above components of the computing device 700 and Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 7 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0180] The computing device 700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 700 may also be a mobile or stationary server.
[0181] The processor 720 is used to execute the following computer executable instructions, which, when executed by the processor, implement the steps of the above-mentioned test case selection method.
[0182] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the test case selection method described above are of the same concept, and the details not described in detail in the technical scheme of the computing device can be found in the description of the technical scheme of the test case selection method described above.
[0183] An embodiment of the present specification also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the above-mentioned test case selection method.
[0184] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the test case selection method described above belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be found in the description of the technical scheme of the test case selection method described above.
[0185] An embodiment of the present specification also provides a computer program product, including a computer program or instructions, which implement the steps of the above-mentioned test case selection method when executed by a processor.
[0186] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the test case selection method described above belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be found in the description of the technical scheme of the test case selection method described above.
[0187] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0188] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0189] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0190] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0191] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can understand and use this specification well.
Claims
1. A test case selection method, characterized in that: include: Determine a test case set associated with the target software, wherein the candidate test cases included in the test case set are written by a test case writer for the target software; Acquire test case information corresponding to each candidate test case in the test case set, and software development information corresponding to the target software, wherein the test case information records historical execution information and test rule information of the candidate test case; According to the test case information and the software development information, the risk scores corresponding to each candidate test case in at least two risk dimensions are calculated, wherein the at least two risk dimensions include a test case execution dimension and a software development dimension, the software development dimension includes a code change risk dimension, and a code mapping relationship between the candidate test case and the target software is established through dynamic and static code analysis strategies, and the number of functions, the number of code lines, and the number of conditional judgment branches in the changed code of the target software are extracted from the software development information, and the number of functions, the number of code lines, and the number of conditional judgment branches are normalized according to the code mapping relationship to obtain the risk score of the candidate test case corresponding to the code change risk dimension; A target test case is selected from the test case set based on the risk scores of each candidate test case corresponding to the at least two risk dimensions.
2. The test case selection method according to claim 1, characterized in that: Determining the test case information corresponding to any candidate test case in the test case set includes: Acquire historical execution information and test rule information corresponding to a first candidate test case, and use the historical execution information and the test rule information as test case information of the first candidate test case; Wherein, obtaining software development information corresponding to the target software includes: Determine the developer corresponding to the target software, and obtain the personnel attribute information corresponding to the developer; Performing a test on the target software and determining code change information according to the test result; The personnel attribute information and the code change information are used as software development information corresponding to the target software.
3. The test case selection method according to claim 1, characterized in that: The at least two risk dimensions include at least two of the following: Developer risk dimension, code change risk dimension, test rule risk dimension, and historical execution risk dimension.
4. The test case selection method according to claim 3, characterized in that: Determining the risk score corresponding to the developer risk dimension for any candidate test case in the test case set includes: Determining the personnel attribute information of the developer corresponding to the target software; A risk score corresponding to the developer risk dimension of the second candidate test case is calculated according to the personnel attribute information.
5. The test case selection method according to claim 3, characterized in that: Determining the risk score corresponding to the risk dimension of the test rule for any candidate test case in the test case set includes: Extracting test rule information from the test case information; Determine, according to the test rule information, the use case evaluation information corresponding to the fourth candidate test case; Based on the use case assessment information, a risk score corresponding to the fourth candidate test case in the test rule risk dimension is calculated.
6. The test case selection method according to claim 3, characterized in that: Determining the risk score corresponding to the historical execution risk dimension for any candidate test case in the test case set includes: Extracting historical execution information corresponding to the fifth candidate test case from the test case information of the fifth candidate test case; Determine the historical execution times and the number of defects associated with the fifth candidate test case according to the historical execution information; Based on the historical execution times and the number of defects associated with the use case, a risk score of the fifth candidate test case corresponding to the historical execution risk dimension is calculated.
7. The test case selection method according to any one of claims 1 to 6, characterized in that: The selecting a target test case from the test case set based on the risk scores of each candidate test case corresponding to the at least two risk dimensions respectively includes: Determining risk weights corresponding to the at least two risk dimensions respectively; Calculate a target risk score corresponding to each candidate test case based on the risk scores of each candidate test case corresponding to the at least two risk dimensions and the risk weights corresponding to the at least two risk dimensions; The candidate test cases included in the test case set are sorted based on the target risk score, and a target test case is selected according to the sorting result.
8. The test case selection method according to claim 7, characterized in that: Determining the risk weight corresponding to any one of the at least two risk dimensions includes: Obtain test case samples and determine the risk indicators corresponding to the risk dimensions; Calculate the weight information, entropy value information and difference information corresponding to the risk indicator according to the test case sample; Based on the weight information, the entropy value information and the difference information, the risk weight corresponding to the risk dimension is calculated.
9. A test case selection method, characterized in that: include: Determine a test case set associated with the target software, wherein the candidate test cases included in the test case set are written by a test case writer for the target software; Acquire test case information corresponding to each candidate test case in the test case set, and software development information corresponding to the target software, wherein the test case information records historical execution information and test rule information of the candidate test case; According to the test case information and the software development information, the risk scores of each candidate test case in the developer risk dimension, the code change risk dimension, the test rule risk dimension and the historical execution risk dimension are calculated; wherein, a code mapping relationship between the candidate test case and the target software is established through a dynamic and static code analysis strategy, and the number of functions, the number of code lines and the number of conditional judgment branches in the changed code of the target software are extracted from the software development information, and the number of functions, the number of code lines and the number of conditional judgment branches are normalized according to the code mapping relationship to obtain the risk score of the candidate test case corresponding to the code change risk dimension; A target test case is selected from the test case set based on the risk scores of each candidate test case corresponding to the developer risk dimension, the code change risk dimension, the test rule risk dimension, and the historical execution risk dimension, respectively.
10. A computing device, characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the method described in any one of claims 1 to 9 are implemented.
11. A computer-readable storage medium, characterized in that: It stores computer executable instructions, which, when executed by a processor, implement the steps of the method described in any one of claims 1 to 9.
12. A computer program product, characterized in that The method comprises a computer program or an instruction, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
An automatic test grading method and system based on multi-dimensional weights
CN109902019A
Test case-based data processing method and related equipment
CN111625454A
Software testing method and system, storage medium and computer equipment
CN111858371A
Code evaluation method and device, equipment and medium
CN115033248A
Incremental code unit testing method and device, computer equipment and storage medium
CN117951002A
