CN103593285A - Image software unit test method based on judgment recognition - Google Patents

Image software unit test method based on judgment recognition Download PDF

Info

Publication number
CN103593285A
CN103593285A CN201310488254.8A CN201310488254A CN103593285A CN 103593285 A CN103593285 A CN 103593285A CN 201310488254 A CN201310488254 A CN 201310488254A CN 103593285 A CN103593285 A CN 103593285A
Authority
CN
China
Prior art keywords
coverage
condition
software
unit testing
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.)
Granted
Application number
CN201310488254.8A
Other languages
Chinese (zh)
Other versions
CN103593285B (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.)
Beijing Institute of Control Engineering
Original Assignee
Beijing Institute of Control Engineering
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 Institute of Control Engineering filed Critical Beijing Institute of Control Engineering
Priority to CN201310488254.8A priority Critical patent/CN103593285B/en
Publication of CN103593285A publication Critical patent/CN103593285A/en
Application granted granted Critical
Publication of CN103593285B publication Critical patent/CN103593285B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses an image software unit test method based on judgment recognition. The method includes: recognizing all judgment conditions of a test object by lexical analysis, numbering each judgment condition on the premise of not influencing actual operation results, completely running an image test case, recording coverage of true and false branches of the judgment conditions, and analyzing coverage of the true and false branches of each judgment condition to acquire test coverage. Therefore, the problem that unit testing fails due to input of big data and many cycles is solved, related functions of software are fully verified, and software quality is improved. The method is already applied to binocular stereo vision navigation algorithm based unit testing and coverage analysis for Chang'E-3; through the application of the method, full algorithm verification is ensured and software quality is improved.

Description

A kind of image class software unit testing method based on judging identification
Technical field
The present invention relates to a kind of image class software unit testing method based on judging identification, relate in particular to a kind of unit testing software solution method of space flight embedded image class software, belong to technology embedded software reliability checking field.
Background technology
Unit testing is the checking work for software minimum unit, and groundwork is as follows: the information that guarantees tested program unit can flow into normally and flow out; Check that local data structure is to guarantee that data all statements in the whole implementation of algorithm of storage are at least carried out once temporarily; All independent pathways of going in control structure guarantee that in module, all statements are at least carried out once; Test boundary condition is guaranteed still can correctly carry out under the utmost point of module arrival boundary condition or the situation of first limit processing; All mistakes are processed to path tests.
At present, image class software is widely used in the fields such as satellite control, communication and data processing.Raising along with satellite integrated level, software function is more and more various, also phase strain is large for software size, software configuration also becomes increasingly complex, only depend on software test personnel's complicate statistics analysis, not only workload is huge, and testing efficiency is low, and can not effectively to tested software, make accurate evaluation, guaranteed above-mentioned 5 work.
Based on binocular stereo vision navigation algorithm, be the key algorithm that the goddess in the moon realizes independent navigation function for No. three, this algorithm is divided into environment sensing and keeps away barrier planning.Environment sensing comprises pyramid and extracts, and image polar curve is proofreaied and correct, DOG filtering, the image processing process such as images match.Each image processing process input data volume systemic circulation of environment sensing algorithm often, is not suitable for the unit testing environment of TBrun, cannot carry out unit testing.Facing difficult point is: the unit testing need for environment input test driving data of TBrun.Each image processing process input of environment sensing algorithm is view data, such as pyramid extracts input data, be 2 width images, every width image pixel size is 1024x1024, data volume is 1M, and during a plurality of use-case, need to repeatedly input, cannot under the unit testing environment based on instruction set simulation, complete; The unit testing need for environment of TBrun is record data writing in files frequently.Each image processing process cycle index of environment sensing algorithm is more, and such as images match process cycle index reaches ten million time, record data writing in files causes unit testing speed very slow frequently.By analysis, the circulation of 10,000,000 times need to move about 24 hours.The systemic circulation of input data volume causes the problem that cannot carry out unit testing not to be resolved often always.
Unit test tool can be good at addressing this problem.The Testbed that " application of Testbed external member in space flight embedded software " delivered such as the 39th the 1st phase of volume of < < fire control radar technology > > mentioned, its cell level testing tool TBrun can produce software test driving, stubs automatically, tester is focused in design test case, thereby save time, improve Efficiency of Software Testing, its principle as shown in Figure 1.Yet this instrument needs input test driving data, need record test data writing in files frequently, this makes this instrument also inapplicable in some cases.
Summary of the invention
Technology of the present invention is dealt with problems and is: overcome the deficiencies in the prior art, a kind of image class software unit testing method based on judging identification is provided, solve the problem that the systemic circulation of input data volume causes carrying out unit testing often, the correlation function of fully having verified image class software, has improved software quality.
Technical solution of the present invention is: a kind of image class software unit testing method based on judging identification, and step is as follows:
(1) tested object is carried out to lexical analysis, the key word in identification tested object;
(2) decision condition after key word is proposed, and pitching pile;
(3) utilize the decision condition after the Code Substitution key word of pitching pile;
(4) operation image test case, carries out unit testing to tested object;
(5) utilize the coverage condition of the true and false branch of decision condition in the automatic record cell test process of code of pitching pile;
(6) according to the coverage condition of the true and false branch of decision condition, calculate branch covering rate;
(7) if coverage rate does not meet the demands, repeated execution of steps 4 to 6; If coverage rate meets the demands, unit testing completes and exits.
The present invention's beneficial effect is compared with prior art: first by lexical analysis, identify all decision conditions in tested object, do not affecting on the basis of the actual running results, be numbered to each decision condition, complete operation piece image test case, record the coverage condition of these true and false branches of decision condition and output to file, analyze the true and false branch coverage condition of each decision condition, obtain the spreadability of test, thereby solved the problem that the systemic circulation of input data volume causes carrying out unit testing often, the correlation function of abundant verifying software, improve software quality.The method has obtained application the goddess in the moon No. three in the unit testing based on binocular stereo vision navigation algorithm and coverage rate analysis, guarantees fully to have verified this algorithm, has improved software quality.
Accompanying drawing explanation
Fig. 1 is Tbrun theory diagram;
Fig. 2 is realization flow figure of the present invention;
Fig. 3 is the corresponding relation figure of closed-loop simulation environment and Tbrun;
Fig. 4 is the corresponding relation figure of condition identification and Tbrun.
Embodiment
As shown in Figure 2, implementation method of the present invention is:
(1) tested object is carried out to lexical analysis, the key word in identification tested object;
(2) decision condition after key word is proposed, and pitching pile;
(3) utilize the decision condition after the Code Substitution key word of pitching pile;
(4) operation image test case, carries out unit testing to tested object;
(5) utilize the coverage condition of the true and false branch of decision condition in the automatic record cell test process of code of pitching pile;
(6) according to the coverage condition of the true and false branch of decision condition, calculate branch covering rate;
(7) if coverage rate does not meet the demands, repeated execution of steps 4 to 6; If coverage rate meets the demands, unit testing completes and exits.
Build closed-loop simulation system: closed-loop simulation system is the translation and compiling environment based on VC, by kinetic model, on star, code forms.Closed-loop simulation system can be controlled simulation process, stores and shows simulation result.The standard that closed-loop simulation system building completes is that images match is consistent with the result of expectation with planning output.As shown in Figure 3, No. three closed-loop simulation system interfaces of the goddess in the moon as shown in Figure 4 for the corresponding relation of closed-loop simulation environment and TBrun.
Decision condition identification: adopt code on the star after precompile to carry out lexical analysis, find out all decision conditions of measurand source code after precompile; To all decision condition pitching piles, and compose a unique sign to each decision condition, stubs is used for recording the true and false branch of each decision condition implementation status; Tested object in closed-loop simulation system is replaced with to the tested object after pitching pile; Finally intactly move one group of image test case, stubs has recorded the coverage condition of each decision condition.The corresponding relation of decision condition identification and TBrun as shown in Figure 4.
Keyword extraction: keyword extraction is to analyze all key words that comprise decision condition in tested object, the key word that comprises decision condition is had ready conditions and is judged key word (if), cycle criterion key word (while, for), branching selection key word (switch-case), three order computing key words ().Keyword extraction completes based on lexical analysis.
The code of pitching pile, i.e. condition numbering: condition criterion key word (if), cycle criterion key word (while, for), three order computing key words () directly take out each the decision condition st comprising in key word, and replace with SET_UNITEST (st, funnum stnum), wherein:
(1) decision condition of st for taking out;
(2) stnum is condition numbering, by lexical analysis tool automatic assignment;
(3) funnum is function numbering, by lexical analysis tool automatic assignment;
(4) SET_UNITEST is defined as: st (cover[stnum] [funnum] [0]=1, TRUE): (cover[stnum] [funnum] [1]=1, FALSE);
(5) cover[stnum] [funnum] [0] is initialized as 0, for recording the true branch of decision condition, covers, and is 1 for covering;
(6) cover[stnum] [funnum] [1] is initialized as 0, for recording decision condition false ramification, covers, and is 1 for covering;
To branching selection key word (switch-case), extract alternative condition sw in switch key word, extract branch condition cs in case key word.To each case branch, putting st is sw==cs, uses this st to complete the pitching pile that other key words are identical.To default branch, putting st is (sw unequal to cs1) & & (sw unequal to cs2) ... & & (sw unequal to csn), is used this st to complete the pitching pile that other key words are identical.Use the tested object after pitching pile, the function in replacement test drive environment.
File record is used for recording each test case and has moved rear cover[stnum] value of [funnum] [2], for knowing that condition is numbered the true and false branch of stnum-funnum coverage condition, output is aggregated in the excel file with function name name.Complete operation piece image test case, cover[stnum] [funnum] [0] is 1 o'clock, the true branch of decision condition stnum-funnum covers, is not cover for 0 o'clock; According to cover[stnum] [funnum] [1] is 1 o'clock, the false ramification of decision condition stnum-funnum covers, is not cover for 0 o'clock.
Under VC development environment, excel is operated, records cover[stnum] [funnum] [0] and cover[stnum] value of [funnum] [1].Press function and divide excel file, and record test case image place catalogue.
Interpretation of result: after having tested, the value output of cover array is aggregated in test result file.On the correct basis of running software result, according to the value of cover array, get final product the test result file of analytical test object, calculate coverage condition and the statement coverage condition of decision condition.
Based on binocular stereo vision navigation algorithm, be the key algorithm that the goddess in the moon realizes independent navigation function for No. three, often, the unit test tool of inapplicable and TBrurn, cannot carry out unit testing in this algorithm inputoutput data amount systemic circulation.Use the above-mentioned image class software unit testing method based on judging identification, can be good at addressing this problem.First build test drive environment.List tested object, comprise the modules such as images match CorreMatch module, dog filtering DogFilter module, blob filtering HazSubBlob, these tested objects are used to said method, obtain the code after pitching pile.
Before pitching pile, code is:
Figure BDA0000397436860000051
Pitching pile post code is:
Figure BDA0000397436860000062
On this test environment, intactly move one group of image test case, record data.The Output rusults of contrastive test use-case and simulation result consistance, check that whether running software result is correct.In the process of operation test case, this test environment is revised the value of cover array according to coverage condition, be recorded in corresponding excel file.According to the value of cover array, get final product the test result file of analytical test object, calculate coverage condition and the statement coverage condition of decision condition.The method is successfully applied in the development process of No. three binocular stereo vision navigation algorithm softwares of the goddess in the moon, solve image class software and cannot carry out a difficult problem for unit testing for a long time, use the method for unit testing fully to verify software, improved software quality, obtained good effect.
The present invention not detailed description is known to the skilled person technology.

Claims (1)

1. based on judging an image class software unit testing method of identifying, it is characterized in that step is as follows:
(1) tested object is carried out to lexical analysis, the key word in identification tested object;
(2) decision condition after key word is proposed, and pitching pile;
(3) utilize the decision condition after the Code Substitution key word of pitching pile;
(4) operation image test case, carries out unit testing to tested object;
(5) utilize the coverage condition of the true and false branch of decision condition in the automatic record cell test process of code of pitching pile;
(6) according to the coverage condition of the true and false branch of decision condition, calculate branch covering rate;
(7) if coverage rate does not meet the demands, repeated execution of steps 4 to 6; If coverage rate meets the demands, unit testing completes and exits.
CN201310488254.8A 2013-10-17 2013-10-17 A kind of image class software unit testing method based on judging to identify Active CN103593285B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310488254.8A CN103593285B (en) 2013-10-17 2013-10-17 A kind of image class software unit testing method based on judging to identify

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310488254.8A CN103593285B (en) 2013-10-17 2013-10-17 A kind of image class software unit testing method based on judging to identify

Publications (2)

Publication Number Publication Date
CN103593285A true CN103593285A (en) 2014-02-19
CN103593285B CN103593285B (en) 2016-03-02

Family

ID=50083436

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310488254.8A Active CN103593285B (en) 2013-10-17 2013-10-17 A kind of image class software unit testing method based on judging to identify

