CN107153608A - Code detection method and code detecting apparatus - Google Patents
Code detection method and code detecting apparatus Download PDFInfo
- Publication number
- CN107153608A CN107153608A CN201610122040.2A CN201610122040A CN107153608A CN 107153608 A CN107153608 A CN 107153608A CN 201610122040 A CN201610122040 A CN 201610122040A CN 107153608 A CN107153608 A CN 107153608A
- Authority
- CN
- China
- Prior art keywords
- code
- test
- function
- carried out
- case
- 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
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/3668—Software testing
- G06F11/3672—Test management
- G06F11/3676—Test management for coverage analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present invention provides a kind of code detection method, and it includes:Code coverage test is carried out to test code using test case, to obtain the code coverage information of detection code;According to the code parameter for being not carried out testing code, acquisition is not carried out the corresponding code function of test code;According to the corresponding code function of test code is not carried out, the corresponding upper strata call function of code function is obtained;According to upper strata call function, corresponding re-test use-case is obtained;Using re-test use-case code coverage test is carried out to being not carried out test code.The present invention also provides a kind of code detecting apparatus, the code detection method and code detecting apparatus of the present invention carries out code coverage test by the re-test use-case obtained according to upper strata call function to being not carried out test code, can preferably completion code completion detection, while testing cost is low, detection time is short and detecting step is relatively simple.
Description
Technical field
The present invention relates to detection field, more particularly to a kind of code detection method and code detecting apparatus.
Background technology
With the development of science and technology, the application used in terminal is more and more, before each application making time
It can carry out using test, the coverage rate test of such as application code, to ensure the quality of issue application.
The coverage rate test of existing application code is whether to have uncovered letter by tester's investigation
Number or code line;Which function or code for such as investigating which file one by one by hand by tester are not detected
Survey is covered, and wants tester's thinking to increase that what test case could cover these functions or code.
The coverage rate detection of above-mentioned application code has two defects:
First, coverage rate detection has certain technical threshold, it is necessary to which tester is enough to exploitation code
Solution, otherwise can not judge the test scope that code may influence.
2nd, the detection operation that covers again for not covering code needs tester to find according to not covering code
Corresponding upper strata call function, this takes and cumbersome very much.
Therefore the cost of existing code detection flow is higher, detection time is longer and detecting step is more numerous
It is trivial.
The content of the invention
A kind of testing cost of offer of the embodiment of the present invention is low, the generation that detection time is short and detecting step is relatively simple
Code detection method and code detecting apparatus;To solve the inspection of existing code detection method and code detecting apparatus
Survey cost is higher, the technical problem that detection time is longer and detecting step is relatively complicated.
The embodiment of the present invention provides a kind of code detection method, and it includes:
Code coverage test is carried out to test code using test case, to obtain the generation of the detection code
Code coverage rate information;Wherein described code coverage information includes the code parameter for being not carried out testing code;
According to the code parameter for being not carried out testing code, test code corresponding generation is not carried out described in acquisition
Code function;
The corresponding code function of test code is not carried out according to described, the corresponding upper strata of the code function is obtained
Call function;
According to the upper strata call function, corresponding re-test use-case is obtained;And
Code coverage test is carried out to the test code that is not carried out using the re-test use-case.
The embodiment of the present invention also provides a kind of code detecting apparatus, and it includes:
Code coverage data obtaining module, for carrying out code coverage to test code using test case
Test, to obtain the code coverage information of the detection code;Wherein described code coverage information includes
It is not carried out testing the code parameter of code;
Code function acquisition module, the code parameter for being not carried out testing code according to, obtains described
It is not carried out the corresponding code function of test code;
Upper strata call function acquisition module, for being not carried out the corresponding code function of test code according to,
Obtain the corresponding upper strata call function of the code function;
Re-test use-case acquisition module, is used for according to the upper strata call function, obtaining corresponding re-test
Example;And
Test module, for carrying out code coverage to the test code that is not carried out using the re-test use-case
Rate is tested.
Compared to the code detection method and code detecting apparatus of prior art, code detection method of the invention
And code detecting apparatus is entered by the re-test use-case obtained according to upper strata call function to being not carried out test code
Line code coverage rate test, can preferable completion code complete detection, while testing cost is low, detection when
Between it is short and detecting step is relatively simple;Solve the detection of existing code detection method and code detecting apparatus
Cost is higher, detection time is longer and the relatively complicated technical problem of detecting step.
Brief description of the drawings
Fig. 1 is the flow chart of the first preferred embodiment of the code detection method of the present invention;
Fig. 2 is the flow chart of the second preferred embodiment of the code detection method of the present invention;
Fig. 3 is the step S205 of the second preferred embodiment of the code detection method of present invention flow chart;
Fig. 4 is the structural representation of the first preferred embodiment of the code detecting apparatus of the present invention;
Fig. 5 is the structural representation of the second preferred embodiment of the code detecting apparatus of the present invention;
Fig. 6 is the knot of the code function acquisition module of the second preferred embodiment of the code detecting apparatus of the present invention
Structure schematic diagram;
Fig. 7 is the re-test use-case acquisition module of the second preferred embodiment of the code detecting apparatus of the present invention
Structural representation;
Fig. 8 for the present invention code detection method and code detecting apparatus specific embodiment flow chart;
Fig. 9 for the present invention code detecting apparatus where electronic equipment working environment structural representation.
Embodiment
Schema is refer to, wherein identical element numbers represent identical component, and principle of the invention is with reality
Illustrated in computing environment appropriate Shi Yi.The following description is specific based on the illustrated present invention
Embodiment, it is not construed as the limitation present invention other specific embodiments not detailed herein.
In the following description, specific embodiment of the invention will be referred to as performed by one or multi-section computer
Operation the step of and symbol illustrate, unless otherwise stating clearly.Therefore, its will appreciate that these steps and
Operation, mentions being performed by computer for several times, includes by representing with a structuring pattern wherein having
The computer processing unit of the electronic signal of data is manipulated.This manipulation transforms data are maintained at this
At position in the memory system of computer, its is reconfigurable or in addition with well known to those skilled in the art
Mode change the running of the computer.The data structure that the data are maintained is the provider location of the internal memory,
It has the particular characteristics as defined in the data format.But, the principle of the invention is illustrated with above-mentioned word,
It is not represented as a kind of limitation, and those skilled in the art will appreciate that plurality of step as described below and behaviour
Also it may be implemented among hardware.
The present invention code detecting apparatus various electronic equipments can be used to be implemented, the electronic equipment include but
Personal computer, server computer, hand-held or laptop devices, mobile device are not limited to (such as to move
Phone, personal digital assistant (PDA), media player etc.), multicomputer system, consumer electronics set
Standby, minicom, mainframe computer include the DCE of above-mentioned any system or equipment,
Etc..But the electronic equipment is preferably code detection server, with the complete detection of preferable completion code.
Fig. 1 is refer to, Fig. 1 is the flow chart of the first preferred embodiment of the code detection method of the present invention.
Above-mentioned electronic equipment can be used to be implemented for the code detection method of this preferred embodiment, this preferred embodiment
Code detection method include:
Step S101, carries out code coverage test, to obtain detection generation using test case to test code
The code coverage information of code;
Step S102, according to the code parameter for being not carried out testing code, it is corresponding that acquisition is not carried out test code
Code function;
Step S103, according to the corresponding code function of test code is not carried out, obtain code function it is corresponding on
Layer call function;
Step S104, according to upper strata call function, obtains corresponding re-test use-case;
Step S105, code coverage test is carried out using re-test use-case to being not carried out test code;
The following detailed description of the idiographic flow of each step of the code detection method of this preferred embodiment.
In step S101, code tester device carries out coverage rate test using test case to test code,
The application testing process that the test code is specially designed wherein according to test case, it is therefore intended that detection is all
Test code can normally run.Because test case may not be detected to all test codes,
Therefore after the completion of code detecting apparatus is to detection code detection, test coverage statistics is had, so as to obtain inspection
Survey the code coverage information of code.Wherein code coverage information includes being not carried out test in test code
The code parameter of code, the code parameter can be to be not carried out testing code position of code etc..Then pass to step
Rapid S102.
In step s 102, the generation for being not carried out testing code that code tester device is obtained according to step S101
Code parameter, acquisition is not carried out the corresponding code function of test code.Because every row test code may not be single
Solely operation, it is a part for some code function, thus here by be not carried out test code code
Parameter, acquisition is not carried out the corresponding code function of test code, enters to be subsequently not carried out test code to this
Row is detected again.Then pass to step S103.
In step s 103, code tester device is not carried out test code correspondence according to what step S102 was obtained
Code function, obtain the corresponding upper strata call function of code function.The upper strata call function is to call
The upper layer functions of code function, such as code function are that universal keyboard inputs view control loading functions, then the generation
The upper strata call function of code function can be adjustment with the flow page and the traffic monitoring letter of the traffic monitoring of operation
Number and the calendar wallpaper setting function that the local prompting page of calendar is set and operated.Traffic monitoring function and
Calendar wallpaper is required to call universal keyboard to input view control loading functions when setting function operation.Then turn
To step S104.
In step S104, the upper strata call function that code tester device is obtained according to step S103 is obtained
Use the re-test use-case of the upper strata call function.Such as upper strata call function is traffic monitoring function, then surveys again
Traffic monitoring use-case that example on probation can be monitored for the flow to the application of the going game of terminal etc..Then turn
To step S105.
In step S105, the re-test use-case that code tester device is obtained using step S104 is to step
What S101 was obtained is not carried out test code progress code coverage test.Because re-test use-case is that basis is not held
Row test code is set, thus can preferable completion code complete detection.
So complete the code detection process of the code detection method of this preferred embodiment.
The code detection method of this preferred embodiment passes through the re-test use-case pair that is obtained according to upper strata call function
Be not carried out test code and carry out code coverage test, can preferable completion code complete detection, inspection simultaneously
Survey cost is low, detection time is short and detecting step is relatively simple.
Fig. 2 is refer to, Fig. 2 is the flow chart of the second preferred embodiment of the code detection method of the present invention.
Above-mentioned electronic equipment can be used to be implemented for the code detection method of this preferred embodiment, this preferred embodiment
Code detection method include:
Step S201, by coverage rate test instrument, code coverage is carried out using test case to test code
Rate is tested, to obtain the code coverage information of detection code;
Step S202, obtains the code line for being not carried out testing code;
Step S203, obtains the corresponding code function of code line for being not carried out testing code;
Step S204, is carried out using static code scanning tools to being not carried out the corresponding code function of test code
Scanning, to obtain the corresponding upper strata call function of code function, wherein static code scanning tools include code
Function and the corresponding relation of at least one upper strata call function;
Step S205, according to upper strata call function, obtains corresponding re-test use-case;
Step S206, by coverage rate test instrument, is carried out using re-test use-case to being not carried out test code
Code coverage is tested.
The following detailed description of the idiographic flow of each step of the code detection method of this preferred embodiment.
In step s 201, code tester device is used by the coverage rate test instrument such as lcov using test
Example carries out coverage rate test to test code, and what the test code was specially designed wherein according to test case should
With testing process, it is therefore intended that can all test codes of detection normally run.Because test case may
All test codes can not be detected, thus code detecting apparatus to detection code detection after the completion of,
Test coverage statistics is had, so as to obtain the code coverage information of detection code.Wherein code coverage
Information includes the code parameter that being not carried out in test code tests code, and the code parameter can be to be not carried out surveying
The code line of code is tried, be not carried out testing the code execution number of times of code and is not carried out testing the code of code
Validity etc..Then pass to step S202.
In step S202, what code tester device obtaining step S201 was obtained is not carried out testing the generation of code
Code row, i.e. code position, then pass to step S203.
In step S203, code position in code tester device obtaining step S202 is not carried out test
The corresponding code function of code.Due to every row test code may not isolated operation, it is some code
A part for function, therefore here by being not carried out testing the code line of code, acquisition is not carried out testing code
Corresponding code function, is detected again to be subsequently not carried out test code to this.Then pass to step
S204。
In step S204, code tester device using static code scanning tools (such as understand with
And doxygen etc.) the corresponding code function of test code that is not carried out that is obtained to step S203 is scanned,
Because static code scanning tools include code function and the corresponding relation of at least one upper strata call function,
The upper strata call function is that can call the upper layer functions of code function;Therefore code tester device can obtain this
The corresponding upper strata call function of code function.Then pass to step S205.
In step S205, the upper strata call function that code tester device is obtained according to step S204 is obtained
Use the re-test use-case of the upper strata call function.Specific to refer to Fig. 3, Fig. 3 examines for the code of the present invention
The step S205 of second preferred embodiment of survey method flow chart.Step S205 includes:
Whether step S301, it is zero to judge access times of the upper strata call function in test case;Such as it is zero,
Then go to step S302;Such as it is not zero, then goes to step S303.
Step S302, access times of the upper strata call function in test case are zero, then illustrate that the upper strata is adjusted
Do not used with function in test case before, then upper strata call function can be used to create re-test and use
Example;Then pass to step S206.
Step S303, access times of the upper strata call function in test case are not zero, then illustrate the upper strata
Call function was used in test case before, therefore upper strata call function establishment will not be used to survey again
Example on probation.Then pass to step S206.
In step S206, code tester device uses step S205 by the coverage rate test instrument such as lcov
What the re-test use-case of acquisition was obtained to step S201 is not carried out test code progress code coverage test.By
Set in re-test use-case according to test code is not carried out, thus can preferable completion code it is complete
Detection.
So complete the code detection process of the code detection method of this preferred embodiment.
On the basis of first preferred embodiment, the code detection method of this preferred embodiment uses static code
Scanning tools carry out the acquisition of upper strata call function so that the upper strata call function of acquisition is more comprehensively accurate;
By the judgement of the access times to upper strata call function, the detection for further increasing re-test use-case is accurate
Property.
The present invention also provides a kind of code detecting apparatus, refer to Fig. 4, and Fig. 4 is code detection of the invention
The structural representation of the first preferred embodiment of device.The code detecting apparatus 40 includes code coverage information
Acquisition module 41, code function acquisition module 42, upper strata call function acquisition module 43, re-test use-case
Acquisition module 44 and test module 45.
Code coverage data obtaining module 41 is used to carry out code coverage to test code using test case
Rate is tested, to obtain the code coverage information of detection code;Wherein code coverage information includes being not carried out
Test the code parameter of code.Code function acquisition module 42 is used for according to the code ginseng for being not carried out testing code
Number, acquisition is not carried out the corresponding code function of test code.Upper strata call function acquisition module 43 is used for basis
The corresponding code function of test code is not carried out, the corresponding upper strata call function of code function is obtained.Re-test
Use-case acquisition module 44 is used to, according to upper strata call function, obtain corresponding re-test use-case.Test module
45 are used to carry out code coverage test to being not carried out test code using re-test use-case.
The code detecting apparatus 40 of this preferred embodiment is in use, code coverage data obtaining module 41 makes
Coverage rate test is carried out to test code with test case, the test code is special wherein according to test case
The application testing process of design, it is therefore intended that can all test codes of detection normally run.Due to test
Use-case may not be detected to all test codes, therefore code coverage data obtaining module 41
After the completion of detection code detection, test coverage statistics is had, so as to obtain the code coverage of detection code
Rate information.Wherein code coverage information includes the code parameter that being not carried out in test code tests code,
The code parameter can be to be not carried out testing code position of code etc..
Subsequent code function acquisition module 42 is according to being not carried out that code coverage data obtaining module 41 is obtained
The code parameter of code is tested, acquisition is not carried out the corresponding code function of test code.Because every row tests generation
Code may not isolated operation, it is a part for some code function, thus here by be not carried out survey
The code parameter of code is tried, acquisition is not carried out the corresponding code function of test code, not held to this subsequently
Row test code is detected again.
Then upper strata call function acquisition module 43 is not carried out survey according to what code function acquisition module 42 was obtained
The corresponding code function of code is tried, the corresponding upper strata call function of code function is obtained.The upper strata call function
For that can call the upper layer functions of code function, such as code function is universal keyboard input view control loading letters
Number, then the upper strata call function of the code function can be adjustment with the flow page and the traffic monitoring of operation
Traffic monitoring function and the calendar wallpaper setting function that the local prompting page of calendar is set and operated.Flow
Monitoring function and calendar wallpaper are required to call universal keyboard to input the loading of view controls when setting function operation
Function.
Adjust on the upper strata that subsequent re-test use-case acquisition module 44 is obtained according to upper strata call function acquisition module 43
With function, the re-test use-case using the upper strata call function is obtained.If upper strata call function is traffic monitoring
Function, then monitoring function that re-test use-case can be monitored for the flow to the application of the going game of terminal etc..
The re-test use-case that last test module 45 is obtained using re-test use-case acquisition module 44 covers to code
What lid rate data obtaining module was obtained is not carried out test code progress code coverage test.Because re-test is used
Example is set according to being not carried out test code, thus can preferable completion code complete detection.
So complete the code detection process of the code detecting apparatus 40 of this preferred embodiment.
The code detecting apparatus of this preferred embodiment passes through the re-test use-case pair that is obtained according to upper strata call function
Be not carried out test code and carry out code coverage test, can preferable completion code complete detection, inspection simultaneously
Survey cost is low, detection time is short and detecting step is relatively simple.
Fig. 5 is refer to, Fig. 5 is the structural representation of the second preferred embodiment of the code detecting apparatus of the present invention
Figure.The code detecting apparatus 50 includes code coverage data obtaining module 51, code function acquisition module
52nd, upper strata call function acquisition module 53, re-test use-case acquisition module 54 and test module 55.
The code coverage data obtaining module 51 is used to, by coverage rate test instrument, use test case pair
Test code and carry out code coverage test;Code function acquisition module 52 is used for basis and is not carried out testing code
Code parameter, acquisition is not carried out the corresponding code function of test code;Upper strata call function acquisition module 53
For being scanned using static code scanning tools to being not carried out the corresponding code function of test code, to obtain
The corresponding upper strata call function of substitution code function, wherein static code scanning tools are including code function and at least
The corresponding relation of one upper strata call function;Re-test use-case acquisition module 54 is used to call letter according to upper strata
Number, obtains corresponding re-test use-case;Test module 55 is used for using re-test use-case to being not carried out testing generation
Code carries out code coverage test.
Fig. 6 is refer to, Fig. 6 is the code function of the second preferred embodiment of the code detecting apparatus of the present invention
The structural representation of acquisition module.The code function acquisition module 52 include code line acquiring unit 61 and
Code function acquiring unit 62.Code line acquiring unit 61 is used to obtain the code line for being not carried out testing code;
Code function acquiring unit 62 is used to obtain the corresponding code function of code line for being not carried out testing code.
Fig. 7 is refer to, Fig. 7 uses for the re-test of the second preferred embodiment of the code detecting apparatus of the present invention
The structural representation of example acquisition module.Re-test use-case acquisition module 54 includes judging unit 71 and surveyed again
Example creating unit 72 on probation.Judging unit 71 is used to judge use of the upper strata call function in test case
Whether number of times is zero.Re-test use-case creating unit 72 is used to create re-test use using upper strata call function
Example.
The code detecting apparatus 50 of this preferred embodiment is in use, code coverage data obtaining module first
51, by the coverage rate test instrument such as lcov, coverage rate test are carried out using test case to test code, its
The application testing process that the test code is specially designed according to middle test case, it is therefore intended that detection is all
Can test code normally run.Because test case may not be detected to all test codes,
Therefore after the completion of code detecting apparatus is to detection code detection, test coverage statistics is had, so as to obtain inspection
Survey the code coverage information of code.Wherein code coverage information includes being not carried out test in test code
The code parameter of code, the code parameter can be to be not carried out testing the code line of code, be not carried out testing code
Code perform number of times and be not carried out testing code validity etc. of code.
The code line acquiring unit 61 of subsequent code function acquisition module 52 obtains code coverage acquisition of information
What module was obtained is not carried out testing the code line of code, i.e. code position.
Then the code function acquiring unit 62 of code function acquisition module 52 obtains not holding for the code position
The corresponding code function of row test code.Due to every row test code may not isolated operation, it is certain
A part for individual code function, therefore here by being not carried out testing the code line of code, acquisition is not carried out surveying
The corresponding code function of code is tried, is detected again to be subsequently not carried out test code to this.
Subsequent upper strata call function acquisition module 53 using static code scanning tools (such as understand with
And doxygen etc.) the corresponding code function of test code is not carried out to the acquisition of code function acquisition module 52
It is scanned, because static code scanning tools include code function and at least one upper strata call function
Corresponding relation, the upper strata call function is that can call the upper layer functions of code function;Therefore letter is called on upper strata
Number acquisition module 53 can obtain the corresponding upper strata call function of the code function.
Call letter in the upper strata that re-test use-case acquisition module 54 is obtained according to upper strata call function acquisition module 53
Number, obtains the re-test use-case using the upper strata call function.Specially:
The judging unit 71 of re-test use-case acquisition module 54 judges upper strata call function in test case
Whether access times are zero;Such as access times of the upper strata call function in test case are zero, then explanation should
Upper strata call function was not used in test case before, then re-test use-case acquisition module 54 is again
Test case creation unit 72 creates re-test use-case using upper strata call function.As upper strata call function is being surveyed
Access times in example on probation are not zero, then illustrate that the upper strata call function is used in test case before
Cross, therefore re-test use-case acquisition module 54 will not use the upper strata call function to create re-test use-case.
Last test module 55 uses re-test use-case acquisition module by the coverage rate test instrument such as lcov
What the 54 re-test use-cases obtained were obtained to code coverage data obtaining module is not carried out test code progress
Code coverage is tested.Because re-test use-case is set according to test code is not carried out, therefore can be compared with
The complete detection of good completion code.
So complete the code detection process of the code detecting apparatus 50 of this preferred embodiment.
On the basis of first preferred embodiment, the code detecting apparatus of this preferred embodiment uses static code
Scanning tools carry out the acquisition of upper strata call function so that the upper strata call function of acquisition is more comprehensively accurate;
By the judgement of the access times to upper strata call function, the detection for further increasing re-test use-case is accurate
Property.
Below by a specific embodiment illustrate the present invention code detection method and code detecting apparatus it is specific
Operation principle.Fig. 8 is refer to, Fig. 8 is specific for code detection method and code detecting apparatus of the invention
The flow chart of embodiment.The specific embodiment is implemented using code detection server, the code detection mistake
Journey includes:
Step S801, code detecting apparatus is by coverage rate test instrument lcov, using test case to test
Code carries out coverage rate test, obtains code coverage information, such as code coverage information .info files, tool
The code coverage information .info files of body are as follows:
SF:/Applications/Xcode 3.app/X.m
FN:126,_CGPointApplyAffineTransform
FNDA:0,_CGPointApplyAffineTransform
FNF:1
FNH:0
DA:129,4098624
DA:130,4098624
DA:131,4098624
DA:132,0
LF:3
LH:3
End_of_record
Wherein SF is filename;FN is function initial row and function name;FNDA is that function performs number of times
And function name;FNF is function sum;The number that FNH is performed to for function in total;DA is generation
The number of times that code line number and current line are performed to;LF is the effective row sum of code;LH is the effective row of code
The number being performed in sum;End_of_record is " record " end mark.
Step S802, understands the code of the 132nd row to be not carried out testing code, then from step S801
Code tester device obtains this and is not carried out the corresponding code function of test code.Here the code function is
M/shareUI_MInputListView.m- [MInputListView reload], the corresponding knowledge of the code function
Storehouse content is that universal keyboard inputs view control loading functions.
Step S803, code tester device is scanned using two kinds of static codes of understand and doxygen
Instrument is scanned to the above-mentioned corresponding code function of test code that is not carried out, so as to obtain and the code function
Corresponding upper strata call function.In this specific embodiment, code function
M/shareUI_MInputListView.m- [MInputListView reload] upper strata call function is
M/MAdjustUUsedTrafficViewController.m-[MAdjustUsedTrafficViewController
ViewDidload], adjustment is with the flow page and the traffic monitoring function of operation;And
M/MWallpaperNotificationController.m-[MWallpaperNotificationController
ViewDidload], set the local prompting page of calendar and the calendar wallpaper of operation that function is set.
Step S804, code tester device obtains traffic monitoring function and calendar wallpaper sets function to be used in test
Access times in example, here if access times of the traffic monitoring function in test case are 0 time, calendar
Wallpaper sets access times of the function in test case to be 2 times, because calendar wallpaper sets function in test
Used in use-case, therefore used here as traffic monitoring function creation re-test use-case, such as re-test is used
Traffic monitoring use-case that example can be monitored for the flow to the application of the going game of terminal etc..
Step S805, the re-test use-case that code tester device is obtained using step S804 is obtained to step S804
The test code that is not carried out taken carries out code coverage test.Because re-test use-case is that basis is not carried out test
What code was set, thus can preferable completion code complete detection.
So complete the code detection process of the code test method of this specific embodiment.
The code detection method and code detecting apparatus of the present invention is surveyed again by what is obtained according to upper strata call function
Example on probation carries out code coverage test to being not carried out test code, can preferable completion code complete detection,
Testing cost is low, detection time is short and detecting step is relatively simple simultaneously;Solve existing code detection side
The skill that method and the testing cost of code detecting apparatus are higher, detection time is longer and detecting step is relatively complicated
Art problem.
" component ", " module ", " system ", " interface ", " process " etc. are general as used herein the term
Ground is intended to refer to computer related entity:Hardware, the combination of hardware and software, software or executory software.
For example, component can be but not limited to run process on a processor, it is processor, object, executable
Using, perform thread, program and/or computer.By diagram, operation application on the controller and
Both controllers can be component.One or more assemblies can have the process for being to perform and/or line
In journey, and component can be located on a computer and/or be distributed between two or more computers.
Moreover, claimed theme may be implemented as using standard program and/or engineering technology generation soft
Part, firmware, hardware or its any combination realized with control computer the method for disclosed theme, device or
Manufacture.Term as used herein " manufacture " is intended to comprising can be from any computer readable device, carrier
Or the computer program of medium access.Certainly, it would be recognized by those skilled in the art that can be carried out to the configuration
Many modifications, without departing from the scope or spirit of claimed theme.
Fig. 9 and the discussion below are provided to be set to the electronics where realizing device for displaying information of the present invention
Brief, summary the description of standby working environment.Fig. 9 working environment is only appropriate working environment
One example and be not intended to suggestion on working environment purposes or function scope any limitation.Example
Electronic equipment 912 include but is not limited to personal computer, server computer, hand-held or laptop devices,
Mobile device (such as mobile phone, personal digital assistant (PDA), media player etc.), multiprocessor system
System, consumer electronic devices, minicom, mainframe computer including above-mentioned any system or equipment
DCE, etc..
Although not requiring, at " computer-readable instruction " by leading to that one or more electronic equipments are performed
With describing embodiment under background.Computer-readable instruction can be distributed (hereafter via computer-readable medium
Discuss).Computer-readable instruction can be implemented as program module, such as perform particular task or realize specific take out
The function of image data type, object, API (API), data structure etc..Typically, the meter
The function of calculation machine readable instruction can be optionally combined or be distributed in various environment.
Fig. 9 illustrates the electronic equipment of one or more embodiments of the device for displaying information including the present invention
912 example.In one configuration, electronic equipment 912 includes at least one processing unit 916 and storage
Device 918.According to the exact configuration and type of electronic equipment, memory 918 can be volatibility (such as
RAM), non-volatile (such as ROM, flash memory etc.) or certain combination of the two.The configuration is in Fig. 9
In illustrated by dotted line 914.
In other embodiments, electronic equipment 912 can include supplementary features and/or function.For example, setting
Standby 912 can also include additional storage device (for example can be removed and/or non-removable), it include but
It is not limited to magnetic memory apparatus, light storage device etc..This additional memory devices are in fig .9 by storage device
920 diagrams.In one embodiment, for realizing the calculating of one or more embodiments provided in this article
Machine readable instruction can be in storage device 920.Storage device 920 can also be stored for realizing operation system
Other computer-readable instructions of system, application program etc..Computer-readable instruction can be loaded into memory 918
In performed by such as processing unit 916.
Term as used herein " computer-readable medium " includes computer-readable storage medium.Computer storage is situated between
Matter includes any method or skill of the information for storing such as computer-readable instruction or other data etc
Volatibility and non-volatile, removable and nonremovable medium that art is realized.Memory 918 and storage device
920 be the example of computer-readable storage medium.Computer-readable storage medium include but is not limited to RAM, ROM,
EEPROM, flash memory or other memory technologies, CD-ROM, digital universal disc (DVD) or other light are deposited
Storage device, cassette tape, tape, disk storage device or other magnetic storage apparatus can be used for storage
Expect information and any other medium that can be accessed by electronic equipment 912.Any such computer storage
Medium can be a part for electronic equipment 912.
Electronic equipment 912 can also include the communication connection for allowing electronic equipment 912 to be communicated with other equipment
926.Communication connection 926 can include but is not limited to modem, NIC (NIC), collection networking
Network interface, radiofrequency launcher/receiver, infrared port, USB connections or for electronic equipment 912 to be connected
It is connected to other interfaces of other electronic equipments.Communication connection 926 can include wired connection or wireless connection.
Communication connection 926 can launch and/or receive communication medium.
Term " computer-readable medium " can include communication media.Communication media typically comprises computer can
Other data in " the own modulated data signal " of reading instruction or such as carrier wave or other transmission mechanisms etc, and
And including any information delivery media.Term " own modulated data signal " can include such signal:The letter
One or more of number characteristic is set or changed in the way of encoding information onto in signal.
Electronic equipment 912 can include input equipment 924, such as keyboard, mouse, pen, phonetic entry are set
Standby, touch input device, infrared camera, video input apparatus and/or any other input equipment.Equipment
In 912 can also include output equipment 922, such as one or more displays, loudspeaker, printer and/
Or other any output equipments.Input equipment 924 and output equipment 922 can be via wired connections, wireless
Connection or its any combination are connected to electronic equipment 912.In one embodiment, set from another electronics
Standby input equipment or output equipment is used as the input equipment 924 or output equipment of electronic equipment 912
922。
The component of electronic equipment 912 can be connected by various interconnection (such as bus).Such interconnection can
With including periphery component interconnection (PCI) (such as quick PCI), USB (USB), live wire (IEEE
1394), optical bus structure etc..In another embodiment, the component of electronic equipment 912 can pass through
Network interconnection.For example, memory 918 can be by different physical locations, by network interconnection
Multiple physical memory cells arcs are constituted.
It would be recognized by those skilled in the art that can be crossed over for the storage device for storing computer-readable instruction
Network distribution.For example, the electronic equipment 930 that can be accessed via network 928 can be stored for realizing this hair
The computer-readable instruction of bright provided one or more embodiments.Electronic equipment 912 can access electronics
Equipment 930 and downloading computer readable instruction it is part or all of for performing.Alternately, electronics
Equipment 912 can download a plurality of computer-readable instruction on demand, or some instructions can be in electronic equipment
Performed at 912 and some instructions can be performed at electronic equipment 930.
There is provided herein the various operations of embodiment.In one embodiment, described one or more operations
The computer-readable instruction stored on one or more computer-readable mediums is may be constructed, it sets by electronics
It will cause to operate described in computing device during standby execution.The order for describing some or all of operations should not be by
It is construed as to imply that these operations are necessarily order dependent.It will be appreciated by those skilled in the art that with this specification
Benefit alternative sequence.Furthermore, it is to be understood that not all operation must be provided in this article
Exist in each embodiment.
Moreover, word " preferably " used herein means serving as example, example or illustration.Feng Wen is described
It is not necessarily to be construed as than other aspects or designs more favourable for " preferably " any aspect or design.On the contrary, word
The use of language " preferably " is intended to propose concept in a concrete fashion.Term "or" purport as used in this application
In the non-excluded "or" of the "or" for meaning to include.I.e., unless otherwise or clear from the context, " X
Mean that nature includes any one of arrangement using A or B ".That is, if X uses A;X uses B;Or
X uses A and B both, then " X is met using A or B " in foregoing any example.
Although moreover, the disclosure has shown and described relative to one or more implementations, originally
Art personnel are based on the reading to the specification and drawings and understand it will be appreciated that equivalent variations and modification.
The disclosure includes all such modifications and variations, and is limited only by the scope of the following claims.Especially
Ground is on the various functions that are performed by said modules (such as element, resource), for describing such group
The term of part is intended to correspond to the specified function of the execution component (for example it is functionally of equal value)
Random component (unless otherwise instructed), with the exemplary reality of the execution disclosure shown in this article in structure
The open structure of function in existing mode is not equivalent.Although in addition, the special characteristic of the disclosure relative to
Only one in some implementations is disclosed, but this feature can with such as can to it is given or it is specific should
It is to expect other one or more combinations of features with other favourable implementations for.Moreover, with regard to art
For language " comprising ", " having ", " containing " or its deformation are used in embodiment or claim,
Such term is intended to include in the mode similar to term "comprising".
Each functional unit in the embodiment of the present invention can be integrated in a processing module or each
Unit is individually physically present, can also two or more units be integrated in a module.It is above-mentioned integrated
Module can both be realized in the form of hardware, it would however also be possible to employ the form of software function module is realized.Institute
If stating integrated module to realize and as independent production marketing or use using in the form of software function module
When, it can also be stored in a computer read/write memory medium.Storage medium mentioned above can be
Read-only storage, disk or CD etc..Above-mentioned each device or system, can perform correlation method embodiment
In method.
In summary, although the present invention is disclosed above with preferred embodiment, but above preferred embodiment is not
To limit the present invention, one of ordinary skill in the art, without departing from the spirit and scope of the present invention,
Various changes can be made to be defined by the scope that claim is defined with retouching, therefore protection scope of the present invention.
Claims (10)
1. a kind of code detection method, it is characterised in that including:
Code coverage test is carried out to test code using test case, to obtain the generation of the detection code
Code coverage rate information;Wherein described code coverage information includes the code parameter for being not carried out testing code;
According to the code parameter for being not carried out testing code, test code corresponding generation is not carried out described in acquisition
Code function;
The corresponding code function of test code is not carried out according to described, the corresponding upper strata of the code function is obtained
Call function;
According to the upper strata call function, corresponding re-test use-case is obtained;And
Code coverage test is carried out to the test code that is not carried out using the re-test use-case.
2. code detection method according to claim 1, it is characterised in that the use test case
It is specially to testing the step of code carries out code coverage test:
By coverage rate test instrument, code coverage test is carried out to test code using test case;
It is described to be not carried out testing the step that code carries out code coverage test to described using the re-test use-case
It is rapid to be specially:
By the coverage rate test instrument, the test code that is not carried out is entered using the re-test use-case
Line code coverage rate test.
3. code detection method according to claim 1, it is characterised in that do not held described in the basis
The code parameter of row test code, obtaining described includes the step of be not carried out testing code corresponding code function:
It is not carried out testing the code line of code described in obtaining;And
It is not carried out testing the corresponding code function of code line of code described in obtaining.
4. code detection method according to claim 1, it is characterised in that do not held described in the basis
The corresponding code function of row test code, the step of obtaining the code function corresponding upper strata call function is wrapped
Include:
The corresponding code function of test code that is not carried out is scanned using static code scanning tools,
To obtain the corresponding upper strata call function of the code function, wherein the static code scanning tools include institute
State the corresponding relation of code function and at least one upper strata call function.
5. code detection method according to claim 1, it is characterised in that described according to the upper strata
Call function, the step of obtaining corresponding re-test use-case includes:
Judge whether access times of the upper strata call function in the test case are zero;
Such as it is zero, then creates the re-test use-case using the upper strata call function.
6. a kind of code detecting apparatus, it is characterised in that including:
Code coverage data obtaining module, for carrying out code coverage to test code using test case
Test, to obtain the code coverage information of the detection code;Wherein described code coverage information includes
It is not carried out testing the code parameter of code;
Code function acquisition module, the code parameter for being not carried out testing code according to, obtains described
It is not carried out the corresponding code function of test code;
Upper strata call function acquisition module, for being not carried out the corresponding code function of test code according to,
Obtain the corresponding upper strata call function of the code function;
Re-test use-case acquisition module, is used for according to the upper strata call function, obtaining corresponding re-test
Example;And
Test module, for carrying out code coverage to the test code that is not carried out using the re-test use-case
Rate is tested.
7. code detecting apparatus according to claim 6, it is characterised in that the code coverage letter
Acquisition module is ceased specifically for by coverage rate test instrument, line code is entered to test code using test case
Coverage rate test;
The test module is specifically for by the coverage rate test instrument, using the re-test use-case pair
The test code that is not carried out carries out code coverage test.
8. code detecting apparatus according to claim 6, it is characterised in that the code function is obtained
Module includes:
Code line acquiring unit, for obtaining the code line for being not carried out testing code;And
Code function acquiring unit, for obtaining the corresponding code letter of code line for being not carried out testing code
Number.
9. code detecting apparatus according to claim 6, it is characterised in that the upper strata call function
Acquisition module to described using static code scanning tools specifically for being not carried out the corresponding code letter of test code
Number is scanned, to obtain the corresponding upper strata call function of the code function, wherein the static code is swept
Retouch corresponding relation of the instrument including the code function with least one upper strata call function.
10. code detecting apparatus according to claim 6, it is characterised in that the re-test use-case
Acquisition module includes:
Judging unit, for whether judging access times of the upper strata call function in the test case
It is zero;And
Re-test use-case creating unit, for creating the re-test use-case using the upper strata call function.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610122040.2A CN107153608B (en) | 2016-03-02 | 2016-03-02 | Code detection method and code detection device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610122040.2A CN107153608B (en) | 2016-03-02 | 2016-03-02 | Code detection method and code detection device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107153608A true CN107153608A (en) | 2017-09-12 |
CN107153608B CN107153608B (en) | 2020-06-26 |
Family
ID=59791466
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610122040.2A Active CN107153608B (en) | 2016-03-02 | 2016-03-02 | Code detection method and code detection device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107153608B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110134582A (en) * | 2019-04-03 | 2019-08-16 | 口碑(上海)信息技术有限公司 | The processing of test case and data processing method and device |
CN110321144A (en) * | 2019-06-27 | 2019-10-11 | 深圳前海微众银行股份有限公司 | Recognition methods, device, equipment and the storage medium of offline source code |
CN112416773A (en) * | 2020-11-23 | 2021-02-26 | 通号万全信号设备有限公司 | Cross-platform data visualization method |
CN112685312A (en) * | 2020-12-31 | 2021-04-20 | 广州品唯软件有限公司 | Test case recommendation method and device for uncovered codes |
CN113704094A (en) * | 2021-08-06 | 2021-11-26 | 北京城市网邻信息技术有限公司 | Test case knowledge base construction method and device, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090265694A1 (en) * | 2008-04-18 | 2009-10-22 | International Business Machines Corporation | Method and system for test failure analysis prioritization for software code testing in automated test execution |
CN103473171A (en) * | 2013-08-28 | 2013-12-25 | 北京信息科技大学 | Coverage rate dynamic tracking method and device based on function call paths |
CN103699385A (en) * | 2013-12-23 | 2014-04-02 | 国云科技股份有限公司 | Continuous code integration method |
-
2016
- 2016-03-02 CN CN201610122040.2A patent/CN107153608B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090265694A1 (en) * | 2008-04-18 | 2009-10-22 | International Business Machines Corporation | Method and system for test failure analysis prioritization for software code testing in automated test execution |
CN103473171A (en) * | 2013-08-28 | 2013-12-25 | 北京信息科技大学 | Coverage rate dynamic tracking method and device based on function call paths |
CN103699385A (en) * | 2013-12-23 | 2014-04-02 | 国云科技股份有限公司 | Continuous code integration method |
Non-Patent Citations (2)
Title |
---|
于炳霞: "基于嵌入式软件的覆盖测试技术研究", 《中国优秀硕士学位论文全文数据库》 * |
李列锋: "基于二进制可执行文件代码覆盖测试技术研究", 《中国优秀硕士学位论文全文数据库》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110134582A (en) * | 2019-04-03 | 2019-08-16 | 口碑(上海)信息技术有限公司 | The processing of test case and data processing method and device |
CN110321144A (en) * | 2019-06-27 | 2019-10-11 | 深圳前海微众银行股份有限公司 | Recognition methods, device, equipment and the storage medium of offline source code |
CN112416773A (en) * | 2020-11-23 | 2021-02-26 | 通号万全信号设备有限公司 | Cross-platform data visualization method |
CN112685312A (en) * | 2020-12-31 | 2021-04-20 | 广州品唯软件有限公司 | Test case recommendation method and device for uncovered codes |
CN112685312B (en) * | 2020-12-31 | 2024-07-02 | 广州品唯软件有限公司 | Test case recommendation method and device for uncovered codes |
CN113704094A (en) * | 2021-08-06 | 2021-11-26 | 北京城市网邻信息技术有限公司 | Test case knowledge base construction method and device, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN107153608B (en) | 2020-06-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112270149B (en) | Verification platform automatic integration method and system, electronic equipment and storage medium | |
US20150007148A1 (en) | Identifying Test Cases Based on Changed Test Code | |
CN107153608A (en) | Code detection method and code detecting apparatus | |
US20120330598A1 (en) | Method, program, and system for generating test cases | |
CN113742153A (en) | Equipment testing method and device, readable medium and electronic equipment | |
CN113961919B (en) | Malicious software detection method and device | |
CN109614325B (en) | Method and device for determining control attribute, electronic equipment and storage medium | |
CN105786562A (en) | Method and device for integrating plug-in | |
CN104750612A (en) | File operation testing method and device | |
CN103630720B (en) | There is self synchronous T & M instrument for position error-detecting | |
CN108958890A (en) | Container microscope testing method, apparatus and electronic equipment | |
CN112256572B (en) | Random test case generation method and device, electronic equipment and storage medium | |
CN109324967A (en) | The method, apparatus and terminal device of application program pop-up components testing | |
CN110069997B (en) | Scene classification method and device and electronic equipment | |
CN109977005B (en) | End-to-end test method, medium, device and computing equipment | |
CN111782474A (en) | Log processing method and device, electronic equipment and medium | |
CN104090845B (en) | Automatic game testing method and system and related device | |
CN113805861B (en) | Code generation method based on machine learning, code editing system and storage medium | |
CN110414220A (en) | Method and device for extracting operation files in dynamic execution process of program in sandbox | |
CN107743085B (en) | Invite code management method and invitation code managing device | |
CN101706745A (en) | Method for testing storage equipment of mass storage system | |
CN110489341B (en) | Test method and device, storage medium and electronic equipment | |
CN112379967B (en) | Simulator detection method, device, equipment and medium | |
CN116257422A (en) | Self-test case generation method and device and electronic equipment | |
CN104008336A (en) | ShellCode detecting method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |