Movatterモバイル変換


[0]ホーム

URL:


CN113076255A - Program testing method and device - Google Patents

Program testing method and device
Download PDF

Info

Publication number
CN113076255A
CN113076255ACN202110416225.5ACN202110416225ACN113076255ACN 113076255 ACN113076255 ACN 113076255ACN 202110416225 ACN202110416225 ACN 202110416225ACN 113076255 ACN113076255 ACN 113076255A
Authority
CN
China
Prior art keywords
test
probability
test case
program
modified
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
CN202110416225.5A
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.)
Beijing Jingdong Tuoxian Technology Co Ltd
Original Assignee
Beijing Jingdong Tuoxian Technology Co Ltd
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 Beijing Jingdong Tuoxian Technology Co LtdfiledCriticalBeijing Jingdong Tuoxian Technology Co Ltd
Priority to CN202110416225.5ApriorityCriticalpatent/CN113076255A/en
Publication of CN113076255ApublicationCriticalpatent/CN113076255A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本申请提供了一种程序测试方法和装置,所述方法包括:获取第N次修改后的程序对应的漏测概率测试用例集MN;根据第N+1次对程序修改的语句的类型,以及MN确定第N+1次修改后的程序对应的漏测概率测试用例集MN+1;获取MN+1中漏测概率大于预设阈值的测试用例组成回归测试用例集;使用所述回归测试用例集对第N+1次修改后的程序进行测试;其中,漏测概率测试用例集包括测试用例,以及测试用例对应的漏测概率。该方法能够减少测试时间,提高测试效率。

Figure 202110416225

The present application provides a program testing method and device, the method comprising: acquiring a missing-test probability test case set MN corresponding to theNth modified program; And MN determines the missed test probability test case set MN+1 corresponding to theN +1 th modified program; obtains the test cases whose missed test probability in MN+1 is greater than the preset threshold to form a regression test case set; The regression test case set is used to test the program after the N+1th modification; wherein, the missed test probability test case set includes the test case and the missed test probability corresponding to the test case. The method can reduce the test time and improve the test efficiency.

Figure 202110416225

Description

Program testing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a program testing method and apparatus.
Background
In the process of requirement development, frequent iteration requirements often occur, codes are often modified, and then testers are required to perform regression testing on the modified codes to avoid new problems caused by the modified codes.
For a scenario in which only function optimization or function error modification is performed, the prior art directly uses the same test case set as before the program modification to perform regression testing.
In the process of implementing the application, the inventor finds that after a program is modified each time, regression testing is performed by using all test cases, so that the testing time is long, and the testing efficiency is low.
Disclosure of Invention
In view of this, the present application provides a program testing method and apparatus, which can reduce testing time and improve testing efficiency.
In order to solve the technical problem, the technical scheme of the application is realized as follows:
in one embodiment, there is provided a program testing method, the method comprising:
obtaining a test case set M of the probability of missing test corresponding to the program modified for the Nth timeN(ii) a The test case set of the test case with the test missing probability comprises test cases and test missing probabilities corresponding to the test cases;
type of statement modified for program according to N +1 th time, and MNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1
Obtaining MN+1Test cases with the middle and missing test probability larger than a preset threshold value form a regression test case set;
and testing the program modified for the (N + 1) th time by using the regression test case set.
In another embodiment, there is provided a program test apparatus, the apparatus comprising: the device comprises a first acquisition unit, a determination unit, a second acquisition unit and a test unit;
the first obtaining unit is used for obtaining a missed test probability test case set M corresponding to the program modified for the Nth timeN(ii) a The test case set of the test case with the test missing probability comprises test cases and test missing probabilities corresponding to the test cases;
the determining unit is used for modifying the program according to the type of the statement modified by the (N + 1) th time, and the M acquired by the first acquiring unitNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1
The second obtaining unit is used for obtaining the M determined by the determining unitN+1Test cases with the middle and missing test probability larger than a preset threshold value form a regression test case set;
and the testing unit is used for testing the program modified for the (N + 1) th time by using the regression test case set acquired by the second acquiring unit.
In another embodiment, an electronic device is provided comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the program testing method when executing the program.
In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the program testing method.
According to the technical scheme, the test case set of the missed measure probability of the modified program is obtained, the test cases with the missed measure probability larger than the preset probability are obtained to form the regression test case set, and the regression test case set is used for testing the modified program. The scheme can reduce the test time and improve the test efficiency.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 is a schematic flow chart illustrating a process of determining a probability of missed test for each test case in a test case set according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating a process flow of program testing in an embodiment of the present application;
FIG. 3 is a schematic flow chart illustrating a test case set for determining a probability of missing test corresponding to a modified program according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a program testing apparatus according to an embodiment of the present application;
fig. 5 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements explicitly listed, but may include other steps or elements not explicitly listed or inherent to such process, method, article, or apparatus.
The technical solution of the present invention will be described in detail with specific examples. Several of the following embodiments may be combined with each other and some details of the same or similar concepts or processes may not be repeated in some embodiments.
The embodiment of the application provides a program testing method, which is applied to a scene of performing regression testing after function optimization or function error modification of a program, obtains a test case set with a missing test probability of the modified program, obtains a regression test case set formed by test cases with the missing test probability being larger than a preset probability, and tests the modified program by using the regression test case set. The scheme can reduce the test time and improve the test efficiency.
In the embodiment of the application, when testing is performed on an original program, namely an unmodified program, the testing is consistent with the existing implementation, and the written test case set is directly adopted for testing.
The newly added content in the embodiment of the application is that after the unmodified program is tested and the on-line operation is performed, the program needs to be modified, and before the modified program is tested, a test missing probability test case set M corresponding to the unmodified program is generated0The test case set of the test case with the test missing probability comprises the test cases and the test missing probability corresponding to the test cases. The specific generation mode is as follows:
obtaining a test case set for testing an unmodified program, estimating the probability of missing test for each test case in the test case set, and forming a test case set M with the probability of missing test corresponding to the unmodified program0
The probability of missing test of the test case refers to the probability that no defect is found after the test case is executed, but the defect occurs after the test case is operated on line; the specific implementation of how to obtain the missing test probability of each test case is as follows:
referring to fig. 1, fig. 1 is a schematic flow chart illustrating a process of determining a probability of missed test for each test case in a test case set according to an embodiment of the present application. The method comprises the following specific steps:
step 101, a test case set for testing an unmodified program is obtained.
102, obtaining the probability of the statement covering the error, the probability of the error intermediate state and the probability of the output error result corresponding to each test case in the test case set.
And the probability of covering the error statement is the probability of covering the corresponding error statement when the test case test is executed.
In the embodiment of the present application, obtaining the probability of the statement that covers the error includes:
static scanning is carried out on the program, and an error statement is obtained;
in the process of executing each test case, recording executed sentences and unexecuted sentences in an inserting mode;
and determining that the probability that the test case is executed to the corresponding wrong statement is the probability that the test case covers the wrong statement.
Wherein, the static scanning of the program can use sonarQube to perform static scanning of the program (code); and checking whether the scanned error program is executed or not, and if the error program is covered, determining that the probability of covering the error statement in the execution of the corresponding error statement is 1, namely the probability of covering the error statement of the test case is 1.
The probability of the error intermediate state is the probability of the error intermediate state generated after the error sentence is executed.
In the embodiment of the present application, obtaining the probability of the occurrence of the erroneous intermediate state includes:
and acquiring the probability of the occurrence of the wrong intermediate state set for the test case.
And after the system is on-line once, the running case is checked back, and whether the error intermediate state is generated or not is checked from the code to obtain the probability of the error intermediate state. Or experience estimation is adopted for some specific scenes, and the probability of generating an error intermediate state is estimated through experience when a test case is written for verification on the assumption that a tester walks through the logic of a certain developed code.
The probability of the error intermediate state of the test case obtained in any way is set and stored, and the set value is directly obtained when the test case is used.
The probability of outputting the error result is the probability that the error statement generates an error intermediate state after being executed, and the output result is an error after the error intermediate state is executed.
In the embodiment of the present application, obtaining the probability of outputting the error result includes:
when the erroneous intermediate state result is used as calculability, the error probability of the intermediate state result is taken as the probability of outputting the erroneous result;
if the result variable of the intermediate state is faulty, and the result returned by the method is definitely wrong if the variable is taken as an entry of another method. That is, the probability of the intermediate state error is closely related to the probability of the output result, so that the probability of the output error result can be approximately equal to the probability of the intermediate state error result according to the error probability of the intermediate state result.
When the erroneous intermediate state result is used as one control branch of the control flow, the product of the probabilities of whether all the branch expressions are erroneous is used as the probability of outputting the erroneous result.
Control flow usage, which refers to the result of intermediate states, is one use of control flow.
When the value of the wrong intermediate state result is used in a branch statement conditional expression, a program execution path error results. The factor affecting the execution result is therefore whether the expressions of the branch statement execute incorrectly, so the product of the probabilities of whether all branch expressions are incorrect can be used as the probability of error of the output result.
The probability calculation mode of whether the branch expressions are wrong is that all the executed branch expressions are found firstly, after the system is on line, a certain use case is checked reversely to see that the use case executes a wrong program and is an intermediate state which generates errors, and then the value of the error intermediate state is judged whether to be executed by the branch statement expressions or not, and the probability is estimated.
And 103, determining that the test case missing probability is the product of the probability of the error covering statement, the probability of the error intermediate state and the probability of the output error result.
Thus, the 0 th modified program, that is, the test case set of the probability of missing test corresponding to the unmodified program is obtained.
The process of testing the modified program will be described in detail below with reference to the accompanying drawings.
Referring to fig. 2, fig. 2 is a schematic view illustrating a program testing process in the embodiment of the present application. The method comprises the following specific steps:
step 201, obtaining a missed test probability test case set M corresponding to the program modified for the Nth timeN
The test case set can be determined to be directly used when needed, and can also be pre-estimated and stored, and the stored test case set with the probability of missing test can be directly obtained when in use.
In this embodiment, N is an integer not less than 0, and when N is 0, it refers to the program modified at 0 th time, that is, the test case set of the probability of missing test corresponding to the original program.
When N is 0, acquiring a test case set for testing an unmodified program, estimating the test missing probability of each test case in the test case set, and forming a test case set with the test missing probability corresponding to the unmodified program;
when N is 1, obtaining a test case set M of the test probability corresponding to the program modified for the 1 st time according to the type of the statement modified for the program for the 1 st time and the test case set of the test probability corresponding to the unmodified program1
When N is an integer larger than 1, according to the type of the statement modified for the program for the (N-1) th time and the test-missing probability test case set M corresponding to the modified program for the (N-1) th timeN-1Obtaining a test case set M of the probability of missing test corresponding to the program modified for the Nth timeN
Step 202, according to the type of the statement modified for the program at the N +1 th time, and MNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1
The determination of the test case set of the test probability corresponding to the modified program according to the test case set of the test probability corresponding to the program before the modification is described in detail below with reference to the drawings.
The statement types include: operation statements and flow control statements;
the operation statement refers to a statement containing an operation symbol in java, such as an arithmetic operator, a valuation operator, a self-increment and self-decrement cloud operator, a logical operator and a ternary operator.
The flow control statement includes a sequential structure, a branch structure (if, switch), and a loop structure (for, while, do … while).
If the memories are consistent, if the memories are respectively stored in the stack memory and the heap memory, the memories are determined to be stored in different memories; if both are stored in stack memory, or both are stored in heap memory, then the memories are determined to be the same.
The java virtual machine memory comprises a heap memory, a stack memory and a program counter, wherein local variables are stored in the stack memory, a new object is stored in the heap memory, and the program counter stores byte code instructions for recording a program.
Referring to fig. 3, fig. 3 is a schematic flowchart of determining a test case set of the missed measure probability corresponding to the modified program in the embodiment of the present application. The method comprises the following specific steps:
step 301 determines the type of statement modified, and the storage location of the intermediate result.
Step 302, when the modified statement is an operation statement and the intermediate result is in the same memory, the M is executedNAs MN+1. The flow is ended.
The modified statement is an operation statement, and before and after modification, the intermediate result of the statement is executed in the same memory. Therefore, the test missing probability in the test missing case set corresponding to the program before modification can be approximately equal to the test missing probability corresponding to the modified test case.
Examples are as follows:
the modified statement is x, which is an operation statement, for example, x ═ a + b, and intermediate results generated by the programs before and after modification in executing the statement all exist in the same stack memory, and M is stored in the same stack memoryNAs MN+1That is, the probability of missing test for each test case is not changed.
Step 303, when the modified statement is an operation statement and the intermediate result is not in the same memory, MN+1The probability of missing test corresponding to the middle test case is 1 and MNThe difference of the missed test probabilities of the corresponding test cases. The flow is ended.
The modified statement is an operation statement, and before and after modification, intermediate results of executing the statement are stored in different memories. Therefore, the difference value of the missed measure probability in the missed measure case set corresponding to the program before modification and 1 can be used as the missed measure probability corresponding to the modified test case.
The method comprises the following specific steps: the statement before modification is an operation statement x ═ a + b, the value of a + b is stored in x, the program operation statement after modification is changed into y ═ a × b, the statement after modification does not assign x, assigns y, and the values stored in variables x and y are changed when the operation statement is executed. The probability of missing test of each test case corresponding to the modified program is as follows: 1-corresponding probability of missed measure before modification.
Step 304, when the type of the modified statement is a flow control statement, M is addedNAs MN+1
When the modified statement is a flow control statement, the execution path before and after modification may change, but the testing validity of each test case on the modified statement can be reflected to a certain extent, and M is directly usedNAs MN+1That is, the probability of missing test for each test case is not changed.
In this step, M is determinedN+1During the process, the regression test set can be determined currently, and the regression test set can be stored, so that the program can be modified for the (N + 2) th time in the following to directly obtain the regression test case for determination.
Step 203, obtaining MN+1And forming a regression test case set by the test cases with the middle and missing test probability larger than the preset threshold value.
The setting of the preset threshold may be set according to actual needs, or empirically, such as setting 60%, which is not limited in the embodiments of the present application.
And filtering the test cases with the test missing probability not greater than the preset threshold value, so that part of the test cases can be reduced.
And 204, testing the program modified for the (N + 1) th time by using the regression test case set.
In the embodiment of the application, the probability of missing test after each use case is on line is evaluated to generate a test case missing probability use case set of the test use cases. And the test case set of the missed test probability is used as a basis to evaluate the modified program and execute the probability of the missed test of each test case. Through the two key points, the test cases with high occurrence rate of missing test are selected, and a new regression case set is generated, so that the number of the test cases in the regression test case set is reduced, the regression case set obtained by the method is used for testing the modified program, the test time can be shortened, and the test efficiency is improved.
Based on the same inventive concept, the embodiment of the application also provides a program testing device. Referring to fig. 4, fig. 4 is a schematic structural diagram of a program testing device in an embodiment of the present application. The device comprises: afirst acquisition unit 401, adetermination unit 402, asecond acquisition unit 403, and atest unit 404;
a first obtainingunit 401, configured to obtain a missing test probability test case set M corresponding to the nth modified programN(ii) a The test case set of the test case with the test missing probability comprises test cases and test missing probabilities corresponding to the test cases;
adetermination unit 402 for determining the type of the statement for program modification according to the (N + 1) th time, and M acquired by thefirst acquisition unit 401NDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1
A second obtainingunit 403 for obtaining M determined by the determiningunit 402N+1Test cases with the middle and missing test probability larger than a preset threshold value form a regression test case set;
thetesting unit 404 is configured to test the program modified at the (N + 1) th time by using the regression test case set acquired by the second acquiringunit 403.
Preferably, the apparatus further comprises: a storage unit;
the storage unit is configured to use the test case set M of the missed measure probability corresponding to the program modified for the (N + 1) th time determined by the determiningunit 402N+1And (5) storing.
Preferably, the first and second electrodes are formed of a metal,
afirst acquisition unit 401, in particular forWhen the missed measure probability test case set corresponding to the program modified for the Nth time is obtained, the method comprises the following steps: when N is 0, acquiring a test case set for testing an unmodified program, estimating the test missing probability of each test case in the test case set, and forming a test case set with the test missing probability corresponding to the unmodified program; when N is 1, obtaining a test case set M of the test probability corresponding to the program modified for the 1 st time according to the type of the statement modified for the program for the 1 st time and the test case set of the test probability corresponding to the unmodified program1(ii) a When N is an integer larger than 1, according to the type of the statement modified for the program for the (N-1) th time and the test-missing probability test case set M corresponding to the modified program for the (N-1) th timeN-1Obtaining a test case set M of the probability of missing test corresponding to the program modified for the Nth timeN
Preferably, the first and second electrodes are formed of a metal,
the first obtainingunit 401 is specifically configured to obtain a test case set for testing an unmodified program, and when a test missing probability is estimated for each test case in the test case set, the obtaining unit includes: acquiring a test case set for testing an unmodified program; acquiring the probability of error covering sentences, the probability of error intermediate state occurrence and the probability of output error results corresponding to each test case in the test case set; and determining the probability of missing test of the test case as the product of the probability of the statement covering the error, the probability of the error intermediate state and the probability of outputting the error result.
Preferably, the first and second electrodes are formed of a metal,
a first obtainingunit 401, specifically configured to perform static scanning on a program and obtain an error statement; in the process of executing each test case, recording executed sentences and unexecuted sentences in an inserting mode; determining the probability that the test case is executed to the corresponding wrong statement as the probability that the test case covers the wrong statement; acquiring the probability of the occurrence of the wrong intermediate state set for the test case; when the erroneous intermediate state result is used as calculability, the error probability of the intermediate state result is taken as the probability of outputting the erroneous result; when the erroneous intermediate state result is used as one control branch of the control flow, the product of the probabilities of whether all the branch expressions are erroneous is used as the probability of outputting the erroneous result.
Preferably, the first and second electrodes are formed of a metal,
adetermination unit 402, in particular for the type of statement according to the N +1 th modification of the program, and MNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1And then, includes: when the type of the modified statement is an operation statement and the intermediate result is in the same memory, M is addedNAs MN+1(ii) a When the modified statement is an operation statement and the intermediate result is not in the same memory, MN+1The probability of missing test corresponding to the middle test case is 1 and MNThe difference value of the test missing probability of the corresponding test case; when the modified statement is a flow control statement, M is addedNAs MN+1
The units of the above embodiments may be integrated into one body, or may be separately deployed; may be combined into one unit or further divided into a plurality of sub-units.
In another embodiment, an electronic device is also provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the program testing method when executing the program.
In another embodiment, a computer readable storage medium is also provided, having stored thereon computer instructions, which when executed by a processor, may implement the steps in the program test method.
Fig. 5 is a schematic physical structure diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 5, the electronic device may include: a Processor (Processor)510, a communication Interface (Communications Interface)520, a Memory (Memory)530 and acommunication bus 540, wherein theProcessor 510, thecommunication Interface 520 and theMemory 530 communicate with each other via thecommunication bus 540.Processor 510 may call logic instructions inmemory 530 to perform the following method:
obtaining a test case set M of the probability of missing test corresponding to the program modified for the Nth timeN
Type of statement modified for program according to N +1 th time, and MNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1
Obtaining MN+1Test cases with the middle and missing test probability larger than a preset threshold value form a regression test case set;
testing the program modified for the (N + 1) th time by using the regression test case set;
the test case set with the test case missing probability comprises test cases and test cases corresponding to the test cases missing probability.
Furthermore, the logic instructions in thememory 530 may be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of program testing, the method comprising:
obtaining a test case set M of the probability of missing test corresponding to the program modified for the Nth timeN(ii) a The test case set of the test case with the test missing probability comprises test cases and test missing probabilities corresponding to the test cases;
type of statement modified for program according to N +1 th time, and MNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1
Obtaining MN+1Test cases with the middle and missing test probability larger than a preset threshold value form a regression test case set;
and testing the program modified for the (N + 1) th time by using the regression test case set.
2. The method of claim 1, further comprising:
the obtained test case set M of the missed measure probability corresponding to the program modified for the (N + 1) th timeN+1And (5) storing.
3. The method of claim 1, wherein obtaining the test case set of the probability of missing test corresponding to the nth modified program comprises:
when N is 0, acquiring a test case set for testing an unmodified program, estimating the test missing probability of each test case in the test case set, and forming a test case set with the test missing probability corresponding to the unmodified program;
when N is 1, obtaining a test case set M of the test probability corresponding to the program modified for the 1 st time according to the type of the statement modified for the program for the 1 st time and the test case set of the test probability corresponding to the unmodified program1
When N is an integer larger than 1, according to the type of the statement modified for the program for the (N-1) th time and the test-missing probability test case set M corresponding to the modified program for the (N-1) th timeN-1Obtaining a test case set M of the probability of missing test corresponding to the program modified for the Nth timeN
4. The method of claim 1, wherein obtaining a set of test cases for testing an unmodified program, and estimating a probability of missed testing for each test case in the set of test cases comprises:
acquiring a test case set for testing an unmodified program;
acquiring the probability of error covering sentences, the probability of error intermediate state occurrence and the probability of output error results corresponding to each test case in the test case set;
and determining the probability of missing test of the test case as the product of the probability of the statement covering the error, the probability of the error intermediate state and the probability of outputting the error result.
5. The method according to claim 4, wherein the obtaining of the probability of the statement covering the error, the probability of the occurrence of the intermediate state of the error, and the probability of the output of the error result corresponding to each test case in the test case set comprises:
obtaining the probability of the statement covering the error, including:
static scanning is carried out on the program, and an error statement is obtained;
in the process of executing each test case, recording executed sentences and unexecuted sentences in an inserting mode;
determining the probability that the test case is executed to the corresponding wrong statement as the probability that the test case covers the wrong statement;
obtaining a probability of the erroneous intermediate state occurring, comprising:
acquiring the probability of the occurrence of the wrong intermediate state set for the test case;
obtaining a probability of the output error result, including:
when the erroneous intermediate state result is used as calculability, the error probability of the intermediate state result is taken as the probability of outputting the erroneous result;
when the erroneous intermediate state result is used as one control branch of the control flow, the product of the probabilities of whether all the branch expressions are erroneous is used as the probability of outputting the erroneous result.
6. The method according to any one of claims 1-5, wherein the type of the statement that is modified according to the (N + 1) th pair of programs, and MNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1The method comprises the following steps:
when the type of the modified statement is an operation statement and the intermediate result is in the same memory, M is addedNAs MN+1
When the modified statement is an operation statement and the intermediate result is not in the same memory, MN+1The probability of missing test corresponding to the middle test case is 1 and MNThe difference value of the test missing probability of the corresponding test case;
when the modified statement is a flow control statement, M is addedNAs MN+1
7. A program testing apparatus, characterized in that the apparatus comprises: the device comprises a first acquisition unit, a determination unit, a second acquisition unit and a test unit;
the first obtaining unit is used for obtaining a missed test probability test case set M corresponding to the program modified for the Nth timeN(ii) a The test case set of the test case with the test missing probability comprises test cases and test missing probabilities corresponding to the test cases;
the determining unit is used for modifying the program according to the type of the statement modified by the (N + 1) th time, and the M acquired by the first acquiring unitNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1
The second obtaining unit is used for obtaining the M determined by the determining unitN+1Test cases with the middle and missing test probability larger than a preset threshold value form a regression test case set;
and the testing unit is used for testing the program modified for the (N + 1) th time by using the regression test case set acquired by the second acquiring unit.
8. The apparatus of claim 7,
the determining unit is specifically used for determining the type of the statement modified by the program according to the (N + 1) th time, and MNDetermining a test case set M of the probability of missing test corresponding to the program modified for the (N + 1) th timeN+1And then, includes: when the type of the modified statement is an operation statement and the intermediate result is in the same memory, M is addedNAs MN+1(ii) a When the modified statement is an operation statement and the intermediate result is not in the same memory, MN+1The probability of missing test corresponding to the middle test case is 1 and MNThe difference value of the test missing probability of the corresponding test case; when the modified statement is a flow control statement, M is addedNAs MN+1
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1-6 when executing the program.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the method of any one of claims 1 to 6.
CN202110416225.5A2021-04-192021-04-19Program testing method and devicePendingCN113076255A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202110416225.5ACN113076255A (en)2021-04-192021-04-19Program testing method and device

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202110416225.5ACN113076255A (en)2021-04-192021-04-19Program testing method and device

Publications (1)

Publication NumberPublication Date
CN113076255Atrue CN113076255A (en)2021-07-06

Family

ID=76617965

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202110416225.5APendingCN113076255A (en)2021-04-192021-04-19Program testing method and device

Country Status (1)

CountryLink
CN (1)CN113076255A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8276123B1 (en)*2008-07-222012-09-25Juniper Networks, Inc.Adaptive regression test selection within testing environments
CN102750153A (en)*2012-06-292012-10-24南京大学Regression testing case set construction method based on program change
CN105528293A (en)*2015-12-142016-04-27苏州洞察云信息技术有限公司System and method for selecting test case for regression test
JP2016164727A (en)*2015-03-062016-09-08株式会社 日立産業制御ソリューションズTest case selection device
CN109992498A (en)*2017-12-292019-07-09北京京东尚科信息技术有限公司Generation method and system, the computer system of test case
CN111274126A (en)*2020-01-142020-06-12华为技术有限公司Test case screening method, device and medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8276123B1 (en)*2008-07-222012-09-25Juniper Networks, Inc.Adaptive regression test selection within testing environments
CN102750153A (en)*2012-06-292012-10-24南京大学Regression testing case set construction method based on program change
JP2016164727A (en)*2015-03-062016-09-08株式会社 日立産業制御ソリューションズTest case selection device
CN105528293A (en)*2015-12-142016-04-27苏州洞察云信息技术有限公司System and method for selecting test case for regression test
CN109992498A (en)*2017-12-292019-07-09北京京东尚科信息技术有限公司Generation method and system, the computer system of test case
CN111274126A (en)*2020-01-142020-06-12华为技术有限公司Test case screening method, device and medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
王晓琳等: "敏捷开发环境中的回归测试优化技术", 计算机学报, vol. 42, no. 10, 31 October 2019 (2019-10-31)*
边毅;袁方;郭俊霞;李征;赵瑞莲;: "面向CPU+GPU异构计算的多目标测试用例优先排序", 软件学报, no. 04, 30 April 2016 (2016-04-30)*
郑炜;杨喜兵;胡圣佑;付荣亮;李绍奇;张帆;: "基于变异分析和覆盖准则的回归测试用例集缩减", 西北工业大学学报, no. 03, 15 June 2017 (2017-06-15)*

Similar Documents

PublicationPublication DateTitle
US7353505B2 (en)Tracing the execution path of a computer program
CN113434396A (en)Interface test method, device, equipment, storage medium and program product
US10585668B2 (en)Processor testing using randomly generated branch instructions
CN113590454B (en) Test method, device, computer equipment and storage medium
CN111597110A (en)Page testing method and device, electronic equipment and storage medium
CN110688313B (en)Fault injection method for software testing under VxWorks operating system
EP3264274B1 (en)Input discovery for unknown program binaries
CN107547299A (en)A kind of method of testing and system
CN113704123A (en)Interface test method, device, equipment and storage medium
CN116414722A (en) Fuzz test processing method, device, fuzz test system and storage medium
CN112346977A (en)Quantum cloud computing platform software function evaluation method and device
CN112417449B (en)Abnormal behavior detection method, device, storage medium and apparatus
CN114338846B (en)Message testing method and device
CN112100077B (en)Transaction testing method and device
EP2820547B1 (en)Debugging method and computer program product
CN113076255A (en)Program testing method and device
CN115276844B (en)Communication module testing method and device, storage medium and electronic equipment
JP4957521B2 (en) Software partial test system, method and program used therefor
CN112466383B (en)Test method, test device and test equipment for arbitration reliability of storage system
US20100293018A1 (en)Test Model Abstraction For Testability in Product Line Engineering
CN111427762A (en)Automatic calling tool analysis techniques
JP6974707B2 (en) Test program, test equipment and test method
CN114201388A (en)Python function-based dynamic baffle testing method and related device
CN120276962A (en)Program code debugging method, device, equipment and storage medium
JP2001051864A (en) Test execution method for data processing equipment

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination

[8]ページ先頭

©2009-2025 Movatter.jp