CN104090837B - The method for generating test case - Google Patents
The method for generating test case Download PDFInfo
- Publication number
- CN104090837B CN104090837B CN201410273982.1A CN201410273982A CN104090837B CN 104090837 B CN104090837 B CN 104090837B CN 201410273982 A CN201410273982 A CN 201410273982A CN 104090837 B CN104090837 B CN 104090837B
- Authority
- CN
- China
- Prior art keywords
- test
- test target
- target
- cnf
- cnf formula
- 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
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The method that the present invention proposes generation test case, including:A, according to Testing criteria, test target is listed to form test target collection;B, each test target is concentrated to be expressed as trap property the test target;C, each trap property and concrete model are subjected to conjunction and are converted into CNF formula;D, the difficulty of CNF formula is calculated;E, each test target is ranked up according to the difficulty of CNF formula;F, judge whether the test target collection is empty;G, when the test target integrates not as space-time, then a test target is chosen, and concentrated from the test target and delete selected test target;H, test case is generated according to selected test target to form the first test use cases;I, yojan is carried out to obtain the second test use cases to first test use cases based on SAT.The method of Test cases technology proposed by the invention, at least with yojan effect is good, efficiency high.
Description
Technical field
The present invention relates to software test, more particularly to the method for generation test case.
Background technology
Software test is to find mistake in software, ensures a kind of important means of software quality, but traditional software is tested
Cost needed for method has accounted for more than the 50% of software development totle drilling cost.Test automation is a kind of can to reduce having for testing cost
Efficacious prescriptions method.Test data auto generation is an important step and the embodiment of test automation, generally the behavior mould from software
Type produces test case, and re-test real system, whether the result of observing system operation is consistent with the expection of model behavior, and this is just
It is model-based testing.But sometimes used according to the Testing criteria specified from the test of software action model generation
Example collection is huge, and then causes testing cost height, efficiency low.Therefore, test suite reduction is an important work of software test
Make.
At present, relevant technical staff in the field, it is a lot of to the research about test suite reduction, but all exist necessarily
Defect, yojan DeGrain.
At present, relevant technical staff in the field, it is a lot of to the research about test suite reduction, but all exist necessarily
Defect, it will enumerate below:
1) test case of generation is expressed as model by Ammann etc., on the mold the remaining test mesh of model inspection
Mark, to judge whether they are covered by the test case, but this be involved in the continually conversion from test case to model and
To the calling of model detector;
2) Fraser etc. eliminates test target capped at present using LTL rewriting rules after test case is generated,
But selection test target order is not provided, this will directly affect the effect of test case yojan;
3) Zeng etc. is tested target yojan and test suite reduction with reference to CTL rewriting rules, but does not also have equally
There is the method for providing selection test target order, will also directly affect the effect of test case yojan.
The content of the invention
It is in view of above-mentioned, it is necessary to propose a kind of side for generating test case for existing test case yojan defect problem
Method.
A kind of method for generating test case, including:
A, according to Testing criteria, test target is listed to form test target collection;
B, each test target is concentrated to be expressed as trap property the test target;
C, each trap property and concrete model are subjected to conjunction and are converted into CNF formula;
D, the difficulty of CNF formula is calculated;
E, each test target is ranked up according to the difficulty of CNF formula;
F, judge whether the test target collection is empty;
G, when the test target integrates not as space-time, then a test target is chosen, and concentrate and delete from the test target
Selected test target;
H, test case is generated according to selected test target to form the first test use cases;
I, yojan is carried out to obtain the second test use cases to first test use cases based on SAT.
In a wherein embodiment, step i includes:
I1, the trap property of the selected remaining other each test targets of test target is subjected to conjunction it is converted into CNF
Formula;
I2, the satisfiability by SAT instruments judgement CNF formula;
I3, when CNF formula can not meet, then delete corresponding test target.
In a wherein embodiment, also include between step h and step i:First test use cases are carried out superfluous
Remaining property detection.
In a wherein embodiment, in step e, ascending order arrangement is carried out according to the difficulty of CNF formula, correspondingly, step
In rapid g, test target is sequentially chosen.
In a wherein embodiment, in step b, each test target is expressed as by trap property by LTL.
From the foregoing, it will be observed that the method for Test cases technology proposed by the invention, at least has the following advantages that:
1) test target is sequentially selected according to CNF difficulty, less model inspection number and yojan can be called more
Test case number, improves efficiency;
2) yojan is carried out to test case based on SAT, yojan effect is good, also, solves expiring for CNF using SAT instruments
Foot, solution efficiency are high.
Brief description of the drawings
Fig. 1 depicts the schematic flow sheet of the method for the generation test case of an embodiment of the present invention.
Embodiment
In order that relevant technical staff in the field more fully understands technical scheme, below in conjunction with of the invention real
The accompanying drawing of mode is applied, the technical scheme in embodiment of the present invention is clearly and completely described, it is clear that described reality
Apply mode only a part of embodiment of the present invention, rather than whole embodiments.
Reference picture 1, Fig. 1 depict the schematic flow sheet of the method for the generation test case of an embodiment of the present invention.
First, in step s 110, according to Testing criteria, test target is listed to form test target collection.
Then, in the step s 120, each test target is concentrated to be expressed as trap property test target.Present embodiment
In, each test target can be expressed as by trap property using LTL.
Afterwards, in step s 130, each trap property and concrete model are subjected to conjunction and are converted into CNF formula:
F=C1∧…∧Cm, wherein C1..., CmReferred to as clause, each clause
Ci=l1∨…∨ln, l1..., lnReferred to as word, each word
lj(1≤j≤n) is the affirmative of Boolean variable or the form of negative.
Then, in step S140, the difficulty of CNF formula is calculated.
In the present embodiment, when setting clause's number in CNF formula, as n, the word number in i-th of clause is li, then CNF is public
The difficulty h of formula:
Then, in step S150, each test target is ranked up according to the difficulty of CNF formula.In present embodiment
In, can be ranked up using ascending order, i.e. h values it is small come before, h values it is big come behind, and difficulty identical is tested
Target, then it can take randomly ordered.
Afterwards, in step S160, judge whether test target collection is empty.
Then, in step S170, when test target integrates not as space-time, then a test target is chosen, and from test target
Concentrate and delete selected test target.
Here selection test target, due to being ranked up according to difficulty to test target before, therefore can be sequentially
Choose test target, for example, can first choose the small corresponding test target of difficulty, then, then successively behind selection
Test target.
Then, in step S180, test case is generated according to selected test target to form the first test case
Collection, it can such as use model detector generation test case.
Then, in step S190, yojan is carried out to obtain the second test case to the first test use cases based on SAT
Collection.
Specifically, the trap property of the selected remaining other each test targets of test target can be subjected to conjunction
It is converted into CNF formula;The satisfiability of CNF formula is judged by SAT instruments, SAT instruments here can be DPLL algorithms;When
When CNF formula can not meet, then corresponding test target is deleted, due to can directly delete herein and selected test mesh
Test target corresponding to mark, without selecting that corresponding test target in step 170, enter without recalling model inspection
Survey device and generate corresponding test case.
After step S190, step S160 is returned, judges whether test target collection is sky, untill for sky, now about
The second test use cases after letter are as final test case set.
It should be noted that also including between step 180 and step 190, redundancy detection is carried out to the first test use cases,
To delete the test case of redundancy.
From the foregoing, it will be observed that the method for Test cases technology proposed by the invention, at least has the following advantages that:
1) test target is sequentially selected according to CNF difficulty, less model inspection number and yojan can be called more
Test case number, improves efficiency;
2) yojan is carried out to test case based on SAT, yojan effect is good, also, solves expiring for CNF using SAT instruments
Foot, solution efficiency are high.
Only express some embodiments of the present invention above, its describe it is more specific and in detail, but can not therefore and
It is interpreted as the limitation to the scope of the claims of the present invention.It should be pointed out that for the person of ordinary skill of the art, do not taking off
On the premise of present inventive concept, various modifications and improvements can be made, these belong to protection scope of the present invention.Cause
This, the protection domain of patent of the present invention should be determined by the appended claims.
Claims (3)
- A kind of 1. method for generating test case, it is characterised in that including:A, according to Testing criteria, test target is listed to form test target collection;B, each test target is concentrated to be expressed as trap property the test target;C, each trap property and concrete model are subjected to conjunction and are converted into CNF formula, F=C1∧…∧Cm, wherein C1..., CmClaim For clause, each clause Referred to as word, each word lj(1≤j≤ni) be The affirmative of Boolean variable or the form of negative;D, the difficulty of CNF formula is calculated, as m, the word number in i-th of clause is n when setting clause's number in CNF formulai, then CNF is public The difficulty h of formula:E, each test target is ranked up according to the difficulty of CNF formula;F, judge whether the test target collection is empty;G, when the test target integrates not as space-time, then a test target is chosen, and selected by concentrating from the test target and deleting The test target taken;H, test case is generated according to selected test target to form the first test use cases;I, yojan is carried out to obtain the second test use cases to first test use cases based on SAT;In step e, ascending order arrangement is carried out according to the difficulty of CNF formula, correspondingly, in step g, sequentially chooses test target.
- 2. the method for generation test case according to claim 1, it is characterised in that step i includes:I1, the trap property of the selected remaining other each test targets of test target is subjected to conjunction it is converted into CNF formula;I2, the satisfiability by SAT instruments judgement CNF formula;I3, when CNF formula can not meet, then delete corresponding test target.
- 3. the method for generation test case according to claim 1, it is characterised in that in step b, by LTL by each survey Object representation is tried into trap property.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410273982.1A CN104090837B (en) | 2014-06-19 | 2014-06-19 | The method for generating test case |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410273982.1A CN104090837B (en) | 2014-06-19 | 2014-06-19 | The method for generating test case |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104090837A CN104090837A (en) | 2014-10-08 |
CN104090837B true CN104090837B (en) | 2018-02-09 |
Family
ID=51638555
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410273982.1A Active CN104090837B (en) | 2014-06-19 | 2014-06-19 | The method for generating test case |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104090837B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101814055A (en) * | 2010-04-06 | 2010-08-25 | 南京大学 | Sampling method for test cases in clusters |
CN101866316A (en) * | 2010-06-23 | 2010-10-20 | 南京大学 | Software defect positioning method based on relative redundant test set reduction |
CN102063376A (en) * | 2011-02-16 | 2011-05-18 | 哈尔滨工程大学 | Test case selection method |
-
2014
- 2014-06-19 CN CN201410273982.1A patent/CN104090837B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101814055A (en) * | 2010-04-06 | 2010-08-25 | 南京大学 | Sampling method for test cases in clusters |
CN101866316A (en) * | 2010-06-23 | 2010-10-20 | 南京大学 | Software defect positioning method based on relative redundant test set reduction |
CN102063376A (en) * | 2011-02-16 | 2011-05-18 | 哈尔滨工程大学 | Test case selection method |
Non-Patent Citations (3)
Title |
---|
Improve the Effectiveness of Test Case Generation on EFSM via Automatic Path Feasibility Analysis;Rui Yang 等;《2011 IEEE 13th International Symposium on High-Assurance Systems Engineering》;20111112;全文 * |
一种面向测试需求部分覆盖的测试用例集约简技术;顾庆 等;《计算机学报》;20110531;第34卷(第5期);全文 * |
基于FSM的测试用例生成和测试优化;刘攀;《中国博士学位论文全文数据库 信息科技辑》;20120215;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN104090837A (en) | 2014-10-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Li | Evaluating mean life of power system equipment with limited end-of-life failure data | |
CN110222681A (en) | A kind of casting defect recognition methods based on convolutional neural networks | |
CN103973697B (en) | A kind of thing network sensing layer intrusion detection method | |
CN1900937A (en) | Estimating the difficulty level of a formal verification problem | |
CN1806501B (en) | Marine phytoplankton automatic distinguishing method and apparatus | |
CN104461896B (en) | Aerospace system key software evaluation method based on credible attribute | |
CN104462757A (en) | Sequential verification test method of Weibull distribution reliability based on monitoring data | |
CN107004141A (en) | To the efficient mark of large sample group | |
CN109063785A (en) | charging pile fault detection method and terminal device | |
CN103336994B (en) | Transient stability evaluation in power system forecast failure collection rapid screening method | |
CN109992872A (en) | A kind of mechanical equipment method for predicting residual useful life based on stacking separation convolution module | |
CN110442523A (en) | A kind of spanned item mesh Software Defects Predict Methods | |
CN111400505A (en) | Method and system for matching fault elimination scheme of power consumption information acquisition system | |
KR101102436B1 (en) | System and method for modeling river hydraulic and water quality based on location | |
CN106997373A (en) | A kind of link prediction method based on depth confidence network | |
CN114816997A (en) | Defect prediction method based on graph neural network and bidirectional GRU feature extraction | |
CN110991472A (en) | Micro fault diagnosis method for high-speed train traction system | |
CN113362299A (en) | X-ray security check image detection method based on improved YOLOv4 | |
CN110458204A (en) | Vehicle supply chain method based on information gain and LightGBM model | |
CN104090837B (en) | The method for generating test case | |
CN114155551A (en) | Improved pedestrian detection method and device based on YOLOv3 under complex environment | |
CN101527001B (en) | Secret information detecting system based on expert system method | |
CN106547690B (en) | Based on the Software Reliability Modeling method and device under new fitting criterion | |
CN114998285A (en) | Industrial product blind detection target detection method based on neural network architecture search | |
Changsalak et al. | Comparison of seedling detection and height measurement using 3D point cloud models from three software tools: applications in forest restoration |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |