CN106776334A - Based on annotation generation method of test example and device - Google Patents

Based on annotation generation method of test example and device Download PDF

Info

Publication number
CN106776334A
CN106776334A CN201611235663.7A CN201611235663A CN106776334A CN 106776334 A CN106776334 A CN 106776334A CN 201611235663 A CN201611235663 A CN 201611235663A CN 106776334 A CN106776334 A CN 106776334A
Authority
CN
China
Prior art keywords
visual testing
case
testing use
code
test
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
Application number
CN201611235663.7A
Other languages
Chinese (zh)
Other versions
CN106776334B (en
Inventor
李珂
黄威
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201611235663.7A priority Critical patent/CN106776334B/en
Publication of CN106776334A publication Critical patent/CN106776334A/en
Application granted granted Critical
Publication of CN106776334B publication Critical patent/CN106776334B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Abstract

The invention discloses one kind based on annotation generation method of test example and device, its method includes:Obtain being write according to the preset style with code dependent one or more snippets notes content;The relevant information of test case is extracted from one or more snippets notes content;According to the information extracted, one or more first visual testing use-cases suitable for code corresponding with one or more snippets notes content are generated.Using this programme, on the one hand save QA and time, the manpower that relevant documentation is spent are exchanged or checked with developer, greatly improve the efficiency of generation test case.On the other hand it also avoid omission during to code building test case.Meanwhile, being visualized by by test case, more convenient user checks in itself to test case, also reduces threshold of the test case to the technical requirements of user, more simple to operation.

Description

Based on annotation generation method of test example and device
Technical field
The present invention relates to computer software fields, and in particular to one kind is based on annotation generation method of test example and device.
Background technology
Code needs to be tested accordingly after the completion of writing, to be detected to the function that code is realized, it is ensured that The correctness of code.Test case corresponding to written in code is needed during test.Typically when test case is write, it is necessary to QA (Quality Assurance, quality assurance) engineer is linked up or is checked related exploitation text to code development engineer Shelves, according to result or document content is linked up, write corresponding test case.
QA engineer needs to clear the interface of each code, return value first, realizes the contents such as function, on this basis, whole Manage out the test case suitable for code.But so cause that writing test case needs to put into substantial amounts of manpower and time, efficiency Than relatively low.Simultaneously as needing manual compiling test case, easily there is human error so that test case is not comprehensive, cause Situations such as having omission to the test of code.
The content of the invention
In view of the above problems, it is proposed that the present invention so as to provide one kind overcome above mentioned problem or at least in part solve on That states problem generates method of test example and device based on annotation.
According to an aspect of the invention, there is provided a kind of based on annotation generation method of test example, it includes:
Obtain being write according to the preset style with code dependent one or more snippets notes content;
The relevant information of test case is extracted from one or more snippets notes content;
According to the information extracted, corresponding with one or more snippets notes content one or more suitable for code are generated First visual testing use-case.
According to another aspect of the present invention, there is provided based on annotation generation test case device, it includes one kind:
Acquisition module, is suitable to obtain being write according to the preset style with code dependent one or more snippets notes content;
Extraction module, is suitable to be extracted from one or more snippets notes content the relevant information of test case;
Generation module, is suitable to according to the information extracted, and generates corresponding with one or more snippets notes content suitable for generation One or more first visual testing use-cases of code.
Method of test example and device are generated based on annotation according to what the present invention was provided, what acquisition was write according to the preset style With code dependent one or more snippets notes content;The relevant information of test case is extracted from one or more snippets notes content; According to the information extracted, corresponding with one or more snippets notes content one or more suitable for code are generated first visual Change test case.The notes content of the code write according to the preset style, extracts the relevant information of test case.According to test The relevant information of use-case, can be with corresponding generation visual testing use-case.On the one hand QA is saved to exchange or look into developer Time, manpower that relevant documentation is spent are seen, the efficiency of generation test case is greatly improved.On the other hand it is right to it also avoid Omission during the generation test case that human error is caused, more fully test case can be generated to code.Meanwhile, by inciting somebody to action Test case is visualized, and more convenient user checks in itself to test case, also reduces technology of the test case to user It is required that threshold, it is more simple to operation.
Described above is only the general introduction of technical solution of the present invention, in order to better understand technological means of the invention, And can be practiced according to the content of specification, and in order to allow the above and other objects of the present invention, feature and advantage can Become apparent, below especially exemplified by specific embodiment of the invention.
Brief description of the drawings
By reading the detailed description of hereafter preferred embodiment, various other advantages and benefit is common for this area Technical staff will be clear understanding.Accompanying drawing is only used for showing the purpose of preferred embodiment, and is not considered as to the present invention Limitation.And in whole accompanying drawing, identical part is denoted by the same reference numerals.In the accompanying drawings:
Fig. 1 shows the flow chart based on annotation generation method of test example according to an embodiment of the invention;
Fig. 2 shows a schematic diagram for test case;
Fig. 3 shows the flow chart based on annotation generation method of test example in accordance with another embodiment of the present invention;
Fig. 4 shows the functional block diagram based on annotation generation test case device according to an embodiment of the invention;
Fig. 5 shows the functional block diagram based on annotation generation test case device in accordance with another embodiment of the present invention.
Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in accompanying drawing Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here Limited.Conversely, there is provided these embodiments are able to be best understood from the disclosure, and can be by the scope of the present disclosure Complete conveys to those skilled in the art.
Fig. 1 shows the flow chart based on annotation generation method of test example according to an embodiment of the invention.Such as Fig. 1 It is shown, following steps are specifically included based on annotation generation method of test example:
Step S101, obtains being write according to the preset style with code dependent one or more snippets notes content.
Annotation can be included in code, annotation is used to help user and is better understood from code.Typically can in notes content With including the function name of such as code, realize function, interface parameters etc..Herein, the pattern to notes content is set.In advance If the notes content of pattern can include that such as code call method, URL addresses, display Name, code release number, user right are visited Ask information, residing group name, the parameters of interface, normal return value Rule of judgment for performing etc..
Obtain according to the preset style write with code dependent one or more snippets notes content, wherein, if this section of code is needed When wanting multiple test cases, corresponding related notes content is multistage, is obtained and code dependent multistage notes content;If should When section code only needs a test case, corresponding related notes content is one section, is obtained and code dependent one section note Release content.To different codes, according to the demand of code tester use-case, related notes content may be one or more snippets, obtain Take one or more snippets related notes content of different code.
Step S102, extracts the relevant information of test case from one or more snippets notes content.
Extracted from one or more snippets notes content for getting, extracted the information related to test case.Such as Extract the information such as performing environment, product version, interface parameters, the return value check information of test case.Performing environment is defined The environmental information that code needs when performing;Product version is the version number of code, and code after the modification, can update its original version This number;Product version have recorded the renewal of code, convenient that newest code is tested;During interface parameters is test case Important information, interface parameters can be including such as parameter type, default value etc.;Parameter type is such as the isoparametric number of String, int According to type, default value is the value of the interface parameters for testing for setting;The different interface parameters of different code correspondences;Return Returning value check information is included such as return value, the return value or exception under various improper implementation status under normal implementation status Whether code etc., perform normal for check code.
Step S103, according to the information extracted, generates corresponding with one or more snippets notes content suitable for code One or more first visual testing use-cases.
According to the relevant information of the test case extracted, generate first visual testing corresponding with notes content and use Example.One section of notes content generates a first visual testing use-case, and multistage notes content generates multiple first visual testings Use-case.First visual testing use-case of generation is applied to this section of test of the related code of notes content.
First visual testing use-case of generation can be as shown in Figure 2 page format, by the related content of test case All it is illustrated on the page, it is possible to use family is clearly understood that the content of test case, it is possible to changed accordingly.Such as set Put interface parameters, numerical value of input test etc..First visual testing use-case of generation can also use other visualization sides Formula, is user-friendly to.The present invention is not limited this.
Method of test example, acquisition is write according to the preset style and code are generated based on annotation according to what the present invention was provided One or more snippets related notes content;The relevant information of test case is extracted from one or more snippets notes content;According to carrying The information for taking, generates one or more first visual testings suitable for code corresponding with one or more snippets notes content Use-case.The notes content of the code write according to the preset style, extracts the relevant information of test case.According to test case Relevant information, can be with corresponding generation visual testing use-case.On the one hand QA is saved to be exchanged to developer or check related Time, manpower that document is spent, greatly improve the efficiency of generation test case.On the other hand it also avoid to artificial mistake Omission during the generation test case for causing by mistake, more fully test case can be generated to code.Meanwhile, used by by test Example visualization, more convenient user checks in itself to test case, also reduces test case to the technical requirements of user Threshold, it is more simple to operation.
Fig. 3 shows the flow chart based on annotation generation method of test example in accordance with another embodiment of the present invention.Such as Shown in Fig. 3, comprised the following steps based on annotation generation method of test example:
Step S301, obtains being write according to the preset style with code dependent one or more snippets notes content.
Step S302, extracts the relevant information of test case from one or more snippets notes content.
Step S303, according to the information extracted, generates corresponding with one or more snippets notes content suitable for code One or more first visual testing use-cases.
Above step refers to the step S101-S103 in Fig. 1 embodiments, will not be repeated here.
Step S304, newly-built test content is the second empty visual testing use-case.
Step S305, selects at least two first visual testings to use from multiple first visual testing use-cases of generation Example, at least two first visual testing use-cases are carried in the second visual testing use-case, obtain the 3rd visual testing Use-case.
Sometimes the incidence relation that phase mutual is called between code, it is necessary to the content of multistage code is tied together during test Close test.For this test case, test content newly-built first is the second empty visual testing use-case, wherein, institute Some test contents are sky.It is visual at least two first to be selected from the multiple first visual testing use-cases for having generated Change test case, during if desired for two sections of codes being tested together, from the multiple first visual testing use-cases for having generated In select suitable for this two sections the two of code the first visual testing use-cases;If desired multistage code is tested together When, selected from the multiple first visual testing use-cases for having generated and visualized suitable for multiple the first of the multistage code Test case.At least two first visual testing use-case for selecting is carried in the second visual testing use-case, so that Obtain corresponding 3rd visual testing use-case.Obtain including at least two first visual testing use-cases the 3rd is visual Change test case.
Wherein, at least two first visual testing use-cases in the 3rd visual testing use-case have sequencing, its Sequencing can be set in loading, it is also possible to be adjusted after loading.Specific sequencing is held with multistage code Row sequence consensus.And the return value of previous first visual testing use-case is the parameter of latter first visual testing use-case. If including two the first visual testing use-cases in the 3rd visual testing use-case, first the first visual testing use-case Return value be to call second parameter of the first visual testing use-case;If including three in the 3rd visual testing use-case Individual first visual testing use-case, first return value of the first visual testing use-case is surveyed to call second first visualization The parameter of example on probation;The return value of second the first visual testing use-case is to call the 3rd the first visual testing use-case Parameter;If more first visual testing use-cases are included in the 3rd visual testing use-case, can the like.
Step S306, changes the return value check information of at least two first visual testing use-cases.
After the 3rd visual testing use-case is obtained, because the 3rd visual testing use-case is carried out together suitable for multistage code Binding test, the first visual testing use-case included with it carries out being there may be when monomer is tested suitable for independent one section of code The situation of different return value check informations.At this point it is possible to change the 3rd visual testing use-case includes at least two The return value check information of one visual testing use-case.Change that the 3rd visual testing use-case includes at least two first can Return value check information depending on changing test case, the return value check information in former first visual testing use-case is not influenceed, is repaiied Return value check information after changing is only applicable in the 3rd visual testing use-case.
This step can be the optional step of the embodiment.If multistage code together with independent one section of code enter by binding test When return value check information is all consistent when row monomer is tested, it is at least two first visual that the 3rd visual testing use-case includes The return value check information for changing test case can skip the step without modification.
Step S307, by one or more first visual testing use-cases and/or the 3rd visual testing use-case and code Linkage.
Step S308, the automatic visual testing use-case for performing generation.
Step S309, after code is changed, performs one or more first visual testing use-cases and/or the 3rd automatically Visual testing use-case, for carrying out regression test to code.
One or more the first visual testing use-cases for generating and/or the 3rd visual testing use-case are corresponding Code is linked, and such as provides an interface, and one section of code is linked with one or more first visual testing use-cases, This first visual testing use-case of generation can be automatically performed, or automatic multiple first visualizations for performing generation successively Test case is associated.The code of test access can be linked with the 3rd visual testing use-case during multistage code, automatically Perform the 3rd visual testing use-case.
Further, it is necessary to carry out regression test to code after code is changed.Therefore, after code is changed, may be used also To perform the visual testings such as its one or more the first visual testing use-case, the 3rd visual testing use-cases that link automatically Use-case, to carry out regression test.
Method of test example, acquisition is write according to the preset style and code are generated based on annotation according to what the present invention was provided One or more snippets related notes content;The relevant information of test case is extracted from one or more snippets notes content;According to carrying The information for taking, generates one or more first visual testings suitable for code corresponding with one or more snippets notes content Use-case.The notes content of the code write according to the preset style, extracts the relevant information of test case.According to test case Relevant information, can be with corresponding generation visual testing use-case.On the one hand QA is saved to be exchanged to developer or check related Time, manpower that document is spent, greatly improve the efficiency of generation test case.On the other hand it also avoid to artificial mistake Omission during the generation test case for causing by mistake, more fully test case can be generated to code.Meanwhile, used by by test Example visualization, more convenient user checks in itself to test case, also reduces test case to the technical requirements of user Threshold, it is more simple to operation.Further, the code tested together is needed to multistage, is surveyed by by least two first visualizations Example on probation is carried in the second visual testing use-case that newly-built test content is sky, obtains the 3rd visual testing use-case, To solve the situation of the binding test that context relation is carried out to multistage code.Meanwhile, if binding test is tested with monomer existing Return value check information is not at the same time it can also change the first visual testing use-case that the 3rd visual testing use-case includes Return value check information.During modification, the return value check information in former first visual testing use-case is not influenceed, surveyed to combine Examination and monomer are independent of each other between testing.To cause that test is more convenient, visual testing use-case and code can also be linked, The automatic visual testing use-case for performing generation, it is not necessary to manual intervention.Meanwhile, after code is changed, can also automatically again Visual testing use-case is performed, for carrying out regression test to code, finds that code influences other unmodified generations by modification as early as possible Code and produce mistake.
Fig. 4 shows the functional block diagram based on annotation generation test case device according to an embodiment of the invention.Such as Shown in Fig. 4, such as lower module is included based on annotation generation test case device:
Acquisition module 410, is suitable to obtain being write according to the preset style with code dependent one or more snippets notes content.
Annotation can be included in code, annotation is used to help user and is better understood from code.Typically can in notes content With including the function name of such as code, realize function, interface parameters etc..Herein, acquisition module 410 enters to the pattern of notes content Setting is gone.The notes content of the preset style can include such as code call method, URL addresses, display Name, code release Number, user right access information, residing group name, the parameters of interface, normal return value Rule of judgment for performing etc..
Acquisition module 410 obtain according to the preset style write with code dependent one or more snippets notes content, wherein, if When this section of code needs multiple test cases, corresponding related notes content is multistage, and acquisition module 410 is obtained and code phase The multistage notes content of pass;If this section of code only needs a test case, corresponding related notes content is one section, is obtained Modulus block 410 is obtained and code dependent one section of notes content.To different codes, according to the demand of code tester use-case, phase The notes content of pass may be one or more snippets, and acquisition module 410 is obtained in one or more snippets related annotation of different code Hold.
Extraction module 420, is suitable to be extracted from one or more snippets notes content the relevant information of test case.
Extraction module 420 is extracted from one or more snippets notes content that acquisition module 410 gets, extract with The related information of test case.Performing environment, product version, interface parameters, the return of test case are extracted such as extraction module 420 The information such as value check information.Performing environment defines the environmental information needed when code is performed;Product version is the version of code Number, code after the modification, can update its original version number;Product version have recorded the renewal of code, convenient to newest generation Code is tested;Interface parameters is the important information in test case, and interface parameters can include such as parameter type, default value Deng;Parameter type is that such as the isoparametric data type of String, int, default value is to set for the interface parameters tested Value;The different interface parameters of different code correspondences;Return value check information is included such as the return under normal implementation status Whether return value or abnormality code under value, various improper implementation status etc., perform normal for check code.
Generation module 430, is suitable to, according to the information extracted, generate corresponding with one or more snippets notes content being applied to One or more first visual testing use-cases of code.
, according to the relevant information of the test case extracted, generating first corresponding with notes content can for generation module 430 Depending on changing test case.One section of notes content generation module 430 generates a first visual testing use-case, the life of multistage notes content Multiple first visual testing use-cases are generated into module 430.First visual testing use-case of the generation of generation module 430 is applied to To this section of test of the related code of notes content.
First visual testing use-case of the generation of generation module 430 can be related by test case in the manner shown Content be all illustrated on the page, it is possible to use family is clearly understood that the content of test case, it is possible to repaiied accordingly Change.Interface parameters, numerical value of input test etc. are such as set.First visual testing use-case of the generation of generation module 430 also may be used To use other visual means, it is user-friendly to.Do not limit herein.
Test case device, acquisition is write according to the preset style and code are generated based on annotation according to what the present invention was provided One or more snippets related notes content;The relevant information of test case is extracted from one or more snippets notes content;According to carrying The information for taking, generates one or more first visual testings suitable for code corresponding with one or more snippets notes content Use-case.The notes content of the code write according to the preset style, extracts the relevant information of test case.According to test case Relevant information, can be with corresponding generation visual testing use-case.On the one hand QA is saved to be exchanged to developer or check related Time, manpower that document is spent, greatly improve the efficiency of generation test case.On the other hand it also avoid to artificial mistake Omission during the generation test case for causing by mistake, more fully test case can be generated to code.Meanwhile, visual testing is used Example, is more convenient user and test case is checked in itself, also reduces threshold of the test case to the technical requirements of user, more It is simple to operation.
Fig. 5 shows the functional block diagram based on annotation generation test case device in accordance with another embodiment of the present invention. As shown in figure 5, compared with Fig. 4, be further comprises such as lower module based on annotation generation test case device:
Newly-built module 440, it is the second empty visual testing use-case to be suitable to newly-built test content.
Load-on module 450, is suitable to the selection at least two first from multiple first visual testing use-cases of generation visual Change test case, at least two first visual testing use-cases are carried in the second visual testing use-case, obtaining the 3rd can Depending on changing test case.
Sometimes the incidence relation that phase mutual is called between code, it is necessary to the content of multistage code is tied together during test Close test.For this test case, 440 newly-built test contents of module newly-built first are that the second empty visual testing is used Example, wherein, all of test content is sky.Load-on module 450 is from the multiple first visual testing use-cases for having generated Select at least two first visual testing use-cases, during if desired for two sections of codes being tested together, load-on module 450 from Selected in the multiple first visual testing use-cases for having generated suitable for this two sections the two of code the first visual testings Use-case;If desired when multistage code is tested together, load-on module 450 is used from multiple first visual testings for having generated The multiple first visual testing use-cases suitable for the multistage code are selected in example.Load-on module 450 by select this at least Two the first visual testing use-cases are carried in the second visual testing use-case, so as to obtain corresponding 3rd visual testing Use-case.I.e. load-on module 450 obtains including the 3rd visual testing use-case of at least two first visual testing use-cases.
Wherein, at least two first visual testings in the 3rd visual testing use-case that load-on module 450 is obtained are used Example has sequencing, and its sequencing can be set when load-on module 450 is loaded, it is also possible to be loaded in load-on module 450 After be adjusted.Specific sequencing is consistent with the execution sequence of multistage code.And previous first visual testing use-case Return value be latter first visual testing use-case parameter.Can as included two first in the 3rd visual testing use-case Depending on changing test case, the return value of first the first visual testing use-case is to call second the first visual testing use-case Parameter;If including three the first visual testing use-cases in the 3rd visual testing use-case, first the first visual testing The return value of use-case is to call second parameter of the first visual testing use-case;Second the first visual testing use-case is returned Value is returned to call the 3rd parameter of the first visual testing use-case;If included in the 3rd visual testing use-case more During one visual testing use-case, can the like.
Modified module 460, is suitably modified to the return value check information of at least two first visual testing use-cases.
After execution load-on module 450 obtains the 3rd visual testing use-case, because the 3rd visual testing use-case is suitable for more Section code is combined test together, and the first visual testing use-case included with it carries out monomer suitable for independent one section of code The situation of different return value check informations is there may be during test.Now, modified module 460 can change the 3rd visualization and survey The return value check information of at least two first visual testing use-cases that example on probation includes.The modification of modified module 460 the 3rd The return value check information of at least two first visual testing use-cases that visual testing use-case includes, former first is not influenceed Return value check information in visual testing use-case, amended return value check information is only applicable to the 3rd visual testing In use-case.
Modified module of the present invention 460 is optional module.If binding test is carried out multistage code with independent one section of code together When return value check information is all consistent when monomer is tested, can be without carrying out modified module 460.
Interlocking module 470, is suitable to one or more the first visual testing use-cases and/or the 3rd visual testing use-case Linked with code.
Performing module 480, is suitable to the automatic visual testing use-case for performing generation.
Regression block 490, is suitable to after code is changed, and one or more first visual testing use-cases are performed automatically And/or the 3rd visual testing use-case, for carrying out regression test to code.
Interlocking module 470 uses one or more the first visual testing use-cases for generating and/or the 3rd visual testing The corresponding code of example is linked, and such as interlocking module 470 provides an interface, by one section of code and one or more first Visual testing use-case is linked, and performing module 480 can automatically perform this first visual testing use-case of generation, Or the automatic multiple first visual testing use-cases association for performing generation successively of performing module 480.Interlocking module during multistage code 470 can be linked the code of test access with the 3rd visual testing use-case, and performing module 480 performs the 3rd automatically can Depending on changing test case.
Further, it is necessary to carry out regression test to code after code is changed.Therefore, after code is changed, return Module 490 can automatically perform one or more the first visual testing use-case, the 3rd visual testing use-cases of its linkage etc. Visual testing use-case, to carry out regression test.
Test case device, acquisition is write according to the preset style and code are generated based on annotation according to what the present invention was provided One or more snippets related notes content;The relevant information of test case is extracted from one or more snippets notes content;According to carrying The information for taking, generates one or more first visual testings suitable for code corresponding with one or more snippets notes content Use-case.The notes content of the code write according to the preset style, extracts the relevant information of test case.According to test case Relevant information, can be with corresponding generation visual testing use-case.On the one hand QA is saved to be exchanged to developer or check related Time, manpower that document is spent, greatly improve the efficiency of generation test case.On the other hand it also avoid to artificial mistake Omission during the generation test case for causing by mistake, more fully test case can be generated to code.Meanwhile, visual testing is used Example, is more convenient user and test case is checked in itself, also reduces threshold of the test case to the technical requirements of user, more It is simple to operation.Further, the code tested together is needed to multistage, is added by by least two first visual testing use-cases It is loaded in the second visual testing use-case that newly-built test content is sky, obtains the 3rd visual testing use-case, it is right to solve Multistage code carries out the situation of the binding test of context relation.Meanwhile, if there is return value school with monomer test in binding test Information is tested not at the same time it can also change the return value school of the first visual testing use-case that the 3rd visual testing use-case includes Test information.During modification, the return value check information in former first visual testing use-case is not influenceed, so as to binding test and monomer It is independent of each other between test.To cause that test is more convenient, visual testing use-case and code can also be linked, it is automatic to perform The visual testing use-case of generation, it is not necessary to manual intervention.Meanwhile, after code is changed, can also perform again automatically visual Change test case, for carrying out regression test to code, find that code is influenceed other unmodified codes and produced by modification as early as possible Mistake.
Algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment provided herein. Various general-purpose systems can also be used together with based on teaching in this.As described above, construct required by this kind of system Structure be obvious.Additionally, the present invention is not also directed to any certain programmed language.It is understood that, it is possible to use it is various Programming language realizes the content of invention described herein, and the description done to language-specific above is to disclose this hair Bright preferred forms.
In specification mentioned herein, numerous specific details are set forth.It is to be appreciated, however, that implementation of the invention Example can be put into practice in the case of without these details.In some instances, known method, structure is not been shown in detail And technology, so as not to obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify one or more that the disclosure and helping understands in each inventive aspect, exist Above to the description of exemplary embodiment of the invention in, each feature of the invention is grouped together into single implementation sometimes In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:I.e. required guarantor The application claims of shield features more more than the feature being expressly recited in each claim.More precisely, such as following Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore, Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, and wherein each claim is in itself All as separate embodiments of the invention.
Those skilled in the art are appreciated that can be carried out adaptively to the module in the equipment in embodiment Change and they are arranged in one or more equipment different from the embodiment.Can be the module or list in embodiment Unit or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or Sub-component.In addition at least some in such feature and/or process or unit exclude each other, can use any Combine to all features disclosed in this specification (including adjoint claim, summary and accompanying drawing) and so disclosed appoint Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification (including adjoint power Profit is required, summary and accompanying drawing) disclosed in each feature can the alternative features of or similar purpose identical, equivalent by offer carry out generation Replace.
Although additionally, it will be appreciated by those of skill in the art that some embodiments described herein include other embodiments In included some features rather than further feature, but the combination of the feature of different embodiments means in of the invention Within the scope of and form different embodiments.For example, in the following claims, embodiment required for protection is appointed One of meaning mode can be used in any combination.
All parts embodiment of the invention can be realized with hardware, or be run with one or more processor Software module realize, or with combinations thereof realize.It will be understood by those of skill in the art that can use in practice Microprocessor or digital signal processor (DSP) are according to embodiments of the present invention based on annotation generation test case dress to realize The some or all functions of some or all parts in putting.The present invention is also implemented as described here for performing Method some or all equipment or program of device (for example, computer program and computer program product).This Sample realizes that program of the invention can be stored on a computer-readable medium, or can have one or more signal Form.Such signal can be downloaded from internet website and obtained, or be provided on carrier signal, or with any other Form is provided.
It should be noted that above-described embodiment the present invention will be described rather than limiting the invention, and ability Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims, Any reference symbol being located between bracket should not be configured to limitations on claims.Word "comprising" is not excluded the presence of not Element listed in the claims or step.Word "a" or "an" before element is not excluded the presence of as multiple Element.The present invention can come real by means of the hardware for including some different elements and by means of properly programmed computer It is existing.If in the unit claim for listing equipment for drying, several in these devices can be by same hardware branch To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and run after fame Claim.
The invention discloses:A1, a kind of annotation that is based on generate method of test example, and it includes:
Obtain being write according to the preset style with code dependent one or more snippets notes content;
The relevant information of test case is extracted from described one or more snippets notes content;
According to the information of the extraction, generate corresponding with one or more snippets notes content suitable for the one of the code Individual or multiple first visual testing use-cases.
A2, the method according to A1, wherein, it is described that test case is extracted from described one or more snippets notes content Relevant information is further included:
Extracted from described one or more snippets notes content the performing environment of test case, product version, interface parameters and/ Or return value check information.
A3, the method according to A2, wherein, the interface parameters includes parameter type or default value.
A4, the method according to any one of A1-A3, wherein, methods described also includes:
Newly-built test content is the second empty visual testing use-case;
At least two first visual testing use-cases are selected from multiple first visual testing use-cases of generation, will be described At least two first visual testing use-cases are carried in the second visual testing use-case, obtain the 3rd visual testing use Example;Wherein, described at least two first visual testing use-cases have sequencing, and previous first visual testing use-case Return value be latter first visual testing use-case parameter.
A5, the method according to A4, wherein, it is described at least two first visual testing use-cases are carried in it is described After in second visual testing use-case, methods described also includes:
Change the return value check information of described at least two first visual testing use-cases.
A6, the method according to any one of A1-A5, wherein, methods described also includes:
One or more of first visual testing use-cases and/or the 3rd visual testing use-case are joined with the code It is dynamic;
Automatically the visual testing use-case of the generation is performed.
A7, the method according to A6, wherein, methods described also includes:
After code is changed, one or more of first visual testing use-cases and/or the 3rd visual are performed automatically Change test case, for carrying out regression test to code.
The invention also discloses:B8, a kind of annotation that is based on generate test case device, and it includes:
Acquisition module, is suitable to obtain being write according to the preset style with code dependent one or more snippets notes content;
Extraction module, is suitable to be extracted from described one or more snippets notes content the relevant information of test case;
Generation module, is suitable to the information according to the extraction, generates corresponding with one or more snippets notes content being applicable In one or more first visual testing use-cases of the code.
B9, the device according to B8, wherein, the extraction module is further adapted for:
Extracted from described one or more snippets notes content the performing environment of test case, product version, interface parameters and/ Or return value check information.
B10, the device according to B9, wherein, the interface parameters includes parameter type or default value.
B11, the device according to any one of B8-B10, wherein, described device also includes:
Newly-built module, it is the second empty visual testing use-case to be suitable to newly-built test content;
Load-on module, is suitable to the visualization of selection at least two first from multiple first visual testing use-cases of generation and surveys Example on probation, described at least two first visual testing use-cases are carried in the second visual testing use-case, obtain the Three visual testing use-cases;Wherein, described at least two first visual testing use-cases have sequencing, and previous first The return value of visual testing use-case is the parameter of latter first visual testing use-case.
B12, the device according to B11, wherein, described device also includes:
Modified module, is suitably modified to the return value check information of described at least two first visual testing use-cases.
B13, the device according to any one of B8-B12, wherein, described device also includes:
Interlocking module, is suitable to use one or more of first visual testing use-cases and/or the 3rd visual testing Example links with the code;
Performing module, is suitable to perform automatically the visual testing use-case of the generation.
B14, the device according to B13, wherein, described device also includes:
Regression block, is suitable to after code is changed, and one or more of first visual testing use-cases are performed automatically And/or the 3rd visual testing use-case, for carrying out regression test to code.

Claims (10)

1. a kind of based on annotation generation method of test example, it includes:
Obtain being write according to the preset style with code dependent one or more snippets notes content;
The relevant information of test case is extracted from described one or more snippets notes content;
According to the information of the extraction, generate corresponding with one or more snippets notes content one suitable for the code or Multiple first visual testing use-cases.
2. method according to claim 1, wherein, it is described to extract test case from described one or more snippets notes content Relevant information further include:
The performing environment of test case, product version, interface parameters are extracted from described one or more snippets notes content and/or is returned Return value check information.
3. method according to claim 2, wherein, the interface parameters includes parameter type or default value.
4. the method according to any one of claim 1-3, wherein, methods described also includes:
Newly-built test content is the second empty visual testing use-case;
At least two first visual testing use-cases are selected from multiple first visual testing use-cases of generation, by described at least Two the first visual testing use-cases are carried in the second visual testing use-case, obtain the 3rd visual testing use-case; Wherein, described at least two first visual testing use-cases have a sequencing, and previous first visual testing use-case Return value is the parameter of latter first visual testing use-case.
5. method according to claim 4, wherein, at least two first visual testing use-cases are carried in institute described After stating in the second visual testing use-case, methods described also includes:
Change the return value check information of described at least two first visual testing use-cases.
6. the method according to any one of claim 1-5, wherein, methods described also includes:
One or more of first visual testing use-cases and/or the 3rd visual testing use-case are linked with the code;
Automatically the visual testing use-case of the generation is performed.
7. method according to claim 6, wherein, methods described also includes:
After code is changed, one or more of first visual testing use-cases are performed automatically and/or the 3rd visualization is surveyed Example on probation, for carrying out regression test to code.
8. a kind of based on annotation generation test case device, it includes:
Acquisition module, is suitable to obtain being write according to the preset style with code dependent one or more snippets notes content;
Extraction module, is suitable to be extracted from described one or more snippets notes content the relevant information of test case;
Generation module, is suitable to the information according to the extraction, generates corresponding with one or more snippets notes content suitable for institute State one or more first visual testing use-cases of code.
9. device according to claim 8, wherein, the extraction module is further adapted for:
The performing environment of test case, product version, interface parameters are extracted from described one or more snippets notes content and/or is returned Return value check information.
10. device according to claim 9, wherein, the interface parameters includes parameter type or default value.
CN201611235663.7A 2016-12-28 2016-12-28 Comment-based test case generation method and device Active CN106776334B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611235663.7A CN106776334B (en) 2016-12-28 2016-12-28 Comment-based test case generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611235663.7A CN106776334B (en) 2016-12-28 2016-12-28 Comment-based test case generation method and device

Publications (2)

Publication Number Publication Date
CN106776334A true CN106776334A (en) 2017-05-31
CN106776334B CN106776334B (en) 2021-03-23

Family

ID=58924653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611235663.7A Active CN106776334B (en) 2016-12-28 2016-12-28 Comment-based test case generation method and device

Country Status (1)

Country Link
CN (1) CN106776334B (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763091A (en) * 2018-05-31 2018-11-06 恒生电子股份有限公司 Method, apparatus and system for regression test
CN108845953A (en) * 2018-08-27 2018-11-20 北京奇虎科技有限公司 The method and device of interface testing
CN109213683A (en) * 2018-09-06 2019-01-15 无线生活(杭州)信息科技有限公司 Method for generating test case and device
CN109614324A (en) * 2018-12-03 2019-04-12 北京云测网络科技有限公司 A kind of method for generating test case and device
CN110457028A (en) * 2019-08-06 2019-11-15 软通动力信息技术有限公司 A kind of page visual programming method, apparatus, server and storage medium
CN110750434A (en) * 2018-07-23 2020-02-04 北京奇虎科技有限公司 Interface testing method and device, electronic equipment and computer readable storage medium
CN111274120A (en) * 2018-12-05 2020-06-12 北京奇虎科技有限公司 Interface document verification method and device
CN113419954A (en) * 2021-06-25 2021-09-21 陕西浪潮英信科技有限公司 Execution method and system of automation use case of cloud operating system and related components

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030041288A1 (en) * 2001-08-10 2003-02-27 Adam Kolawa Method and system for dynamically invoking and/or checking conditions of a computer test program
CN102096631A (en) * 2009-12-11 2011-06-15 华为技术有限公司 Interface testing method and device
CN103473045A (en) * 2013-08-27 2013-12-25 广州华多网络科技有限公司 Method and device for generating interface documents
CN104407973A (en) * 2014-11-25 2015-03-11 珠海格力电器股份有限公司 Automatic unit test realizing method and device
CN105138461A (en) * 2015-09-23 2015-12-09 网易(杭州)网络有限公司 Interface testing method and device for application program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030041288A1 (en) * 2001-08-10 2003-02-27 Adam Kolawa Method and system for dynamically invoking and/or checking conditions of a computer test program
CN102096631A (en) * 2009-12-11 2011-06-15 华为技术有限公司 Interface testing method and device
CN103473045A (en) * 2013-08-27 2013-12-25 广州华多网络科技有限公司 Method and device for generating interface documents
CN104407973A (en) * 2014-11-25 2015-03-11 珠海格力电器股份有限公司 Automatic unit test realizing method and device
CN105138461A (en) * 2015-09-23 2015-12-09 网易(杭州)网络有限公司 Interface testing method and device for application program

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108763091B (en) * 2018-05-31 2022-05-27 恒生电子股份有限公司 Method, device and system for regression testing
CN108763091A (en) * 2018-05-31 2018-11-06 恒生电子股份有限公司 Method, apparatus and system for regression test
CN110750434A (en) * 2018-07-23 2020-02-04 北京奇虎科技有限公司 Interface testing method and device, electronic equipment and computer readable storage medium
CN108845953A (en) * 2018-08-27 2018-11-20 北京奇虎科技有限公司 The method and device of interface testing
CN108845953B (en) * 2018-08-27 2023-02-17 北京奇虎科技有限公司 Interface testing method and device
CN109213683A (en) * 2018-09-06 2019-01-15 无线生活(杭州)信息科技有限公司 Method for generating test case and device
CN109614324A (en) * 2018-12-03 2019-04-12 北京云测网络科技有限公司 A kind of method for generating test case and device
CN109614324B (en) * 2018-12-03 2022-02-08 北京云测信息技术有限公司 Test case generation method and device
CN111274120A (en) * 2018-12-05 2020-06-12 北京奇虎科技有限公司 Interface document verification method and device
CN111274120B (en) * 2018-12-05 2024-02-02 三六零科技集团有限公司 Interface document verification method and device
CN110457028A (en) * 2019-08-06 2019-11-15 软通动力信息技术有限公司 A kind of page visual programming method, apparatus, server and storage medium
CN110457028B (en) * 2019-08-06 2023-09-01 软通智慧信息技术有限公司 Page visual programming method, device, server and storage medium
CN113419954A (en) * 2021-06-25 2021-09-21 陕西浪潮英信科技有限公司 Execution method and system of automation use case of cloud operating system and related components
CN113419954B (en) * 2021-06-25 2023-03-31 陕西浪潮英信科技有限公司 Execution method and system of automation use case of cloud operating system and related components

Also Published As

Publication number Publication date
CN106776334B (en) 2021-03-23

Similar Documents

Publication Publication Date Title
CN106776334A (en) Based on annotation generation method of test example and device
US7917895B2 (en) Automated software testing and validation system
US9389849B2 (en) Test case pattern matching
CN112270149B (en) Verification platform automatic integration method and system, electronic equipment and storage medium
US7895575B2 (en) Apparatus and method for generating test driver
JP2012059026A (en) Source code conversion method and source code conversion program
US20090064111A1 (en) Formal Verification of Graphical Programs
US20140214396A1 (en) Specification properties creation for a visual model of a system
CN112597028A (en) Method and device for displaying case test result and readable storage medium
CN109960648A (en) A kind of test method of application program, device
CN106933591A (en) The method and device that code merges
US20140289708A1 (en) Methods, Circuits, Devices, Systems and Associated Computer Executable Code for Testing Software Code
US9274933B2 (en) Pretest setup planning
CN103176894A (en) Test data automatic derivative method and automatic derivative device facing database
JP6310527B1 (en) Object analysis apparatus, object analysis method, and program
CN109933326A (en) Rewrite Compilation Method, device and the corresponding terminal of code
US10592703B1 (en) Method and system for processing verification tests for testing a design under test
CN110737573B (en) Method and device for automatically testing user interface UI
EP3547143B1 (en) System and method for model-based and behaviour-driven testing
US10579761B1 (en) Method and system for reconstructing a graph presentation of a previously executed verification test
Glazer Using python and Eppy for a large national simulation study
KR20190094779A (en) Automatically Generate Device for PLC Instruction Compiler Test-Case
CN108009083A (en) Functional information acquisition methods and device in a kind of Software function test
JP6320269B2 (en) Software test support apparatus and software test support program
CN109019217B (en) Elevator control software field debugging system

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