Country Status (1)

Country Link
CN (1) CN103593285B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109460357A (en) * 2018-10-19 2019-03-12 北京新能源汽车股份有限公司 A kind of test method of code coverage, device and equipment
CN112231196A (en) * 2020-12-14 2021-01-15 平安科技(深圳)有限公司 APP embedded point behavior classification method and device, computer equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833500A (en) * 2010-04-07 2010-09-15 南京航空航天大学 Embedded software intelligent testing method based on Agent
CN102243609A (en) * 2011-06-15 2011-11-16 惠州运通信息技术有限公司 Embedded software-based test analysis method and system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833500A (en) * 2010-04-07 2010-09-15 南京航空航天大学 Embedded software intelligent testing method based on Agent
CN102243609A (en) * 2011-06-15 2011-11-16 惠州运通信息技术有限公司 Embedded software-based test analysis method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
蔡建平,路翠: "覆盖测试中高效代码插桩技术的研究", 《微计算机信息》, vol. 26, no. 92, 30 September 2010 (2010-09-30), pages 87 - 88 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109460357A (en) * 2018-10-19 2019-03-12 北京新能源汽车股份有限公司 A kind of test method of code coverage, device and equipment
CN112231196A (en) * 2020-12-14 2021-01-15 平安科技(深圳)有限公司 APP embedded point behavior classification method and device, computer equipment and storage medium
CN112231196B (en) * 2020-12-14 2021-03-16 平安科技(深圳)有限公司 APP embedded point behavior classification method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN103593285B (en) 2016-03-02

Similar Documents

Publication Publication Date Title
CN101256502B (en) System and method for simulating multiprocessor system
CN105893256A (en) Software failure positioning method based on machine learning algorithm
CN110348441A (en) VAT invoice recognition methods, device, computer equipment and storage medium
CN106776319A (en) Automatic test approach and device
CN110175236A (en) Training sample generation method, device and computer equipment for text classification
CN106682036A (en) Data exchange system and exchange method thereof
CN110378343A (en) A kind of finance reimbursement data processing method, apparatus and system
CN105095756A (en) Method and device for detecting portable document format document
CN109740040A (en) Method for recognizing verification code, device, storage medium and computer equipment
CN105070321A (en) Quick test circuit and method for memory device
CN113420768A (en) Core category determination method and device, electronic equipment and storage medium
CN103593285B (en) A kind of image class software unit testing method based on judging to identify
CN110175519B (en) Method and device for identifying separation and combination identification instrument of transformer substation and storage medium
CN114639152A (en) Multi-modal voice interaction method, device, equipment and medium based on face recognition
JP2021533493A (en) Finger vein matching method, device, computer equipment, and storage medium
CN112149828B (en) Operator precision detection method and device based on deep learning framework
CN106066881A (en) Data processing method and device
CN111738290B (en) Image detection method, model construction and training method, device, equipment and medium
CN105760638A (en) SOC-chip simulation accelerating method
CN110309825A (en) Uighur detection method, system and electronic equipment under a kind of complex background
CN107077365A (en) Selectively load the head and/or its part of precompile
CN103971052A (en) Magnetic disk boot virus identification method and device
CN110096594A (en) A kind of short message normal form library generating method, device and computer memory device
CN104915682A (en) Leguminous seed recognition system and method
CN103983264A (en) Real-time star image coordinate extraction method of star sensor with multi-output image sensor

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant