[summary of the invention]
The embodiment of the invention provides a kind of test case edit methods and devices, terminal and computer-readable storage medium
Matter, it is intended to the technical issues of solving manual compiling test big, error-prone, the difficult maintenance of code difficulty in the related technology, it can be simple
The written in code for efficiently completing automatic test, promotes the written in code of automatic test and the efficiency of maintenance.
In a first aspect, the embodiment of the invention provides a kind of test case edit methods, comprising: obtain test to be generated and use
The attribute information of example;According to the attribute information, select in use-case template database to answer with the test case to be generated
Right highest target use-case template;According to the attribute information, the target use-case template is filled, is generated corresponding
Test case.
In the above embodiment of the present invention, optionally, the attribute information for obtaining test case to be generated the step of
Before, further includes: multiplexed content detection is carried out to multiple history test cases in history test;Each history is tested
Multiplex content other than the multiplexed content in use-case is deleted, and multiple use-case templates are formed.
In the above embodiment of the present invention, optionally, further includes: duplicate removal processing is carried out to the multiple use-case template, and
The use-case template obtained after the duplicate removal processing will be carried out to be stored in the use-case template database.
In the above embodiment of the present invention, optionally, the attribute information of the test case to be generated includes use-case
Description and use-case operating procedure.
It is optionally, described according to the attribute information in the above embodiment of the present invention, it is selected in use-case template database
The step of selecting target use-case template highest with the multiplicity of the test case to be generated, specifically includes: described to be generated
Keyword is chosen in the corresponding use case description of each of test case use-case operating procedure;In the use-case template number
According in library, the use-case template most with the quantity of the keyword match of the test case to be generated is chosen, as described
Target use-case template.
It is optionally, described according to the attribute information in the above embodiment of the present invention, it is selected in use-case template database
The step of selecting target use-case template highest with the multiplicity of the test case to be generated, specifically includes: described to be generated
Keyword is chosen in the corresponding use case description of each of test case use-case operating procedure;In the use-case template number
According in library, the quantity of selection and the keyword match of the test case to be generated reaches several use-cases of predetermined quantity
Template;Select a use-case template for meeting predetermined condition as the target use-case mould in several described use-case templates
Plate, wherein the predetermined condition are as follows: the function type of the use-case template of selection and the function of the test case to be generated
Type is consistent;And/or the grade of the accessed permission of the use-case template of selection is used less than or equal to the test to be generated
The grade of the access authority of example.
Second aspect, the embodiment of the invention provides a kind of test case editing devices, comprising: attribute information obtains single
Member, for obtaining the attribute information of test case to be generated;Template selection unit is used for according to the attribute information, in use-case
The highest target use-case template of multiplicity with the test case to be generated is selected in template database;Template fills unit,
For being filled to the target use-case template, generating corresponding test case according to the attribute information.
In the above embodiment of the present invention, optionally, further includes: multiplexed content detection unit, for believing in the attribute
Before breath acquiring unit obtains the attribute information of the test case to be generated, multiple history in history test are tested
Use-case carries out multiplexed content detection;Multiplex content deleting unit, for will be described multiple in each history test case
It is deleted with the multiplex content other than content, forms multiple use-case templates.
In the above embodiment of the present invention, optionally, further includes: duplicate removal unit, for the multiple use-case template into
Row duplicate removal processing;Storage unit, the use-case template for that will carry out obtaining after the duplicate removal processing are stored in the use-case template number
According in library.
In the above embodiment of the present invention, optionally, the attribute information of the test case to be generated includes use-case
Description and use-case operating procedure.
In the above embodiment of the present invention, optionally, the template selection unit includes: keyword selection unit, is used for
Keyword is chosen in the corresponding use case description of each of the test case to be generated use-case operating procedure;It is crucial
Word matching unit, for choosing the keyword with the test case to be generated in the use-case template database
The most use-case template of the quantity matched, as the target use-case template.
In the above embodiment of the present invention, optionally, the template selection unit includes: keyword selection unit, is used for
Keyword is chosen in the corresponding use case description of each of the test case to be generated use-case operating procedure;First
Screening unit, for choosing the keyword match with the test case to be generated in the use-case template database
Quantity reach several use-case templates of predetermined quantity;Second screening unit, for being selected in several described use-case templates
A use-case template for meeting predetermined condition is selected as the target use-case template, wherein the predetermined condition are as follows: the institute of selection
The function type for stating use-case template is consistent with the function type of the test case to be generated;And/or the use-case mould of selection
Grade of the grade of the accessed permission of plate less than or equal to the access authority of the test case to be generated.
The third aspect, the embodiment of the invention provides a kind of terminals, comprising: at least one processor;And with it is described extremely
The memory of few processor communication connection;Wherein, the memory, which is stored with, to be executed by least one described processor
Instruction, described instruction is arranged to be used for executing method described in any one of above-mentioned first aspect.
Fourth aspect, the embodiment of the invention provides a kind of computer readable storage mediums, and it is executable to be stored with computer
Instruction, the computer executable instructions are for executing method flow described in any one of above-mentioned first aspect.
Above technical scheme, for the technology of test big, error-prone, the difficult maintenance of code difficulty of manual compiling in the related technology
Problem can simply and efficiently complete the written in code of automatic test, promote written in code and the maintenance of automatic test
Efficiency.
Specifically, it is stored with a large amount of use-case templates in use-case template database, includes to write in each use-case template
The compound common code of height, can save using use-case template and write step to common code when test case, it is only necessary to
By the part polishing other than common code existing in use-case template.And it selects in use-case template and filling use-case template
Part other than the common code having can determine by the attribute information of test case to be generated, the attribute of test case to be generated
Information includes but is not limited to use case description and use-case operating procedure, is operated according to the use case description of test case to be generated and use-case
Step can select Compound Degree and the highest use-case template of test case to be generated as target in use-case template database
Use-case template.Then, it may be determined that do not have in target use-case template in the use-case operating procedure of test case to be generated corresponding
The part of code, then this partial code is write automatically or manual compiling.Therein write automatically including but not limited to exists
Code snippet corresponding with use-case operating procedure is obtained in code database.
Generally speaking, multiple use-case templates can be set, be stored in use-case template database, wherein each use-case mould
Include the code that height is compound when writing test case in plate, introduces the code that use-case template can be compound by height as a result,
It directly takes, without manual compiling, to substantially reduce written in code amount, saves the time early period investment of test, it is maximum
Written in code difficulty is reduced to limit, equally, decreases the workload of the later maintenance to test case.
[specific embodiment]
For a better understanding of the technical solution of the present invention, being retouched in detail to the embodiment of the present invention with reference to the accompanying drawing
It states.
It will be appreciated that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Base
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts it is all its
Its embodiment, shall fall within the protection scope of the present invention.
The term used in embodiments of the present invention is only to be not intended to be limiting merely for for the purpose of describing particular embodiments
The present invention.In the embodiment of the present invention and the "an" of singular used in the attached claims, " described " and "the"
It is also intended to including most forms, unless the context clearly indicates other meaning.
Fig. 1 shows the flow chart of the test case edit methods of one embodiment of the present of invention.
As shown in Figure 1, the process of the test case edit methods of one embodiment of the present of invention includes:
Step 102, the attribute information of test case to be generated is obtained.
Step 104, it according to the attribute information, is selected in use-case template database and the test case to be generated
The highest target use-case template of multiplicity.
It is stored with a large amount of use-case templates in use-case template database, includes when writing test case in each use-case template
Highly compound common code, can save using use-case template and write step to common code, it is only necessary to by use-case template
In part polishing other than existing common code.And select existing common generation in use-case template and filling use-case template
Code other than part can be determined by the attribute information of test case to be generated, the attribute information of test case to be generated include but
It is not limited to use case description and use-case operating procedure, it, can be with according to the use case description of test case to be generated and use-case operating procedure
Select Compound Degree and the highest use-case template of test case to be generated as target use-case template in use-case template database.
Then, it may be determined that do not have the portion of respective code in the use-case operating procedure of test case to be generated in target use-case template
Point, then this partial code is write automatically or manual compiling.It is therein to write including but not limited in code data automatically
Code snippet corresponding with use-case operating procedure is obtained in library.
Step 106, according to the attribute information, the target use-case template is filled, corresponding test is generated and uses
Example.
Above technical scheme, for the technology of test big, error-prone, the difficult maintenance of code difficulty of manual compiling in the related technology
Problem can simply and efficiently complete the written in code of automatic test, promote written in code and the maintenance of automatic test
Efficiency.
Generally speaking, multiple use-case templates can be set, be stored in use-case template database, wherein each use-case mould
Include the code that height is compound when writing test case in plate, introduces the code that use-case template can be compound by height as a result,
It directly takes, without manual compiling, to substantially reduce written in code amount, saves the time early period investment of test, it is maximum
Written in code difficulty is reduced to limit, equally, decreases the workload of the later maintenance to test case.
Fig. 2 has gone out the flow chart of the test case edit methods of another embodiment of the invention.
As shown in Fig. 2, the process of the test case edit methods of another embodiment of the invention includes:
Step 202, multiplexed content detection is carried out to multiple history test cases in history test.
Step 204, the multiplex content other than the multiplexed content in each history test case is deleted, shape
At multiple use-case templates.
Step 202 and step 204 describe the generating mode of use-case template, that is, detect in a large amount of history test cases
Multiplexed content will be in the multiplex other than the multiplexed content in history test case using multiplexed content as template content
Hold and deletes to get to a use-case template.
Wherein, it can go through to classify as a large amount of history test cases of sample by testing procedure is same or similar
History test case is divided into one kind, for example, the test case of two step of only order reception and order processing can be divided into one kind, when one
When the use-case operating procedure of a test case is two step of order reception and order processing, can by this test case point in such,
Then, the multiplex contents such as order sender information, order reception side's information in this test case are deleted, leave embodiment and
Execution of order receives and the composite code of order processing, that is, forms the test for being exclusively used in two step of order reception and order processing
Use-case template.
Step 206, duplicate removal processing is carried out to the multiple use-case template.
Step 208, the use-case template obtained after the duplicate removal processing will be carried out to be stored in the use-case template database.
It is duplicate due to being likely to have in the use-case template that is obtained after handling a large amount of history test cases, therefore can be into
Row duplicate removal processing, to save the memory space of use-case template database.In addition, duplicate removal processing can reduce the sum of use-case template
Amount, therefore the step of being also further selection target use-case template reduces the size that template set to be selected closes, convenient for more rapidly quasi-
Really select required target use-case template.
Step 210, the attribute information of test case to be generated is obtained.
Step 212, according to the attribute information, selection is used with the test to be generated in the use-case template database
The highest target use-case template of multiplicity of example.
Step 214, according to the attribute information, the target use-case template is filled, corresponding test is generated and uses
Example.
By above technical scheme, the compound code of height can directly be used after introducing use-case template, without artificial
It writes, to substantially reduce written in code amount, saves the time early period investment of test, reduce written in code to the maximum extent
Difficulty equally decreases the workload of the later maintenance to test case.
Fig. 3 has gone out the flow chart of the test case edit methods of yet another embodiment of the present invention.
As shown in figure 3, the process of the test case edit methods of yet another embodiment of the present invention includes:
Step 302, the attribute information of test case to be generated is obtained.
Step 304, in the corresponding use case description of each of the test case to be generated use-case operating procedure
Middle selection keyword.
Step 306, in the use-case template database, the keyword with the test case to be generated is chosen
The most use-case template of the quantity matched, as the target use-case template.
Step 308, according to the attribute information, the target use-case template is filled, corresponding test is generated and uses
Example.
In the above-mentioned technical solutions, test case to be generated is mainly determined by the quantity height of keyword match and is used
The multiplicity height of example template, wherein keyword is derived from the corresponding use case description of each use-case operating procedure.
It, can will be in the keyword of test case to be generated and use-case template database in a kind of implementation of the invention
The keyword of each use-case template carries out overall comparison, chooses in each use-case template matched with the test case institute to be generated
The most use-case template of the quantity of the keyword.Wherein, keyword selects in the corresponding use case description of use-case operating procedure,
Certainly, the quantity for the keyword chosen in the corresponding use case description of each use-case operating procedure can according to the actual situation depending on,
The quantity for the keyword chosen in the corresponding use case description of each use-case operating procedure is more, more smart to the judgement of multiplicity
Really, the use-case template formed therefrom also more has practicability.
Fig. 4 has gone out the flow chart of the test case edit methods of another embodiment of the invention.
As shown in figure 4, the process of the test case edit methods of another embodiment of the invention includes:
Step 402, the attribute information of test case to be generated is obtained.
Step 404, in the corresponding use case description of each of the test case to be generated use-case operating procedure
Middle selection keyword.
Step 406, in the use-case template database, the keyword with the test case to be generated is chosen
The quantity matched reaches several use-case templates of predetermined quantity.
In a kind of implementation of the invention, since the function type of use-case template is varied, in order to accurately select
Template more practical, can be in several sufficiently high use-case templates of the keyword match quantity in use-case template database
In, using the function type of test case to be generated as further screening conditions, carry out postsearch screening.
In another implementation of the invention, in order to protect the safety of automatic test, its use-case template is protected
Etc. contents be not stolen or reveal, can be in several sufficiently high use-case moulds of the keyword match quantity in use-case template database
In plate, using the grade of the access authority of test case to be generated as further screening conditions, postsearch screening is carried out.
Step 408, select a use-case template for meeting predetermined condition as described in several described use-case templates
Target use-case template, wherein the predetermined condition are as follows: the function type of the use-case template of selection and the test to be generated
The function type of use-case is consistent;And/or the grade of the accessed permission of the use-case template of selection less than or equal to it is described to
Generate the grade of the access authority of test case.
In a kind of implementation of the invention, the function type of the use-case template of selection and the test to be generated
The function type of use-case is consistent, i.e., only could mutually be nested between the test case to be generated and use-case template of identical function type
With, to avoid test case to be generated and use-case template function type difference cause generate test case it is invalid, avoid shadow
Ring test result.
In another implementation of the invention, the grade of the accessed permission of the use-case template of selection be lower than or
Equal to the grade of the access authority of the test case to be generated.I.e. different use-case templates has different accessed permissions,
When the grade of the access authority of test case only to be generated is greater than or equal to the grade of the accessed permission of use-case template, just say
Bright test case to be generated is qualified to use the use-case template.It can avoid the higher specific function template quilt of privacy degrees as a result,
The junior user of access authority reveals, and protects the safety of use-case template.
Step 410, according to the attribute information, the target use-case template is filled, corresponding test is generated and uses
Example.
In addition, above two predetermined condition can be used alone according to actual test demand, also in relation with using, with to greatest extent
Protect the validity of test template selection and the safety of automatic test in ground.
Fig. 5 shows the block diagram of the test case editing device of one embodiment of the present of invention.
As shown in figure 5, the embodiment of the invention provides a kind of test case editing devices 500, comprising: attribute information obtains
Unit 502, for obtaining the attribute information of test case to be generated;Template selection unit 504, for being believed according to the attribute
Breath selects the highest target use-case template of multiplicity with the test case to be generated in use-case template database;Template
Fills unit 506 generates corresponding test and uses for being filled to the target use-case template according to the attribute information
Example.
The test case editing device 500 is using scheme described in any one of embodiment shown in Fig. 1 to Fig. 4, therefore,
With above-mentioned all technical effects, details are not described herein.Test case editing device 500 also has following technical characteristic:
In the above embodiment of the present invention, optionally, further includes: multiplexed content detection unit, for believing in the attribute
Before breath acquiring unit 502 obtains the attribute information of the test case to be generated, to multiple history in history test
Test case carries out multiplexed content detection;Multiplex content deleting unit, for by the institute in each history test case
It states the multiplex content other than multiplexed content to delete, forms multiple use-case templates.
In the above embodiment of the present invention, optionally, further includes: duplicate removal unit, for the multiple use-case template into
Row duplicate removal processing;Storage unit, the use-case template for that will carry out obtaining after the duplicate removal processing are stored in the use-case template number
According in library.
In the above embodiment of the present invention, optionally, the attribute information of the test case to be generated includes use-case
Description and use-case operating procedure.
In the above embodiment of the present invention, optionally, the template selection unit 504 includes: keyword selection unit, is used
In choosing keyword in the corresponding use case description of each of the test case to be generated use-case operating procedure;It closes
Key word matching unit, for choosing the keyword with the test case to be generated in the use-case template database
The most use-case template of matched quantity, as the target use-case template.
In the above embodiment of the present invention, optionally, the template selection unit 504 includes: keyword selection unit, is used
In choosing keyword in the corresponding use case description of each of the test case to be generated use-case operating procedure;The
One screening unit, for choosing the keyword with the test case to be generated in the use-case template database
The quantity matched reaches several use-case templates of predetermined quantity;Second screening unit, in several described use-case templates
Select a use-case template for meeting predetermined condition as the target use-case template, wherein the predetermined condition are as follows: selection
The function type of the use-case template is consistent with the function type of the test case to be generated;And/or the use-case of selection
Grade of the grade of the accessed permission of template less than or equal to the access authority of the test case to be generated.
Fig. 6 shows the block diagram of the terminal of one embodiment of the present of invention.
As shown in fig. 6, the terminal 600 of one embodiment of the present of invention, including at least one processor 602;And with institute
State the processor 604 of the communication connection of at least one processor 602;Wherein, the memory be stored with can by it is described at least one
The instruction that processor 604 executes, described instruction are arranged to be used for executing described in any one of above-mentioned Fig. 1 to Fig. 4 embodiment
Scheme.Therefore, which has and Fig. 1 to Fig. 4 applies the identical technical effect of any one of example, and details are not described herein.
In addition, computer executable instructions are stored with the embodiment of the invention provides a kind of computer readable storage medium,
The computer executable instructions are for executing method flow described in any one of above-mentioned Fig. 1 to Fig. 4 embodiment.
The technical scheme of the present invention has been explained in detail above with reference to the attached drawings, according to the technical solution of the present invention, for correlation
In technology the technical issues of manual compiling test code difficulty big, error-prone, difficult maintenance, it can simply and efficiently complete to automate
The written in code of test promotes the written in code of automatic test and the efficiency of maintenance, in short, including to write in use-case template
Height compound code when test case, introducing use-case template can directly take the compound code of height, without artificial
It writes, to substantially reduce written in code amount, saves the time early period investment of test, reduce written in code to the maximum extent
Difficulty equally decreases the workload of the later maintenance to test case.
It should be appreciated that term "and/or" used herein is only a kind of incidence relation for describing affiliated partner, indicate
There may be three kinds of relationships, for example, A and/or B, can indicate: individualism A, exist simultaneously A and B, individualism B these three
Situation.In addition, character "/" herein, typicallys represent the relationship that forward-backward correlation object is a kind of "or".
Depending on context, word as used in this " if " can be construed to " ... when " or " when ...
When " or " in response to determination " or " in response to detection ".Similarly, depend on context, phrase " if it is determined that " or " if detection
(condition or event of statement) " can be construed to " when determining " or " in response to determination " or " when the detection (condition of statement
Or event) when " or " in response to detection (condition or event of statement) ".
It should be noted that terminal involved in the embodiment of the present invention can include but is not limited to personal computer
(Personal Computer, PC), personal digital assistant (Personal Digital Assistant, PDA), wireless handheld
Equipment, tablet computer (Tablet Computer), mobile phone, MP3 player, MP4 player etc..
In several embodiments provided by the present invention, it should be understood that disclosed systems, devices and methods, it can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or group
Part can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown
Or the mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, device or unit it is indirect
Coupling or communication connection can be electrical property, mechanical or other forms.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of hardware adds SFU software functional unit.
The above-mentioned integrated unit being realized in the form of SFU software functional unit can store and computer-readable deposit at one
In storage media.Above-mentioned SFU software functional unit is stored in a storage medium, including some instructions are used so that a computer
It is each that device (can be personal computer, server or network equipment etc.) or processor (Processor) execute the present invention
The part steps of embodiment the method.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (Read-
Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic or disk etc. it is various
It can store the medium of program code.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all in essence of the invention
Within mind and principle, any modification, equivalent substitution, improvement and etc. done be should be included within the scope of the present invention.