CN110147317A - Code test method and device, electronic equipment and storage medium - Google Patents
Code test method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN110147317A CN110147317A CN201910317815.5A CN201910317815A CN110147317A CN 110147317 A CN110147317 A CN 110147317A CN 201910317815 A CN201910317815 A CN 201910317815A CN 110147317 A CN110147317 A CN 110147317A
- Authority
- CN
- China
- Prior art keywords
- interface
- code
- function
- test
- target
- 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
- 238000010998 test method Methods 0.000 title claims abstract description 19
- 238000012360 testing method Methods 0.000 claims abstract description 127
- 238000013507 mapping Methods 0.000 claims abstract description 11
- 230000006870 function Effects 0.000 claims description 187
- 230000008859 change Effects 0.000 claims description 43
- 238000000034 method Methods 0.000 claims description 34
- 238000001514 detection method Methods 0.000 claims description 17
- 230000015654 memory Effects 0.000 claims description 13
- 238000012986 modification Methods 0.000 claims description 11
- 230000004048 modification Effects 0.000 claims description 11
- 230000004044 response Effects 0.000 claims description 10
- 238000005516 engineering process Methods 0.000 claims description 5
- 238000004590 computer program Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 10
- 238000004891 communication Methods 0.000 description 5
- 235000013399 edible fruits Nutrition 0.000 description 3
- 230000005291 magnetic effect Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 108010001267 Protein Subunits Proteins 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 230000003044 adaptive effect Effects 0.000 description 1
- 210000004027 cell Anatomy 0.000 description 1
- 239000000470 constituent Substances 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000001727 in vivo Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000003550 marker Substances 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000003014 reinforcing effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 210000000352 storage cell Anatomy 0.000 description 1
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/3684—Test management for test design, e.g. generating new test cases
-
- 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/3688—Test management for test execution, e.g. scheduling of test suites
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)
- Stored Programmes (AREA)
Abstract
The disclosure is directed to a kind of code test method and device, electronic equipment and storage medium, the test and management technical field being related in software test can be applied to the application scenarios that code tester is carried out to the software code that developer completes.The code test method includes being stored interface and function using the storage mode of relationship between the interface and function in definition code;If function changes in code, it is determined that interface corresponding with changed function is as target interface;The corresponding test case of target interface is determined according to interface and the default mapping relations of test case, to test based on test case the changed code of function.The disclosure can accurately navigate to the corresponding interface of changed function in software code, and generate test case based on the interface navigated to, to carry out code tester.
Description
Technical field
This disclosure relates to the test and management technical field in software test, in particular to a kind of code test method,
Code tester device, electronic equipment and storage medium.
Background technique
Code tester is that an important process in software development needs tester after developer completes software code
Member is constantly tested, and some loopholes (i.e. bug) in code is found, to improve code in time.
In existing code tester process, after developer modifies to code, tester needed to all generations
Code carries out whole process regression test, to confirm that modified code does not introduce new mistake or to cause other codes to generate wrong
Accidentally.
When code changes, needs all to carry out regression test to all interfaces, lead to the test job of tester
Measure huge, the cost of increase system testing and maintenance upgrade.
It should be noted that information is only used for reinforcing the reason to the background of the disclosure disclosed in above-mentioned background technology part
Solution, therefore may include the information not constituted to the prior art known to persons of ordinary skill in the art.
Summary of the invention
The disclosure is designed to provide a kind of code test method, code tester device, electronic equipment and computer
Readable storage medium storing program for executing, and then the interface that can not be changed in precise positioning code is overcome at least to a certain extent, and is directed to
The interface to change carries out the problem of code tester.
According to the disclosure in a first aspect, providing a kind of code test method, comprising: using in definition code interface and
The storage mode of relationship stores interface and function between function;If function changes in code, it is determined that with hair
The corresponding interface of the function for changing is as target interface;Determine that target connects according to the default mapping relations of interface and test case
The corresponding test case of mouth, to be tested based on test case the changed code of function.
Optionally, interface and function are deposited using the storage mode of relationship between the interface and function in definition code
Storage comprises determining that multiple interfaces in code and respectively function corresponding with each interface;Using tree structure to multiple interfaces
Function corresponding with each interface is stored;Wherein, tree structure defines between multiple interfaces and function corresponding with each interface
Relationship.
Optionally, carrying out storage to multiple interfaces function corresponding with each interface using tree structure includes: to make interface
For the root node in tree structure, using the function in code as the intermediate node or leaf node in tree structure.
Optionally, determining interface corresponding with changed function as target interface includes: that will change in code
The function of change is determined as objective function;It is corresponding with objective function to determine based on the bottom-up traversal tree structure of objective function
Interface as target interface.
Optionally, after determining interface corresponding with changed function as target interface, code test method is also wrapped
It includes: if target interface is multiple, it is determined that the associated weights of each target interface and objective function;According to each target determined
The associated weights of interface and objective function judge the changed type of code;Wherein, the changed type of code includes kind
Meaning modification and malice are distorted.
Optionally, determine that the associated weights of each target interface and objective function comprise determining that a target interface as target
Test interface;Determine the version before target detection interface is not modified as first version;Determine target detection interface by more
Version after changing is as the second edition;Operation result of the code under first version is obtained as the first test result;It obtains
Operation result of the code under the second edition is as the second test result;If between the second test result and the first test result
Diversity factor determine the associated weights of target detection interface and objective function.
Optionally, the changed class of code is judged according to the associated weights of each target interface and objective function determined
Type comprises determining that the implementing result of test case before objective function changes as the first implementing result;Determine objective function
The implementing result of test case is as the second implementing result after changing;If the second implementing result and the first implementing result it
Between diversity factor and associated weights to response be greater than preset threshold, it is determined that code change type be good will modify;If the
Diversity factor and associated weights between two implementing results and the first implementing result are less than or equal to preset threshold to response, then really
Determine code change type to distort for malice.
According to the second aspect of the disclosure, a kind of code tester device is provided, comprising: relationship storage module, for using
The storage mode of relationship stores interface and function between interface and function in definition code;Target interface determines mould
Block determines interface corresponding with changed function as target interface if changed for function in code;Test
Use-case generation module, for determining the corresponding test case of target interface according to interface and the default mapping relations of test case,
To be tested based on test case the changed code of function.
Optionally, relationship storage module includes relationship storage unit, for determining multiple interfaces and difference in code
Function corresponding with each interface;Multiple interfaces function corresponding with each interface is stored using tree structure;Wherein, tree-like
Structure defines relationship between multiple interfaces and function corresponding with each interface.
Optionally, relationship storage unit includes relationship storing sub-units, for using interface as the root section in tree structure
Point, using the function in code as the intermediate node or leaf node in tree structure.
Optionally, target interface determining module includes target interface determination unit, the letter for will change in code
Number is determined as objective function;Based on the bottom-up traversal tree structure of objective function to determine interface corresponding with objective function
As target interface.
Optionally, the code tester device further includes code change determination type module, if being for target interface
It is multiple, it is determined that the associated weights of each target interface and objective function;According to each target interface and objective function determined
Associated weights judge the changed type of code;Wherein, the changed type of code includes that good will modification and malice are distorted.
Optionally, code change determination type module includes associated weights determination unit, for determining that a target interface is made
For target detection interface;Determine the version before target detection interface is not modified as first version;Determine that target detection connects
Mouth be modified after version as the second edition;Operation result of the code under first version is obtained as the first test knot
Fruit;Operation result of the code under the second edition is obtained as the second test result;If the second test result and the first test
As a result the diversity factor between determines the associated weights of target detection interface and objective function.
Optionally, code change determination type module includes code change type determining units, for determining objective function
The implementing result of test case is as the first implementing result before changing;Determine test case after objective function changes
Implementing result is as the second implementing result;If diversity factor and associated weights between the second implementing result and the first implementing result
To response be greater than preset threshold, it is determined that code change type be good will modify;If the second implementing result is executed with first
As a result diversity factor and associated weights between are less than or equal to preset threshold to response, it is determined that code change type is malice
It distorts.
According to the third aspect of the disclosure, a kind of electronic equipment is provided, comprising: processor;And memory, the storage
It is stored with computer-readable instruction on device, is realized when the computer-readable instruction is executed by the processor according to above-mentioned any
The method of one code tester.
According to the fourth aspect of the disclosure, a kind of computer readable storage medium is provided, computer program is stored thereon with,
The code test method according to above-mentioned any one is realized when the computer program is executed by processor.
Code test method in the exemplary embodiment of the disclosure is closed using between the interface and function in definition code
The storage mode of system stores interface and function;If function changes in code, it is determined that with changed letter
The corresponding interface of number is as target interface;The corresponding survey of target interface is determined according to interface and the default mapping relations of test case
Example on probation, to be tested based on test case the changed code of function.On the one hand, the disclosure will define in code
The storage mode of relationship stores interface and function between interface and function, when the function in code changes, energy
It is enough quickly to navigate to the changed the corresponding interface of interface layer;On the other hand, after navigating to changed interface, according to prior
Newest accurate test case, and implementation of test cases can be generated in mapping relations between the interface set and test case,
Test scope is reduced, therefore reduces workload.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not
The disclosure can be limited.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows the implementation for meeting the disclosure
Example, and together with specification for explaining the principles of this disclosure.It should be evident that the accompanying drawings in the following description is only the disclosure
Some embodiments for those of ordinary skill in the art without creative efforts, can also basis
These attached drawings obtain other attached drawings.In the accompanying drawings:
Fig. 1 diagrammatically illustrates the flow chart of code test method according to an exemplary embodiment of the present disclosure;
It is tree-like that Fig. 2 diagrammatically illustrates code test method according to an exemplary embodiment of the present disclosure constructs first
Structure chart;
It is tree-like that Fig. 3 diagrammatically illustrates code test method according to an exemplary embodiment of the present disclosure constructs second
Structure chart;
Fig. 4 diagrammatically illustrates the first block diagram of code tester device according to an exemplary embodiment of the present disclosure;
Fig. 5 diagrammatically illustrates the block diagram of relationship storage module according to an exemplary embodiment of the present disclosure;
Fig. 6 diagrammatically illustrates the block diagram of relationship storage unit according to an exemplary embodiment of the present disclosure;
Fig. 7 diagrammatically illustrates the block diagram of target interface determining module according to an exemplary embodiment of the present disclosure;
Fig. 8 diagrammatically illustrates the second block diagram of code tester device according to an exemplary embodiment of the present disclosure;
Fig. 9 diagrammatically illustrates the first of code change determination type module according to an exemplary embodiment of the present disclosure
Block diagram;
Figure 10 diagrammatically illustrates the of code change determination type module according to an exemplary embodiment of the present disclosure
Two block diagrams;
Figure 11 diagrammatically illustrates the block diagram of the electronic equipment according to one exemplary embodiment of the disclosure;And
Figure 12 diagrammatically illustrates the schematic diagram of the computer readable storage medium according to one exemplary embodiment of the disclosure.
Specific embodiment
Example embodiment is described more fully with reference to the drawings.However, example embodiment can be real in a variety of forms
It applies, and is not understood as limited to embodiment set forth herein;On the contrary, thesing embodiments are provided so that the disclosure will be comprehensively and complete
It is whole, and the design of example embodiment is comprehensively communicated to those skilled in the art.Identical appended drawing reference indicates in figure
Same or similar part, thus repetition thereof will be omitted.
In addition, described feature, structure or characteristic can be incorporated in one or more implementations in any suitable manner
In example.In the following description, many details are provided to provide and fully understand to embodiment of the disclosure.However,
It will be appreciated by persons skilled in the art that can be with technical solution of the disclosure without one in the specific detail or more
It is more, or can be using other methods, constituent element, device, step etc..In other cases, known in being not shown in detail or describing
Structure, method, apparatus, realization, material or operation are to avoid fuzzy all aspects of this disclosure.
Block diagram shown in the drawings is only functional entity, not necessarily must be corresponding with physically separate entity.
I.e., it is possible to realize these functional entitys using software form, or these are realized in the module of one or more softwares hardening
A part of functional entity or functional entity, or realized in heterogeneous networks and/or processor device and/or microcontroller device
These functional entitys.
Before the online use of software, repeatedly test is carried out to code usually to find the bug in code;It is either right
The case where software optimizes upgrading, and new function is added on the basis of original code release, it is also desirable to which code is surveyed
Examination.But currently used method for testing software, it needs to test all codes as long as change occurs for code, with discovery
Bug in code causes test job amount very big.
Based on this, in this exemplary embodiment, a kind of code test method is provided firstly, it is real to can use server
The existing disclosure uses code test method, can use terminal device also to realize method described in the disclosure, wherein the end
End equipment can be for example the various terminal equipments such as mobile phone, computer.With reference to Fig. 1, which may include following step
It is rapid:
S110. interface and function are deposited using the storage mode of relationship between the interface and function in definition code
Storage.
According to some illustrative embodiments of the disclosure, code can be one group by character, symbol or signal element with
The specific rule system of discrete form expression information, the source file that the language that programmer's developing instrument is supported writes out,
In general, the code of complete set can be a software systems.Interface refers to the reference type being defined to agreement, can wrap
Contain but be not limited to method, attribute, index and event etc. as member.Interface in code can include but is not limited to data into
Enter the interface of system and the interface of data outflow system.The interface that data enter system is that test case executes connecing for calling
Mouthful, these interfaces can be called by running parameter, simulate external use;And the interface of data outflow system is then to survey
The part that example on probation is really verified, the content of verifying may include: that data wherefrom flow out, and how is state when outflow, at this time
System is any state.Function in code can be the code of one section of realization standalone feature, in addition, function herein can also be with
Refer to the term " method " in software program.
Total interface and all methods in code can be determined using code identification facility, when determining the institute in code
After having interface and function, interface and function can be stored using the storage method of relationship between defining interface and function
Come, when being stored to it, it is possible to use only interface name and function name are stored, without the tool in memory interface and function
Hold in vivo, as long as storage mode is able to reflect the relationship between interface and function.
In some exemplary embodiments of the disclosure, multiple interfaces in code and corresponding with each interface respectively are determined
Function;Multiple interfaces function corresponding with each interface is stored using tree structure;Wherein, tree structure defines multiple
Relationship between interface and function corresponding with each interface.A function in code can correspond to an interface, in addition, due to
Interface may be implemented to inherit more, and therefore, a function can also correspond to multiple interfaces.When being stored to interface and function,
Using the mark that can uniquely determine each interface and each function, so as to the changed function of subsequent positioning and interface.
It in another exemplary embodiment of the present disclosure, will be in code using interface as the root node in tree structure
Function is as the intermediate node or leaf node in tree structure.Tree structure is the nested structure of a level, a tree-like knot
The outer layer and internal layer of structure have similar structure, and therefore, tree structure recursive can mostly indicate that a tree can simply indicate
For root, left subtree and right subtree, left subtree and right subtree have the subtree of oneself again.Interface in code is used into root node table
Show, the child node of the corresponding root node of each interface can be the function in code.Call relation in code between function can be with
Including but not limited to: a subfunction inherits father's function, then the subfunction is next layer of father's function, i.e., subfunction is father
The child node of function;Method A call method B, then for method B in next layer of method A, i.e. method B is the child node of method A.It should
The intermediate node or leaf node of tree structure can be function.The corresponding tree structure of constructed code is wanted being capable of body
Calling hierarchical relationship in modern code between interface and function.
Based on the call relation between method and method, between method and interface, the corresponding tree of code segment can be constructed
Shape structure can identify the tree constructed using the storage of the data structures such as stack, queue or chained list in the database so as to subsequent
Shape structure.In storage, root node, intermediate node and leaf node have corresponding marker respectively, for distinguishing different type
Node.Can be tree structure corresponding to interface 210 with reference to Fig. 2, Fig. 2, wherein interface 210 can correspond to three functions,
Function 1 (i.e. function 220), function 2 and function 3, function 200 have respectively corresponded subfunction 1 (i.e. subfunction 230) and subfunction again
2 (subfunctions 240).
Further, due in one section of code there may be multiple interfaces, can be constructed based on this code segment
Multiple tree structures;In addition, a function can inherit multiple interfaces, therefore, a function can correspond to multiple interfaces, multiple
Cross reference is also likely to be present between tree.
S120. if function changes in code, it is determined that interface corresponding with changed function is as target
Interface.
According to some illustrative embodiments of the disclosure, target interface be can be and function pair changed in code
The interface answered will first determine these interfaces when having function to change in code, to carry out subsequent operation.
In some exemplary embodiments of the disclosure, the function to change in code is determined as objective function;Base
In the bottom-up traversal tree structure of objective function to determine interface corresponding with objective function as target interface.Target letter
Number can first can determine these target letters when the function in code changes for changed function in code
Number, the objective function determined can be one or more.It, can be bottom-up based on objective function after determining objective function
The constructed tree structure of identification, bottom-up method can be for when a certain function changes, upward recurrence be once known
It is clipped to function corresponding to its a upper node layer, if the upper node layer recognized is not root node, continues up knowledge
The father node of not upper node layer;Layer-by-layer upward recurrence, until finding interface corresponding with changed function.
In another exemplary embodiment of the present disclosure, if target interface is multiple, it is determined that each target interface and mesh
The associated weights of scalar functions;Judge that code is changed according to the associated weights of each target interface and objective function determined
Type;Wherein, the changed type of code includes that good will modification and malice are distorted.In code, a function may be corresponded to
Multiple interfaces, this multiple interface may also be different to the influence of the operation result of the function, i.e., the degree of incidence relation is not
Together, accordingly, it is determined that the associated weights of each interface and objective function help further accurately to determine on operation result influence out
Maximum interface judges the variation that code is occurred.
In the another exemplary embodiment of the disclosure, determine a target interface as target detection interface;Determine target
Test interface be not modified before version as first version;Determine the version after target detection interface is modified as
Two versions;Operation result of the code under first version is obtained as the first test result;Code is obtained under the second edition
Operation result is as the second test result;If the diversity factor between the second test result and the first test result determines that target is surveyed
It tries the associated weights of mouth and objective function.In code tester, every primary complete code of generation will be to the code definition
Code release number, so as to distinguish it is modified after formed different editions code, and it is possible to record it is right with code release number
The test case implementing result answered, i.e. test result.For example, realizing the code of a certain function, initial version can be
First version can once test code, and test result is denoted as the first test result after completing first version;
It can be the second edition by updated code release when needing the code to initial version to be updated, and record the
The test result of the code of two versions is the second test result.It, can be right after obtaining the first test result and the second test result
Two test results compare, and determine the diversity factor between two kinds of test results, analyze connect corresponding with the objective function
In mouthful, the incidence relation between interface and function determines associated weights according to the correlation degree of incidence relation, to carry out in next step
Judgement.
With reference to Fig. 3, function 340 respectively corresponds interface 310, interface 320 and interface 330, interface 310, interface 320 and interface
Associated weights between 330 and functions 340 are respectively v1, v2 and v3, and v1, v2 and v3 can be the first test knot based on code
What the diversity factor of fruit and the second test result was determined.Interface 320 and interface 330 can also correspond to other tree structures,
Exist i.e. between the corresponding tree structure of interface 310 tree structure corresponding with interface 330 and intersects.
In another exemplary embodiment of the disclosure, the implementing result of test case before objective function changes is determined
As the first implementing result;Determine the implementing result of test case after objective function changes as the second implementing result;Such as
Diversity factor and associated weights between the second implementing result of fruit and the first implementing result are greater than preset threshold to response, it is determined that
Code change type is good will modification;If diversity factor and associated weights between the second implementing result and the first implementing result
Preset threshold is less than or equal to response, it is determined that code change type is that malice is distorted.For example, when a test case
Function be for obtaining some resources on network, the first implementing result of implementation of test cases before code changes institute is right
The acquisition time answered be 2s, and code change after implementation of test cases the second implementing result corresponding to acquisition time be
0.8s, it may be considered that code is artificial good will modification.In addition, the first implementing result of test case can be before code change
One table, the second implementing result of test case becomes a number after code change, then the second implementing result and first
The diversity factor of implementing result is larger, then can first determine the change type of code maliciously to distort, and then can determine in next step
Operation, be the reasonability of artificial detection code or code tested using other test cases.
S130. the corresponding test case of target interface is determined according to interface and the default mapping relations of test case, so as to
The changed code of function is tested based on test case.
According to some illustrative embodiments of the disclosure, the default mapping relations of interface and test case be can be artificially
The some test cases being set in advance after determining corresponding interface by changed objective function, can be directed to these
Interface generates new test case, and the content of test case can include but is not limited to main test function point, test environment, survey
Try data, execute operation and expected results etc..After generating new test case, it can be surveyed using automated testing method
Examination, can such as write shell script, by calling perform script program to complete to test, it may not be necessary to artificial to participate in.In addition,
The equipment of implementation of test cases can be identical as the operation equipment of disclosure code test method, can also be different.When the two is right
When the equipment difference answered, interface corresponding with objective function is determined, and after generating test case, it can be by these test cases
It runs in the equipment dedicated for implementation of test cases, is tested with completion code.
It should be noted that term " first " used in the disclosure, " second " etc., merely to distinguishing the difference of code
The different implementing results of version or code do not cope with the disclosure and cause any restrictions.
In conclusion the code test method of the disclosure, deposited using relationship between the interface and function in definition code
Storage mode stores interface and function;If function changes in code, it is determined that corresponding with changed function
Interface as target interface;Determine that the corresponding test of target interface is used according to interface and the default mapping relations of test case
Example, to be tested based on test case the changed code of function.On the one hand, when the function in code changes
Afterwards, the corresponding interface of the changed function can be determined, based on the tree structure of building to be accurately directed to the interface
Generate test case.On the other hand, after generating test case based on interface, only these test cases can be tested, and
It does not need to test overall code, reduces the workload of code tester.In another aspect, in implementation of test cases, it can
To call the shell script write in advance, corresponding interface testing is carried out using automated testing method, is participated in without artificial,
It is further reduced test job amount.
In addition, in this exemplary embodiment, additionally providing a kind of code tester device.With reference to Fig. 4, the code tester device
400 may include relationship storage module 410, target interface determining module 420 and Test cases technology module 430.
Specifically, relationship storage module 410 can be used for depositing using relationship between the interface and function in definition code
Storage mode stores interface and function;It changes if target interface determining module 420 can be used for function in code,
Determine interface corresponding with changed function as target interface;Test cases technology module 430 can be used for basis and connect
Mouthful determine the corresponding test case of target interface with the default mapping relations of test case, so as to based on test case to function hair
The code for changing is tested.
Code tester device 400 uses can be with the storage organization of relationship between the interface and function in definition code by interface
It is stored with function, when thering is function to change in code, it will precise positioning to interface corresponding with the function, and needle
Test case is generated to the interface determined not needing all to test code, reduce to test code
The workload of code tester is a kind of effective code tester device.
According to some exemplary embodiments of the disclosure, with reference to Fig. 5, relationship storage module 410 includes relationship storage unit
510。
Specifically, relationship storage unit 510 be determined for multiple interfaces in code and respectively with each interface pair
The function answered;Multiple interfaces function corresponding with each interface is stored using tree structure;Wherein, tree structure defines more
Relationship between a interface and function corresponding with each interface.
Relationship storage unit 510 using tree structure by code interface and function store, so as in code
When function changes, it is based on tree structure precise positioning interface corresponding with changed function.
According to the another exemplary embodiment of the disclosure, with reference to Fig. 6, relationship storage unit 510 may include relationship storage
Subelement 620.
Specifically, relationship storing sub-units 620 can be used for using interface as the root node in tree structure, it will be in code
Function as the intermediate node or leaf node in tree structure.
Relationship storing sub-units 620 define the node relationships of tree structure, using the interface in code as root node, because
This, can determine corresponding interface according to function.
According to the another exemplary embodiment of the disclosure, with reference to Fig. 7, target interface determining module 420 may include target
Interface determination unit 710.
Specifically, target interface determining module 710 may include target interface determination unit, for will change in code
The function of change is determined as objective function;It is corresponding with objective function to determine based on the bottom-up traversal tree structure of objective function
Interface as target interface.
Target interface determining module 710 can be determined to send out with code by the method for bottom-up identification tree structure
The corresponding interface of the function for changing.
In the another exemplary embodiment of the disclosure, code tester device 800 is additionally provided, with reference to Fig. 8, code is surveyed
Trial assembly sets 800 compared to code tester device 400, except including relationship storage module 410, target interface determining module 420 and
It can also include code change determination type module 810 outside Test cases technology module 430.
Specifically, it is multiple that if code change determination type module 810, which can be used for target interface, it is determined that each target
The associated weights of interface and objective function;Judge that code is sent out according to the associated weights of each target interface and objective function determined
The type for changing;Wherein, the changed type of code includes that good will modification and malice are distorted.
Code change determination type module 810 can connect difference when changed function corresponds to multiple interfaces
Mouth determines the corresponding different weights of these interfaces for the influence degree of code effect, to judge the change type of code.
According to some exemplary embodiments of the disclosure, with reference to Fig. 9, code change determination type module 810 may include
Associated weights determination unit 910.
Specifically, associated weights determination unit 910 is determined for a target interface as target detection interface;It determines
Target detection interface be not modified before version as first version;Determine that the version after target detection interface is modified is made
For the second edition;Operation result of the code under first version is obtained as the first test result;Code is obtained in the second edition
Under operation result as the second test result;If the diversity factor between the second test result and the first test result determines mesh
Mark the associated weights of test interface and objective function.
Associated weights determination unit 910 provides the method for determination of associated weights corresponding to distinct interface.
According to the another exemplary embodiment of the disclosure, with reference to Figure 10, code change determination type module 1010 be can wrap
Include code change type determining units 1020.
Specifically, code change type determining units 1020 are determined for test case before objective function changes
Implementing result as the first implementing result;Determine that the implementing result of test case after objective function changes is held as second
Row result;If being greater than to response for diversity factor and associated weights between the second implementing result and the first implementing result presets threshold
Value, it is determined that code change type is good will modification;If diversity factor between the second implementing result and the first implementing result with
Associated weights are less than or equal to preset threshold to response, it is determined that code change type is that malice is distorted.
Code change type determining units 1020 according to function change front and back different implementing results, determine code
Change type.
The detail of each virtual code test device module carries out in corresponding code test method among the above
Detailed description, therefore details are not described herein again.
It should be noted that although being referred to several modules or unit of code tester device in the above detailed description,
It is that this division is not enforceable.In fact, according to embodiment of the present disclosure, two or more above-described modules or
The feature and function of person's unit can embody in a module or unit.Conversely, an above-described module or
The feature and function of unit can be to be embodied by multiple modules or unit with further division.
In addition, in an exemplary embodiment of the disclosure, additionally providing a kind of electronic equipment that can be realized the above method.
Person of ordinary skill in the field it is understood that various aspects of the invention can be implemented as system, method or
Program product.Therefore, various aspects of the invention can be embodied in the following forms, it may be assumed that complete hardware embodiment, completely
Software implementation (including firmware, microcode etc.) or hardware and software in terms of combine embodiment, may be collectively referred to as here
Circuit, " module " or " system ".
The electronic equipment 1100 of this embodiment according to the present invention is described referring to Figure 11.The electronics that Figure 11 is shown
Equipment 1100 is only an example, should not function to the embodiment of the present invention and use scope bring any restrictions.
As shown in figure 11, electronic equipment 1100 is showed in the form of universal computing device.The component of electronic equipment 1100 can
To include but is not limited to: at least one above-mentioned processing unit 1110, connects not homologous ray at least one above-mentioned storage unit 1120
The bus 1130 of component (including storage unit 1120 and processing unit 1110), display unit 1140.
Wherein, the storage unit is stored with program code, and said program code can be held by the processing unit 1110
Row, so that various according to the present invention described in the execution of the processing unit 1110 above-mentioned " illustrative methods " part of this specification
The step of exemplary embodiment.
Storage unit 1120 may include the readable medium of volatile memory cell form, such as Random Access Storage Unit
(RAM) 1121 and/or cache memory unit 1122, it can further include read-only memory unit (ROM) 1123.
Storage unit 1120 can also include program/utility with one group of (at least one) program module 1125
1124, such program module 1125 includes but is not limited to: operating system, one or more application program, other program moulds
It may include the realization of network environment in block and program data, each of these examples or certain combination.
Bus 1130 can be to indicate one of a few class bus structures or a variety of, including storage unit bus or storage
Cell controller, peripheral bus, graphics acceleration port, processing unit use any bus structures in a variety of bus structures
Local bus.
Electronic equipment 1100 can also be with one or more external equipments 1170 (such as keyboard, sensing equipment, bluetooth equipment
Deng) communication, can also be enabled a user to one or more equipment interact with the electronic equipment 1100 communicate, and/or with make
The electronic equipment 1100 can with it is one or more of the other calculating equipment be communicated any equipment (such as router, modulation
Demodulator etc.) communication.This communication can be carried out by input/output (I/O) interface 1150.Also, electronic equipment 1100
Network adapter 1160 and one or more network (such as local area network (LAN), wide area network (WAN) and/or public affairs can also be passed through
Common network network, such as internet) communication.As shown, network adapter 1160 passes through its of bus 1130 and electronic equipment 1100
The communication of its module.It should be understood that although not shown in the drawings, other hardware and/or software can be used in conjunction with electronic equipment 1100
Module, including but not limited to: microcode, device driver, redundant processing unit, external disk drive array, RAID system, magnetic
Tape drive and data backup storage system etc..
By the description of above embodiment, those skilled in the art is it can be readily appreciated that example embodiment described herein
It can also be realized in such a way that software is in conjunction with necessary hardware by software realization.Therefore, implemented according to the disclosure
The technical solution of example can be embodied in the form of software products, which can store in a non-volatile memories
In medium (can be CD-ROM, USB flash disk, mobile hard disk etc.) or on network, including some instructions are so that a calculating equipment (can
To be personal computer, server, terminal installation or network equipment etc.) it executes according to the method for the embodiment of the present disclosure.
In an exemplary embodiment of the disclosure, a kind of computer readable storage medium is additionally provided, energy is stored thereon with
Enough realize the program product of this specification above method.In some possible embodiments, various aspects of the invention can be with
It is embodied as a kind of form of program product comprising program code, it is described when described program product is run on the terminal device
Program code is for executing the terminal device described in above-mentioned " illustrative methods " part of this specification according to the present invention
The step of various exemplary embodiments.
With reference to shown in Figure 12, the program product for realizing the above method of embodiment according to the present invention is described
1200, can using portable compact disc read only memory (CD-ROM) and including program code, and can in terminal device,
Such as it is run on PC.However, program product of the invention is without being limited thereto, in this document, readable storage medium storing program for executing can be with
To be any include or the tangible medium of storage program, the program can be commanded execution system, device or device use or
It is in connection.
Described program product can be using any combination of one or more readable mediums.Readable medium can be readable letter
Number medium or readable storage medium storing program for executing.Readable storage medium storing program for executing for example can be but be not limited to electricity, magnetic, optical, electromagnetic, infrared ray or
System, device or the device of semiconductor, or any above combination.The more specific example of readable storage medium storing program for executing is (non exhaustive
List) include: electrical connection with one or more conducting wires, portable disc, hard disk, random access memory (RAM), read-only
Memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read only memory
(CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal,
In carry readable program code.The data-signal of this propagation can take various forms, including but not limited to electromagnetic signal,
Optical signal or above-mentioned any appropriate combination.Readable signal medium can also be any readable Jie other than readable storage medium storing program for executing
Matter, the readable medium can send, propagate or transmit for by instruction execution system, device or device use or and its
The program of combined use.
The program code for including on readable medium can transmit with any suitable medium, including but not limited to wirelessly, have
Line, optical cable, RF etc. or above-mentioned any appropriate combination.
The program for executing operation of the present invention can be write with any combination of one or more programming languages
Code, described program design language include object oriented program language-Java, C++ etc., further include conventional
Procedural programming language-such as " C " language or similar programming language.Program code can be fully in user
It calculates and executes in equipment, partly executes on a user device, being executed as an independent software package, partially in user's calculating
Upper side point is executed on a remote computing or is executed in remote computing device or server completely.It is being related to far
Journey calculates in the situation of equipment, and remote computing device can pass through the network of any kind, including local area network (LAN) or wide area network
(WAN), it is connected to user calculating equipment, or, it may be connected to external computing device (such as utilize ISP
To be connected by internet).
In addition, above-mentioned attached drawing is only the schematic theory of processing included by method according to an exemplary embodiment of the present invention
It is bright, rather than limit purpose.It can be readily appreciated that the time that above-mentioned processing shown in the drawings did not indicated or limited these processing is suitable
Sequence.In addition, be also easy to understand, these processing, which can be, for example either synchronously or asynchronously to be executed in multiple modules.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to its of the disclosure
His embodiment.This application is intended to cover any variations, uses, or adaptations of the disclosure, these modifications, purposes or
Adaptive change follow the general principles of this disclosure and including the undocumented common knowledge in the art of the disclosure or
Conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the disclosure are by claim
It points out.
It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and
And various modifications and changes may be made without departing from the scope thereof.The scope of the present disclosure is only limited by the attached claims.
Claims (10)
1. a kind of code tester mode is improved applied to the testing process in test and management characterized by comprising
The interface and the function are stored using the storage mode of relationship between the interface and function in definition code;
If function changes in the code, it is determined that interface corresponding with changed function is as target interface;
The corresponding test case of the target interface is determined according to interface and the default mapping relations of test case, to be based on institute
Test case is stated to test the changed code of function.
2. code tester mode according to claim 1, which is characterized in that using in definition code interface and function it
Between relationship storage mode by the interface and the function carry out storage include:
Determine multiple interfaces in code and respectively function corresponding with each interface;
The multiple interface function corresponding with each interface is stored using tree structure;Wherein, the tree-like knot
Structure defines relationship between the multiple interface and function corresponding with each interface.
3. code tester mode according to claim 2, which is characterized in that using tree structure to the multiple interface with
The corresponding function of each interface carries out storage
Using the interface as the root node in the tree structure, using the function in code as in the tree structure
Intermediate node or leaf node.
4. code tester mode according to claim 2, which is characterized in that determine connect corresponding with changed function
Include: mouthful as target interface
The function to change in code is determined as objective function;
Based on the bottom-up traversal tree structure of the objective function to determine interface corresponding with the objective function
As target interface.
5. code tester mode according to claim 4, which is characterized in that determine connect corresponding with changed function
After mouth is used as target interface, the code test method further include:
If the target interface is multiple, it is determined that the associated weights of each target interface and the objective function;
The changed type of code is judged according to the associated weights of each target interface and the objective function determined;
Wherein, the changed type of the code includes that good will modification and malice are distorted.
6. code tester mode according to claim 5, which is characterized in that determine each target interface and the target
The associated weights of function include:
Determine a target interface as target detection interface;
Determine the version before the target detection interface is not modified as first version;
Determine the version after the target detection interface is modified as the second edition;
Operation result of the code under first version is obtained as the first test result;
Operation result of the code under the second edition is obtained as the second test result;
If the diversity factor between second test result and first test result determine the target detection interface with
The associated weights of the objective function.
7. code tester mode according to claim 5, which is characterized in that according to each target interface for determining with
The associated weights of the objective function judge that the changed type of code includes:
Determine the implementing result of test case before the objective function changes as the first implementing result;
Determine the implementing result of test case after the objective function changes as the second implementing result;
If the diversity factor between second implementing result and first implementing result is with the associated weights to response
Greater than preset threshold, it is determined that the code change type is good will modification;
If the diversity factor between second implementing result and first implementing result is with the associated weights to response
Less than or equal to preset threshold, it is determined that the code change type is that malice is distorted.
8. a kind of code tester device characterized by comprising
Relationship storage module, for the storage mode using relationship between the interface and function in definition code by the interface and
The function is stored;
Target interface determining module, if changed for function in the code, determination is corresponding with changed function
Interface as target interface;
Test cases technology module, for determining that the target interface is corresponding with the default mapping relations of test case according to interface
Test case, to be tested the changed code of function based on the test case.
9. a kind of electronic equipment characterized by comprising
Processor;And
Memory is stored with computer-readable instruction on the memory, and the computer-readable instruction is held by the processor
Code tester mode according to any one of claim 1 to 7 is realized when row.
10. a kind of computer readable storage medium, is stored thereon with computer program, the computer program is executed by processor
Shi Shixian code tester mode according to any one of claim 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910317815.5A CN110147317A (en) | 2019-04-19 | 2019-04-19 | Code test method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910317815.5A CN110147317A (en) | 2019-04-19 | 2019-04-19 | Code test method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110147317A true CN110147317A (en) | 2019-08-20 |
Family
ID=67589772
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910317815.5A Pending CN110147317A (en) | 2019-04-19 | 2019-04-19 | Code test method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110147317A (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110716859A (en) * | 2019-08-30 | 2020-01-21 | 平安普惠企业管理有限公司 | Method for automatically pushing test cases for modified codes and related device |
CN110928786A (en) * | 2019-11-20 | 2020-03-27 | 中国工商银行股份有限公司 | Testing method and device for financial program |
CN111209217A (en) * | 2020-03-12 | 2020-05-29 | 苏州浪潮智能科技有限公司 | System software function testing method, device, equipment and storage medium |
CN111400181A (en) * | 2020-03-13 | 2020-07-10 | 北京金山云网络技术有限公司 | Object testing method and device and server |
CN111538651A (en) * | 2020-03-30 | 2020-08-14 | 中国平安人寿保险股份有限公司 | Interface testing method, device, server and storage medium |
CN111782556A (en) * | 2020-08-26 | 2020-10-16 | 中国银行股份有限公司 | Automatic test method and device |
CN112328506A (en) * | 2021-01-06 | 2021-02-05 | 北京云真信科技有限公司 | Web end code detection system |
CN113626325A (en) * | 2021-08-05 | 2021-11-09 | 杭州遥望网络科技有限公司 | Interface testing method, device and equipment in code iterative updating |
CN113760765A (en) * | 2021-09-09 | 2021-12-07 | 北京百度网讯科技有限公司 | Code testing method and device, electronic equipment and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106909510A (en) * | 2017-03-02 | 2017-06-30 | 腾讯科技(深圳)有限公司 | A kind of method and server for obtaining test case |
CN107085555A (en) * | 2017-04-19 | 2017-08-22 | 广州视源电子科技股份有限公司 | Code test method, device, terminal and storage medium |
CN107992409A (en) * | 2017-11-21 | 2018-05-04 | 平安养老保险股份有限公司 | Method for generating test case, device, computer equipment and storage medium |
CN108874661A (en) * | 2018-05-07 | 2018-11-23 | 上海陆家嘴国际金融资产交易市场股份有限公司 | Test mapping relations library generating method, device, computer equipment and storage medium |
-
2019
- 2019-04-19 CN CN201910317815.5A patent/CN110147317A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106909510A (en) * | 2017-03-02 | 2017-06-30 | 腾讯科技(深圳)有限公司 | A kind of method and server for obtaining test case |
CN107085555A (en) * | 2017-04-19 | 2017-08-22 | 广州视源电子科技股份有限公司 | Code test method, device, terminal and storage medium |
CN107992409A (en) * | 2017-11-21 | 2018-05-04 | 平安养老保险股份有限公司 | Method for generating test case, device, computer equipment and storage medium |
CN108874661A (en) * | 2018-05-07 | 2018-11-23 | 上海陆家嘴国际金融资产交易市场股份有限公司 | Test mapping relations library generating method, device, computer equipment and storage medium |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110716859A (en) * | 2019-08-30 | 2020-01-21 | 平安普惠企业管理有限公司 | Method for automatically pushing test cases for modified codes and related device |
CN110928786A (en) * | 2019-11-20 | 2020-03-27 | 中国工商银行股份有限公司 | Testing method and device for financial program |
CN110928786B (en) * | 2019-11-20 | 2024-04-02 | 中国工商银行股份有限公司 | Testing method and device for financial program |
CN111209217A (en) * | 2020-03-12 | 2020-05-29 | 苏州浪潮智能科技有限公司 | System software function testing method, device, equipment and storage medium |
CN111400181A (en) * | 2020-03-13 | 2020-07-10 | 北京金山云网络技术有限公司 | Object testing method and device and server |
CN111538651A (en) * | 2020-03-30 | 2020-08-14 | 中国平安人寿保险股份有限公司 | Interface testing method, device, server and storage medium |
CN111782556A (en) * | 2020-08-26 | 2020-10-16 | 中国银行股份有限公司 | Automatic test method and device |
CN112328506A (en) * | 2021-01-06 | 2021-02-05 | 北京云真信科技有限公司 | Web end code detection system |
CN112328506B (en) * | 2021-01-06 | 2021-04-13 | 北京云真信科技有限公司 | Web end code detection system |
CN113626325A (en) * | 2021-08-05 | 2021-11-09 | 杭州遥望网络科技有限公司 | Interface testing method, device and equipment in code iterative updating |
CN113760765A (en) * | 2021-09-09 | 2021-12-07 | 北京百度网讯科技有限公司 | Code testing method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110147317A (en) | Code test method and device, electronic equipment and storage medium | |
CN106547678B (en) | Method and apparatus for white-box testing | |
US11151024B2 (en) | Dynamic automation of DevOps pipeline vulnerability detecting and testing | |
US9514036B1 (en) | Test case generation | |
CN111814951B (en) | Debugging deep neural network | |
CN106649084A (en) | Function call information obtaining method and apparatus, and test device | |
US11294884B2 (en) | Annotation assessment and adjudication | |
WO2017159638A1 (en) | Ability imparting data generation device | |
US20200356237A1 (en) | Graphical chatbot interface facilitating user-chatbot interaction | |
US11061739B2 (en) | Dynamic infrastructure management and processing | |
US11487949B2 (en) | Image object disambiguation resolution using learner model based conversation templates | |
US20200125695A1 (en) | Detecting hotspots in physical design layout patterns utilizing hotspot detection model with data augmentation | |
US20210311853A1 (en) | Automated breakpoint creation | |
CN108920370A (en) | Compatibility issue detection method, device and equipment | |
US20210042291A1 (en) | Annotation Assessment and Ground Truth Construction | |
CN110442515A (en) | Application testing method, device, equipment and readable storage medium storing program for executing | |
CN115298659A (en) | Automatic generation of diversified text | |
CN109656815A (en) | There are test statement write method, device, medium and the electronic equipment of configuration file | |
US11055204B2 (en) | Automated software testing using simulated user personas | |
CN116401339A (en) | Data processing method, device, electronic equipment, medium and program product | |
CN109240928A (en) | A kind of test method, device, equipment and storage medium | |
US11341394B2 (en) | Diagnosis of neural network | |
CN114882168B (en) | Digital twinning method and device of touch sensor based on vision | |
CN111435348A (en) | Method for creating runtime executable program for data analysis function | |
US11164088B2 (en) | Interactive feedback and assessment experience |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
CB02 | Change of applicant information |
Address after: 201, room 518000, building A, No. 1, front Bay Road, Qianhai Shenzhen Guangdong Shenzhen Hong Kong cooperation zone (Qianhai business secretary) Applicant after: Pingan Pu Hui Enterprise Management Co., Ltd. Address before: 518000 Guangdong city of Shenzhen province Qianhai Shenzhen Hong Kong cooperation zone before Bay Road No. 1 building 201 room A Applicant before: Pingan Pu Hui Enterprise Management Co., Ltd. |
|
CB02 | Change of applicant information | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |