CN114281691A - Test case sequencing method and device, computing equipment and storage medium - Google Patents

Test case sequencing method and device, computing equipment and storage medium Download PDF

Info

Publication number
CN114281691A
CN114281691A CN202111580368.6A CN202111580368A CN114281691A CN 114281691 A CN114281691 A CN 114281691A CN 202111580368 A CN202111580368 A CN 202111580368A CN 114281691 A CN114281691 A CN 114281691A
Authority
CN
China
Prior art keywords
class
test
probability
test case
capability
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111580368.6A
Other languages
Chinese (zh)
Inventor
赵晓彬
王欣
苏畅
李佩刚
高建瓴
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202111580368.6A priority Critical patent/CN114281691A/en
Publication of CN114281691A publication Critical patent/CN114281691A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a method and a device for sequencing test cases, computing equipment and a storage medium. The method comprises the following steps: calculating the probability of easy occurrence of the defects of each class shared by the version of the software to be tested and the historical version; calculating the testing capability of each test case according to the probability of easy occurrence of the defects of each class; and sequencing the test cases according to the test capability of the test cases to obtain a priority sequencing result of the test cases. The embodiment of the invention can improve the reliability of sequencing the test cases, optimize the test cases and improve the test value of the test cases to the version of the software to be tested.

Description

Test case sequencing method and device, computing equipment and storage medium
Technical Field
The embodiment of the invention relates to the field of software testing, in particular to a method and a device for sequencing test cases, computing equipment and a storage medium.
Background
In order to meet the ever-evolving and changing demands of people, various software is also constantly updated in versions to meet various ever-increasing demands.
Since the software changes various underlying codes inevitably in the process of changing the version, stability and use problems which are difficult to predict may be caused after the software version is updated. Software developers usually choose to test software through various predetermined test cases after the software finishes version updating, and push new version software after repairing problems occurring in the testing process. If software is required to be tested with high quality, as many test cases as possible need to be selected, which seriously affects the efficiency of software testing, so how to optimize and select the test cases becomes a problem to be solved urgently.
Disclosure of Invention
The invention provides a test case sequencing method, a test case sequencing device, computing equipment and a storage medium, which are used for improving the reliability of sequencing test cases and optimizing the test cases, thereby improving the test value of the test cases to a software version to be tested.
In a first aspect, an embodiment of the present invention provides a test case sequencing method, where the method includes: calculating the probability of easy occurrence of the defects of each class shared by the version of the software to be tested and the historical version;
calculating the testing capability of each test case according to the probability of easy occurrence of the defects of each class;
and sequencing the test cases according to the test capability of the test cases to obtain a priority sequencing result of the test cases.
In a second aspect, an embodiment of the present invention further provides a test case sequencing apparatus, where the apparatus includes:
the probability calculation module is used for calculating the defect probability of each class shared by the version of the software to be tested and the historical version;
the capability determining module is used for calculating the testing capability of each test case according to the probability of easy occurrence of the defects of each class;
and the priority ranking module is used for ranking the test cases according to the test capability of the test cases to obtain the priority ranking result of the test cases.
In a third aspect, an embodiment of the present invention further provides a computing device, where the computing device includes:
one or more processors;
storage means for storing one or more programs;
when the one or more programs are executed by the one or more processors, the one or more processors implement the test case sequencing method of any of the first aspects.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium containing computer-executable instructions, where the computer-executable instructions are stored, and when executed by a computer processor, implement the test case sequencing method according to any of the first aspects.
According to the embodiment of the invention, the defect proneness probability of each type in the common types is obtained, and the test capability of the test case is further determined based on the defect proneness probability, so that the test cases are subjected to priority sequencing according to the test capability, the reliability of sequencing the test cases is improved, the test cases are optimized, and the test value of the test cases on the software version to be tested is improved.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
FIG. 1A is a diagram illustrating a test case ordering method according to an embodiment of the present invention;
FIG. 1B is a schematic diagram of a defect vulnerability model provided by an embodiment of the present invention;
FIG. 2 is a diagram illustrating a test case sorting method according to another embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a test case sorting apparatus according to yet another embodiment of the present invention;
FIG. 4 is a block diagram of a computing device used to implement an embodiment of the invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Regression testing refers to a phase of a software testing cycle, typically testing a new version of a software system after a version update. The software system is updated mainly for modifying the problems existing in the current version or adding new functions on the basis of the existing functions. For the tested program P ', the regression test not only ensures that the newly added or modified code behavior of P ' on the previous version P is correct, but also ensures that the unmodified code behavior in P ' is not affected. Whenever a program is modified, the tester needs to perform regression testing to ensure the quality of the software. Therefore, regression testing is an important, indispensable testing activity. However, frequent regression testing can take up a significant portion of project resources, including time and human resources. Some previous studies have shown that the time cost of regression testing is more than one-third of the total cost of software maintenance. Researchers in the industry and academia are all dedicated to searching for methods for reducing the regression testing cost and improving the regression testing efficiency.
In the embodiment of the application, the regression testing cost can be effectively reduced and the regression testing efficiency is improved by optimizing the test case set of the regression testing. Specifically, the priority ranking technique of the test cases can be used for optimization, and the contribution degree of different test cases to the test target is considered to be different. Therefore, the test cases are sorted according to the contribution degree of the test cases to the test target, and the test cases which have larger contribution to the test target are preferentially executed. On the basis, the tester can freely adjust the length of the test case execution sequence according to the budget of the project. Regression testing can utilize more information than normal testing activities, including test case pools of previous versions of test cases and execution slices and execution results of test cases. If the information is utilized, the optimization of the regression test can be assisted, and the efficiency of the regression test is improved.
In the embodiment of the application, considering that modification information of a program source code and quality metric information of a code unit both have an influence on the vulnerability of the code unit, the higher the vulnerability of the code unit is, the higher the possibility that a test case covering the code unit finds a flaw is. Therefore, the invention provides a test case priority ranking technology based on multiple factors, which constructs a test case-code unit coverage matrix by utilizing modification information of program source codes, software quality measurement information and code coverage information of test cases, and uses a greedy algorithm to perform priority ranking on the test cases according to the coverage rate of the test cases.
Fig. 1A is a flowchart of test case sequencing according to an embodiment of the present invention, where this embodiment is applicable to a case where different test case priorities are determined in a test case set, and the method may be executed by a test case sequencing apparatus according to an embodiment of the present invention, where the apparatus may be implemented in a software and/or hardware manner. The device can be configured in a computing device with corresponding data processing capacity, and the method specifically comprises the following steps:
and S110, calculating the defect probability of each class shared by the version of the software to be tested and the historical version.
The defect susceptibility can be understood as the probability that the code of the software version to be tested may have defects for each class. The greater the probability of the easy occurrence of the defect of one class, the more expected a test case can be used for effectively testing the class in the testing process, and correspondingly, the higher the contribution degree or value of the test case is. The probability of the easy occurrence of the defect can be determined by a conditional probability network, and the conditional probability network can be composed of three elements, which are respectively: conditional probability distributions for C, CF, and F nodes.
Fig. 1B is a schematic diagram of a defect susceptibility model according to an embodiment of the present invention. Referring to fig. 1B, in which:
and C, node C: the classes existing in the version V to be tested and the historical version V-1 of the software P both have a C node corresponding to the classes. One C node contains corresponding classesThere are two possible values for the code modification information of (1): modified (denoted c) and unmodified (denoted c)
Figure BDA0003426827770000051
). A class is considered modified if its source code changes from version V-1 to version V, and unmodified otherwise.
And node F: each C node has a corresponding F node for representing the defect susceptibility of the class. There are also two possible values for a node F: containing defects (denoted as f) and not containing defects (denoted as f)
Figure BDA0003426827770000052
). These two values represent that the corresponding class contains defects or does not contain defects, respectively.
CF side: the classes existing in both the version V to be tested and the historical version V-1 of the software P have a CF edge from the corresponding C node to the corresponding F node. Such edges represent a causal relationship: modifying the code of a class may introduce defects into the class.
Specifically, after the software version to be tested and the historical version are obtained, the common classes of the software version to be tested and the historical version are compared to determine whether each class is modified by the corresponding source code, and the probability of causing the class to be defective under the two conditions of modification or non-modification of the class of source code is further calculated and determined according to the defect susceptibility of each class, and the probability is used as the defect susceptibility probability of each class. By only calculating the defect proneness probability of the common class instead of the whole class, the test data of the previous version can be partially borrowed, and the data test amount in the software version test process is reduced.
Illustratively, before calculating the defect probability of each class shared by the version to be tested and the historical version, a test coverage matrix of the test case set T used in the current test on the last historical version V-1 of the software P to be tested needs to be collected.
Table 1 shows the test coverage of the test case set T on version V-1 of the software P. According to the test coverage condition shown in table 1, the test coverage matrix corresponding to the previous version of the test case set can be obtained, and the test coverage matrix can be reused by adaptively modifying the test coverage matrix according to the updated content of the current version, so that the test coverage matrix does not need to be reconstructed, and the test efficiency is improved.
TABLE 1 test coverage of test case suite T on version V-1 of software P
Figure BDA0003426827770000061
And S120, calculating the testing capability of each test case according to the defect incidence probability of each class.
The test capability refers to the capability of the current test case to effectively test the shared class.
Specifically, for test cases, it may or may not cover at least one of the common classes. At this time, it is necessary to determine whether the current test case has the test capability according to whether the current test case covers one of the common classes. If the current test case covers any one of the common classes, the test capability of the current test embodiment is further determined according to the defect proneness probability of the covered class. If the test case covers at least one line of code in any class, the current test case is shown to cover the class. The test capability quantification value of each test case is determined according to the defect probability, so that the priority sequencing of the implementation of subsequent different tests is facilitated, and the reliability of the test capability sequencing can be ensured according to the test capability determined by the defect probability.
S130, sequencing the test cases according to the test capability of the test cases to obtain a priority sequencing result of the test cases.
The priority is a logic sequence used for distinguishing the importance degrees of different test cases, such as the sequence and weight of different test cases when being executed.
Specifically, the test cases are sequenced according to the test capabilities of the test targets, the test cases with better test capabilities are preferentially executed, the priority sequencing of the test cases can be determined in sequence from high to low according to the test capabilities, and the length of the execution sequence of the test cases can be freely adjusted according to the budget of the project. By carrying out priority sequencing on the test cases based on the test capability, the priority with better test capability can be preferentially executed, and the test value of the test cases used by version test is improved.
According to the embodiment of the invention, the defect proneness probability of each type in the common types is obtained, and the test capability of the test case is further determined based on the defect proneness probability, so that the test cases are subjected to priority sequencing according to the test capability, the reliability of sequencing the test cases is improved, and the test value of the test cases on the version of the software to be tested is improved.
Fig. 2 is a flowchart of a test case sorting method according to another embodiment of the present invention, and the embodiment is optimized and improved based on the above embodiments. Specifically, referring to fig. 2, the method may include:
s211, determining the prior probability of each class being modified and the prior probability of each class not being modified according to the modification quantity of each class shared by the to-be-tested software version and the historical version;
specifically, the source codes of a common class in the software to be tested and the historical version are respectively obtained, the difference between the two types of source codes in number and format is compared, and the modifier of the common class is further determined, for example, 20 lines in 50 lines of codes are modified, and the modifier of the class is 20 lines of codes. From the ratio of the modifier to the historical version of the common source code of the class, a prior probability of the code being modified and a prior probability of the code not being modified can be determined. Wherein the sum of the unmodified prior probability and the modified prior probability is 1.
Illustratively, the prior probability P (c) of each class being modified can be calculated by the following formulai) And a priori probability that each class has not been modified
Figure BDA0003426827770000081
P(ci)=change(classi)
Figure BDA0003426827770000082
Wherein, change (class)i) Equal to the number of lines of code in software P that class i modifies from version V-1 to version V/the total number of lines of code for class i version V-1.
S212, estimating the conditional probability that the modified part and the unmodified part of each class contain defects according to the incoming coupling metric value and the outgoing coupling metric value of each class;
where incoming Coupling (CA) is a software quality metric that measures the number of classes that depend on a particular class (if class a calls a method of the particular class or uses its member variables, then class a depends on the particular class). The outgoing Coupling (CBO) is an Object-oriented software quality metric in the Chidameter and Kemer (CK) metric set that measures the number of classes that a specified class depends on (if the specified class calls a method of class A or uses its member variables, then the specified class depends on class A). CA and CBO are metrics for each class in version V, and may be received by tools such as ckjm, which compute Chidammber and Kemer object-oriented metrics, including CA and CBO, by processing the byte code of the compiled Java files.
Specifically, for each F-node, the modified conditional probability and the unmodified conditional probability of the packet are estimated based on the incoming coupling and outgoing coupling univariate defect susceptibility models, respectively.
In this embodiment of the present invention, optionally, estimating conditional probabilities that the modified part and the unmodified part of each class contain defects according to the incoming coupling metric value and the outgoing coupling metric value of each class includes:
estimating a conditional probability that the modified portion of each class contains defects according to a ratio of the incoming coupling metric value to the maximum incoming coupling metric value for each class; the conditional probability that the unmodified part of each class contains defects is estimated based on the ratio of the outgoing coupling metric value to the maximum outgoing coupling metric value for each class.
In particular, the incoming coupling metric value for class i may be understood as the number of classes in the common class that depend on class i; the outgoing coupling metric value of class i may be understood as the number of classes in the common class on which class i depends; the maximum incoming coupling metric value may be understood as the maximum value of the incoming coupling metric values of the common classes; the value of the outgoing coupling metric, the maximum outgoing coupling metric, may be understood as the maximum value of the outgoing coupling metric for each common class. Illustratively, the conditional probability P (f) that each class is modified to contain a defect is estimated by the following formulai|ci) And the conditional probability that the unmodified part contains a defect
Figure BDA0003426827770000093
Figure BDA0003426827770000091
Figure BDA0003426827770000092
Wherein, beta + delta2<<α+δ1≤1,β、δ2、α、δ1Can be set according to requirements. CA (class)i) For the incoming coupling metric value, CBO (class), of class i in the version V to be tested of the software Pi) Is the outgoing coupling metric value of class i in the version V to be tested of the software P.
S213, calculating the probability of susceptibility to defects of each class according to the modified prior probability and the unmodified prior probability of each class and the conditional probability that the modified part and the unmodified part of each class contain defects.
Specifically, the probability model is substantially related to the C node and the F node, i.e., the CF edge. The modified prior probability and the unmodified prior probability calculated above are essentially numerical representations of the C node, and the modified part and the unmodified part of each class contain the conditional probability of defects are numerical representations of the F node. Therefore, the corresponding defect probability is calculated based on the prior probability and the conditional probability, so that the defect probability has higher reliability.
Optionally, the modified prior probability of each class may be multiplied by the conditional probability of the modified part to obtain a first probability of the class; multiplying the unmodified prior probability of each class by the unmodified conditional probability of the unmodified part to obtain a second probability of the class; and adding the first probability and the second probability of each class to obtain the probability of the easy occurrence of the defects of each class.
Illustratively, the probability P (f) of the susceptibility to defects of class i in the version V of the software P to be tested is calculated by the following formulai):
Figure BDA0003426827770000101
S221, multiplying the defect proneness probability of each class with the coverage value of the test case to the corresponding class in the historical version respectively to obtain the test capability of the test case to each class.
Specifically, Cov (T)j,classi) Representative test case TjTest coverage, i.e. coverage value, for class i in version V-1 of software P if test case TjCovering at least one line of code in class i, cov (T)j,classi) 1, otherwise cov (T)j,classi) 0. On the basis, the test case TjThe test capability for class i can be expressed as: p (f)i)cov(Tj,classi)。
S222, adding the testing capability of the test case to each class to obtain the testing capability of the test case.
For example, the test case T can be expressed by the following formulajAdding the testing capability of each class, and calculating each test in the test case set TTest capability TC of use casej
TCj=∑P(fi)cov(Tj,classi)|classi∈C
Wherein, TCjRepresentative test case TjTest capability of (c), P (f)i) Representing the defect easiness of the class i in the version V to be tested of the software P; the set C is a residual coverage set, and initially contains all classes existing in the version V to be tested and the version V-1 of the software P.
S231, removing the test case with the maximum current test capability value from the test case set.
And S232, adding the removed test cases into the initially empty result sequence.
And the result sequence is a finally determined test case sequencing result for testing the current software version to be tested.
Specifically, after the test capability of the test implementation is determined, the test case with the maximum test capability is transferred to the result sequence, because the result sequence is empty, the test with the maximum test capability is executed first, that is, the test case with the maximum test capability is set to have the highest priority, so that the test capability is ensured to be sequentially converted into the test priority, and before the test case is transferred to the result sequence, the test case to be transferred is deleted in the test case set, so that the same test case can be prevented from being repeatedly subjected to test capability acquisition and transfer.
In addition, the residual coverage set C is updated while the test cases are removed or added into the result sequence, and the classes covered by the removed test cases are removed from the residual coverage set C. On the basis, after each test case with the maximum current test capability value is removed, the test case with the maximum test capability value can be continuously selected for the rest classes (namely the classes not covered by the removed test cases), and the test capability calculation and comparison of different test cases for the same class can be avoided, so that the test value of each test case for all classes is improved, and the reliability and the test effect of the sequencing result are ensured.
And S233, judging whether all the test cases in the test case set are removed. If not, the process returns to the step S231. If yes, the process returns to step S234.
S234, the test cases arranged according to the adding sequence in the result sequence are the priority sequencing result.
According to the embodiment of the invention, the probability of the easy occurrence of the defect is calculated by combining the prior probability and the conditional probability, so that the accuracy of the probability of the easy occurrence of the defect is improved; the test capability of the test case is obtained by adding the test capabilities of all the common types covered by the test case, so that the test capability is more effective and credible; the original test cases which are concentrated and unordered are converted into clear and definite priority sequencing in the result sequence according to the size of the test capability, so that the value and the sequencing reliability of the test cases are further improved.
On the basis of the foregoing embodiment, optionally, removing the test case with the largest current test capability value from the test case set includes:
and if more than one test case with the maximum value of the current test capability is used, selecting one test case to remove by adopting a random strategy.
Specifically, if the test capabilities of two test cases are completely the same in the process of calculating the test capabilities of different test cases, if both test cases are transferred to the result sequence, different priorities cannot be defined, and test resources are wasted when the test cases with the same test capabilities are used for testing respectively. Therefore, when the test cases with the same test capability are determined to appear, one of the test cases is selected to be removed by adopting a random strategy until only one test case with the same test capability is left, so that the effective sequencing of the priority based on the test capability is ensured, and the test value of the test case is further improved.
Fig. 3 is a block diagram of a test case sorting apparatus according to another embodiment of the present invention. The embodiment is applicable to the situation that different test case priorities are determined in the test case set, and the device can be realized in a software and/or hardware mode and can be configured in a computing device with corresponding data processing capacity. As shown in fig. 3, the apparatus may include:
the probability calculation module 310 is used for calculating the probability of easy occurrence of the defect of each class shared by the version of the software to be tested and the historical version;
the capability determining module 320 is used for calculating the testing capability of each test case according to the probability of the easy occurrence of the defects of each class;
the priority ranking module 330 is configured to rank the test cases according to the test capabilities of the test cases, so as to obtain a priority ranking result of the test cases. Optionally, the probability calculating module 310 includes a prior probability determining unit, a conditional probability determining unit, and a comprehensive probability calculating unit.
The device and the module can execute the test case sequencing method provided by any embodiment of the invention, and have the corresponding functional modules and beneficial effects of the execution method.
And the prior probability determining unit is used for determining the modified prior probability and the unmodified prior probability of each class according to the modification quantity of each class shared by the to-be-tested software version and the historical version.
The conditional probability determination unit is configured to estimate a conditional probability that the modified portion and the unmodified portion of each class contain defects based on the incoming and outgoing coupling metric values for each class.
And the comprehensive probability calculating unit is used for calculating the defect proneness probability of each class according to the modified prior probability and the unmodified prior probability of each class and the modified part and the unmodified part of each class containing the defect conditional probability.
Optionally, the conditional probability determination unit includes a modified conditional probability calculation subunit and an unmodified conditional probability calculation subunit.
And the modification conditional probability calculation subunit is used for estimating the conditional probability that the modified part of each class contains the defects according to the ratio of the incoming coupling metric value of each class to the maximum incoming coupling metric value.
And the unmodified conditional probability calculation subunit is used for estimating the conditional probability that the unmodified part of each class contains the defect according to the ratio of the outgoing coupling metric value and the maximum outgoing coupling metric value of each class.
And (4) optional. The comprehensive probability calculation unit includes a first probability calculation subunit, a second probability calculation subunit, and a comprehensive probability calculation subunit.
And the first probability calculation subunit is used for multiplying the modified prior probability of each class with the modified conditional probability of the modified part to obtain the first probability of the class.
And the second probability calculating subunit is used for multiplying the unmodified prior probability of each class by the unmodified conditional probability of the unmodified part to obtain the second probability of the class.
And the comprehensive probability calculating subunit is used for adding the first probability and the second probability of each class to obtain the probability of easy occurrence of the defects of each class.
Optionally, the capability determining module 310 is specifically configured to, for each test case, respectively multiply the probability of easy occurrence of a defect of each class by the coverage value of the test case to the corresponding class in the historical version, so as to obtain the testing capability of the test case to each class; and adding the test capability of the test case to each class to obtain the test capability of the test case.
Optionally, the priority ranking module 330 includes a test case removing unit and a ranking result determining unit.
The test case removing unit is used for removing the test case with the maximum current test capability value from the test case set and adding the removed test case into an initially empty result sequence.
The sorting result determining unit is configured to repeat the removing and adding operations until all test cases in the test case set are removed, and the test cases arranged according to the adding order in the result sequence are the priority sorting result.
Optionally, the test case removing unit is further configured to select one of the test cases to be removed by using a random strategy if more than one test case with the largest current test capability value exists.
The device, module, unit and subunit described above can execute the test case sequencing method provided by any embodiment of the present invention, and have the corresponding functional modules and beneficial effects of the execution method.
Fig. 4 is a schematic structural diagram of a computing device according to another embodiment of the present invention, as shown in fig. 4, the computing device includes a processor 40, a memory 41, an input device 42, and an output device 43; the number of processors 40 in the device may be one or more, and one processor 40 is taken as an example in fig. 4; the processor 40, the memory 41, the input means 42 and the output means 43 in the device may be connected by a bus or other means, as exemplified by the bus connection in fig. 4.
The memory 41, as a computer-readable storage medium, may be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the test case ranking in the embodiment of the present invention (for example, the probability calculation module 301, the capability determination module 302, and the prioritization module 303 in the test case ranking apparatus). The processor 40 executes various functional applications and data processing of the device by running software programs, instructions and modules stored in the memory 41, that is, implements the test case sequencing method described above.
The memory 41 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 41 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 41 may further include memory located remotely from processor 40, which may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 42 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the apparatus/terminal/server. The output device 43 may include a display device such as a display screen.
Yet another embodiment of the present invention also provides a storage medium containing computer-executable instructions which, when executed by a computer processor, perform a method of trial case ordering, the method comprising:
calculating the probability of easy occurrence of the defects of each class shared by the version of the software to be tested and the historical version;
calculating the testing capability of each test case according to the probability of easy occurrence of the defects of each class;
and sequencing the test cases according to the test capability of the test cases to obtain a priority sequencing result of the test cases.
Of course, the storage medium provided by the embodiment of the present invention includes computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and may also perform related operations in the test case sorting method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. With this understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random ACCess Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the above search apparatus, each included unit and module are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A test case ordering method is characterized by comprising the following steps:
calculating the probability of easy occurrence of the defects of each class shared by the version of the software to be tested and the historical version;
calculating the testing capability of each test case according to the probability of easy occurrence of the defects of each class;
and sequencing the test cases according to the test capability of the test cases to obtain a priority sequencing result of the test cases.
2. The method of claim 1, wherein calculating the probability of susceptibility to defects for each class common to the version of the software under test and the historical version comprises:
determining the prior probability of each class being modified and the prior probability of each class not being modified according to the modification quantity of each class shared by the software version to be tested and the historical version;
estimating a conditional probability that the modified portion and the unmodified portion of each class contain defects based on the incoming and outgoing coupling metric values for each class;
and calculating the defect proneness probability of each class according to the modified prior probability and the unmodified prior probability of each class and the modified part and the unmodified part of each class containing defects.
3. The method of claim 2, wherein estimating the conditional probability that the modified portion and the unmodified portion of each class contain defects based on the incoming and outgoing coupling metric values for each class comprises:
estimating a conditional probability that the modified portion of each class contains defects according to a ratio of the incoming coupling metric value to the maximum incoming coupling metric value for each class;
the conditional probability that the unmodified part of each class contains defects is estimated based on the ratio of the outgoing coupling metric value to the maximum outgoing coupling metric value for each class.
4. The method of claim 2, wherein calculating the probability of susceptibility to defects for each class based on the modified and unmodified prior probabilities for each class and the conditional probabilities that the modified and unmodified portions of each class contain defects comprises:
multiplying the modified prior probability of each class with the conditional probability of the modified part to obtain a first probability of the class;
multiplying the unmodified prior probability of each class by the unmodified conditional probability of the unmodified part to obtain a second probability of the class;
and adding the first probability and the second probability of each class to obtain the probability of the easy occurrence of the defects of each class.
5. The method of claim 1, wherein calculating the testability of each test case according to the probability of vulnerability to defects of each class comprises:
for each test case, multiplying the defect probability of each class by the coverage value of the test case to the corresponding class in the historical version to obtain the test capability of the test case to each class;
and adding the test capability of the test case to each class to obtain the test capability of the test case.
6. The method of claim 1, wherein ranking the test cases according to their testing capabilities to obtain a result of the priority ranking of the test cases comprises:
removing the test case with the maximum value of the current test capability from the test case set, and adding the removed test case into an initially empty result sequence;
repeating the removing and adding operations until all the test cases in the test case set are removed, wherein the test cases arranged according to the adding sequence in the result sequence are the priority sequencing result.
7. The method of claim 6, wherein removing the test case with the largest value of the current test capability from the test case set comprises:
and if more than one test case with the maximum value of the current test capability is used, selecting one test case to remove by adopting a random strategy.
8. A test case sorting apparatus, comprising:
the probability calculation module is used for calculating the defect probability of each class shared by the version of the software to be tested and the historical version;
the capability determining module is used for calculating the testing capability of each test case according to the probability of easy occurrence of the defects of each class;
and the priority ranking module is used for ranking the test cases according to the test capability of the test cases to obtain the priority ranking result of the test cases.
9. A computing device, comprising:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the test case sequencing method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the test case ranking method according to any of claims 1 to 7.
CN202111580368.6A 2021-12-22 2021-12-22 Test case sequencing method and device, computing equipment and storage medium Pending CN114281691A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111580368.6A CN114281691A (en) 2021-12-22 2021-12-22 Test case sequencing method and device, computing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111580368.6A CN114281691A (en) 2021-12-22 2021-12-22 Test case sequencing method and device, computing equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114281691A true CN114281691A (en) 2022-04-05

Family

ID=80873694

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111580368.6A Pending CN114281691A (en) 2021-12-22 2021-12-22 Test case sequencing method and device, computing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114281691A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996167A (en) * 2022-08-03 2022-09-02 成都星联芯通科技有限公司 Test case management method and device, storage medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996167A (en) * 2022-08-03 2022-09-02 成都星联芯通科技有限公司 Test case management method and device, storage medium and electronic equipment
CN114996167B (en) * 2022-08-03 2022-11-01 成都星联芯通科技有限公司 Test case management method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
US10671516B2 (en) Method, device, and computer program product for testing code
US9329981B2 (en) Testing program, testing method, and testing device
CN107924360B (en) Diagnostic framework in a computing system
CN108491302B (en) Method for detecting spark cluster node state
US7864679B2 (en) System utilization rate managing apparatus and system utilization rate managing method to be employed for it, and its program
EP3682324A1 (en) Method and apparatus for finding long methods in code
CN108647137B (en) Operation performance prediction method, device, medium, equipment and system
CN113342500B (en) Task execution method, device, equipment and storage medium
CN110647447A (en) Abnormal instance detection method, apparatus, device and medium for distributed system
CN115098292B (en) Method and device for identifying root cause of application program crash and electronic equipment
US9152423B2 (en) Method and apparatus for efficient loop instruction execution using bit vector scanning
US11663113B2 (en) Real time fault localization using combinatorial test design techniques and test case priority selection
CN114281691A (en) Test case sequencing method and device, computing equipment and storage medium
CN112685275A (en) Algorithm strategy searching method and device, electronic equipment and storage medium
CN116662674A (en) Service recommendation method and system based on efficient Markov blanket learning mechanism
CN115186738B (en) Model training method, device and storage medium
CN116166967A (en) Data processing method, equipment and storage medium based on meta learning and residual error network
US20220342395A1 (en) Method and system for infrastructure monitoring
CN113141407B (en) Page resource loading method and device and electronic equipment
CN115329143A (en) Directed acyclic graph evaluation method, device, equipment and storage medium
CN114385398A (en) Request response state determination method, device, equipment and storage medium
CN114461390A (en) Evaluation method combining multi-dimensional analysis and critical path method and related device
CN110442508B (en) Test task processing method, device, equipment and medium
CN112580869A (en) Service optimization method, device and equipment
TWI782845B (en) Configuration setting prediction system and method for general-purpose graphics processor core functions

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination