A kind of use-case step matching method based on test case, systemTechnical field
The present invention relates to software auxiliary development field more particularly to a kind of use-case step collocation sides based on test caseMethod, system.
Background technology
Present company is also mostly in without test or the autonomous test phase of developer, does not touch testUse-case, test case (TestCase) are one group of test input, execution condition and the expection worked out for some special objectiveAs a result, to test some Program path or to verify whether meet some particular demands.Test case reflects the need to be verifiedIt asks.However, verifying these demands may implement by different modes and by different test mans;
And common primary test case management tool is also with execl, word, relatively advanced has testlink,Bugzilla etc..But these softwares cannot all be tested according to use-case automatic code generating, and non-technical personnel is being tested certainlyDynamicization can only look at use-case and not know how to determine whether that test is correct when testing.
Invention content
It is an object of the invention to propose a kind of use-case step matching method based on test case, system, by fromEach step of test case is encoded in dynamicization test, is carried out writing test case and test code, side according to different situationsJust while developer tests, the tester for being also convenient for write code writes test case and generates code,Flexibly collocation use-case step realizes use-case test.
For this purpose, the present invention uses following technical scheme:
A kind of use-case step matching method based on use-case test, the use-case step matching method include creating use-case stepSuddenly it, manages use-case step and creates three interior methods of test case, include the process of use-case step collocation:
Step A:Into use-case step system, and obtain operating right;
Step B:It chooses whether to create use-case step, if so, use-case Step Information is write, and the use-case to writing completionStep Information is preserved;If it is not, then choosing whether management use-case step;
Step C:If selection management use-case step, it is that use-case step is deleted or changed to continue selection;If choosingIt selects and use-case step is deleted, then directly delete use-case step file;If selection modifies to use-case step, to use-caseThe information and code of step are modified and are preserved;
Step D:If not selecting management use-case step, choose whether to create test case, if selection creates test case,Suitable use-case step is then selected according to use-case Step Information, determines use-case;And use-case is preserved.
Preferably, it is included in and creates in use-case step, writes the process of use-case Step Information:
Step B1:Write use-case step shorthand information;
Step B2:Write use-case Step Details;
Step B3:Write use-case step code.
Preferably, after creating use-case step, it includes filename, file remarks and text to need the use-case step file preservedPart content;The filename includes the shorthand information for the use-case step for needing to preserve;The file remarks include needing to preserveThe details of use-case step;File content includes the code for writing use-case step.
Preferably, include the process of determining use-case:
Step d1:It is created according to use-case Step Information and selects suitable use-case step;
Step d2:Write use-case shorthand information and use-case details;
Step d3:It adjusts use-case sequence of steps and preserves.
Preferably, it is included in when creating test case, process that determining use-case is preserved:
Step D1:Confirm and preserve use-case, and establishment file is pressed from both sides, the title expression of the file simply describes use-case;
Step D2:The code of use-case step is extracted to file;
Step D3:It creates public function file f unction and creates principal function file main;
Step D4:Public operation step is copied in public function file f unction;
Step D5:It is inserted into detailed use case description in principal function file main, according to use-case step, calls a step in orderRapid code and return information.
A kind of use-case step collocation system based on test case, the use-case step collocation system include creating use-case stepRapid module, management use-case step block and establishment test case module;
The establishment use-case step block is for creating use-case step and being preserved to the use-case step of establishment;
The management use-case step block is for modifying and deleting to the use-case step created;
The establishment test case module is for creating test case and being preserved to test case.
Preferably, the establishment use-case step block includes writing use-case Step Information module and preservation use-case step mouldBlock;
The use-case Step Information module of writing is for writing use-case step shorthand information, writing use-case Step DetailsWith write use-case step code;
For the preservation use-case step block for preserving the use-case step file created, the file includes fileName, file remarks and file content;
The filename includes the shorthand information for the use-case step for needing to preserve;The file remarks include needing to preserveThe details of use-case step;File content includes the code for writing use-case step.
Preferably, the establishment test case module includes determining use-case module and preservation use-case module;
The determining use-case module creates according to use-case Step Information and selects suitable use-case step, writes use-case and simply believesBreath and use-case details, adjust use-case sequence of steps and preserve;
The preservation use-case module is used to preserve the test case created, including:Confirm and preserve use-case, and createsFile is built, the title expression of the file simply describes use-case;The code of use-case step is extracted to file;It creates publicFunction file function and establishment principal function file main altogether;Public operation step is copied into public function fileIn function;It is inserted into detailed use case description in principal function file main, according to use-case step, calls a step in orderCode and return information.
Description of the drawings
Fig. 1 is use-case step collocation flow chart of the present invention;
Fig. 2 be the present invention write use-case Step Information flow chart;
Fig. 3 is the determination use-case flow chart of the present invention;
Fig. 4 is that the present invention preserves the flow chart for determining use-case
Fig. 5 is the system framework figure of the present invention.
Specific implementation mode
Technical solution to further illustrate the present invention below with reference to the accompanying drawings and specific embodiments.
A kind of use-case step matching method based on use-case test of the present embodiment, the use-case step matching method includeIt creates use-case step, management use-case step and creates three interior methods of test case, as shown in Figure 1, including that use-case step is takenThe process matched:
Step A:Into use-case step system, and obtain operating right;
Step B:It chooses whether to create use-case step, if so, use-case Step Information is write, and the use-case to writing completionStep Information is preserved;If it is not, then choosing whether management use-case step;
Step C:If selection management use-case step, it is that use-case step is deleted or changed to continue selection;If choosingIt selects and use-case step is deleted, then directly delete use-case step file;If selection modifies to use-case step, to use-caseThe information and code of step are modified and are preserved;
Step D:If not selecting management use-case step, choose whether to create test case, if selection creates test case,Suitable use-case step is then selected according to use-case Step Information, determines use-case;And use-case is preserved.
Each use-case is allocated as much walking according to operation, a step portion code, it can be according to operating procedure when combining use-caseManually sorted.Code has been fixed in use-case, needs to change when there is data, it is only necessary to change initial input step generationCode, the data of the output of every part of code halfway can be monitored and checked, final to obtain tester's demand data.SystemEffect is that these step codes are recorded, and is preserved, redjustment and modification, and a use-case of generation can be used for a long time according to demand.
In order to mitigate the pressure of developer and tester, can be walked according to the use-case preserved when creating use-caseSuddenly it is added, generates new use-case code.While facilitating developer to test, it is also convenient for that the survey of code will not be writeExamination personnel write test case and generate code, and use-case step of flexibly arranging in pairs or groups realizes use-case test.It is this establishment and generation forPressure test, automatic test, system testing, regression test can be supported, greatly reduce the development time and facilitate variousThe people in type post tests and adjusts.
Preferably, it is created in use-case step as shown in Fig. 2, being included in, writes the process of use-case Step Information:
Step B1:Write use-case step shorthand information;
Step B2:Write use-case Step Details;
Step B3:Write use-case step code.
Preferably, after creating use-case step, it includes filename, file remarks and text to need the use-case step file preservedPart content;The filename includes the shorthand information for the use-case step for needing to preserve;The file remarks include needing to preserveThe details of use-case step;File content includes the code for writing use-case step.
Preferably, as shown in figure 3, the process including determining use-case:
Step d1:It is created according to use-case Step Information and selects suitable use-case step;
Step d2:Write use-case shorthand information and use-case details;
Step d3:It adjusts use-case sequence of steps and preserves.
Preferably, as shown in figure 4, being included in when creating test case, the process that is preserved to determining use-case:
Step D1:Confirm and preserve use-case, and establishment file is pressed from both sides, the title expression of the file simply describes use-case;
Step D2:The code of use-case step is extracted to file;
Step D3:It creates public function file f unction and creates principal function file main;
Step D4:Public operation step is copied in public function file f unction;
Step D5:It is inserted into detailed use case description in principal function file main, according to use-case step, calls a step in orderRapid code and return information.
A kind of use-case step collocation system based on test case, as shown in figure 5, the use-case step collocation system includesIt creates use-case step block, management use-case step block and creates test case module;
The establishment use-case step block is for creating use-case step and being preserved to the use-case step of establishment;
The management use-case step block is for modifying and deleting to the use-case step created;
The establishment test case module is for creating test case and being preserved to test case.
Preferably, the establishment use-case step block includes writing use-case Step Information module and preservation use-case step mouldBlock;
The use-case Step Information module of writing is for writing use-case step shorthand information, writing use-case Step DetailsWith write use-case step code;
For the preservation use-case step block for preserving the use-case step file created, the file includes fileName, file remarks and file content;
The filename includes the shorthand information for the use-case step for needing to preserve;The file remarks include needing to preserveThe details of use-case step;File content includes the code for writing use-case step.
Preferably, the establishment test case module includes determining use-case module and preservation use-case module;
The determining use-case module creates according to use-case Step Information and selects suitable use-case step, writes use-case and simply believesBreath and use-case details, adjust use-case sequence of steps and preserve;
The preservation use-case module is used to preserve the test case created, including:Confirm and preserve use-case, and createsFile is built, the title expression of the file simply describes use-case;The code of use-case step is extracted to file;It creates publicFunction file function and establishment principal function file main altogether;Public operation step is copied into public function fileIn function;It is inserted into detailed use case description in principal function file main, according to use-case step, calls a step in orderCode and return information.
The technical principle of the present invention is described above in association with specific embodiment.These descriptions are intended merely to explain the present invention'sPrinciple, and it cannot be construed to limiting the scope of the invention in any way.Based on the explanation herein, the technology of this fieldPersonnel would not require any inventive effort the other specific implementation modes that can associate the present invention, these modes are fallen withinWithin protection scope of the present invention.