CN109359049A - A kind of execution method and system of test case - Google Patents
A kind of execution method and system of test case Download PDFInfo
- Publication number
- CN109359049A CN109359049A CN201811342700.3A CN201811342700A CN109359049A CN 109359049 A CN109359049 A CN 109359049A CN 201811342700 A CN201811342700 A CN 201811342700A CN 109359049 A CN109359049 A CN 109359049A
- Authority
- CN
- China
- Prior art keywords
- test case
- case
- test
- implementing result
- relying
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
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
Abstract
This application discloses a kind of execution method and system of test case, this method comprises: the test case that creation is pending;Obtain the dependence use-case of test case;According to the implementing result for relying on use-case, it is determined whether implementation of test cases.The system includes: test case creation module, relies on use-case acquisition module and determining module.By the method and system in the application, the analysis time that test case executes time and test report can be greatlyd save, so as to effectively improve the accuracy of testing efficiency and test.
Description
Technical field
This application involves automatization testing technique fields, more particularly to a kind of execution method and system of test case.
Background technique
In automatic test course, the execution of test case is most basic operating procedure.Currently, relatively common survey
Example on probation executes method, usually are as follows: according to preset testing procedure, executes each test case one by one, then gets each
The relevant implementing result of test case, finally analyzes test result, obtains test report, surveys to complete automation
Examination.
However, current test example executing method, is used due to needing to execute each test in automatic test respectively
Example, occupies the more testing time.A test report can be generated for each test case after the completion of test, correspondingly,
Occupied test report analysis time is also more, and if test report shows test crash, it is also necessary to further in detail
Check failure cause.Therefore, current test example executing method engaged test time and test report analysis time are more, survey
It is lower to try efficiency.
Summary of the invention
This application provides a kind of execution method and system of test case, are held with solving test case in the prior art
Row method occupied testing time and the problem that test report analysis time is more, testing efficiency is lower.
In order to solve the above-mentioned technical problem, the embodiment of the present application discloses following technical solution:
A kind of execution method of test case, which comprises
Create pending test case;
Obtain the dependence use-case of the test case;
According to the implementing result for relying on use-case, it is determined whether execute the test case.
It is optionally, described according to the implementing result for relying on use-case, it is determined whether to execute the test case, comprising:
Obtain the implementing result for relying on use-case;
If the implementing result for relying on use-case is to execute failure, the test case is skipped;
Otherwise, the test case is executed.
Optionally, after skipping the test case, the method also includes:
Export the reason of test case is not carried out.
Optionally, the method also includes:
By described according to the implementing result for relying on use-case, it is determined whether the method for executing the test case, encapsulation
In a function decorator.
Optionally, the function decorator is Myskip function decorator.
A kind of execution system of test case, the system comprises:
Test case creation module, for creating pending test case;
It relies on use-case and obtains module, for obtaining the dependence use-case of the test case;
Determining module, for according to the implementing result for relying on use-case, it is determined whether execute the test case.
Optionally, the determining module includes:
Implementing result acquiring unit, for obtaining the implementing result for relying on use-case;
Dynamic jump-transfer unit, for skipping the test and using when the implementing result for relying on use-case is to execute failure
Example;
Execution unit, for executing the test case when the implementing result for relying on use-case is to run succeeded.
Optionally, the determining module further includes output unit, for exporting the reason of test case is not carried out.
It optionally, further include package module in the system, for the determining module to be encapsulated in a function decorator
In.
The technical solution that embodiments herein provides can include the following benefits:
The application provides a kind of execution method of test case, and this method creates pending test case first, then
The dependence use-case of the test case is obtained, finally according to the implementing result for relying on use-case, it is determined whether execute the test case.This
After application creation test case, these test cases are not directly executed successively, and first get pending test case
Use-case is relied on, determines whether to continue to execute current test case using the implementing result for relying on use-case, if relying on use-case
Failure was executed and had executed, then current test case need not just continue to execute, therefore, the application makes full use of test
Dependence between use-case can greatly save test case and execute the time, be conducive to improve testing efficiency.Due to by according to
Use-case is relied to filter out a part of test case, final test report effective percentage generated improves, the quantity phase of test report
To less, it is thus possible to enough greatly reduce the analysis time of test report, be conducive to improve testing efficiency.In addition, the application adopts
It, will be according to the process for relying on use-case implementing result and determine whether to execute current test case, encapsulation with the method for function decorator
In a function decorator, it can be conducive to further increase survey by the method batch application in the application in test case
Try efficiency.From the angle of written in code, it can be avoided and write acquisition dependence use-case implementing result for each test case and sentence
Disconnected the case where whether executing current test case, code redundancy is avoided, is conducive to improve working efficiency, simplifies testing process, into
And improve test accuracy and testing efficiency.
The application also provides a kind of execution system of test case, the system mainly include test case creation module, according to
Use-case is relied to obtain module and determining module.By the pending test case of test case creation module creation, then by according to
Rely use-case to obtain module and get the relevant dependence use-case of pending test case, finally by determining module, is used according to relying on
The implementing result of example determines whether to continue to execute current pending test case.The present embodiment makes full use of between test case
Dependence, according to the implementing result of the dependence use-case of current use-case to be tested, to determine whether to continue to execute current survey
Example on probation can greatly reduce the analysis time that test case executes time and test report, to improve testing efficiency.Separately
It outside, further include package module in the system of the present embodiment, the setting of package module can be avoided largely using function decorator
Code redundancy is conducive to simplify testing process, to further increase testing efficiency and test accuracy.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not
The application can be limited.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows the implementation for meeting the application
Example, and together with specification it is used to explain the principle of the application.
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, for those of ordinary skill in the art
Speech, without creative efforts, is also possible to obtain other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of the execution method of test case provided by the embodiment of the present application;
Fig. 2 is the flow chart of the exemplary application provided in the embodiment of the present application;
Fig. 3 is a kind of structural schematic diagram of the execution system of test case provided by the embodiment of the present application.
Specific embodiment
In order to make those skilled in the art better understand the technical solutions in the application, below in conjunction with the application reality
The attached drawing in example is applied, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described implementation
Example is merely a part but not all of the embodiments of the present application.Based on the embodiment in the application, this field is common
The application protection all should belong in technical staff's every other embodiment obtained without making creative work
Range.
Unitttest frame is the unit testing frame under a kind of python, which supports automatic test, can
Shared setup and teardown code, test aggregate into collection and independently of report frames.Unitttest frame provides one
Tool set abundant is for constructing and executing use-case.Python decorator is a kind of method of dynamic increase function performance.After
It holds, subclass can be inherited using the non-private attribute and method in parent.
The application in order to better understand explains in detail presently filed embodiment with reference to the accompanying drawing.
Referring to Fig. 1, Fig. 1 is a kind of flow diagram of the execution method of test case provided by the embodiment of the present application.
As shown in Figure 1, in the present embodiment test case execution method, main includes following step process:
S1: pending test case is created.
In automatization testing technique field, it is typically based on python unittest establishment of item automatic test cases.This
Embodiment specifies the dependence between different test cases when creating pending test case.
S2: the dependence use-case of test case is obtained.
After creation finishes test case, before executing current test case, first used according to current pending test
Example, gets the dependence use-case of the test case.
S3: according to the implementing result for relying on use-case, it is determined whether implementation of test cases.
Specifically, step S3 is comprised the following processes again:
S31: the implementing result for relying on use-case is obtained.
The implementing result for relying on use-case generally includes two kinds: executing failure and runs succeeded.
If the implementing result for relying on use-case is to execute failure, step S32: skip test use-case is executed.
If the implementing result for relying on use-case is to run succeeded, S33 is thened follow the steps: implementation of test cases.
In automatic test course, if there is dependence between test case, such as: test case A is stepped on for testing
Recording function, test case B and C relevant to test case A are used to test other correlation functions after logging in, then, test is used
Example A is exactly the dependence use-case of test case B and test case C.If test case A executes failure, relevant test is used
Example B and C must execute failure.
By above step S2 and step S31-S33 it is found that compared with the prior art, the present embodiment was executed in test case
Cheng Zhong first gets the dependence use-case of current test case after creating test case, further according to the implementing result for relying on use-case
To determine whether to continue to execute current test case.This determined according to the implementing result for relying on use-case is that dynamic skips survey
The method that example on probation still continues to execute current test test case, can make full use of the dependence between test case,
It avoids executing unnecessary test case, therefore the execution time of test case can be greatly improved.Due to the present embodiment according to
Relying on use-case can be avoided the test case of the unnecessary execution in part, therefore invalid test greatly reduces, additionally it is possible to reduce test
The analysis time of report improves testing efficiency to further save overall test time.
Further, in this embodiment further including step S34 after step S32: the original that output test case is not carried out
Cause.
Such as: " because XX use-case executes failure, which is not carried out " similar content can be exported.It is current by exporting
Test case is not carried out reason, and test report can be made to be easier to provide, to keep staff timely according to test report
The executive condition and reason of test case are obtained, and then improves testing efficiency.
In addition, the execution method of test case further includes step S4 in the present embodiment: will be according to the execution knot for relying on use-case
Fruit, it is determined whether the method for implementation of test cases is encapsulated in a function decorator.
Namely the method in step S3 is encapsulated in a function decorator.Myskip function dress can be specifically encapsulated in
In frilled organ.The method of function decorator, can be by the method batch application of step S3 in the present embodiment in test case, favorably
In further increasing testing efficiency.From the angle of written in code, it can be avoided and write acquisition dependence use for each test case
Example and judges whether the case where executing current test case at implementing result, avoids code redundancy, is conducive to improve working efficiency, essence
Simple testing process, and then improve test accuracy and testing efficiency.
Below by taking an exemplary application as an example, the execution method of test case in the application is described.Referring to fig. 2 may be used
Know: firstly, creation test case;
Secondly, adding Myskip function decorator to the test case created.
Then, the test case of addition function decorator is executed.
Finally, judging whether the related example of test case executes failure.
Related example namely dependence use-case.
If related example executes failure, created test case is skipped, and export and skip reason;If correlation is used
Example runs succeeded, then continues to execute created test case.
In practical application, the method that can use the present embodiment writes relevant program using python language.Such as:
Using Myskip function, wrapper function encapsulation judgement and skip functions are write.
Referring to Fig. 3 it is found that the application also provides a kind of execution system of test case.The system specifically includes that test is used
Example creation module relies on use-case acquisition module and determining module three parts.Wherein, test case creation module for create to
The test case of execution;It relies on use-case and obtains the dependence use-case that module is used to obtain test case;Determining module be used for according to according to
Rely the implementing result of use-case, it is determined whether implementation of test cases.
Wherein it is determined that module includes: implementing result acquiring unit, dynamic jump-transfer unit and execution unit again.Wherein, it holds
Row result acquiring unit is used to obtain the implementing result for relying on use-case;Dynamic jump-transfer unit is used for when the implementing result for relying on use-case
When to execute failure, skip test use-case;Execution unit is used to execute survey when the implementing result for relying on use-case is to run succeeded
Example on probation.
Further, it is determined that further including having output unit in module, for exporting the reason of test case is not carried out.
It further include having package module in the execution system of the present embodiment test case, for determining module to be encapsulated in one
In function decorator.Determining module can be encapsulated in Myskip function decorator.
The working principle and working method of the execution system of test case in the application are used in Fig. 1 and test shown in Fig. 2
It has been elaborated in the execution method of example, details are not described herein.
In conclusion the system makes full use of the dependence between test case, according to current use-case to be tested according to
Rely the implementing result of use-case, to determine whether to continue to execute current test case, when can greatly reduce test case execution
Between and test report analysis time, to improve testing efficiency.In addition, in the system package module setting, utilize letter
Number decorator can be avoided a large amount of code redundancy, be conducive to simplify testing process, to further increase testing efficiency and survey
Try accuracy.
The above is only the specific embodiment of the application, is made skilled artisans appreciate that or realizing this Shen
Please.Various modifications to these embodiments will be apparent to one skilled in the art, as defined herein
General Principle can be realized in other embodiments without departing from the spirit or scope of the application.Therefore, the application
It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one
The widest scope of cause.
Claims (9)
1. a kind of execution method of test case, which is characterized in that the described method includes:
Create pending test case;
Obtain the dependence use-case of the test case;
According to the implementing result for relying on use-case, it is determined whether execute the test case.
2. a kind of execution method of test case according to claim 1, which is characterized in that described to be used according to the dependence
The implementing result of example, it is determined whether execute the test case, comprising:
Obtain the implementing result for relying on use-case;
If the implementing result for relying on use-case is to execute failure, the test case is skipped;
Otherwise, the test case is executed.
3. a kind of execution method of test case according to claim 2, which is characterized in that skip the test case it
Afterwards, the method also includes:
Export the reason of test case is not carried out.
4. a kind of execution method of test case according to claim 1 to 3, which is characterized in that the method is also
Include:
By described according to the implementing result for relying on use-case, it is determined whether the method for executing the test case is encapsulated in one
In function decorator.
5. a kind of execution method of test case according to claim 4, which is characterized in that the function decorator is
Myskip function decorator.
6. a kind of execution system of test case, which is characterized in that the system comprises:
Test case creation module, for creating pending test case;
It relies on use-case and obtains module, for obtaining the dependence use-case of the test case;
Determining module, for according to the implementing result for relying on use-case, it is determined whether execute the test case.
7. a kind of execution system of test case according to claim 6, which is characterized in that the determining module includes:
Implementing result acquiring unit, for obtaining the implementing result for relying on use-case;
Dynamic jump-transfer unit, for skipping the test case when the implementing result for relying on use-case is to execute failure;
Execution unit, for executing the test case when the implementing result for relying on use-case is to run succeeded.
8. a kind of execution system of test case according to claim 7, which is characterized in that the determining module further includes
Output unit, for exporting the reason of test case is not carried out.
9. according to a kind of execution system of test case any in claim 6-8, which is characterized in that in the system
It further include package module, for the determining module to be encapsulated in a function decorator.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811342700.3A CN109359049A (en) | 2018-11-12 | 2018-11-12 | A kind of execution method and system of test case |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811342700.3A CN109359049A (en) | 2018-11-12 | 2018-11-12 | A kind of execution method and system of test case |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109359049A true CN109359049A (en) | 2019-02-19 |
Family
ID=65345066
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811342700.3A Pending CN109359049A (en) | 2018-11-12 | 2018-11-12 | A kind of execution method and system of test case |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109359049A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112380141A (en) * | 2020-12-11 | 2021-02-19 | 上海中通吉网络技术有限公司 | Interface case set execution method and device |
CN112650681A (en) * | 2020-12-28 | 2021-04-13 | 广州品唯软件有限公司 | Automatic testing method and device, electronic equipment and readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101882107A (en) * | 2010-06-28 | 2010-11-10 | 山东中创软件商用中间件股份有限公司 | Method and device for automatically testing WEB (World Wide Web) application |
CN103246601A (en) * | 2012-02-10 | 2013-08-14 | 腾讯科技(深圳)有限公司 | Testing method and device |
CN106412975A (en) * | 2016-09-30 | 2017-02-15 | 中国联合网络通信集团有限公司 | Content charging vulnerability test methods, and apparatuses |
CN108287788A (en) * | 2017-12-26 | 2018-07-17 | 广东睿江云计算股份有限公司 | A kind of use-case step matching method based on test case, system |
-
2018
- 2018-11-12 CN CN201811342700.3A patent/CN109359049A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101882107A (en) * | 2010-06-28 | 2010-11-10 | 山东中创软件商用中间件股份有限公司 | Method and device for automatically testing WEB (World Wide Web) application |
CN103246601A (en) * | 2012-02-10 | 2013-08-14 | 腾讯科技(深圳)有限公司 | Testing method and device |
CN106412975A (en) * | 2016-09-30 | 2017-02-15 | 中国联合网络通信集团有限公司 | Content charging vulnerability test methods, and apparatuses |
CN108287788A (en) * | 2017-12-26 | 2018-07-17 | 广东睿江云计算股份有限公司 | A kind of use-case step matching method based on test case, system |
Non-Patent Citations (1)
Title |
---|
STEVEN JOHN METSKER: "《C#设计模式》", 31 July 2005 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112380141A (en) * | 2020-12-11 | 2021-02-19 | 上海中通吉网络技术有限公司 | Interface case set execution method and device |
CN112650681A (en) * | 2020-12-28 | 2021-04-13 | 广州品唯软件有限公司 | Automatic testing method and device, electronic equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6226783B1 (en) | Object oriented method of structuring a software step program | |
CN110764753A (en) | Business logic code generation method, device, equipment and storage medium | |
CN109032927A (en) | A kind of bug excavation method and device | |
US20050028138A1 (en) | Programmatically determining calling information of a graphical program | |
US7895575B2 (en) | Apparatus and method for generating test driver | |
CN109359049A (en) | A kind of execution method and system of test case | |
CN110515848B (en) | Automatic test system and automatic test method | |
CN109857663B (en) | Keyword driving and image similarity combined automatic test platform | |
CN101706753A (en) | Unit testing framework and method based on Perl | |
US10831639B2 (en) | Method and device for non-intrusively collecting function trace data | |
CN104750606A (en) | Reflection-based automated testing method | |
CN110399299A (en) | The execution method of automated test frame and test case | |
CN105302549A (en) | Multiple-language-supporting test process generating, debugging and executing system | |
CN113760956A (en) | Universal engine calibration system based on ASAP standard | |
CN108984416A (en) | Conflict hazard class method for distinguishing is relied in a kind of assessment Maven environment | |
CN109669851A (en) | Performance test script method for recording based on Selenium automation | |
CN112463586A (en) | Method and medium for automatically generating application program interface test case | |
CN109032941A (en) | The sustainable integrated interface automated testing method and system of test case driving | |
US8005639B2 (en) | Compact framework for automated testing | |
Abramson et al. | A debugging tool for software evolution | |
CN110334001A (en) | A kind of method and apparatus that batch automatically generates echo test | |
CN111176995A (en) | Test method and test system based on big data test case | |
CN109522234A (en) | Show method, system and the automated testing method of test case implementation progress | |
EP0801348A1 (en) | Method of monitoring the operation of a computer | |
CN112380134A (en) | WebUI automatic testing method based on image recognition |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190219 |
|
RJ01 | Rejection of invention patent application after publication |