CN110442370A - A kind of test case querying method and device - Google Patents
A kind of test case querying method and device Download PDFInfo
- Publication number
- CN110442370A CN110442370A CN201910697340.7A CN201910697340A CN110442370A CN 110442370 A CN110442370 A CN 110442370A CN 201910697340 A CN201910697340 A CN 201910697340A CN 110442370 A CN110442370 A CN 110442370A
- Authority
- CN
- China
- Prior art keywords
- code
- function
- test case
- code data
- data
- 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/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/31—Indexing; Data structures therefor; Storage structures
- G06F16/316—Indexing structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
Abstract
The embodiment of the invention provides a kind of test case querying method and devices, and wherein method includes: to obtain code data to be processed;For the code in code data, the word meaning in code, the logical relation between meaning of parameters and code line are analyzed, and the first function is determined according to code analysis result;The code in code data is run, and the second function is determined according to code operation result;According to identified first function and the second function, the first function and the corresponding test case of the second function are determined respectively, and establish the corresponding relationship between the code in code data and identified each test case;According to the corresponding relationship established, test case corresponding to target query code is searched.The embodiment of the present invention can make application developer find affected function in time, to reduce bugs.
Description
Technical field
The present invention relates to field of computer technology, more particularly to a kind of test case querying method and device.
Background technique
In program development process, need that program is tested and debugged using a large amount of test cases.Wherein, test case
It is one group of test input, execution condition and the expected results worked out for some special objective, to test some program road
Whether diameter or verification meet some particular demands.
However, inventor has found in the implementation of the present invention, at least there are the following problems for the prior art: the prior art
When developing program, as function is more and more in program, the modification of some functions often will affect other and seem very uncorrelated
Function, before causing program online and when regression test, the function being affected occurs omitting situation, that is, tester is difficult to send out
The function being now affected in turn results in program and defect (bug) occurs.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of test case querying method and device, to reduce because being affected
There are bugs caused by omitting in function.Specific technical solution is as follows:
In a first aspect, the embodiment of the invention provides a kind of test case querying methods, which comprises
Code data to be processed is obtained, includes lines of code in the code data;
For the code in the code data, the word meaning in the code, meaning of parameters and code line are analyzed
Between logical relation, and the first function is determined according to code analysis result, first function is in the code data
The function that code is realized;
The code in the code data is run, and the second function, second function are determined according to code operation result
For the function that the code in the code data is realized, first function and the second function difference;
According to identified first function and second function, first function and described second are determined respectively
The corresponding test case of function, and establish pair between the code in the code data and identified each test case
It should be related to;
According to the corresponding relationship established, test case corresponding to target query code is searched.
Optionally, the corresponding relationship established between the code in the code data and identified each test case
The step of, comprising:
Establish the index information between the code in the code data and identified each test case, the index letter
Record has a corresponding relationship of code and test case in the code data in breath, the name information of the code data, with
And the function name information of the code in the code data.
Optionally, the code in the operation code data, and the second function is determined according to code operation result
Step, comprising:
Code in the code data is woven into pre-set code when running;
By the pre-set code being woven into, the realized when the code operation in the code data is determined and recorded
Two functions.
Optionally, first function described according to determined by and second function, determine first function respectively
Energy and the corresponding test case of the second function, and establish the code in the code data and identified each test
The step of corresponding relationship between use-case, comprising:
According to identified first function, the corresponding survey of first function is determined in default test case set
Example on probation;
According to identified second function, the corresponding survey of second function is determined in default test case set
Example on probation;
Establish pair between each test case in the code in the code data and the default test case set
It should be related to.
Optionally, the corresponding relationship established between the code in the code data and identified each test case
Later, the method also includes:
If existing in the default test case set and not establishing corresponding relationship with the code in the code data
Test case, then send alert notification, carried in the alert notification not in the code data code establish pair
The information for the test case that should be related to.
Optionally, described according to the corresponding relationship established, search test case corresponding to target query code
The step of, comprising:
Inquiry instruction is received, carries target query code in the inquiry instruction;
According to the corresponding relationship between the code and each test case established, search corresponding with the target query code
Test case.
Optionally,
The method also includes:
After the code in the code data is modified, the quilt in the code data is obtained using default hook program
Modify code snippet;
It is described according to the corresponding relationship established, the step of searching test case corresponding to target query code,
Include:
In corresponding relationship between the identified code and each test case, search described by modification code snippet
Corresponding test case.
Second aspect, the embodiment of the invention provides a kind of test case inquiry unit, described device includes:
First obtains module, includes lines of code in the code data for obtaining code data to be processed;
First determining module is joined for analyzing the word meaning in the code for the code in the code data
Logical relation between number meaning and code line, and determine that the first function, first function are according to code analysis result
The function that code in the code data is realized;
Second determining module determines second for running the code in the code data, and according to code operation result
Function, second function are the function that the code in the code data is realized, first function and second function
It is different;
Module is established, for determining described first respectively according to identified first function and second function
Function and the corresponding test case of the second function, and establish the code in the code data and identified each survey
Corresponding relationship between example on probation;
Searching module, for searching test corresponding to target query code and using according to the corresponding relationship established
Example.
Optionally, described to establish module, it is specifically used for:
Establish the index information between the code in the code data and identified each test case, the index letter
Record has a corresponding relationship of code and test case in the code data in breath, the name information of the code data, with
And the function name information of the code in the code data.
Optionally, second determining module, comprising:
It is woven into submodule, is woven into pre-set code when running for the code in the code data;
First determines submodule, for the pre-set code by being woven into, determines and records in the code data
Code operation when the second function for realizing.
It is optionally, described to establish module, comprising:
Second determines submodule, for being determined in default test case set according to identified first function
The corresponding test case of first function;
Second determines submodule, for being determined in default test case set according to identified second function
The corresponding test case of second function;
Setting up submodule, each survey in code and the default test case set for establishing in the code data
Corresponding relationship between example on probation.
Optionally, described device further include:
Sending module, if in the default test case set, exist not with the generation in the code data
Code establishes the test case of corresponding relationship, then sends alert notification, carried in the alert notification not with the code data
In code establish corresponding relationship test case information.
Optionally, the searching module, comprising:
Receiving submodule carries target query code for receiving inquiry instruction in the inquiry instruction;
Search submodule, for according to the corresponding relationship between the code and each test case established, search with it is described
The corresponding test case of target query code.
Optionally, described device further include:
Second obtains module, for being obtained after the code in the code data is modified using default hook program
In the code data by modification code snippet;
The searching module, is specifically used for:
In corresponding relationship between the identified code and each test case, search described by modification code snippet
Corresponding test case.
At the another aspect that the present invention is implemented, a kind of computer readable storage medium is additionally provided, it is described computer-readable
Instruction is stored in storage medium, when run on a computer, so that computer executes any of the above-described test and uses
Example querying method.
At the another aspect that the present invention is implemented, the embodiment of the invention also provides a kind of, and the computer program comprising instruction is produced
Product, when run on a computer, so that computer executes any of the above-described test case querying method.
A kind of test case querying method and device provided in an embodiment of the present invention, after obtaining code data to be processed,
Code can be determined respectively by the way that the code in code data is analyzed and run, based on analysis result and operation result
Code in data for realizing the first function and the second function, and then determine that the first function and the second function are respectively right respectively
The test case answered, so that the corresponding relationship between the code in code data and each test case is established, so that tester
Target query test case can be searched according to the corresponding relationship established, and determine the corresponding function of the test case, it can
Application developer is set to find affected function in time, to reduce bugs.Certainly, implement any production of the invention
Product or method must be not necessarily required to reach all the above advantage simultaneously.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described.
Fig. 1 is a kind of flow diagram of test case querying method provided in an embodiment of the present invention;
Fig. 2 is a kind of flow diagram of step S130 in test case querying method provided in an embodiment of the present invention;
Fig. 3 is a kind of flow diagram of step S140 in test case querying method provided in an embodiment of the present invention;
Fig. 4 is a kind of flow diagram of step S150 in test case querying method provided in an embodiment of the present invention;
Fig. 5 is a kind of schematic device of test case inquiry unit provided in an embodiment of the present invention;
Fig. 6 is a kind of structural representation of the second determining module in test case inquiry unit provided in an embodiment of the present invention
Figure;
Fig. 7 is a kind of structural schematic diagram that module is established in test case inquiry unit provided in an embodiment of the present invention;
Fig. 8 is the schematic device of another test case inquiry unit provided in an embodiment of the present invention;
Fig. 9 is the schematic device of another test case inquiry unit provided in an embodiment of the present invention;
The schematic device of Figure 10 the 4th kind of test case inquiry unit provided in an embodiment of the present invention;
Figure 11 is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention is described.
The prior art is in program development process, and particularly with large program, the quantity of test case or test cell is got over
Come it is more, since program code is not associated with test case well, certain by testing case program
Function, and after modifying to functions certain in program, other that often will affect in program seem uncorrelated function, cause journey
There is defect in sequence.And ideally, the modification of code should trigger and only trigger relevant test case and execute, so both
The development time can be saved or sufficiently tested.The embodiment of the present invention is based on the above problem, proposes a kind of test case
Querying method and device.
A kind of test case querying method is provided for the embodiments of the invention first below to be illustrated.
The embodiment of the invention provides a kind of test case querying methods, as shown in Figure 1, this method may include following step
It is rapid:
S110 obtains code data to be processed.
In the embodiment of the present invention, acquired code data can be the source code of program, it will be understood that in code data
It may include lines of code, program is by executing the code in code data, to realize corresponding function.
S120 analyzes the word meaning in code for the code in code data, meaning of parameters and code line it
Between logical relation, and the first function is determined according to code analysis result.
In above-mentioned code data, different codes can be used to implement different functions, in order to determine these codes with
Incidence relation between different function, the embodiment of the present invention can analyze each code in code data, for example, analysis generation
Word meaning in code, the logical relation between meaning of parameters and code line, to determine the code in code data for real
Existing function, due to not running code when analysis, it can be considered that above-mentioned analytic process is static analysis process, these are logical
Function determined by analysis is crossed, the first function is properly termed as.
In addition, these functions usually require to realize by adjusting the parameter in code, therefore different functions can be corresponded to
Entrance, determine the code in code data for realizing the first function after, code and the first functional entrance can be established
Corresponding relationship.
Illustratively, by taking common search input frame as an example, a search input frame can usually correspond to following functions and enter
Mouthful: text input box functional entrance, display function entrance trigger Trigger Function entrance of Back-end search etc..Therefore, generation is being obtained
After code data, can by directly carrying out static analysis to code, determine which code for realizing text input box function, which
A little codes are for realizing display function, which code is for realizing triggering Back-end search function, to establish code and each function
The corresponding relationship of entrance.
As a kind of optional embodiment of the embodiment of the present invention, it can be analyzed by static analysis software and determine code
Code in data for realizing the first function.
S130 runs the code in code data, and determines the second function according to code operation result.
The above analysis can determine the corresponding relationship of most of code and function in code data, still, due to the modern times
Largely cause analysis that can not analyze whole corresponding relationships completely, therefore using technologies such as dynamic bindings in programming
Can by the code in operation code data, thus analyze and determine in code implementation for realizing function, i.e., the
Two functions.Determine the code in code data for realizing the second function after, code can be established and entered with the second function
The corresponding relationship of mouth.
S140 determines that the first function and the second function are respectively right according to identified first function and the second function respectively
The test case answered, and establish the corresponding relationship between the code in code data and identified each test case.
In large program development process, it usually needs the different function of a large amount of test cases or test cell to program
Tested, wherein test case can refer to the one group of test input worked out for some special objective, execution condition and
Expected results, to test whether some function meets some particular demands;Test cell can refer to the smallest in program
Tested functional module a, for example, function, a class, a window, menu etc..
In the embodiment of the present invention, in determining code data after different functions, since these functions usually require difference
Test case tested, therefore can readily determine that the corresponding test case of each function, that is, determine the first function respectively
With the corresponding test case of the second function.
According to foregoing teachings it is found that determine the code in code data for realizing the first function after, can build
The corresponding relationship of vertical code and the first functional entrance, determine the code in code data for realizing the second function after, just
It can establish the corresponding relationship of code and the second functional entrance, the embodiment of the present invention has also determined the first function and the second function respectively
Therefore the corresponding test case of energy can establish the corresponding relationship between code and test case.
As a kind of optional embodiment of the embodiment of the present invention, the code that can also be established in code data and determine
Each test case between index information, can recorde code in code data and test case in the index information
Corresponding relationship, for example, first code row to the 5th code line in code data corresponds to test case 1, in code data
Six code lines to the 9th code line correspond to test case 2, and the name information of code data can also be recorded in the index information,
For example, the source code file name of code data, the function name of the code in code data can also be recorded in the index information
Claim information.
Test case corresponding to target query code is searched according to the corresponding relationship established referring to Fig. 1, S150.
After establishing the corresponding relationship between code and each test case, it can search target according to the corresponding relationship and look into
Test case corresponding to code is ask, described target query code refers to the code of corresponding test case to be found.
As a kind of optional embodiment of the embodiment of the present invention, as shown in Fig. 2, above-mentioned steps S130 may include:
S1301, the code in code data are woven into pre-set code when running.
In the embodiment of the present invention, code weaving can be carried out when the code in code data is run, that is, be woven into default generation
Code, and the data for wishing to obtain can be obtained by the pre-set code, for example, obtaining the code institute at runtime in code data
The function of realization.
S1302 determines and records second realized when the code operation in code data by the pre-set code being woven into
Function.
After pre-set code is woven into, can be obtained by the pre-set code code in code data at runtime it is real
The second existing function, that is, code corresponding second function at runtime is determined, so that it is determined that the corresponding relationship of code and function.
It, can also be by being configured in the code of code data as a kind of optional embodiment of the embodiment of the present invention
AOP (Aspect Oriented Programming, towards tangent plane programming) blocker, determines the corresponding relationship of code and function.
Certainly, except for example shown in addition to implementation, realize that the mode of this feature belongs to the protection of the embodiment of the present invention
Range.
It, can be with after determining the corresponding relationship of code and function as a kind of optional embodiment of the embodiment of the present invention
Index information is uploaded to server, is believed by the code in server store code data and the index between each test case
Breath.
As a kind of optional embodiment of the embodiment of the present invention, as shown in figure 3, above-mentioned steps S140 may include:
S1401 determines the corresponding test of the first function according to identified first function in default test case set
Use-case.
In the embodiment of the present invention, a test case set can be pre-established, may include in the test case set
The whole test cases used when developing program therefore, can be from the test case set quickly after determining the first function
Ground determines the corresponding test case of the first function, without seriatim searching the corresponding test case of function, raising processing
Efficiency.
S1402 determines the corresponding test of the second function according to identified second function in default test case set
Use-case.
It is similar with above-mentioned steps, after determining the second function, second can be quickly determined from the test case set
The corresponding test case of function.
S1403 is established corresponding between the code in code data and each test case in default test case set
Relationship.
The embodiment of the present invention is directed to default test case set, can establish the code in code data and the default test
The corresponding relationship between each test case in use-case set, consequently facilitating subsequent search test corresponding with target query code
Use-case.
As a kind of optional embodiment of the embodiment of the present invention, on the basis of the above embodiments, the embodiment of the present invention
Test case querying method can also include:
If in default test case set, there is the test use for not establishing corresponding relationship with the code in code data
Example, i.e., certain unlapped codes of test case can then send alert notification, carried in the alert notification not with code number
Code in establishes the information of the test case of corresponding relationship, for example, the identification number of test case, the title etc. of test case
Information makes application developer pass through alert notification in time and learns which test case does not cover code, to change to code
Into the timely defect for eliminating program.
As a kind of optional embodiment of the embodiment of the present invention, on the basis of the above embodiments, as shown in figure 4, on
Stating step S150 can specifically include:
S1501 receives inquiry instruction.
Application developer therefore can sometimes for test case corresponding to the code in a certain code data of determination
To send inquiry instruction to the server for being stored with code and test case corresponding relationship, server can receive the inquiry and refer to
It enables, carries target query code in the inquiry instruction, survey corresponding to the code for inquiring in code data to be checked
Example on probation, i.e. target query test case.Also, less test case can also be selected to survey the function in program as far as possible
Examination saves time and service device when executing unnecessary test case and runs expense.
It is appreciated that in order to easily facilitate the above-mentioned corresponding relationship of server preservation and management, server can be to index letter
The form of breath saves the corresponding relationship between code and test case, not only can recorde code data in these index informations
In code and test case corresponding relationship, can also include code data name information and the generation in code data
The function name information of code.
S1502 is searched and target query code pair according to the corresponding relationship between the code and each test case established
The test case answered.
It, can be according to the code in the code data established and between each test case after server receives inquiry instruction
Corresponding relationship, search corresponding with target query code test case.
Illustratively, server can search test corresponding with target query code and use in the index information of preservation
Example.
As a kind of optional embodiment of the embodiment of the present invention, test corresponding with target query code is obtained in lookup
After use-case, which can be sent to the client that application developer uses by server, so as to application developer
Debugging, improves the ease for use of program debugging.
In program development process, the code in code data is often modified, and is modified to more advantageously obtain
The corresponding test case of code, as a kind of optional embodiment of the embodiment of the present invention, the code in code data is repaired
After changing, it can use default hook program and obtain the code snippet modified in code data.Above-mentioned hook program is a kind of normal
For obtaining the program or function of information, application developer can compile hook program according to actual needs to obtain
The information needed, is repeated no more using the principle embodiment of the present invention.
Then the step of test case corresponding to above-mentioned lookup target query code, is specifically as follows:
In corresponding relationship between identified code and each test case, search by the corresponding survey of modification code snippet
Example on probation.
Optionally, due to can recorde the function name of code in index information, the embodiment of the present invention can basis
The function name for the code snippet modified is searched correspond to test case by modification code snippet in the above correspondence relationship.Example
Such as, in the index information for preserving the corresponding relationship between code and each test case in code data, input is modified
Code snippet function name, the corresponding test case of the code can be easily searched for, to further increase lookup
Efficiency.
A kind of test case querying method provided in an embodiment of the present invention, after obtaining code data to be processed, Neng Goutong
It crosses and the code in code data is analyzed and run, based on analysis result and operation result, determine in code data respectively
Code for realizing the first function and the second function, and then determine the first function and the corresponding survey of the second function respectively
Example on probation enables tester's root to establish the corresponding relationship between the code in code data and each test case
According to the corresponding relationship established, target query test case is searched, and determines the corresponding function of the test case, program can be made
Developer has found affected function in time, to reduce bugs.
Corresponding to embodiment of the method, the embodiment of the invention also provides a kind of test case inquiry units, flow with shown in Fig. 1
Journey is corresponding, as shown in figure 5, the device includes:
First obtains module 301, includes lines of code in code data for obtaining code data to be processed.
First determining module 302, for analyzing the word meaning in code for the code in code data, parameter contains
Logical relation between justice and code line, and determine that the first function, the first function are code data according to code analysis result
In code realize function.
Second determining module 303 determines the second function for running the code in code data, and according to code operation result
Can, the second function is the function that the code in code data is realized, the first function and the second function difference.
Module 304 is established, for determining the first function and second respectively according to identified first function and the second function
The corresponding test case of function, and establish the corresponding pass between the code in code data and identified each test case
System.
Searching module 305, for searching test corresponding to target query code and using according to the corresponding relationship established
Example.
Wherein, module is established, is specifically used for:
The index information between the code in code data and identified each test case is established, is recorded in index information
There are the corresponding relationship of the code and test case in code data, the name information of code data and the generation in code data
The function name information of code.
Wherein, as shown in fig. 6, above-mentioned second determining module 303, comprising:
It is woven into submodule 3031, is woven into pre-set code when running for the code in code data.
First determines submodule 3032, for determining and recording the generation in code data by be woven into pre-set code
The second function of being realized when code operation.
Wherein, as shown in fig. 7, above-mentioned establish module 304, comprising:
Second determines submodule 3041, for being determined in default test case set according to identified first function
The corresponding test case of first function.
Third determines submodule 3042, for being determined in default test case set according to identified second function
The corresponding test case of second function.
Setting up submodule 3043 is used for establishing the code in code data and each test in default test case set
Corresponding relationship between example.
Wherein, on the basis of device shown in Fig. 5, as shown in figure 8, the test case inquiry unit of the embodiment of the present invention is also
May include:
Sending module 401, if existing and not established with the code in code data in default test case set
The test case of corresponding relationship then sends alert notification, carried in alert notification not in code data code establish pair
The information for the test case that should be related to.
Wherein, on the basis of device shown in Fig. 5, as shown in figure 9, above-mentioned searching module 305, comprising:
Receiving submodule 3051 carries target query code for receiving inquiry instruction in inquiry instruction.
Search submodule 3052, for according to the corresponding relationship between the code and each test case established, search with
The corresponding test case of target query code.
Wherein, on the basis of device shown in Fig. 5, as shown in Figure 10, the test case inquiry unit of the embodiment of the present invention
Can also include:
Second obtains module 601, after being modified for the code in code data, obtains generation using default hook program
Code data in by modification code snippet.
Then above-mentioned searching module, specifically can be used for:
In corresponding relationship between identified code and each test case, search by the corresponding survey of modification code snippet
Example on probation.
A kind of test case inquiry unit provided in an embodiment of the present invention, after obtaining code data to be processed, Neng Goutong
It crosses and the code in code data is analyzed and run, based on analysis result and operation result, determine in code data respectively
Code for realizing the first function and the second function, and then determine the first function and the corresponding survey of the second function respectively
Example on probation enables tester's root to establish the corresponding relationship between the code in code data and each test case
According to the corresponding relationship established, target query test case is searched, and determines the corresponding function of the test case, program can be made
Developer has found affected function in time, to reduce bugs.
The embodiment of the invention also provides a kind of electronic equipment, as shown in figure 11, including processor 701, communication interface
702, memory 703 and communication bus 704, wherein processor 701, communication interface 702, memory 703 pass through communication bus
704 complete mutual communication,
Memory 703, for storing computer program;
Processor 701 when for executing the program stored on memory 703, realizes following steps:
Code data to be processed is obtained, includes lines of code in code data;
For the code in code data, the word meaning in code, patrolling between meaning of parameters and code line are analyzed
The relationship of collecting, and determine that the first function, the first function are the function that the code in code data is realized according to code analysis result;
The code in code data is run, and determines that the second function, the second function are code number according to code operation result
The function that code in is realized, the first function and the second function difference;
According to identified first function and the second function, the first function and the corresponding survey of the second function are determined respectively
Example on probation, and establish the corresponding relationship between the code in code data and identified each test case;
According to the corresponding relationship established, test case corresponding to target query code is searched.
A kind of electronic equipment provided in an embodiment of the present invention can be by code after obtaining code data to be processed
Code in data is analyzed and is run, and based on analysis result and operation result, determines that the code in code data is used respectively
In the first function and the second function of realization, and then the first function and the corresponding test case of the second function are determined respectively,
To establish corresponding relationship between the code in code data and each test case, enable tester according to being established
Corresponding relationship, search target query test case, and determine the corresponding function of the test case, application developer can be made
Affected function is found in time, to reduce bugs.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, abbreviation PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, abbreviation EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..
Only to be indicated with a thick line in figure, it is not intended that an only bus or a type of bus convenient for indicating.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, abbreviation RAM), also may include
Nonvolatile memory (non-volatile memory), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
Abbreviation CPU), network processing unit (Network Processor, abbreviation NP) etc.;It can also be digital signal processor
(Digital Signal Processing, abbreviation DSP), specific integrated circuit (Application Specific
Integrated Circuit, abbreviation ASIC), field programmable gate array (Field-Programmable Gate Array,
Abbreviation FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hardware components.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can
It reads to be stored with instruction in storage medium, when run on a computer, so that computer executes any institute in above-described embodiment
The test case querying method stated.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when it
When running on computers, so that computer executes any test case querying method in above-described embodiment.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program
Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or
It partly generates according to process or function described in the embodiment of the present invention.The computer can be general purpose computer, dedicated meter
Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium
In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer
Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center
User's line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server or
Data center is transmitted.The computer readable storage medium can be any usable medium that computer can access or
It is comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium can be with
It is magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard disk
Solid State Disk (SSD)) etc..
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for system reality
For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method
Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (15)
1. a kind of test case querying method, which is characterized in that the described method includes:
Code data to be processed is obtained, includes lines of code in the code data;
For the code in the code data, the word meaning in the code is analyzed, between meaning of parameters and code line
Logical relation, and the first function is determined according to code analysis result, first function is the code in the code data
The function of realization;
The code in the code data is run, and determines that the second function, second function are institute according to code operation result
The function that the code in code data is realized is stated, first function is different with second function;
According to identified first function and second function, first function and second function are determined respectively
Corresponding test case, and establish the corresponding pass between the code in the code data and identified each test case
System;
According to the corresponding relationship established, test case corresponding to target query code is searched.
2. the method according to claim 1, wherein the code established in the code data and determining
Each test case between corresponding relationship the step of, comprising:
The index information between the code in the code data and identified each test case is established, in the index information
Record has the corresponding relationship of code and test case in the code data, the name information of the code data, Yi Jisuo
State the function name information of the code in code data.
3. the method according to claim 1, wherein the code in the operation code data, and according to
The step of code operation result determines the second function, comprising:
Code in the code data is woven into pre-set code when running;
By the pre-set code being woven into, the second function realized when the code operation in the code data is determined and recorded
Energy.
4. the method according to claim 1, wherein first function described according to determined by and described
Two functions determine first function and the corresponding test case of the second function respectively, and establish the code number
The step of corresponding relationship between code and identified each test case in, comprising:
According to identified first function, determine that the corresponding test of first function is used in default test case set
Example;
According to identified second function, determine that the corresponding test of second function is used in default test case set
Example;
Establish the corresponding pass between the code in the code data and each test case in the default test case set
System.
5. according to the method described in claim 4, it is characterized in that, the code established in the code data and determining
Each test case between corresponding relationship after, the method also includes:
If in the default test case set, there is the survey for not establishing corresponding relationship with the code in the code data
Example on probation, then send alert notification, and pass not corresponding with the code foundation in the code data is carried in the alert notification
The information of the test case of system.
6. the method according to claim 1, wherein described according to the corresponding relationship established, lookup mesh
The step of test case corresponding to mark inquiry code, comprising:
Inquiry instruction is received, carries target query code in the inquiry instruction;
According to the corresponding relationship between the code and each test case established, survey corresponding with the target query code is searched
Example on probation.
7. the method according to claim 1, wherein the method also includes:
After the code in the code data is modified, being modified in the code data is obtained using default hook program
Code snippet;
It is described according to the corresponding relationship established, the step of searching test case corresponding to target query code, comprising:
In corresponding relationship between the identified code and each test case, lookup is described to be corresponded to by modification code snippet
Test case.
8. a kind of test case inquiry unit, which is characterized in that described device includes:
First obtains module, includes lines of code in the code data for obtaining code data to be processed;
First determining module, for analyzing the word meaning in the code, parameter contains for the code in the code data
Logical relation between justice and code line, and the first function is determined according to code analysis result, first function is described
The function that code in code data is realized;
Second determining module determines the second function for running the code in the code data, and according to code operation result,
Second function is the function that the code in the code data is realized, first function is different with second function;
Module is established, for determining first function respectively according to identified first function and second function
With the corresponding test case of the second function, and the code in the code data and identified each test use are established
Corresponding relationship between example;
Searching module, for searching test case corresponding to target query code according to the corresponding relationship established.
9. device according to claim 8, which is characterized in that it is described to establish module, it is specifically used for:
The index information between the code in the code data and identified each test case is established, in the index information
Record has the corresponding relationship of code and test case in the code data, the name information of the code data, Yi Jisuo
State the function name information of the code in code data.
10. device according to claim 8, which is characterized in that second determining module, comprising:
It is woven into submodule, is woven into pre-set code when running for the code in the code data;
First determines submodule, for the pre-set code by being woven into, determines and records the generation in the code data
The second function of being realized when code operation.
11. device according to claim 8, which is characterized in that described to establish module, comprising:
Second determines submodule, described in being determined in default test case set according to identified first function
The corresponding test case of first function;
Second determines submodule, described in being determined in default test case set according to identified second function
The corresponding test case of second function;
Setting up submodule, each test in code and the default test case set for establishing in the code data are used
Corresponding relationship between example.
12. device according to claim 11, which is characterized in that described device further include:
Sending module, if existing and not built with the code in the code data in the default test case set
The test case of vertical corresponding relationship, then send alert notification, carried not and in the code data in the alert notification
Code establishes the information of the test case of corresponding relationship.
13. device according to claim 8, which is characterized in that the searching module, comprising:
Receiving submodule carries target query code for receiving inquiry instruction in the inquiry instruction;
Submodule is searched, for searching and the target according to the corresponding relationship between the code and each test case established
Inquire the corresponding test case of code.
14. device according to claim 8, which is characterized in that described device further include:
Second obtains module, for after the code in the code data is modified, obtained using default hook program described in
In code data by modification code snippet;
The searching module, is specifically used for:
In corresponding relationship between the identified code and each test case, lookup is described to be corresponded to by modification code snippet
Test case.
15. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing
Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes method and step as claimed in claim 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910697340.7A CN110442370B (en) | 2019-07-30 | 2019-07-30 | Test case query method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910697340.7A CN110442370B (en) | 2019-07-30 | 2019-07-30 | Test case query method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110442370A true CN110442370A (en) | 2019-11-12 |
CN110442370B CN110442370B (en) | 2023-10-27 |
Family
ID=68432389
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910697340.7A Active CN110442370B (en) | 2019-07-30 | 2019-07-30 | Test case query method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110442370B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021196674A1 (en) * | 2020-03-30 | 2021-10-07 | 平安科技(深圳)有限公司 | System code testing method and apparatus, and computer device and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030093716A1 (en) * | 2001-11-13 | 2003-05-15 | International Business Machines Corporation | Method and apparatus for collecting persistent coverage data across software versions |
CN106557413A (en) * | 2015-09-25 | 2017-04-05 | 伊姆西公司 | Based on the method and apparatus that code coverage obtains test case |
CN108874661A (en) * | 2018-05-07 | 2018-11-23 | 上海陆家嘴国际金融资产交易市场股份有限公司 | Test mapping relations library generating method, device, computer equipment and storage medium |
-
2019
- 2019-07-30 CN CN201910697340.7A patent/CN110442370B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030093716A1 (en) * | 2001-11-13 | 2003-05-15 | International Business Machines Corporation | Method and apparatus for collecting persistent coverage data across software versions |
CN106557413A (en) * | 2015-09-25 | 2017-04-05 | 伊姆西公司 | Based on the method and apparatus that code coverage obtains test case |
CN108874661A (en) * | 2018-05-07 | 2018-11-23 | 上海陆家嘴国际金融资产交易市场股份有限公司 | Test mapping relations library generating method, device, computer equipment and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021196674A1 (en) * | 2020-03-30 | 2021-10-07 | 平安科技(深圳)有限公司 | System code testing method and apparatus, and computer device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110442370B (en) | 2023-10-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105553769B (en) | A kind of data acquisition and analysis system and method | |
WO2021143175A1 (en) | Test case screening method and device, and medium | |
CN107798047B (en) | Repeated work order detection method, device, server and medium | |
CN109491990A (en) | A kind of method of detection data quality and the device of detection data quality | |
CN109491860A (en) | Method for detecting abnormality, terminal device and the medium of application program | |
CN111897724B (en) | Automatic testing method and device suitable for cloud platform | |
US9116779B2 (en) | Test management domain asset discovery and analysis | |
US10990510B2 (en) | Associating attribute seeds of regression test cases with breakpoint value-based fingerprints | |
CN107003931B (en) | Decoupling test validation from test execution | |
CN105022694A (en) | Test case generation method and system for mobile terminal test | |
CN109144852A (en) | Scan method, device, computer equipment and the storage medium of static code | |
CN111258881A (en) | Intelligent test system for workflow test | |
CN114116801A (en) | Data list checking method and device | |
CN110442370A (en) | A kind of test case querying method and device | |
CN104933105B (en) | The analysis method and device of database access request | |
US20120124428A1 (en) | Method and system for testing software on programmable devices | |
US20240086165A1 (en) | Systems and methods for building and deploying machine learning applications | |
CN115514570B (en) | Network diagnosis processing method, system and cloud platform | |
US9679245B2 (en) | Predicting the impact of change on events detected in application logic | |
JP2013077124A (en) | Software test case generation device | |
CN109086198A (en) | Test method, device and the storage medium of database | |
CN109032930A (en) | System detection method and device | |
US11586853B2 (en) | System and method of validating multi-vendor Internet-of-Things (IoT) devices using reinforcement learning | |
US20180004879A1 (en) | Integrated circuit design verification | |
CN111045849A (en) | Method, device, server and storage medium for identifying reason of checking abnormality |
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 |