CN104484278A - Static state code defect testing method and device - Google Patents

Static state code defect testing method and device Download PDF

Info

Publication number
CN104484278A
CN104484278A CN201510005060.7A CN201510005060A CN104484278A CN 104484278 A CN104484278 A CN 104484278A CN 201510005060 A CN201510005060 A CN 201510005060A CN 104484278 A CN104484278 A CN 104484278A
Authority
CN
China
Prior art keywords
defect mode
defect
rule
static code
tested
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
CN201510005060.7A
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.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry 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 Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201510005060.7A priority Critical patent/CN104484278A/en
Publication of CN104484278A publication Critical patent/CN104484278A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a static state code defect testing method and device. The static state code defect testing method includes the steps that a defect mode describing UI is built in advance, wherein the defect mode describing UI is at least provided with a defect mode describing window and a defect mode selecting window; static state code rules are obtained from the defect mode describing window in advance, the screened effective rules are converted into defect modes, and a defect mode base is built for storing the defect modes. The static state code defect testing method further includes the steps that a defect analysis tool loads to-be-tested static state codes, the defect mode base is called according to the defect mode describing window and/or the defect mode selecting window, and the to-be-tested static state codes are tested. By means of the method, static state code defect testing can be simply and efficiently carried out, and the defect mode can be conveniently expanded.0.

Description

A kind of static code defect test method and apparatus
Technical field
The present invention relates to technical field of measurement and test, espespecially a kind of static code defect test method and apparatus.
Background technology
Aacode defect, is often called Bug, is problem, mistake that certain that exist in computer software or program destroys normal service ability, or the functional defect hidden.The existence of defect can cause software product can not meet the needs of user to a certain extent.IEEE729-1983 has the definition of a standard to defect: from interiors of products, and defect is the various problem such as mistake, defect existed in Software Development or maintenance process; From product outside, defect is the inefficacy of required certain function realized of system or runs counter to.
Aacode defect measuring technology based on defect mode carries out defect test according to the defect mode preset to tested program, this measuring technology has and uses the advantages such as simple, seek rate is fast, is to develop new technology more rapidly in static code defect test method in recent years.
But, at present based on most of instruments of the aacode defect measuring technology of defect mode not for user provides enough easy-to-use, efficient extended mode, support that to enable instrument user detects the aacode defect paid close attention to.Such as: for the representational FindBugs of most, its defect mode paid close attention to is all be hard coded in defect mode detector, when needing to use FindBugs to check new defect mode, the necessary manual modification implementing procedure of user, code capacity for user has higher requirement, and problems limits the ability of the static code defect test of instrument.
Summary of the invention
In order to solve the problems of the technologies described above, the invention provides a kind of static code defect test method and apparatus, static code defect test can be carried out simply efficiently, and extend testing project can be facilitated.
In order to reach the object of the invention, the invention provides a kind of static code defect test method, comprising: set up defect mode in advance and describe user interface UI, described defect mode describes UI and is at least provided with defect mode and describes window and defect mode selection window; Describe from described defect mode the rule that window obtains static code in advance, the effective rule after screening is converted to defect mode, and sets up defect mode described in defect mode library storage; Also comprise: defect analysis tool loads static code to be tested, the detecting information describing window and/or defect mode selection window according to described defect mode calls defect mode storehouse, tests described static code to be tested.
The rule of described static code at least comprises: the standard rule that static code is followed, and/or the Outline Design of static code, and/or user-defined rule; Described effective rule is the rule that can find significant problem.
Described effective rule after screening is converted to defect mode and comprises: from the rule of the static code obtained, filter out effective rule, the effective rule after screening is carried out abstract according to the condition pre-set, is converted into defect mode.
Describedly set up defect mode described in defect mode library storage and comprise: set up defect mode storehouse and according to defect mode kind storage defect pattern.
The described detecting information describing window and/or defect mode selection window according to described defect mode calls defect mode storehouse, carry out test to described static code to be tested to comprise: the detecting information describing window according to described defect mode, creating new defect mode is stored in defect mode storehouse, call defect mode new described in defect mode storehouse, described static code to be tested is tested; According to the detecting information of described defect mode selection window, determine the defect mode of the needs test of described static code to be tested, call the corresponding defect mode in defect mode storehouse, described static code to be tested is tested.
A kind of static code defect test device, at least comprising: the first pretreatment module, describing user interface UI for setting up defect mode in advance, and described defect mode describes UI and is at least provided with defect mode and describes window and defect mode selection window; Second pretreatment module, obtains the rule of static code for describing window from described defect mode, the effective rule after screening is converted to defect mode; 3rd pretreatment module, for setting up defect mode described in defect mode library storage; Defect analysis tool, for loading static code to be tested, the detecting information describing window and/or defect mode selection window according to described defect mode calls defect mode storehouse, tests described static code to be tested.
The rule of described static code at least comprises: the standard rule that static code is followed, and/or the Outline Design of static code, and/or user-defined rule; Described effective rule is the rule that can find significant problem.
Described second pretreatment module comprises rule digging device, rule is refined device Sum fanction converter, wherein, described rule digging device is for obtaining the rule of static code; Described rule device of refining screens for the rule of the static code obtained described rule digging device; Described regular converter is used for the effective rule after by screening and carries out abstract according to the condition pre-set, and is converted into defect mode.
Described 3rd pretreatment module is used for setting up defect mode library storage defect mode and is specially: described 3rd pretreatment module sets up defect mode storehouse and according to defect mode kind storage defect pattern.
The detecting information that described defect analysis tool is used for describing according to described defect mode window and/or defect mode selection window calls defect mode storehouse, carry out test to described static code to be tested to be specially: described defect analysis tool describes the detecting information of window according to described defect mode, creating new defect mode is stored in defect mode storehouse, call defect mode new described in defect mode storehouse, described static code to be tested is tested; According to the detecting information of described defect mode selection window, determine the defect mode of the needs test of described static code to be tested, call the corresponding defect mode in defect mode storehouse, described static code to be tested is tested.
Compared with prior art, the present invention includes and set up defect mode in advance and describe user interface UI, described defect mode describes UI and is at least provided with defect mode and describes window and defect mode selection window; Describe from described defect mode the rule that window obtains static code in advance, the effective rule after screening is converted to defect mode, and sets up defect mode described in defect mode library storage; Also comprise: defect analysis tool loads static code to be tested, the detecting information describing window and/or defect mode selection window according to described defect mode calls defect mode storehouse, tests described static code to be tested.The present invention is by setting up defect mode library storage defect mode in advance, and set up defect mode according to defect mode and describe UI, therefore, user only needs the defect mode describing needs test UI determining static code to be tested at defect mode, just can test this static code to be tested, do not need user to carry out the defect mode encoding to input needs test, achieve the test of simple static code efficiently.In addition, defect mode describes UI and additionally provides newly-increased defect mode window, and user can expand the defect mode of static code to be tested easily.
Other features and advantages of the present invention will be set forth in the following description, and, partly become apparent from instructions, or understand by implementing the present invention.Object of the present invention and other advantages realize by structure specifically noted in instructions, claims and accompanying drawing and obtain.
Accompanying drawing explanation
Accompanying drawing is used to provide the further understanding to technical solution of the present invention, and forms a part for instructions, is used from and explains technical scheme of the present invention, do not form the restriction to technical solution of the present invention with the embodiment one of the application.
Fig. 1 is the schematic flow sheet of static code defect test method of the present invention.
Fig. 2 is the structural representation of static code defect test device of the present invention.
Fig. 3 is the structural representation of the present invention second pretreatment module.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly understand, hereinafter will be described in detail to embodiments of the invention by reference to the accompanying drawings.It should be noted that, when not conflicting, the embodiment in the application and the feature in embodiment can combination in any mutually.
Can perform in the computer system of such as one group of computer executable instructions in the step shown in the process flow diagram of accompanying drawing.Further, although show logical order in flow charts, in some cases, can be different from the step shown or described by order execution herein.
Fig. 1 is the schematic flow sheet of static code defect test method of the present invention, as shown in Figure 1, comprising:
Step 11, sets up defect mode in advance and describes user interface (UI, User Interface), and this defect mode describes UI and is at least provided with defect mode and describes window and defect mode selection window.
In this step, this defect mode describes the input window that window is static code rule; This defect mode selection window is the input window selecting static code to need the defect mode of test.
The concrete conventional techniques means how set up UI and belong to those skilled in the art, the protection domain that its specific implementation is not intended to limit the present invention, repeats no more here.
Step 12, the defect mode describing UI from defect mode in advance describes the rule that window obtains static code, the effective rule after screening is converted to defect mode, and sets up defect mode library storage defect mode.
In this step, the rule of static code comprises the standard rule that static code is followed, and/or the Outline Design of static code, and/or user-defined rule etc., such as code regulation, complicacy rule, control flow check is regular, naming rule, portable rule and resource are regular.
Effective rule refers to the rule that can find significant problem, such as, directly can not call Thread.run () function in a program, DataBase combining must the timely rule such as closedown, document flow service regeulations after using and terminating.
Pattern is that the summary that rules abstraction goes out describes, therefore the effective rule after screening is converted to defect mode to comprise: from the rule of the static code obtained, filter out effective rule according to test experience or User Defined condition, effective rule after screening is carried out abstract according to the condition pre-set, be converted into defect mode, and configure corresponding test procedure for defect mode, wherein this condition pre-set can be repetition or similar effective rule.
Storage defect pattern is responsible in defect mode storehouse, particularly can according to defect mode kind storage defect pattern, wherein defect mode kind comprises defect mode that sequential is correlated with, defect mode that value is relevant, inherits relevant defect mode and realize relevant defect mode etc.
In addition, the defect mode describing UI interface by defect mode describes window can carry out supplementing and/or deleting to the defect mode in defect mode storehouse.So, after user finds new static code rule, only need to describe window by defect mode and add dependency rule information, be stored in defect mode storehouse after converting defect mode to, and need not manual modification defect analysis tool, thus realize the defect mode expanding static code to be tested easily.
Step 13, defect analysis tool loads static code to be tested, describes the detecting information of window and/or defect mode selection window according to described defect mode, calls defect mode storehouse, tests this static code to be tested.
In this step, if there is multiple static code to be tested, defect analysis tool can load static code to be tested according to the execution sequence of Business Stream.The concrete conventional techniques means how loading static code to be tested and belong to those skilled in the art, the protection domain that its specific implementation is not intended to limit the present invention, repeats no more here.
If when may there is which defect in user's this static code to be tested uncertain, after defect analysis tool has loaded static code to be tested, tested static code can be treated and carry out full test, namely describe all defect pattern in window determination defect mode storehouse by defect mode, this static code to be tested is tested.
Also the test of given defect pattern can be carried out to this static code to be tested, particularly, by determining the defect mode of the needs test of static code to be tested from defect mode selection window, defect analysis tool calls corresponding defect mode in defect mode storehouse, tests this static code to be tested.
Window can also be described according to defect mode, create new defect mode and be stored in defect mode storehouse, call defect mode new in defect mode storehouse, this static code to be tested is tested.
In the present invention, by setting up defect mode library storage defect mode in advance, and set up defect mode according to defect mode and describe UI, therefore, user only needs the defect mode describing needs test UI determining static code to be tested at defect mode, just can test this static code to be tested, not need user to carry out the defect mode encoding to input needs test, achieve the test of simple static code efficiently.In addition, defect mode describes UI and additionally provides newly-increased defect mode window, and user can expand the defect mode of static code to be tested easily.
Fig. 2 is the structural representation of static code defect test device of the present invention, as shown in Figure 1, at least comprises:
First pretreatment module, describes user interface UI for setting up defect mode in advance, and this defect mode describes UI and is at least provided with defect mode and describes window and defect mode selection window.
Second pretreatment module, obtains the rule followed of static code for describing UI from defect mode in advance, the effective rule after screening is converted to defect mode.
Particularly, as shown in Figure 3, second pretreatment module comprises rule digging device, rule is refined device Sum fanction converter, wherein rule digging device obtains the standard rule that static code is followed, and/or the Outline Design of software, and/or user-defined rule, the rule rule of device to the static code that rule digging device obtains of refining is screened, repetition or similar effective rule after screening are carried out abstract by rule converter, are converted into defect mode.
3rd pretreatment module, for setting up defect mode library storage defect mode.
Particularly, the 3rd pretreatment module sets up defect mode storehouse and according to defect mode kind storage defect pattern.
Defect analysis tool, for loading static code to be tested, calls defect mode storehouse, tests this static code to be tested.
Particularly, defect analysis tool is used for loading static code to be tested according to the execution sequence of Business Stream; Determine that static code to be tested needs the defect mode of test, call corresponding defect mode in defect mode storehouse, this static code to be tested is tested.
Static code defect test device of the present invention is corresponding with static code defect test method, and therefore, what static code defect test device was concrete realize details referring to static code defect test method, can be not repeated herein.
In the present invention, by setting up defect mode library storage defect mode in advance, and set up defect mode according to defect mode and describe UI, therefore, user only needs the defect mode describing needs test UI determining static code to be tested at defect mode, just can test this static code to be tested, not need user to carry out the defect mode encoding to input needs test, achieve the test of simple static code efficiently.In addition, defect mode describes UI and additionally provides newly-increased defect mode window, and user can expand the defect mode of static code to be tested easily.
Although the embodiment disclosed by the present invention is as above, the embodiment that described content only adopts for ease of understanding the present invention, and be not used to limit the present invention.Those of skill in the art belonging to any the present invention; under the prerequisite not departing from the spirit and scope disclosed by the present invention; any amendment and change can be carried out in the form implemented and details; but scope of patent protection of the present invention, the scope that still must define with appending claims is as the criterion.

Claims (10)

1. a static code defect test method, is characterized in that, comprising:
Set up defect mode in advance and describe user interface UI, described defect mode describes UI and is at least provided with defect mode and describes window and defect mode selection window;
Describe from described defect mode the rule that window obtains static code in advance, the effective rule after screening is converted to defect mode, and sets up defect mode described in defect mode library storage;
Also comprise:
Defect analysis tool loads static code to be tested, and the detecting information describing window and/or defect mode selection window according to described defect mode calls defect mode storehouse, tests described static code to be tested.
2. method according to claim 1, is characterized in that, the rule of described static code at least comprises: the standard rule that static code is followed, and/or the Outline Design of static code, and/or user-defined rule;
Described effective rule is the rule that can find significant problem.
3. method according to claim 1 and 2, is characterized in that, described effective rule after screening is converted to defect mode and comprises:
From the rule of the static code obtained, filter out effective rule, the effective rule after screening is carried out abstract according to the condition pre-set, is converted into defect mode.
4. method according to claim 1, is characterized in that, describedly sets up defect mode described in defect mode library storage and comprises:
Set up defect mode storehouse and according to defect mode kind storage defect pattern.
5. method according to claim 4, is characterized in that, the described detecting information describing window and/or defect mode selection window according to described defect mode calls defect mode storehouse, carries out test comprise described static code to be tested:
Describe the detecting information of window according to described defect mode, create new defect mode and be stored in defect mode storehouse, call defect mode new described in defect mode storehouse, described static code to be tested is tested;
According to the detecting information of described defect mode selection window, determine the defect mode of the needs test of described static code to be tested, call the corresponding defect mode in defect mode storehouse, described static code to be tested is tested.
6. a static code defect test device, is characterized in that, at least comprises:
First pretreatment module, describes user interface UI for setting up defect mode in advance, and described defect mode describes UI and is at least provided with defect mode and describes window and defect mode selection window;
Second pretreatment module, obtains the rule of static code for describing window from described defect mode, the effective rule after screening is converted to defect mode;
3rd pretreatment module, for setting up defect mode described in defect mode library storage;
Defect analysis tool, for loading static code to be tested, the detecting information describing window and/or defect mode selection window according to described defect mode calls defect mode storehouse, tests described static code to be tested.
7. device according to claim 6, is characterized in that, the rule of described static code at least comprises: the standard rule that static code is followed, and/or the Outline Design of static code, and/or user-defined rule;
Described effective rule is the rule that can find significant problem.
8. the device according to claim 6 or 7, is characterized in that, described second pretreatment module comprises rule digging device, rule is refined device Sum fanction converter, wherein,
Described rule digging device is for obtaining the rule of static code;
Described rule device of refining screens for the rule of the static code obtained described rule digging device;
Described regular converter is used for the effective rule after by screening and carries out abstract according to the condition pre-set, and is converted into defect mode.
9. device according to claim 6, is characterized in that, described 3rd pretreatment module is used for setting up defect mode library storage defect mode and is specially:
Described 3rd pretreatment module sets up defect mode storehouse and according to defect mode kind storage defect pattern.
10. device according to claim 9, it is characterized in that, the detecting information that described defect analysis tool is used for describing according to described defect mode window and/or defect mode selection window calls defect mode storehouse, carries out test be specially described static code to be tested:
Described defect analysis tool describes the detecting information of window according to described defect mode, creates new defect mode and is stored in defect mode storehouse, call defect mode new described in defect mode storehouse, tests described static code to be tested;
According to the detecting information of described defect mode selection window, determine the defect mode of the needs test of described static code to be tested, call the corresponding defect mode in defect mode storehouse, described static code to be tested is tested.
CN201510005060.7A 2015-01-05 2015-01-05 Static state code defect testing method and device Pending CN104484278A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510005060.7A CN104484278A (en) 2015-01-05 2015-01-05 Static state code defect testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510005060.7A CN104484278A (en) 2015-01-05 2015-01-05 Static state code defect testing method and device

Publications (1)

Publication Number Publication Date
CN104484278A true CN104484278A (en) 2015-04-01

Family

ID=52758822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510005060.7A Pending CN104484278A (en) 2015-01-05 2015-01-05 Static state code defect testing method and device

Country Status (1)

Country Link
CN (1) CN104484278A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104991858A (en) * 2015-06-12 2015-10-21 扬州大学 Method for automatically generating outline and label for code modification
CN106294096A (en) * 2015-05-13 2017-01-04 腾讯科技(成都)有限公司 A kind of information processing method and device
WO2018045585A1 (en) * 2016-09-12 2018-03-15 深圳中兴力维技术有限公司 Method and system for checking incompliant item of code
CN108710568A (en) * 2018-05-05 2018-10-26 中科软评科技(北京)有限公司 Detection method, computer equipment and the storage medium of static code defect
CN109597747A (en) * 2017-09-30 2019-04-09 南京大学 A method of across item association defect report is recommended based on multi-objective optimization algorithm NSGA- II
CN113297075A (en) * 2021-05-21 2021-08-24 吉林亿联银行股份有限公司 Software defect information acquisition method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101286132A (en) * 2008-06-02 2008-10-15 北京邮电大学 Test method and system based on software defect mode
US20090044177A1 (en) * 2007-08-09 2009-02-12 Cary Lee Bates Method and apparatus for profile enhanced source code analyzer results

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090044177A1 (en) * 2007-08-09 2009-02-12 Cary Lee Bates Method and apparatus for profile enhanced source code analyzer results
CN101286132A (en) * 2008-06-02 2008-10-15 北京邮电大学 Test method and system based on software defect mode

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
梁广泰 等: "一个可半自动化扩展的静态代码缺陷分析工具", 《计算机学报》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106294096A (en) * 2015-05-13 2017-01-04 腾讯科技(成都)有限公司 A kind of information processing method and device
CN106294096B (en) * 2015-05-13 2020-03-17 腾讯科技(成都)有限公司 Information processing method and device
CN104991858A (en) * 2015-06-12 2015-10-21 扬州大学 Method for automatically generating outline and label for code modification
CN104991858B (en) * 2015-06-12 2017-10-20 扬州大学 The summary and label automatic generation method of a kind of code-oriented modification
WO2018045585A1 (en) * 2016-09-12 2018-03-15 深圳中兴力维技术有限公司 Method and system for checking incompliant item of code
CN109597747A (en) * 2017-09-30 2019-04-09 南京大学 A method of across item association defect report is recommended based on multi-objective optimization algorithm NSGA- II
CN108710568A (en) * 2018-05-05 2018-10-26 中科软评科技(北京)有限公司 Detection method, computer equipment and the storage medium of static code defect
CN113297075A (en) * 2021-05-21 2021-08-24 吉林亿联银行股份有限公司 Software defect information acquisition method and device

Similar Documents

Publication Publication Date Title
CN104484278A (en) Static state code defect testing method and device
US9454466B2 (en) Explaining partially illegal combinations in combinatorial models
US9128733B2 (en) Display and resolution of incompatible layout constraints
CN109388566A (en) A kind of code coverage rate analysis method, apparatus, equipment and storage medium
KR20060050370A (en) System and method for selecting test case execution behaviors for reproducible test automation
CN104536812B (en) A kind of call method of the dynamic link library based on LabVIEW
US9733930B2 (en) Logical level difference detection between software revisions
US20150046906A1 (en) Test planning with order coverage requirements
CN105426309A (en) Test case automatic generation method and apparatus
CN106528415A (en) Software compatibility test method, business platform and system
US9336228B2 (en) Synchronization of program code between revision management applications utilizing different version-control architectures
US20170046132A1 (en) Data type visualization
US9760470B2 (en) Device, method, and program analysis of new source code to be added to execution program to check for bug
CN105162664A (en) Automatic platform testing method and system developed based on intermediate layers of instruments
CN108958890A (en) Container microscope testing method, apparatus and electronic equipment
HARUN Review of iOS Architectural Pattern for Testability, Modifiability, and Performance Quality
US10168990B1 (en) Automatic replacement of a floating-point function to facilitate fixed-point program code generation
CN101030160A (en) Tester and method for testing unified series interface command
US9244652B1 (en) State management for task queues
CN105446849A (en) Product testing method and device
US8266153B2 (en) Determining and displaying application server object relevance
CN104407978A (en) Automatic test method of software and device thereof
CN106201810A (en) A kind of method of testing, device
CN103902445B (en) A kind of regression test object determines method and device
Kaya et al. A new cohesion metric and restructuring technique for object oriented paradigm

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20150401