Embodiment
For making the purpose, technical solutions and advantages of the present invention clearer, below in conjunction with embodiment and accompanying drawing, the present invention is described in more detail.
Core concept of the present invention is the configuration item of software testing management system according to input, obtains test procedure document or existing text use-case; And, obtain test case according to this configuration item content and the test procedure document or the existing text use-case that obtain.
Fig. 1 is the block diagram of system of software testing management of the present invention system.As shown in Figure 1, this software testing management system comprises that file imports module 110, graphic user interface (GUI) 120, administration module 130, test case data storehouse 140 and file generating module 150.
Wherein, file imports module 110, is used for importing test procedure document to be extracted or existing text use-case to GUI120.Wherein, test procedure document to be extracted is the test procedure document that has write, and this test procedure document to be extracted is according to entry name, and category of test is stored in respectively under the different catalogues.The content of test procedure document comprises the test case contents such as test I D, test purpose, test description, expected results and test duration that exist with the note form, and corresponding to the trial function of this test case.A test procedure document may comprise one or more test case; Wherein, existing text use-case is the test case of textual form.
GUI120 is used for providing operation interface to the user.This GUI comprises inputting interface 121 and output interface 122.The software testing management system obtains file by inputting interface 121 and imports test procedure document to be extracted or existing text use-case in the module 110; The user extracts the test case configuration item by these inputting interface 121 inputs and gives administration module 130.This extraction test case configuration item is the term restriction to the test case that will extract.The user generates the test frame configuration item by output interface 122 inputs and gives administration module 130.This generation test frame configuration item is to generating the term restriction of test frame content.
File generating module 150 is used for generating the test frame configuration item according to configuration file that obtains from administration module 130 and test case, or according to the test case of obtaining from administration module 130, generates new text use-case.
Administration module 130 comprises and extracts test case module 131, is used for according to the extraction test case configuration item of above-mentioned user's input test procedure document to be extracted being extracted test case, and the test case of extracting is imported in the test case data storehouse 140.
Administration module 130 also comprises database management module 132, is used for the existing text use-case that inputting interface 121 receives is imported to test case data storehouse 140; The bookkeeping that this database management module 132 can increase, delete, revises and search the test case in the test case data storehouse 140; In addition, this module is obtained test case according to the generation text use-case configuration item of user in output interface 122 inputs from test case data storehouse 140, and generates new text use-case in file generating module 150, and browses printing.
Administration module 130 also comprises generation test frame module 133, be used for obtaining test case at the generation test frame configuration item of output interface 122 inputs from test case data storehouse 140, and export to file generating module 150 by output interface 122 the configuration file that generates according to this generation test frame configuration item with according to the test case that this generation test frame configuration item obtains according to the user.
Test case data storehouse 140 is used to store test case.If directly adopt the test case in the existing text use-case that administration module 130 obtains to generate the test procedure framework, then this software testing management system also can not comprise test case data storehouse 140.
In this software testing management system, GUI120 is for administration module 130 and file import between the module 110, provide an information transmission interface between administration module 130 and the file generating module 150.Administration module 130 also can directly import module 110 with file and link to each other with file generating module 150, directly import module 110 and obtain test procedure document to be extracted or existing text use-case from file, and the test case from the test procedure framework to file generating module output and the relevant information thereof that directly are used to generate.
Software testing management of the present invention system will be stored in from the test case that test procedure document extracts the test case data storehouse 140.Search for convenience and management of test cases, also store the project information relevant in the test case data storehouse 140 with test case.This project information is from the extraction test case configuration item of user's input.Below extract among the test case method embodiment, the test case that not only has of extracting and deposit in the test case data storehouse also has its project information.
Fig. 2 extracts the test case method flow diagram for the present invention.The concrete steps of this method are as follows:
Step 201, the user extracts the test case configuration item by inputting interface 121 inputs.
In this step, the extraction test case configuration item that the user need import comprises following several contents:
Entry name and program member: these two contents are imported by the user, in order to when test case is write the test case data storehouse, as the information that writes.
PROJECT TIME: represent that this extracts the time of test case.2006.10.24 for example.
Item description: expression is extracted the description of test case purpose to this.For example: this project is used for demonstration (This project is used for demo).
Testing classification: represent that this need extract the test case of which kind of testing classification.This category of test comprises functional test, performance test, testing classifications such as pressure test, compatibility test, uniformity test.The test procedure document of every kind of classification all is stored in the corresponding file folder.Present embodiment adopts filename to distinguish the test-types of test procedure document to be extracted.For example the filename of functional test with F as prefix, the filename of performance test with P as prefix, the filename of pressure test with S as prefix, the filename of compatibility test with C as prefix.This configuration item can be selected one or more classification, has selected all testing classifications if do not select then be defaulted as.
File type to be extracted: expression need be extracted test case from the test procedure document to be extracted of which kind of file type.The type of test procedure document is different and different according to the translation and compiling environment that adopts, and can comprise the file of types such as compilation, C, C++, VC, JAVA.Can adopt the extension name of file to distinguish file type, the extension name of file can be .c .asm .java etc.This configuration item can be selected one or more type, has selected all file types if do not select then be defaulted as.
File path to be extracted: represent the path at test procedure document to be extracted place, extract test case module 131 and can find test procedure document to be extracted according to this path.
The note sign: expression needs the annotation symbol that test case adopted of extraction.Can select "/* @...@*/", when then extracting test case, can extract the content in "/* @...@*/" symbol.This note sign can be selected other tag mark for use, for example "/* § ... § */" etc.
Show Styles: which kind of Show Styles is the test case that expression extracts adopt.Present embodiment specifies expansion identifiable language (XML) form as specifying Show Styles, and therefore the test case of extracting from test procedure document writes the XML file earlier, utilizes the perl wscript.exe that the content in the XML file is imported the test case data storehouse again.In the present embodiment, the interpretative tool of script adopts the perl wscript.exe, and the perl wscript.exe is used for the file content of certain form is read variable, so that use this variable to carry out some operation, perhaps this variable is write some file.Present embodiment reads configuration file content, reads the test case file information of XML form, generates the test case file of XML form, and this document is imported in the test case data storehouse, all adopts the perl wscript.exe.Adopting the perl wscript.exe is for the present invention is better illustrated, but is not limited to this, can use the other Languages that can articulate with database.
Connect database information: the nominative testing use-case database that the test case that expression extracts will be preserved, this connection database information comprises the database-name that will connect the test case data storehouse, database address, database port, account, encrypted message.
More than in each configuration item, file path to be extracted, file type to be extracted, note are designated essential information; Entry name, program member, PROJECT TIME, item description, testing classification are project information; The connection database information is a database information.
In the present embodiment, user's cuit is called G2000, the program member is alen, PROJECT TIME is 2006.10.24, item description is This project is used for demo, testing classification is functional test and performance test (Function Performance), file path to be extracted is ./G2000, and file type to be extracted is .c, note is designated/and * @...@*/, Show Styles is XML, the database name that connects database information is called MySQL, and database address is 10.1.1.1, and the database port is 1021, account is test, and password is test.
Step 202, administration module 130 forms configuration file according to extracting the test case configuration item.
In this step, form configuration file according to extracting the test case configuration item, be to extract the process that the test case configuration item writes configuration file, concrete grammar is: the content stores that will extract each field of test case configuration item is written to the variable name and the variate-value thereof of those variablees in the configuration file in the variable of correspondence line by line.This moment, configuration file comprised: essential information, project information, database information etc.The content of this configuration file is that the mode with joint writes down, in the present embodiment, joint with " [] " as a token of, after connect this joint interior variable name and variate-value thereof.
Wherein, essential information is represented with the joint of [General], being comprised: file path to be extracted (Path), file type/file extension to be extracted (File Extension), note sign variable name and variate-values thereof such as (CommentMark); Project information is represented with the joint of [Project], being comprised: entry name (ProjectName), program member (ProjectMember), key word (Keyword), category of test variable name and variate-values thereof such as (Type); Database information is represented with the joint of [DB], being comprised: database-name (DBName), database address (DBAddress), database port (DBPort), account (DBAccount), password variable name and variate-values thereof such as (DBCode).Above-mentioned every information is to write configuration file respectively line by line.Wherein, key word can have more than one, has two in the present embodiment, difference corresponding PROJECT TIME (Keyword1) and item description (Keyword2), and this key word can add as required; According to the configuration item of user's input, file extension and category of test can have more than one, and file extension has one in the present embodiment, i.e. .c; Because the user selected two category of tests, so category of test has two in configuration file, i.e. Type1 and Type2.
In the present embodiment, the configuration file of formation is as follows
[General]
Path=./G2000
File?Extension=.c
CommentMark=/*@...@*/
[Project]
ProjectName=G2000
ProjectMember=″alen″
Keyword1=2006.10.24
Keyword2=This?project?is?used?for?demo
Type1=Function
Type2=Performance
[DB]
DBName=MySQL
DBAddress=10.1.1.1
DBPort=1021
DBAccount=test
DBCode=test
Step 203 adopts the perl script to read configuration file.
In this step, extract test case module 131 and adopt the perl wscript.exe to read in the configuration file that forms in the step 202 line by line, the profile data that reads out is deposited in the configuration information variable of perl wscript.exe, wait is called.The operation according to the information and executing in the configuration file of the following stated is actually and carries out according to corresponding configuration information variable.
Step 204, the file under inquiry assigned catalogue and the sub-directory thereof.
In this step, the modularity function that adopts the perl script to provide, specified catalogue of file path to be extracted and the test procedure document to be extracted under the catalogue thereof in the query configuration file.Query directory is a test procedure document under the ./G2000 in the present embodiment, because test procedure document is deposited under the classification sub-directory according to testing classification, therefore the perl wscript.exe is according to the Type information that provides in the configuration file, and all test procedure documents under catalogue and the performance test catalogue are tested in the query function test.
Step 205 judges whether to inquire qualified file.If inquire, then execution in step 206; Otherwise, execution in step 209, process ends.
In this step, qualified file is meant and meets File Extension requirement, and meets the test case file to be extracted that Type requires.In the present embodiment, in 131 arbitration functions test of extraction test case module and the performance test sub-directory whether File Extension being arranged is the test procedure document of .c.
Step 206 is preserved the file set that inquires.
In this step, path, qualified test procedure document place and the filename that inquires is saved in a file set, that is, preserves the path and the filename of these test procedure documents with a data structure.
Step 207 according to configuration file, extracts qualified test case in the file set, and writes the XML file.
In this step, qualified test case is meant that the note sign of test case identifies the test case that is complementary with user configured note.These test cases can import test case data storehouse 140, with the management of realization to test case, and can derive use when needed.Qualified test case in the file set is imported database 140, need earlier test case to be extracted from test procedure document, and write the XML file.The XML file that generates is the test case file of XML form, comprises project information and the test case that extracts from test procedure document.Wherein, project information is the project information in the configuration file.Each test case all identifies to start with filename (file name) in the XML file, and the back writes the test I D of test case successively, test purpose, test description, expected results and test duration; The test case of same testing classification is write together, identifies to start with specific name (typename).Have a plurality of testing classifications in this XML file, have a plurality of test cases in each testing classification.In the present embodiment, shown in the theing contents are as follows of the XML file of formation:
<?xml?version=″1.0″encoding=″gb2312″?>
<project?projectname=″G2000″projectmember=″alem,joe,mark″
keyword1=″2006.10.24″keyword2=″This?project?is?used?for?demo″>
<type?name=″Function″>
<file?name=″./G2000/Function/F_A.c″line=”001”>
<test I D 〉
F_A
</test I D 〉
<test purpose 〉
Checking C can compile
</test purpose 〉
<test description 〉
On screen, print Hello world
</test description 〉
<expected results 〉
Hello world appears on the screen
</expected results 〉
<the test duration 〉
2006.10.24
</the test duration 〉
</file>
</type>
<type?name=″Performance″>
<file?name=″./G2000/Performance/P_A.c″line=”012”>
<test I D 〉
P_A
</test I D 〉
<test purpose 〉
Verify that once more C can compile
</test purpose 〉
<test description 〉
On screen, print Hello world-again
</test description 〉
<expected results 〉
Hello world-again appears on the screen
</expected results 〉
<the test duration 〉
2006.10.24
</the test duration 〉
</file>
</type>
</project>
In the above XML file, the version information that first behavior is relevant.The end of each message segment of XML file all with</expression, according to different message segments</insert different contents.Extracted test case among the file F_A.c under path/G2000/Function/ (suppose to have only in this document one and meet note sign test case) in the above-mentioned XML file, the row of the initial row of this use-case in test procedure document F_A.c to be extracted number be that line=" 001 " represents.If write the XML file a plurality of test cases are arranged, also extracted test case among the file P_A.c under path/G2000/Performance/ (supposing that this document has only and meets note sign test case) in the above-mentioned for another example XML file, the row of the initial row of this use-case in test procedure document P_A.c to be extracted number be that line=" 012 " represents.
Step 208 imports the test case data storehouse with the XML file.
In this step, the test case data storehouse is by database information appointment in the configuration file, and creates test case data storehouse according to this database information and connect.This test case data storehouse comprises test case table and Project Information Table.The process that the XML file is imported the test case data storehouse is, the perl wscript.exe reads the XML file content, entry name in the XML file, program member, PROJECT TIME, item description are write in the respective field of Project Information Table, and each test case in the XML file all write in the respective field of test case table, the field of test case table comprises entry name, testing classification, test I D, test purpose, test description, expected results, test duration.Use this test case table that test case is managed in order to further facilitate the user, make test case library reaction more information can also comprise filename (Filename) and test case row number (line) field in this test case table.Filename and test case row number also all obtain from above-mentioned XML file.In the present embodiment, the test case table that forms behind the XML file importing test case data storehouse is as shown in table 1, and Project Information Table is as shown in table 2:
Entry name |
Testing classification |
Test I D |
Filename |
Capable number |
Test purpose |
Test description |
Expected results |
Test duration |
G2000 |
Function |
F_A |
./G2000/ Function/ F_A.c |
001 |
Checking C can compile |
On screen, print Hello world |
On screen, print Hello world |
2006.10.24 |
G2000 |
Performance |
P_A |
./G2000/ Performance/ P_A.c |
012 |
Verify that once more C can compile |
On screen, print Hello world-ag ain |
On screen, print Hello world-agai n |
2006.10.24 |
Table 1
Entry name |
The program member |
PROJECT TIME (Keyword1) |
Item description (Keyword2) |
?other |
G2000 |
alen |
2006.10.24 |
This?project?is?used?for?demo |
|
Table 2
When needing the test case of use test use-case database storing, can utilize the test I D field accurately to inquire about test case by inputting interface 121, perhaps utilize in " test description " field in the test case table or the Project Information Table " item description " field, " program member " field to carry out fuzzy query.The user can also operate by GUI, realizes each field information in the test case data storehouse is increased, deletes or revises by the management to content in test case table and the Project Information Table.
Step 209, process ends.
In extracting the test case process, step 207 is the processes that qualified test case write one by one the XML file.As shown in Figure 3, the step of formation XML file is as follows:
Step 2071 writes the XML file with project information.
In this step, entry name, program member, PROJECT TIME, the item description of project information in the configuration file are write in the XML file, these information are that the user imports when extracting the test case configuration item and imports, and are used for inserting when the XML file is imported the test case data storehouse Project Information Table.
Step 2072 judges whether the test procedure document in the file set all disposes, if do not dispose, and the execution in step 2073~2077 that then circulates, the file in file set all disposes; If the file processing of file set finishes, then execution in step 208, and the test case that is written in the XML file is imported test case data storehouse 140.
In this step, adopt the data structure of traversal whole storage file path and filename to judge whether the file in the file set all disposes.When traversal, travel through according to testing classification.In the present embodiment, according to Type1, the order of Type2 travels through the file in the file set.The Type1 presentation function is tested, and therefore at first handles the test procedure document of functional test in the file set, and the prefix of the filename of test procedure document has identified the type of this test procedure document.
Step 2073 is opened current file, the coupling notes content.
In this step, traverse a test procedure document after, this test procedure document is opened, adopt the perl wscript.exe to read and search the annotation symbol that is complementary with the note sign line by line, as "/* @...@*/".
Step 2074, whether determining step 2073 matches the note that meets.If the note that current test procedure document does not meet, then execution in step 2075, handle next test procedure document, and return step 2072; If match qualified note, execution in step 2076.
Step 2076 extracts test case, writes the XML file.
In this step, utilize the regular expression that the perl wscript.exe provides to extract the qualified notes content that finds, i.e. test case, and put into temporary variable, then the test case in this temporary variable is write in the XML file.The form that the test case that extracts in this step writes file can also be formatted files such as HTML, RFT, TXT.The form of file is to determine according to the Show Styles that the user imports.In the present embodiment, the test case content that writes the XML file comprises test I D, test purpose, test description, expected results and test duration etc.
Step 2077 judges whether current file disposes.If do not dispose, then repeated execution of steps 2074,2076,2077, finish up to the file processing when front opening, and execution in step 2075 is handled next file, and changes step 2072 over to.
In extracting the test case process, step 203 adopts the perl script to get and reads configuration file line by line.Referring to Fig. 4, the concrete steps that read the configuration file method are as follows:
Step 300 is opened configuration file.
Step 301, employing perl wscript.exe reads the content in this configuration file of delegation.
Step 302 judges whether the content that reads is the beginning of " joint " sign.Present embodiment is to be feast-brand mark will with " [] ", but also is not limited thereto, and can be the tag mark of other type, for example " { } " etc.Begin if this row content is a feast-brand mark will, then execution in step 306, claim the content in i.e. " [] " to read in the configuration information variable section name; Begin if not feast-brand mark will, then execution in step 303 further judges whether this content that reads is variable name; If not then returning step 301, variable name reads in delegation's content again; Otherwise execution in step 304,305 is read in variable name, and to this variable name assignment.
Step 307 judges whether configuration file finishes.If do not finish, return step 301 and read in delegation again; Otherwise execution in step 308 is closed configuration file.
Step 309, all deposit data of configuration file wait for that in the configuration information variable next step calls.
Step 310 reads configuration file and finishes.
More than extracting the embodiment of test case method, is that test procedure document to be extracted is extracted test case.Can also from existing text use-case, extract test case.The file of existing text use-case comprises test case and project information thereof.Its content class is similar to the above-mentioned content of extracting test case XML file from test procedure document.Therefore in the step 201 of Fig. 2, file can be imported existing text use-case in the module 110, import administration module 130 by inputting interface 121.Database management module 132 in the administration module 130 will have the text use-case and join in the test case data storehouse 140, and in the test case table, set up field according to test case in the existing text use-case, in Project Information Table, set up field according to project information in the existing text use-case.Database management module 132 also by GUI to visual data base administration interface that the user provides, the user can pass through the interface operation importing management information, increase field and data thereof in the mode of adding, perhaps update Database field, for example entry name in the test case library and testing classification field.
Extraction test case method of the present invention can extract test case, and be kept in the test case data storehouse according to the extraction test case configuration item of user's input from test procedure document.When needing, the user only needs to import the configuration item of required test case from the data base administration interface, can browse and print required test case.Just can obtain all test cases of this project, i.e. test case scheme if only imported entry name.Simplify the tester and carried out the test case conceptual design earlier, carried out the process that test case is write again.But can carry out writing of test procedure document earlier, from test procedure document, extract test case by the method for extracting test case again, and form the test case scheme.The extraction test case configuration item of user input comprises the note sign, so the present invention can extract the test case of different note styles from dissimilar files, has increased the dirigibility of extracting test case.The user can also obtain test case by the operation of GUI from the test case data storehouse, and to test case add, bookkeeping such as modification or deletion.
Software testing management of the present invention system also provides and generates the test procedure frame method.Generating the test procedure framework is to extract qualified test case by the generation test frame configuration item that the user imports from existing test case, and write test procedure document, in each test case back, write the trial function framework of this test case correspondence simultaneously.The test procedure framework that the generates preservation of classifying automatically, the test procedure of different category of tests is kept under the different catalogues, makes things convenient for the tester to search and writes test procedure.
The test case that is adopted that generates the test procedure framework can be from the test case data storehouse, also can be from existing text use-case.When test case during,, be directly used in generation test procedure framework according to generating the test case chassis configuration to the existing text use-case that will import from the outside from existing text use-case.The generation of test procedure framework is mainly finished by generation test frame module 133 and file generating module 150 in the administration module, and generation test frame module 133 is mainly finished according to generating the test frame configuration item and obtained corresponding test case file and configuration file; File generating module 150 is mainly finished according to test case file and configuration file and is generated the test procedure framework.Below just illustrate that the present invention generates the method for test procedure framework for two example two.At first the method that generates the test procedure framework with the test case of obtaining in the test case data storehouse is as embodiment one, and referring to Fig. 5, the concrete steps that this embodiment generates the test procedure framework are as follows:
Step 400 generates the test frame configuration item in the output interface input.
In this step, the generation test frame configuration item of user's input comprises Basic Configuration Items and expanded configuration item.Basic Configuration Items comprises project information, test case content, TPL, note style again, connects the generation test file path of database information and appointment.The expanded configuration item comprises: function information such as function name, function return value, function parameter.
Wherein, project information comprises other project information such as entry name, program member, testing classification, PROJECT TIME, item description, and those project information can be obtained from Project Information Table, and the user can choose by output interface when input.The test case content comprises contents such as test I D, test purpose, test description, expected results, and those test case contents can be obtained from the test case table, and the user can choose by output interface when input.The field of project information and test case content all can be used as the field of matching test use-case.
TPL, expression generates the programming language of test procedure framework, c for example, c++ etc.
The note sign, which kind of note style is test case adopt in the test procedure framework that expression generates.
Connect database information, expression will be obtained the relevant information in the test case data storehouse of test case.
The generation test file path of appointment, the path that the test procedure framework that expression generates will be preserved.
The expanded configuration item, the frame content of the pairing trial function of expression test case.
The configuration item that the unnecessary input of user is all when for example wanting to obtain the test procedure document of certain all testing classification of project, then can not be provided with the testing classification item.If do not want to limit the concrete function of test case, the test case content can be set.
In the present embodiment, if user's cuit is called G2000, testing classification is Function, and note is denoted as "/*/", and the database name that connects database information is called MySQL, database address is 10.1.1.1, the database port is 1021, and account is test, and password is test, TPL is the c language, and the generation test file path of appointment is ./G.Function name is not imported, and promptly is defaulted as the test I D of corresponding test case, and function return value (Return Value) is void, and function parameter (Parameter) is void.Other configuration item is not filled out.Therefore utilize the test case of functional test in the G2000 project to generate the test procedure framework.And the language of having determined to generate the test procedure framework is the c language, and the test procedure framework of generation is kept under the ./G path.
Step 401 forms configuration file according to generating the test frame configuration item.
In this step, generate entry name, the TPL of test frame module 130 with Basic Configuration Items, testing classification, the note sign, and the function return value of expanded configuration item, function parameter write configuration file.The information of configuration file is used for setting up engineering catalogue and testing classification sub-directory when generating the test procedure framework, and the note style of definite TPL and test case.
Step 402 generates test frame module 130 usefulness perl wscript.exes and reads configuration file.The process that reads configuration file is with shown in Figure 4 to read the configuration file process identical.Information in the configuration file is read in the configuration information variable at this moment, and wait is called.The operation according to the information and executing in the configuration file of the following stated is actually and carries out according to corresponding configuration information variable.
Step 411,412 is obtained the test case in test case data storehouse according to generating the test frame configuration item, and is derived from the test case data storehouse.
In this step, generate test frame module 130 and set up the connection of test case data storehouse according to the database information that generates in the test frame configuration item, according to the test case that generates in other content match test case data storehouse of test frame configuration item, obtain qualified test case, and from the test case data storehouse, derive.
In the present embodiment, qualified test case is that in the MySQL database, testing classification is the test case of functional test under the project G2000.Suppose to generate test frame module 133 and find a qualified test case from the test case data storehouse, test I D as shown in table 1 is the test case of F_A.
Step 413 forms test case file with the test case that derives.The form of this test case file is the XML form, and this form is imported configuration item according to the user and selected the XML Show Styles to determine.The form of test case file can also be file layouts such as HTML, RTF, TXT.After adopting the XML form to form test case file, need read this document, adopt the perl wscript.exe here with the wscript.exe of correspondence.
In the present embodiment, the test I D that finds out according to step 412 is the test case generation XML file of F A, and this XML file is as follows:
<?xml?version=″1.0″encoding=″gb2312″?>
<project?projectname=″G2000″projectmember=″alen″keyword1=″2006.10.24″
keyword2=″This?project?is?used?for?demo″>
<type?name=″Function″>
<pattern?line=″1″>
<test I D 〉
F_A
</test I D 〉
<test purpose 〉
Checking C can compile
</test purpose 〉
<test description 〉
On screen, print Hello world
</test description 〉
<expected results 〉
Hello world appears on the screen
</expected results 〉
<the test duration 〉
2006.10.24
</the test duration 〉
</pattern>
</type>
</project>
Wherein, in forming XML file process, write project information earlier, again test case is write in the different sections according to testing classification.For beginning sign, each test case identifies with use-case numbering (pattern line) section of testing classification to start with specific name (type name).The end of each section all with</as finishing sign, different sections</the content difference.
Step 420 according to configuration file and XML file, generates the test procedure framework, and writes source file.
In this step, adopt the perl wscript.exe that the content in the XML file is read in the test case variable, so as with the content match of configuration information variable, generate the test procedure framework.When writing the test procedure framework, earlier under specified path, set up engineering catalogue and testing classification sub-directory according to the content of configuration file, and in the testing classification sub-directory, set up test procedure document, the file type of foundation determines that by the TPL that the user selects filename is determined by test I D.Subsequently, open test procedure document, the test case that will extract from the test case data storehouse according to the note style writes this test procedure document with the note form, and the function framework of this test case correspondence is inserted each test case back.So just formed the source file of test procedure.After the test case that derives from test case all is written to corresponding test procedure document, constipation Shu Shengcheng test procedure framework.
Step 430 is with the source file output of test procedure framework.The tester can carry out programming and testing according to the test case in the test frame that generates like this.
To obtain method that external data generates the test procedure framework as embodiment two, referring to Fig. 6, the concrete steps that this embodiment generates the test procedure framework are as follows below:
Step 500, by the existing text use-case in the direct select File importing of the output interface module, user's input simultaneously will generate the test frame configuration item.The particular content of this configuration item is identical with the configuration item of input in Fig. 5 step 400.The existing text use-case file layout of input can be formatted files such as XML, HTML, RTF or TXT.
Step 501 forms configuration file according to generating the test frame configuration item.
Step 502 adopts the perl wscript.exe to read this configuration file.Read process and shown in Figure 4 to read the configuration file process identical.
Step 511 imports module 110 by file and obtains existing text use-case, forms external data.
In this step, obtain satisfactory existing text use-case according to generating the test frame configuration.Should test case and project information thereof have been comprised in the existing text use-case.The qualification to the use-case content extracts test case and project information thereof from the existing text use-case that obtains in the test frame configuration according to generating, and forms external data.If to the qualification of use-case content, then the test case and the project information thereof of the existing text use-case of all that will obtain do not extract, form external data.Then this external data being imported generation test frame module 133 handles.That is, to this external data inquire about, increase, operation such as deletion or modification.At this moment, the existing text use-case that obtains can exist with file layouts such as XML, HTML, RTF or TXT.
Step 512 forms external file, i.e. test case file with the external data after the above-mentioned processing.This external file can exist with file layouts such as XML, HTML, RTF or TXT.Simultaneously, this external file can also directly import in the test case data storehouse 140 and manage.Present embodiment, external file exists with the XML form, and its form is identical with the form that forms the XML file according to the test case in test case data storehouse.
Step 520 according to the external file of configuration file and XML form, generates the test procedure framework, and writes source file.
Step 530 is exported source file.The tester can carry out programming and testing according to the test case in the test frame that generates like this.
After generating test frame module 133 generation test procedure frameworks, write source file, the tester could adopt this source file programming and test.Fig. 7 is the method flow diagram that test procedure framework of the present invention writes source file, and this method may further comprise the steps:
Step 600 is read in data.These data comprise, the configuration file content of obtaining according to generation test frame configuration item in the step 614, test case and the project information thereof obtained from the test case data storehouse in the step 615, perhaps step 616 is from having test case and the project information thereof that the text use-case obtains.
Step 601 according to the specified path and the entry name of Basic Configuration Items in the configuration file, is set up the engineering catalogue with entry name under this path.
Step 602 is set up the testing classification sub-directory according to testing classification under the engineering catalogue.This testing classification sub-directory is divided into functional test file, performance test file, pressure test file, compatibility test file etc. with test procedure document.
Step 603 is set up test procedure document according to test case under each testing classification sub-directory.The test I D of file this test case by name.
Step 604 is opened the testing classification sub-directory that step 602 is set up.
Step 605 is opened the test procedure document that step 603 is set up.
Step 606 is inserted test case with the note form in test procedure.In the present embodiment "/* @...@*/".
Function entrance is inserted, function body begins and the function body end mark in order in step 607~609.Wherein the form that begins of function body is as " Retumvalue functionname (parameter) ".
Step 610 judges whether the test case content that writes current test procedure document finishes.If do not finish, then return step 606 execution in step 606~610 once more, write a test case again; Otherwise execution in step 611 judges whether the test procedure document under this testing classification sub-directory travels through.If no, then execution in step 605~611, open another test procedure document under the current testing classification sub-directory, write test case and trial function framework; Otherwise execution in step 612, judge whether the testing classification sub-directory under this project catalogue travels through, if do not have, then execution in step 604~612, under current engineering catalogue, open another testing classification sub-directory, each test procedure document under this catalogue is write corresponding test case and test procedure framework; Otherwise execution in step 613, process ends.
In the present embodiment, owing to have only one from the test case data library inquiry to qualified test case, when generating the test procedure framework, under specified path ./G, set up engineering catalogue/G2000, under this project sub-directory, set up functional test classification sub-directory/Function, under this functional test sub-directory, set up the test procedure document of file F_A.c by name, the content of this test procedure, as follows:
/*@
Test I D F_A
Test purpose checking C can compile
Test description on screen, print Hello world
Hello world appears on the expected results screen
Test duration 2006.10.24
@*/
void?F_A(void)
{
}
As seen, when generating the test procedure framework, test procedure is corresponding one by one with test case.In use, the user only need insert program coding and get final product in the F_A function, helps testing the coding personnel and increases work efficiency.
By the above as can be seen, program test management system provided by the present invention can be extracted required form test case scheme according to user's needs from existing test procedure document, improve tester's work efficiency; Secondly, the user can also operate by GUI, and the test case in the test case data storehouse is managed.In addition, the present invention can generate the test procedure framework according to user's needs, the test procedure document of generation store classifiedly with different directories under, and test case is corresponding one by one with test procedure in the test procedure document, makes things convenient for the use of tester's coding.
In sum, more than be preferred embodiment of the present invention only, be not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.