CN112035343B - Test case generation method and system based on Bayesian estimation - Google Patents

Test case generation method and system based on Bayesian estimation Download PDF

Info

Publication number
CN112035343B
CN112035343B CN202010811550.7A CN202010811550A CN112035343B CN 112035343 B CN112035343 B CN 112035343B CN 202010811550 A CN202010811550 A CN 202010811550A CN 112035343 B CN112035343 B CN 112035343B
Authority
CN
China
Prior art keywords
sub
region
test case
found
test
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.)
Active
Application number
CN202010811550.7A
Other languages
Chinese (zh)
Other versions
CN112035343A (en
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.)
Wuhan University WHU
Original Assignee
Wuhan University WHU
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 Wuhan University WHU filed Critical Wuhan University WHU
Priority to CN202010811550.7A priority Critical patent/CN112035343B/en
Publication of CN112035343A publication Critical patent/CN112035343A/en
Application granted granted Critical
Publication of CN112035343B publication Critical patent/CN112035343B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N7/00Computing arrangements based on specific mathematical models
    • G06N7/01Probabilistic graphical models, e.g. probabilistic networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Optimization (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Analysis (AREA)
  • Data Mining & Analysis (AREA)
  • Pure & Applied Mathematics (AREA)
  • Computing Systems (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Artificial Intelligence (AREA)
  • Algebra (AREA)
  • Probability & Statistics with Applications (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a test case generation method and a test case generation system based on Bayesian estimation, which comprises the following steps of dividing an input domain of software into a plurality of sub-regions, distinguishing a boundary region of the input domain from an inner region, and taking the boundary region as the sub-region with the highest priority; a Bayesian estimation mode is introduced, the probability that the sub-region in the inner region possibly contains the failure region is estimated, and the sub-regions in the inner region are sequenced based on the probability; generating test cases according to the priority order of the sub-regions until a software error is found; and if the number of the test cases reaches the preset condition and no software error is found yet, continuing to generate the test cases in the sub-area with the highest priority until the software error is found. The method can well solve the problem of huge calculation overhead of the existing ART method, solves the problem of boundary effect of the ART method to a certain extent, and simultaneously improves the operation efficiency.

Description

Test case generation method and system based on Bayesian estimation
Technical Field
The invention relates to the technical field of computers, in particular to a test case generation method and system based on Bayesian estimation.
Background
Software testing is an important link in the software development process, the whole system or part of modules can be operated by manual or automatic means, and whether the whole or local functions of the software meet the specified requirements or not is judged according to whether the expected result is consistent with the actual result or not. Currently, the variety of technologies in the field of software testing is quite large, and the most common software testing technologies are white box testing, gray box testing and black box testing. However, no matter which test method the tester chooses to use, it is almost impossible to completely test the input field of the software, and therefore it is common practice to select test cases from some representative subset of the input field of the software for testing.
Random testing is the random generation of test cases required for experiments in the input domain. But this method is not highly capable of finding errors due to its randomness to generate test cases.
Aiming at the defect that the random test has poor error finding capability, the random test is improved, and the ART method (adaptive random test) is proposed in the prior ART, wherein the classical ART method belongs to an adaptive random test method with a fixed candidate set scale. The FSCS-ART method (adaptive random test of a fixed candidate set) greatly improves the error finding capability by ensuring that test cases are more uniformly distributed in a software input domain.
However, the FSCS-ART method introduces a large number of distance calculations, resulting in a significant overhead of system computing resources for the method. Due to the characteristic that the FSCS-ART selects the test cases, the test cases selected for testing the software are easy to accumulate at the boundary of the software input domain, so that the effect of detecting the software error is influenced, namely the boundary effect.
Patent application 201811501282.8 proposes an adaptive random test method based on iterative region averaging and localization.
Patent application 201911030817.2 proposes an adaptive random test case generation method based on a central point compensation strategy.
The two methods divide an input domain, but the selection of the divided sub-regions for generating the test case is random, so that the problem of high calculation overhead of the traditional ART method is solved to a certain extent, but the blindness of the random selection of the sub-regions cannot well improve the test efficiency. Therefore, a new technical scheme with practical application significance is urgently needed to be proposed in the technical field.
Disclosure of Invention
The invention aims to provide a test case generation scheme based on Bayesian estimation, aiming at the problems that the calculation cost of the method is very large due to a large amount of distance calculation in the prior art, and the boundary effect that test cases are easy to accumulate at the boundary of a software input domain is caused.
The technical scheme of the invention provides a test case generation method based on Bayesian estimation, which comprises the following steps,
step S1, dividing the input domain of the software into a plurality of sub-regions, distinguishing the boundary region of the input domain from the internal region, and taking the boundary region as the sub-region with the highest priority;
step S2, a Bayesian estimation mode is introduced, the probability that the sub-region in the inner region possibly contains the failure region is estimated, and the sub-regions in the inner region are sorted based on the probability;
step S3, generating test cases according to the priority order of the sub-regions until a software error is found; and if the number of the test cases reaches the preset condition and no software error is found yet, continuing to generate the test cases in the sub-area with the highest priority until the software error is found.
Further, step S1 includes the following sub-steps,
s1.1, setting the boundary length of the internal area according to the failure rate of the input area to obtain a boundary area outside the internal area, and recording the boundary area as D1;
step S1.2, the priority of the bounding region D1 is ranked first, and the inner region is divided into two parts of the same size, denoted as sub-regions D2 and D3.
When the input field is a two-dimensional square, the boundary length of the inner region is set as follows,
Figure BDA0002631147010000021
wherein b is the side length of the internal region, a is the side length of the input domain of the whole body, and theta is failure rate.
Further, step S2 includes the following sub-steps,
s2.1, randomly generating 1000 test cases in the two inner sub-areas D2 and D3 respectively, and counting the number of the test cases in which the software errors are found respectively;
s2.2, replacing the probability that the sub-region can find the software error by the probability that the test case finds the error and falls in the sub-region;
s2.3, a Bayesian estimation method is applied, and prior distribution is given by combining prior information;
step S2.4, generating the joint condition distribution of the samples through the extracted samples;
s2.5, solving the joint distribution by combining the prior distribution and the joint condition distribution of the sample;
s2.6, solving a marginal probability function through combined distribution to obtain posterior distribution;
s2.7, taking the mean value of the posterior distribution as the estimation of probability;
s2.8, sorting the priorities of the two inner subregions D2 and D3 by comparing the probability;
step S2.9, further dividing the two internal sub-regions into two parts with the same size, respectively, assuming that the sub-region D2 is divided into D4 and D5, D3 is divided into D6 and D7, repeating the above steps S2.1 to S2.8 for D4 and D5, and repeating the above steps S2.1 to S2.8 for D6 and D7;
step S2.10, the priorities of all the divided sub-regions are sorted, and the priority order of the sub-regions D1, D4, D5, D6 and D7 is determined.
Furthermore, step S3 is implemented as follows,
1) firstly, continuously generating a test case from a boundary region with the highest priority, executing a test, and stopping if a software error is found; if no software error is found and the total test case generation number reaches a preset threshold value, generating a test case in a sub-area with the second priority and executing the test, and if the software error is found, stopping the test; if no software error is found and the total test case generation number reaches a preset threshold value, generating a test case in a third priority subregion, executing the test, and stopping if the software error is found; by analogy, after the priority level is continuously reduced, if no software error is found in the sub-region with the lowest priority level and the total test case generation number reaches a preset threshold value, entering the step 2);
2) if the step 1) has been executed once currently, returning to execute the step 1), if the step 1) has been executed twice repeatedly currently, continuing to generate the test case only in the boundary area with the highest priority, and executing the test until a software error is found or a preset upper limit of test times is reached.
Also, the threshold setting preferably takes a value of 10.
The invention also provides a test case generation system based on Bayesian estimation, which is used for realizing the test case generation method based on Bayesian estimation.
And, including the following modules,
the first module is used for dividing an input domain of the software into a plurality of sub-regions, distinguishing a boundary region of the input domain from an internal region, and taking the boundary region as the sub-region with the highest priority;
the second module is used for introducing a Bayesian estimation mode, estimating the probability that the sub-region in the inner region possibly contains the failure region, and sequencing the sub-regions in the inner region based on the probability;
the third module is used for generating test cases according to the priority order of the sub-regions until a software error is found; and if the number of the test cases reaches the preset condition and no software error is found yet, continuing to generate the test cases in the sub-area with the highest priority until the software error is found.
Alternatively, the test case generation method comprises a processor and a memory, wherein the memory is used for storing program instructions, and the processor is used for calling the stored instructions in the processor to execute the test case generation method based on Bayesian estimation.
Or, the test case generating method includes a readable storage medium, on which a computer program is stored, and when the computer program is executed, the test case generating method based on bayesian estimation is implemented.
The invention discloses a test case generation method based on Bayesian estimation, which comprises the following steps: the input domain is divided into a plurality of sub-domains with different sizes, the probability that software errors possibly occur in each sub-domain is estimated by the Bayesian idea, the sub-domains are finally ranked by taking the size of the estimated value of the probability as a standard, and test cases are preferentially generated in the sub-domains ranked in the front. The method of the invention can well solve the problem of huge calculation overhead of the prior ART method, solve the problem of boundary effect of the prior ART method to a certain extent and simultaneously improve the operation efficiency.
Drawings
Fig. 1 is a flowchart of a test case generation method based on bayesian estimation according to an embodiment of the present invention;
fig. 2 is a diagram showing the division of the Bayes-ART method into the input domain according to the embodiment of the present invention, wherein (a) part is the division schematic diagram of D1, D2 and D3, and (b) part is the division schematic diagram of D4, D5, D6 and D7.
Detailed Description
The invention provides a test case generation method based on Bayesian estimation, which is characterized in that an input domain is divided into a plurality of sub-domains with different sizes, the probability that software errors can occur in each sub-domain is estimated by using a Bayesian idea, the sub-domains are finally ranked by taking the size of the estimated value of the probability as a standard, and test cases are generated in the sub-domains with the front ranking preferentially. In order to conform to the habit in the technical field, the test case generation method based on Bayesian estimation provided by the invention is referred to as Bayes-ART method for short.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. 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 invention.
The embodiment provides a test case generation method based on bayesian estimation, please refer to fig. 1, which includes the following steps:
step S1: the input domain of the software is divided into a plurality of sub-domains, the boundary region of the input domain is distinguished from the inner region, and the boundary region is used as the sub-domain with the highest priority. The inner region may be divided into two or more sub-regions.
The invention provides a method for dividing an input domain into a plurality of sub-domains with different sizes and distinguishing a boundary region of a software input domain from an inner region aiming at the problem of boundary effect of an ART method in the prior ART. Taking a two-dimensional square input field as an example, a specific scheme of the Bayes-ART method for dividing the software input field is shown in FIG. 2.
In one embodiment, step S1 specifically includes:
step S1.1: the boundary length of the inner region is set according to the failure rate of the input field.
Step S1.2: the priority of the boundary area is arranged at the first position, and the inner area is divided into two parts with the same size, so that two inner sub-areas are obtained.
Specifically, as shown in part (a) of fig. 2, an inner square region is provided in the center of the total input field, a ring region obtained by subtracting the middle square region from the total input field is a boundary region, the boundary region is denoted as D1, and the inner square region is divided into two parts having the same size, which are respectively denoted as D2 and D3. That is, the merging region of D2 and D3 is the inner square region at the center of the overall input field. In order to make the boundary region D1 relatively close to the "boundary" in the true sense, the side length of the internal square region is also considered, and according to the prior art study on the failure rate of the input domain and the geometry of the failure domain, it is preferable to set the boundary length of the internal square region to be the same
Figure BDA0002631147010000051
Where b is the inner square regionThe domain side length, a is the overall input domain side length, and θ is the failure rate. Then, the three regions D1, D2, and D3 are prioritized, the boundary region D1 is ranked first, and the two equal sub-regions D2 and D3 in the inner square region cannot be prioritized for a while.
In specific implementation, a user can set a value θ corresponding to a specific problem according to an application scenario, and the value θ is usually smaller, for example, 0.01, 0.005, 0.002, 0.001, 0.0005, 0.0002, and 0.0001.
Step S2: aiming at the problem of huge calculation overhead existing in the prior ART method, a Bayesian estimation mode is introduced to estimate the probability that the sub-regions in the internal region possibly contain failure regions, and finally the sub-regions in the internal region are ranked by taking the probability as a standard (the priority of the boundary region is still ranked at the first place and higher than that of all the sub-regions in the internal region);
aiming at the problem of huge calculation overhead existing in an ART method in the prior ART, the Bayesian estimation idea is introduced to estimate the probability that the sub-regions possibly contain failure regions, and the sub-regions are finally sequenced by taking the probability as a standard.
In order to make the test cases more uniformly distributed, the embodiment proposes to equally divide the sub-regions D2 and D3, so that after the priority order of D2 and D3 is determined based on bayesian estimation, the sub-regions D2 and the sub-regions D3 are sorted in the same way.
In one embodiment, step S2 specifically includes:
step S2.1: and respectively generating 1000 test cases in the two internal sub-areas at random, and respectively counting the number of the test cases in which the software errors are found.
For example, 1000 test cases are randomly generated in the regions D2 and D3, and the number of test cases in which a software error is found in the sub-region D2 is counted and recorded as x 1.
Step S2.2: replacing the sub-region with the probability that the test case found the error and fell within the sub-region can find the probability of a software error.
In particular, it relates toAssume that the probability of a software error being found in sub-region D2 is α1Then the probability of a software error being found in sub-region D3 is θ - α1If the event under study is described as a test case discovery error and falls in sub-region D2 or D3, then the conditional probability μ can be used1And 1-mu1To replace the original probability value for the estimation (here
Figure BDA0002631147010000061
) The result is more visual and easy to compare.
x1/1000 is approximately equal to alpha1When the number of experiments is larger, the calculated value is closer to the real probability value.
Step S2.3: and (3) applying a Bayesian estimation method and combining the prior information to give prior distribution.
Step S2.4: a joint conditional distribution of the samples is generated by the extracted samples.
Step S2.5: and (4) combining the prior distribution with the joint condition distribution of the sample to obtain the joint distribution.
Step S2.6: and (4) solving a marginal probability function through the joint distribution to obtain posterior distribution.
Step S2.7: the mean of the posterior distribution is used as the estimate of the probability.
Specifically, the software error found in the sub-region D2 by the test case is denoted as event a, and n independent observations are performed on the test, where the event a occurs X times. According to a Bayesian estimation method, a parameter mu to be estimated is given by combining prior information1A priori distribution of (u) ("pi")1) And generating a joint conditional distribution p (X | mu) of samples from the extracted samples1)P(X|μ1),
Combined prior distribution pi (mu)1) Joint conditional distribution with sample p (X | μ)1) Finding the parameter μ1Combined distribution h (X, mu)1)=p(X|μ1)π(μ1) And then h (X | mu) by joint distribution1) Determining the marginal probability function m (X) ═ jeff of Xθh(X,μ1)dμ1=∫θp(X|μ1)π(μ1)dμ1Finally, mu is obtained1Posterior distribution of
Figure BDA0002631147010000071
The mean of the posterior distribution was used as μ1Point estimate of (d) is recorded as μ1'。
Step S2.8: the priorities of the two inner sub-regions D2 or D3 are ordered by comparing the magnitude of the probabilities.
Specifically, the value of μ is determined1Bayesian estimation of μ1' thereafter, the comparison of μ1' and 1-mu1' size to order the priority order of sub-regions D2 and D3.
Step S2.9: the two inner sub-regions D2 and D3 are further divided into two equal-sized portions, respectively, and the above steps S2.1 to S2.8 are repeated.
Step S2.10: the priorities of all the partitioned sub-regions are ordered.
Specifically, after determining the priority order of D2 and D3, in order to make the test cases more evenly distributed and to make the method have better test effect, the embodiment proposes to divide the subfields D2 and D3 into two halves, and to set the subfield D2 into D4 and D5 and the subfield D3 into D6 and D7, so that the final division result is actually shown in part (b) of fig. 2. Assume that the probability of a software error being found in sub-region D4 is μ2Then the probability of a software error being found in sub-region D5 is 1- μ2Similarly, assume that the probability of a software error being found in sub-region D6 is μ3Then the probability of a software error being found in sub-region D7 is 1- μ3. Solving the parameter mu according to the Bayesian estimation process2And mu3A posterior distribution of (d) ([ mu ])2I X) and pi (mu)3| X) and respectively obtain the parameter μ2And mu3Bayesian estimation of (u)2' and mu3', by comparison of μ2' and 1-mu2' to determine the priority order of subdomains D4 and D5; by comparing μ3' and 1-mu3The magnitude of the value of' determines the priority order of subdomains D6 and D7. Finally, the product is processedThe priority order of the subfields D1, D4, D5, D6, and D7 is determined by the above parameter estimation results, and test cases are generated in this order during the later Bayes-ART experiment.
Step S3: and generating test cases according to the priority order of the sub-regions until a software error is found. And if the number of the test cases reaches a certain degree and no software error is found, continuing to generate the test cases in the sub-area with the highest priority until the software error is found.
In the step, a Bayes-ART method is used for software testing, and test cases are preferentially generated in the sub-regions in the front sequence.
Specifically, step S3 of the embodiment is implemented as follows:
1) firstly, continuously generating test cases from a boundary area with the highest priority, executing the test, and stopping if a software error is found. And if no software error is found and the total test case generation number reaches a preset threshold value, generating a test case in a sub-area with the second priority and executing the test, and if the software error is found, stopping the test. And if no software error is found and the total test case generation number reaches a preset threshold value, generating a test case in a third priority subregion, executing the test, and if the software error is found, stopping the test. By analogy, after the priority level is continuously reduced, if no software error is found in the sub-region with the lowest priority level and the total test case generation number reaches a preset threshold value, entering the step 2);
in specific implementation, the threshold may be preset by a person skilled in the art as needed, and the embodiment adopts the preferred value of 10, that is, 10 test cases are sequentially generated in each area according to the priority order.
2) If the step 1) has been executed once currently, returning to execute the step 1), if the step 1) has been executed twice repeatedly currently, continuing to generate the test case only in the boundary area with the highest priority, and executing the test until a software error is found or a preset upper limit of test times is reached.
In specific implementation, a person skilled in the art can implement the automatic operation process by using a computer software technology, and a system device for implementing the method, such as a computer-readable storage medium storing a corresponding computer program according to the technical solution of the present invention and a computer device including a corresponding computer program for operating the computer program, should also be within the scope of the present invention.
In some possible embodiments, a test case generation system based on bayesian estimation is provided, including the following modules,
the first module is used for dividing an input domain of the software into a plurality of sub-regions, distinguishing a boundary region of the input domain from an internal region, and taking the boundary region as the sub-region with the highest priority;
the second module is used for introducing a Bayesian estimation mode, estimating the probability that the sub-region in the inner region possibly contains the failure region, and sequencing the sub-regions in the inner region based on the probability;
the third module is used for generating test cases according to the priority order of the sub-regions until a software error is found; and if the number of the test cases reaches the preset condition and no software error is found yet, continuing to generate the test cases in the sub-area with the highest priority until the software error is found.
In some possible embodiments, a test case generation system based on bayesian estimation is provided, which includes a processor and a memory, wherein the memory is used for storing program instructions, and the processor is used for calling the stored instructions in the processor to execute a test case generation method based on bayesian estimation as described above.
In some possible embodiments, a test case generation system based on bayesian estimation is provided, which includes a readable storage medium, on which a computer program is stored, and when the computer program is executed, the test case generation system based on bayesian estimation implements a test case generation method based on bayesian estimation as described above.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.

Claims (9)

1. A test case generation method based on Bayesian estimation is characterized by comprising the following steps,
step S1, dividing the input domain of the software into a plurality of sub-regions, distinguishing the boundary region of the input domain from the internal region, and taking the boundary region as the sub-region with the highest priority;
step S2, a Bayesian estimation mode is introduced, the probability that the sub-region in the inner region possibly contains the failure region is estimated, and the sub-regions in the inner region are sorted based on the probability;
step S3, generating test cases according to the priority order of the sub-regions until a software error is found; if the number of the test cases reaches the preset condition and no software error is found yet, continuing to generate the test cases in the sub-area with the highest priority until the software error is found;
the step S3 is implemented as follows,
1) firstly, continuously generating a test case from a boundary region with the highest priority, executing a test, and stopping if a software error is found; if no software error is found and the total test case generation number reaches a preset threshold value, generating a test case in a sub-area with the second priority and executing the test, and if the software error is found, stopping the test; if no software error is found and the total test case generation number reaches a preset threshold value, generating a test case in a third priority subregion, executing the test, and stopping if the software error is found; by analogy, after the priority level is continuously reduced, if no software error is found in the sub-region with the lowest priority level and the total test case generation number reaches a preset threshold value, entering the step 2);
2) if the step 1) has been executed once currently, returning to execute the step 1), if the step 1) has been executed twice repeatedly currently, continuing to generate the test case only in the boundary area with the highest priority, and executing the test until a software error is found or a preset upper limit of test times is reached.
2. The bayesian estimation-based test case generation method according to claim 1, wherein: step S1 includes the following sub-steps,
s1.1, setting the boundary length of the internal area according to the failure rate of the input area to obtain a boundary area outside the internal area, and recording the boundary area as D1;
step S1.2, the priority of the bounding region D1 is ranked first, and the inner region is divided into two parts of the same size, denoted as sub-regions D2 and D3.
3. The bayesian estimation based test case generation method according to claim 2, wherein: when the input field is a two-dimensional square, the boundary length of the inner region is set as follows,
Figure FDA0003308538020000021
wherein b is the side length of the internal region, a is the side length of the input domain of the whole body, and theta is failure rate.
4. The bayesian estimation based test case generation method according to claim 2, wherein: step S2 includes the following sub-steps,
s2.1, randomly generating 1000 test cases in the two inner sub-areas D2 and D3 respectively, and counting the number of the test cases in which the software errors are found respectively;
s2.2, replacing the probability that the sub-region can find the software error by the probability that the test case finds the error and falls in the sub-region;
s2.3, a Bayesian estimation method is applied, and prior distribution is given by combining prior information;
step S2.4, generating the joint condition distribution of the samples through the extracted samples;
s2.5, solving the joint distribution by combining the prior distribution and the joint condition distribution of the sample;
s2.6, solving a marginal probability function through combined distribution to obtain posterior distribution;
s2.7, taking the mean value of the posterior distribution as the estimation of probability;
s2.8, sorting the priorities of the two inner subregions D2 and D3 by comparing the probability;
step S2.9, further dividing the two internal sub-regions into two parts with the same size, respectively, assuming that the sub-region D2 is divided into D4 and D5, D3 is divided into D6 and D7, repeating the above steps S2.1 to S2.8 for D4 and D5, and repeating the above steps S2.1 to S2.8 for D6 and D7;
step S2.10, the priorities of all the divided sub-regions are sorted, and the priority order of the sub-regions D1, D4, D5, D6 and D7 is determined.
5. The bayesian estimation-based test case generation method according to claim 1, wherein: the threshold setting preferably takes a value of 10.
6. A test case generation system based on Bayesian estimation is characterized in that: the test case generation method based on Bayesian estimation is used for realizing any one of claims 1-5.
7. The bayesian estimation based test case generation system according to claim 6, wherein: comprises the following modules which are used for realizing the functions of the system,
the first module is used for dividing an input domain of the software into a plurality of sub-regions, distinguishing a boundary region of the input domain from an internal region, and taking the boundary region as the sub-region with the highest priority;
the second module is used for introducing a Bayesian estimation mode, estimating the probability that the sub-region in the inner region possibly contains the failure region, and sequencing the sub-regions in the inner region based on the probability;
the third module is used for generating test cases according to the priority order of the sub-regions until a software error is found; if the number of the test cases reaches the preset condition and no software error is found yet, continuing to generate the test cases in the sub-area with the highest priority until the software error is found;
the implementation mode is as follows,
1) firstly, continuously generating a test case from a boundary region with the highest priority, executing a test, and stopping if a software error is found; if no software error is found and the total test case generation number reaches a preset threshold value, generating a test case in a sub-area with the second priority and executing the test, and if the software error is found, stopping the test; if no software error is found and the total test case generation number reaches a preset threshold value, generating a test case in a third priority subregion, executing the test, and stopping if the software error is found; by analogy, after the priority level is continuously reduced, if no software error is found in the sub-region with the lowest priority level and the total test case generation number reaches a preset threshold value, entering the step 2);
2) if the step 1) has been executed once currently, returning to execute the step 1), if the step 1) has been executed twice repeatedly currently, continuing to generate the test case only in the boundary area with the highest priority, and executing the test until a software error is found or a preset upper limit of test times is reached.
8. The bayesian estimation based test case generation system according to claim 6, wherein: comprising a processor and a memory, the memory being used for storing program instructions, the processor being used for calling the stored instructions in the processor to execute a test case generation method based on bayesian estimation according to any of claims 1-5.
9. The bayesian estimation based test case generation system according to claim 6, wherein: comprising a readable storage medium having stored thereon a computer program which, when executed, implements a bayesian estimation based test case generation method as recited in any of claims 1-5.
CN202010811550.7A 2020-08-13 2020-08-13 Test case generation method and system based on Bayesian estimation Active CN112035343B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010811550.7A CN112035343B (en) 2020-08-13 2020-08-13 Test case generation method and system based on Bayesian estimation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010811550.7A CN112035343B (en) 2020-08-13 2020-08-13 Test case generation method and system based on Bayesian estimation

Publications (2)

Publication Number Publication Date
CN112035343A CN112035343A (en) 2020-12-04
CN112035343B true CN112035343B (en) 2022-02-01

Family

ID=73577896

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010811550.7A Active CN112035343B (en) 2020-08-13 2020-08-13 Test case generation method and system based on Bayesian estimation

Country Status (1)

Country Link
CN (1) CN112035343B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7331007B2 (en) * 2005-07-07 2008-02-12 International Business Machines Corporation Harnessing machine learning to improve the success rate of stimuli generation
NO337655B1 (en) * 1997-11-03 2016-05-23 Qualcomm Inc Method, device and computer program for high-speed packet data transmission
CN105786708A (en) * 2016-03-21 2016-07-20 苏州大学 Iterative division testing method and system
CN107480069A (en) * 2017-08-23 2017-12-15 厦门大学 A kind of Ration Assessing Software Dependability method under low demand operator scheme
CN110795349A (en) * 2019-10-29 2020-02-14 毛澄映 Self-adaptive random test case generation method based on central compensation strategy
CN110825627A (en) * 2019-10-30 2020-02-21 毛澄映 Adaptive random test case generation method based on grid area density

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7356436B2 (en) * 2005-02-02 2008-04-08 International Business Machines Corporation Method, system, and storage medium for estimating and improving test case generation
CN101882106B (en) * 2010-06-11 2012-10-24 东南大学 Dynamic optimization method of evolutionary testing based on catastrophe
CN103699475B (en) * 2012-09-27 2016-09-28 西门子公司 The method that test case in fuzz testing is optimized, device and system
GB2530516A (en) * 2014-09-24 2016-03-30 Ibm Intelligent Software Test Augmenting
CN111936976A (en) * 2018-02-06 2020-11-13 西门子股份公司 Artificial intelligence enabled output space exploration for guided test case generation
CN110221957B (en) * 2018-12-10 2023-06-09 江苏大学 Adaptive random test method based on iterative region equipartition and positioning

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
NO337655B1 (en) * 1997-11-03 2016-05-23 Qualcomm Inc Method, device and computer program for high-speed packet data transmission
US7331007B2 (en) * 2005-07-07 2008-02-12 International Business Machines Corporation Harnessing machine learning to improve the success rate of stimuli generation
CN105786708A (en) * 2016-03-21 2016-07-20 苏州大学 Iterative division testing method and system
CN107480069A (en) * 2017-08-23 2017-12-15 厦门大学 A kind of Ration Assessing Software Dependability method under low demand operator scheme
CN110795349A (en) * 2019-10-29 2020-02-14 毛澄映 Self-adaptive random test case generation method based on central compensation strategy
CN110825627A (en) * 2019-10-30 2020-02-21 毛澄映 Adaptive random test case generation method based on grid area density

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Generalized partition testing via Bayes linear methods;F.P.A Coolen;《Information and Software Technology》;20010824;全文 *
一种基于优先级的迭代划分测试方法;章晓芳;《计算机学报》;20161130;第39卷(第11期);全文 *
一种基于贝叶斯网络的随机测试方法在Cache一致性验证中的设计与实现;艾阳阳;《计算机工程与科学》;20170831;第39卷(第8期);全文 *

Also Published As

Publication number Publication date
CN112035343A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
CN107957848B (en) Deduplication processing method and storage device
CN111950643B (en) Image classification model training method, image classification method and corresponding device
CN113986717B (en) Fuzzy test method and terminal adopting zone-based neuron selection strategy
CN111291894A (en) Resource scheduling method, device, equipment and medium in hyper-parameter optimization process
US7171393B2 (en) Solving constraint satisfaction problems using variable-range hopping
CN112069059B (en) Test case generation method and system based on maximum likelihood estimation maximum expectation
CN112035343B (en) Test case generation method and system based on Bayesian estimation
CN117576089B (en) Piston ring defect detection method and system
US9053434B2 (en) Determining an obverse weight
CN111414930A (en) Deep learning model training method and device, electronic equipment and storage medium
CN112270957A (en) High-order SNP (Single nucleotide polymorphism) pathogenic combination data detection method, system and computer equipment
CN114445700B (en) Evidence fusion target identification method for unbalanced SAR image data
CN116091784A (en) Target tracking method, device and storage medium
CN115758222A (en) Signal category identification method and device, electronic equipment and storage medium
US20210342688A1 (en) Neural network training method, device and storage medium based on memory score
Mayraz et al. Construction of physical maps from oligonucleotide fingerprints data
CN109446057B (en) Dynamic system test resource allocation method based on GDE3 algorithm
CN114398964A (en) Fault diagnosis method, fault diagnosis device, electronic equipment and storage medium
KR102104295B1 (en) Method for automatically generating search heuristics and performing method of concolic testing using automatically generated search heuristics
CN110795349A (en) Self-adaptive random test case generation method based on central compensation strategy
CN112463378A (en) Server asset scanning method, system, electronic equipment and storage medium
CN113127694A (en) Data storage method and device, electronic equipment and storage medium
CN111507188A (en) Face recognition model training method and device, computer equipment and storage medium
CN108829659A (en) A kind of reference recognition methods, equipment and computer can storage mediums
CN112148592B (en) Adaptive random test method for partitioning multidimensional input domain space based on favorable point tree

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
GR01 Patent grant
GR01 Patent grant