CN106354636A - Method and device for code testing - Google Patents
Method and device for code testing Download PDFInfo
- Publication number
- CN106354636A CN106354636A CN201610727570.XA CN201610727570A CN106354636A CN 106354636 A CN106354636 A CN 106354636A CN 201610727570 A CN201610727570 A CN 201610727570A CN 106354636 A CN106354636 A CN 106354636A
- Authority
- CN
- China
- Prior art keywords
- code data
- examination criteria
- detection
- user
- special
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3644—Software debugging by instrumenting at runtime
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/366—Software debugging using diagnostics
Abstract
The invention discloses a method and a device for code testing. The code testingmethod comprises the steps of 1) getting the current code data to be detected; 2) testingthe code data according to the pre-existing testing standard; if the tested code data do not accord with the testing standard, a messageis sent to the user to show the test result. Being based on the present framework, this code testing method reads the matched data testing standard to allow the present code data running in the existing framework.This code testing method greatly improves the work efficiency as it can fixwrong codes without an overall product performance testing.
Description
Technical field
The present embodiments relate to the technical field of data processing, more particularly, to a kind of method and device of detection code.
Background technology
Developer is after the completion of coding editor, it usually needs code is checked, the detection of code be one very time-consuming
Between thing, sometimes developer is to improve work efficiency, often relatively coarse once-over.Although existing also have
The performance issue of some corresponding plug-in unit monitor codes of increasing income, but its monitoring capacity is relatively low, leads to developer that these are inserted
Part is relatively conflicted.Such as checkstyle, findbug, klockwork etc. increase income plug-in unit, and such plug-in unit is in developer
Code is checked and is pointed out with the problem that code exists, developer is modified to code according to prompting before submitting code to, but
It is that this kind of plug-in unit is only capable of checking the problem of general editor, the problem for particularity cannot check, the realization of such as code is
The no frame requirements meeting whole company, if can realize under existing frame system etc..For such special examination mark
Standard, at present only by carrying out performance test to whole product, could obtain the prompting of some and bad code, right according to pointing out
Bad code is repaired, but this kind of mode leads to work efficiency relatively low.
Content of the invention
The purpose of the embodiment of the present invention is to propose a kind of method and device of detection code it is intended to solve how to improve generation
The problem of the efficiency of code detection.
For reaching this purpose, the embodiment of the present invention employs the following technical solutions:
In a first aspect, a kind of method of detection code, methods described includes:
Obtain code data currently to be detected;
According to the examination criteria prestoring, described code data is detected;
If described code data does not meet described examination criteria, send display information to user, described information is used
In to described user display testing result.
Preferably, the examination criteria that described basis prestores detects to described code data, comprising:
According to the common examination criteria prestoring and special detection standard, described code data is detected, described common inspection
The mutatis mutandis common code mistake in the described code data of detection of mark;Described special detection standard is used for detecting described code data
Special code mistake.
Preferably, described special detection standard includes w3c specification and html specification.
Preferably, the common examination criteria that described basis prestores and special detection standard detect to described code data
Before, also include:
Obtain the key word information in described code data;
Corresponding common examination criteria and special detection standard are obtained according to described key word information.
Preferably, described key word information includes closing label, w3c key word, grammer and Chinese and English punctuate.
Preferably, if described code data does not meet described examination criteria, before sending display information to user,
Also include:
Judge whether described code data meets described examination criteria;
Described judge whether described code data meets described examination criteria, comprising:
Judge whether described code data meets the common examination criteria mating with described key word information and described special
Examination criteria.
Preferably, if described code data does not meet described examination criteria, display information, bag are sent to user
Include:
If described code data does not meet described examination criteria, send general class mistake class prompting, spy to described user
Different class miscue and/or warning class prompting.
Preferably, described send the prompting of general class mistake class, special defects miscue and/or warning class to described user and carry
After showing, also include:
The code data that modification is matched with described general class mistake class prompting.
Second aspect, a kind of device of detection code, described device includes:
First acquisition module, for obtaining code data currently to be detected;
Detection module, for detecting to described code data according to the examination criteria prestoring;
Sending module, if not meeting described examination criteria for described code data, sends display information, institute to user
State information for showing testing result to described user.
Preferably, described detection module, specifically for:
According to the common examination criteria prestoring and special detection standard, described code data is detected, described common inspection
The mutatis mutandis common code mistake in the described code data of detection of mark;Described special detection standard is used for detecting described code data
Special code mistake.
Preferably, described special detection standard includes w3c specification and html specification.
Preferably, described device also includes:
Second acquisition module, for according to the common examination criteria that prestores and special detection standard to described code data
Before being detected, obtain the key word information in described code data;Obtained corresponding common according to described key word information
Examination criteria and special detection standard.
Preferably, described key word information includes closing label, w3c key word, grammer and Chinese and English punctuate.
Preferably, described device also includes:
Judge module, if not meeting described examination criteria for described code data, to user send display information it
Before, judge whether described code data meets described examination criteria;
Described judge module, specifically for:
Judge whether described code data meets the common examination criteria mating with described key word information and described special
Examination criteria.
Preferably, described sending module, specifically for:
If described code data does not meet described examination criteria, send general class mistake class prompting, spy to described user
Different class miscue and/or warning class prompting.
Preferably, described device also includes:
Modified module, for sending general class mistake class prompting, special defects miscue and/or warning class to described user
After prompting, the code data that modification is matched with described general class mistake class prompting.
The embodiment of the present invention provides a kind of method and device of detection code, obtains code data currently to be detected;Root
According to the examination criteria prestoring, described code data is detected;If described code data does not meet described examination criteria, to
User sends display information, and described information is used for showing testing result to described user.The present invention is based on existing framework
The code detection standard that system reading is matched with available frame system, with so that existing code data can be existing
Run it is not necessary to performance test is carried out to whole product in frame system, you can bad code is repaired, and substantially increases work
Make efficiency.
Brief description
Fig. 1 is that the embodiment of the present invention provides a kind of schematic flow sheet of the method for detection code;
The schematic flow sheet of the method for Fig. 2 another kind of detection code provided in an embodiment of the present invention;
The schematic flow sheet of the method for Fig. 3 another kind of detection code provided in an embodiment of the present invention;
The schematic flow sheet of the method for Fig. 4 another kind of detection code provided in an embodiment of the present invention;
Fig. 5 is a kind of high-level schematic functional block diagram of the device of detection code provided in an embodiment of the present invention.
Specific embodiment
With reference to the accompanying drawings and examples the embodiment of the present invention is described in further detail.It is understood that this
The described specific embodiment in place is used only for explaining the embodiment of the present invention, rather than the restriction to the embodiment of the present invention.In addition also
It should be noted that for the ease of description, illustrate only the part related to the embodiment of the present invention rather than entire infrastructure in accompanying drawing.
With reference to Fig. 1, a kind of Fig. 1 schematic flow sheet of the method for detection code provided in an embodiment of the present invention.
As shown in figure 1, the method for described detection code includes:
Step 101, obtains code data currently to be detected;
Specifically, extract code data currently to be detected from the code data after end of run.
Step 102, detects to described code data according to the examination criteria prestoring;
Preferably, the examination criteria that described basis prestores detects to described code data, comprising:
According to the common examination criteria prestoring and special detection standard, described code data is detected, described common inspection
The mutatis mutandis common code mistake in the described code data of detection of mark;Described special detection standard is used for detecting described code data
Special code mistake.
Preferably, described special detection standard includes w3c specification and html specification.
Specifically, the first examination standard specification matching with available frame system is read based on existing frame system;
First examination standard specification is particularity examination standard specification, with so that existing code data can be in existing frame body
Run in system.
Step 103, if described code data does not meet described examination criteria, sends display information to user, described carries
Show that information is used for showing testing result to described user.
Further, described prompting at least includes general class mistake class prompting, special defects miscue and warning class prompting.
The embodiment of the present invention provides a kind of method of detection code, obtains code data currently to be detected;According to prestoring
Examination criteria described code data is detected;If described code data does not meet described examination criteria, send out to user
Send display information, described information is used for showing testing result to described user.The present invention is based on existing frame system and reads
Take the code detection standard matching with available frame system, with so that existing code data can be in existing frame body
Run it is not necessary to performance test is carried out to whole product in system, you can bad code is repaired, substantially increase work effect
Rate.
With reference to Fig. 2, the schematic flow sheet of the method for Fig. 2 another kind of detection code provided in an embodiment of the present invention.
On the basis of the embodiment of Fig. 1, as shown in Fig. 2 the method for described detection code includes:
Step 201, obtains code data currently to be detected;
Step 202, obtains the key word information in described code data;
Wherein, described key word information includes closing label, w3c key word, grammer and Chinese and English punctuate.
Step 203, obtains corresponding common examination criteria and special detection standard according to described key word information;
Step 204, detects to described code data according to the examination criteria prestoring;
Step 205, if described code data does not meet described examination criteria, sends display information to user, described carries
Show that information is used for showing testing result to described user.
With reference to Fig. 3, the schematic flow sheet of the method for Fig. 3 another kind of detection code provided in an embodiment of the present invention.
On the basis of the embodiment of Fig. 1 and Fig. 2, taking on the basis of Fig. 2 as a example, as shown in figure 3, described detection code
Method include:
Step 301, obtains code data currently to be detected;
Step 302, obtains the key word information in described code data;
Step 303, obtains corresponding common examination criteria and special detection standard according to described key word information;
Step 304, detects to described code data according to the examination criteria prestoring;
Step 305, judges whether described code data meets described examination criteria;
Preferably, described judge whether described code data meets described examination criteria, comprising:
Judge whether described code data meets the common examination criteria mating with described key word information and described special
Examination criteria.
Step 306, if described code data does not meet described examination criteria, sends display information to user, described carries
Show that information is used for showing testing result to described user.
Preferably, if described code data does not meet described examination criteria, display information, bag are sent to user
Include:
If described code data does not meet described examination criteria, send general class mistake class prompting, spy to described user
Different class miscue and/or warning class prompting.
With reference to Fig. 4, the schematic flow sheet of the method for Fig. 4 another kind of detection code provided in an embodiment of the present invention.
On the basis of the embodiment of Fig. 1 to Fig. 3, taking on the basis of Fig. 3 as a example, as shown in figure 4, described detection code
Method include:
Step 401, obtains code data currently to be detected;
Step 402, obtains the key word information in described code data;
Step 403, obtains corresponding common examination criteria and special detection standard according to described key word information;
Step 404, detects to described code data according to the examination criteria prestoring;
Step 405, judges whether described code data meets described examination criteria;
Step 406, if described code data does not meet described examination criteria, sends display information to user, described carries
Show that information is used for showing testing result to described user;
Preferably, if described code data does not meet described examination criteria, display information, bag are sent to user
Include:
If described code data does not meet described examination criteria, send general class mistake class prompting, spy to described user
Different class miscue and/or warning class prompting.
Step 407, the code data that modification is matched with described general class mistake class prompting.
With reference to Fig. 5, Fig. 5 is a kind of high-level schematic functional block diagram of the device of detection code provided in an embodiment of the present invention.
As shown in figure 5, described device includes:
First acquisition module 501, for obtaining code data currently to be detected;
Detection module 502, for detecting to described code data according to the examination criteria prestoring;
Sending module 503, if not meeting described examination criteria for described code data, sends display letter to user
Breath, described information is used for showing testing result to described user.
Preferably, described detection module 502, specifically for:
According to the common examination criteria prestoring and special detection standard, described code data is detected, described common inspection
The mutatis mutandis common code mistake in the described code data of detection of mark;Described special detection standard is used for detecting described code data
Special code mistake.
Preferably, described special detection standard includes w3c specification and html specification.
Preferably, described device also includes:
Second acquisition module, for according to the common examination criteria that prestores and special detection standard to described code data
Before being detected, obtain the key word information in described code data;Obtained corresponding common according to described key word information
Examination criteria and special detection standard.
Preferably, described key word information includes closing label, w3c key word, grammer and Chinese and English punctuate.
Preferably, described device also includes:
Judge module, if not meeting described examination criteria for described code data, to user send display information it
Before, judge whether described code data meets described examination criteria;
Described judge module, specifically for:
Judge whether described code data meets the common examination criteria mating with described key word information and described special
Examination criteria.
Preferably, described sending module 503, specifically for:
If described code data does not meet described examination criteria, send general class mistake class prompting, spy to described user
Different class miscue and/or warning class prompting.
Preferably, described device also includes:
Modified module, for sending general class mistake class prompting, special defects miscue and/or warning class to described user
After prompting, the code data that modification is matched with described general class mistake class prompting.
The embodiment of the present invention provides a kind of device of detection code, obtains code data currently to be detected;According to prestoring
Examination criteria described code data is detected;If described code data does not meet described examination criteria, send out to user
Send display information, described information is used for showing testing result to described user.The present invention is based on existing frame system and reads
Take the code detection standard matching with available frame system, with so that existing code data can be in existing frame body
Run it is not necessary to performance test is carried out to whole product in system, you can bad code is repaired, substantially increase work effect
Rate.
Describe the know-why of the embodiment of the present invention above in association with specific embodiment.These descriptions are intended merely to explain this
The principle of inventive embodiments, and the restriction to embodiment of the present invention protection domain can not be construed to by any way.Based on herein
Explanation, those skilled in the art do not need to pay performing creative labour and can associate the other concrete of the embodiment of the present invention
Embodiment, these modes fall within the protection domain of the embodiment of the present invention.
Claims (16)
1. a kind of method of detection code is it is characterised in that methods described includes:
Obtain code data currently to be detected;
According to the examination criteria prestoring, described code data is detected;
If described code data does not meet described examination criteria, to user send display information, described information be used for
Described user shows testing result.
2. method according to claim 1 is it is characterised in that the examination criteria that prestores of described basis is to described code data
Detected, comprising:
According to the common examination criteria prestoring and special detection standard, described code data is detected, described common detection mark
The mutatis mutandis common code mistake in the described code data of detection;Described special detection standard is used for detecting the spy of described code data
Different code error.
3. method according to claim 2 is it is characterised in that described special detection standard includes w3c specification and html rule
Model.
4. the method according to claims 1 to 3 any one is it is characterised in that the common detection mark that prestores of described basis
Before accurate and special detection standard detects to described code data, also include:
Obtain the key word information in described code data;
Corresponding common examination criteria and special detection standard are obtained according to described key word information.
5. method according to claim 4 is it is characterised in that described key word information includes closing label, w3c key
Word, grammer and Chinese and English punctuate.
If 6. method according to claim 4 is not it is characterised in that described code data meets described detection mark
Standard, then, before sending display information to user, also include:
Judge whether described code data meets described examination criteria;
Described judge whether described code data meets described examination criteria, comprising:
Judge whether described code data meets the common examination criteria mating with described key word information and described special detection
Standard.
If 7. method according to claim 4 is not it is characterised in that described code data meets described detection mark
Standard, then send display information to user, comprising:
If described code data does not meet described examination criteria, send general class mistake class prompting, special defects to described user
Miscue and/or warning class prompting.
8. method according to claim 7 it is characterised in that described to described user send the prompting of general class mistake class,
After special defects miscue and/or warning class prompting, also include:
The code data that modification is matched with described general class mistake class prompting.
9. a kind of device of detection code is it is characterised in that described device includes:
First acquisition module, for obtaining code data currently to be detected;
Detection module, for detecting to described code data according to the examination criteria prestoring;
Sending module, if not meeting described examination criteria for described code data, sending display information to user, described carrying
Show that information is used for showing testing result to described user.
10. device according to claim 9 is it is characterised in that described detection module, specifically for:
According to the common examination criteria prestoring and special detection standard, described code data is detected, described common detection mark
The mutatis mutandis common code mistake in the described code data of detection;Described special detection standard is used for detecting the spy of described code data
Different code error.
11. devices according to claim 10 are it is characterised in that described special detection standard includes w3c specification and html
Specification.
12. devices according to claim 9 to 11 any one are it is characterised in that described device also includes:
Second acquisition module, for carrying out to described code data according to the common examination criteria prestoring and special detection standard
Before detection, obtain the key word information in described code data;Corresponding common detection is obtained according to described key word information
Standard and special detection standard.
13. devices according to claim 12 are it is characterised in that described key word information includes closing label, w3c key
Word, grammer and Chinese and English punctuate.
14. devices according to claim 12 are it is characterised in that described device also includes:
Judge module, if not meeting described examination criteria for described code data, before sending display information to user, sentences
Whether described code data of breaking meets described examination criteria;
Described judge module, specifically for:
Judge whether described code data meets the common examination criteria mating with described key word information and described special detection
Standard.
15. devices according to claim 12 it is characterised in that described sending module, specifically for:
If described code data does not meet described examination criteria, send general class mistake class prompting, special defects to described user
Miscue and/or warning class prompting.
16. devices according to claim 15 are it is characterised in that described device also includes:
Modified module, for sending general class mistake class prompting, special defects miscue and/or warning class prompting to described user
Afterwards, the code data that modification is matched with described general class mistake class prompting.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610727570.XA CN106354636A (en) | 2016-08-25 | 2016-08-25 | Method and device for code testing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610727570.XA CN106354636A (en) | 2016-08-25 | 2016-08-25 | Method and device for code testing |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106354636A true CN106354636A (en) | 2017-01-25 |
Family
ID=57854229
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610727570.XA Pending CN106354636A (en) | 2016-08-25 | 2016-08-25 | Method and device for code testing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106354636A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107015813A (en) * | 2017-04-19 | 2017-08-04 | 网易(杭州)网络有限公司 | Method, device and electronic equipment that code is repaired |
CN107124425A (en) * | 2017-05-26 | 2017-09-01 | 北京立思辰新技术有限公司 | The method and computing device of monitoring device safety |
WO2019184159A1 (en) * | 2018-03-30 | 2019-10-03 | 平安科技(深圳)有限公司 | Application program code detection method, device, server and medium |
CN112817876A (en) * | 2021-04-19 | 2021-05-18 | 阿里云计算有限公司 | Code diagnosis method, device, server, user equipment and storage medium |
-
2016
- 2016-08-25 CN CN201610727570.XA patent/CN106354636A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107015813A (en) * | 2017-04-19 | 2017-08-04 | 网易(杭州)网络有限公司 | Method, device and electronic equipment that code is repaired |
CN107124425A (en) * | 2017-05-26 | 2017-09-01 | 北京立思辰新技术有限公司 | The method and computing device of monitoring device safety |
WO2019184159A1 (en) * | 2018-03-30 | 2019-10-03 | 平安科技(深圳)有限公司 | Application program code detection method, device, server and medium |
CN112817876A (en) * | 2021-04-19 | 2021-05-18 | 阿里云计算有限公司 | Code diagnosis method, device, server, user equipment and storage medium |
CN112817876B (en) * | 2021-04-19 | 2022-02-01 | 阿里云计算有限公司 | Code diagnosis method, device, server, user equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106354636A (en) | Method and device for code testing | |
CN111382740B (en) | Text picture analysis method, text picture analysis device, computer equipment and storage medium | |
JP2011008622A (en) | Display test device, display test program, and display test method | |
CN104516732A (en) | Application crash report method and system | |
CN102243699A (en) | Malicious code detection method and system | |
CN105635313A (en) | Medical equipment state monitoring system and method | |
CN107958215A (en) | A kind of antifraud recognition methods, device, server and storage medium | |
CN101751530A (en) | Method for detecting loophole aggressive behavior and device | |
CN109144852A (en) | Scan method, device, computer equipment and the storage medium of static code | |
CN103514092A (en) | Method for automatic testing of software system of ATM | |
CN106776179A (en) | The automatic testing method and device of electronic device failure | |
CN103020773B (en) | Elevator intelligent laboratory information management system based on RFID | |
US20110225559A1 (en) | Logic verifying apparatus, logic verifying method, and medium | |
CN110647523B (en) | Data quality analysis method and device, storage medium and electronic equipment | |
CN109254868A (en) | A kind of file test method and device | |
CN111881054A (en) | User interface automation test method, system, equipment and storage medium | |
CN103838666B (en) | A kind of method and apparatus for determining code implementation coverage | |
CN106708675A (en) | Method for detecting faults before starting of computers | |
CN103577318A (en) | Code detection method and device | |
CN106845244A (en) | A kind of detection method and device | |
CN102169458A (en) | Software accuracy verification system and method for automobile electric control component | |
CN102043711A (en) | Auxiliary testing device for software system | |
CN103746871B (en) | Data validity detection means and detection method | |
CN111726260A (en) | Test method, device and system for format conversion of network request reply information | |
CN101887391A (en) | Automatic testing device for mobile phone software and testing method thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20170125 |
|
WD01 | Invention patent application deemed withdrawn after publication |