Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, the every other implementation that those of ordinary skill in the art are obtained without creative efforts
Example, shall fall within the protection scope of the present invention.
Automatic test management method provided by the present application, can be applicable in the application environment such as Fig. 1, the automatic test
The application environment of management method includes server and client side.Wherein, client is communicated by network with server.Client
End refers to corresponding with server, and the program of local service is provided for client, which can install but be not limited to computer, intelligence
In the equipment such as mobile phone and tablet.Server can be realized with independent server.
Fig. 2 shows the flow charts of automatic test management method in the present embodiment.The automatic test management method can answer
With in automatic test management system, so as to using the automatic test management method promoted testing efficiency, reduce manually at
This.As shown in Fig. 2, the automatic test management method includes the following steps executed on use-case test platform:
S10:The original test case of the first edit format is obtained, original test case includes at least one primitive element.
Wherein, use-case test platform is the platform for carrying out automatic test according to test case.First edit format
Including but not limited to Excel formats.Original test case refers to that tester compiles according to the testing requirement of test system to be measured
Collect obtained testing scheme.The original test case includes at least one primitive element.Test system to be measured refers to that will carry out
The system of test.In the present embodiment, primitive element includes but not limited to test case number, affiliated product, use-case title, use-case
Important level, precondition, testing procedure, check post, verification point identification, check post expected result, test environment, by number,
Failure number skips the fields such as number, percent of pass, failure problem reason and use-case state.Use-case state refers to the state that use-case executes,
It includes processed, untreated and pending, can be embodied in implementation of test cases later.
Specifically, test case number, affiliated product, use-case title, use-case important level, precondition, testing procedure,
Check post, the occurrence for verifying the elements such as point identification and check post expected result are pre-defined by tester, and are surveyed
Test ring border, by number, unsuccessfully count, skip number, the occurrence of percent of pass, the elements such as failure problem reason and use-case state is desirable
It is obtained by subsequent test result.
Specifically, testing procedure be according to testing requirement be designed for realizing automatic test the step of, such as
When testing the function that APP is logined successfully, testing procedure setting is as follows:1, APP is opened;2, it clicks and skips to log in page after logging in;
3, it inputs username and password and clicks submission;4, homepage is skipped to after logining successfully.Check post refers to that the test to be verified is wanted
Point all meets the requirements for example, the check post of APP login functions can be username and password and is correct, or checks
Whether can login successfully.Verification point identification is the unique mark of check post for identification.Before precondition refers to test case execution
The condition to be met.Such as before execution use-case B, it is necessary to first carry out A, then the precondition of use-case B is to execute A.
S20:Test request is obtained, test request includes test-types.
Wherein, test request is to carry out the request of automatic test to test case for triggering use-case test platform.It should
Test request includes test-types, which refers to the class of pre-stored test report template in use-case test platform
Type.Test elements included by each type of test report template are different.In the present embodiment, test report template includes but not
It is limited to performance test and functional test.
Specifically, it can show that test report template list, tester can pass through dragging or point on use-case test platform
It hits corresponding test report template in template list to be determined, so that dragging or clicking operation of the server based on tester
Corresponding test request is obtained, the test-types in the test request are the test report mould that tester pulls or clicks
The type of plate.
S30:Based on test-types, corresponding at least one object element is determined.
Specifically, the corresponding testing requirement difference of different test systems to be measured, that is, different corresponding test of testing requirement is reported
The type of slide former is different.The testing requirement includes but not limited to performance test and functional test.And it is required in performance test
Test elements it is different from the required test elements of institute in functional test.Such as:Performance test is the properties to system
Index (such as CPU occupation rates) is tested on condition that each function of system does not occur exception.And functional test is each to system
Function whether can normal operation tested.Wherein, object element be tester according to testing requirement it is selected into
The essential elements of row test.Specifically, a search column can be shown on use-case test platform, for tester search needed for
The type of test report template, server can based on the type search database for the test report template that tester is searched for,
To obtain test report template corresponding with the test report template type that tester selects, test report model includes
Test elements be object element.The operating process is simple and convenient, improves efficiency.
It specifically, can be with if tester thinks that required test report template is called to lack required test elements
It is added test elements operation, i.e., voluntarily adds required test elements into template, so that server is added based on user
Test elements, determine at least one object element.It is to be appreciated that it includes in test report template that the object element, which removes, at this time
Test elements outside, further include the test elements added in tester's later stage, to enhance the availability of use-case test platform, fully
Meet user demand.
Further, into test report template add test elements when, can select batch addition manner or by
A addition manner, i.e., when user test elements to be added be more than N (N be the numerical value of default setting, and N is the integer more than 0)
When, batch addition manner may be selected, efficiency is added to improve element;When user the quantity of test elements to be added be not more than
When N, addition manner one by one may be selected, it is too many to avoid the display elements on the visualization interface of use-case test platform so that
Interface resources occupation rate is high, reduces loading speed.It specifically, can be to if user adds test elements using addition manner one by one
The addition instruction of use-case test platform input test element can customize the survey to be added of input institute in test elements addition instruction
Try the quantity of element;When such as selecting batch addition manner, can self-defined batch parameter, when batch parameter definition be 1 when, that is, select
Addition manner one by one is selected, to reach addition easily purpose.
S40:If including all object elements at least one primitive element of original test case, original test is used
Example carries out format conversion, obtains the target detection use-case of XML format.
Wherein, target detection use-case is the test case for original test case convert obtained XML format.
XML is extensible markup language, for marking electronic document, makes it have structural markup language.By in this present embodiment
Used test frame is tested the test case of XML format, therefore, need to be used the original test of Excel formats
Example is converted, and the target detection use-case of XML format is obtained, with clearly reflect the original test cases of Excel formats with
It is low to grasp threshold convenient for checking for the contrast relationship of XML file.
Specifically, since the test elements in original test case include not necessarily target element necessary to all tests
Element, can lead to the problem that test execution is unsuccessful or accuracy rate is not high, thus need to the primitive element in original test case into
Row judges.If at least one primitive element of original test case include all object elements, to original test case into
Row format is converted, and the target detection use-case of XML format is obtained.If not including at least one primitive element of original test case
All object elements lack object element necessary to test, then give mailbox or other communications of corresponding tester
Account number sends prompting message and achievees the purpose that timely feedback with the testing progress that follows up.
S50:Target detection use-case is imported into test frame and is tested, test report is obtained.
Wherein, test report is for describing or evaluating whether test system to be measured meets statement of requirements.In the present embodiment, survey
Examination is reported as html formatted files.Test frame is to carry out the obtained frame of secondary development based on third-party test frame.
Specifically, the method for reading file built-in in third-party testing frame, interface testing combined into the method for URL, judge to verify
Point whether by method (such as commonly use asset methods in testNG to judge whether check post passes through), acquisition page elements
Method and the method that generates test report be packaged, to realize secondary development to third-party testing frame.Server is logical
It crosses and target detection use-case is imported into test frame and calls the method for reading file built-in in test frame, interface testing
Combine URL method, judge check post whether by method, obtain page elements method tested, finally, based on survey
The method for trying the generation test report in frame generates corresponding test report, to analyze system to be tested, and
Shi Youhua test systems to be measured.
In the present embodiment, the original test case of the first edit format is first obtained, which includes at least one
A primitive element;Test report template list can be shown on use-case test platform based on the test request got again, tested
Personnel can select the type of test report template according to self-demand, to obtain required test report template, operation
Simply.Then, the test elements for including according to test report template are with the corresponding at least one object element of determination, if original
Include all object elements at least one primitive element of test case, then format conversion is carried out to original test case, obtained
The target detection use-case for taking XML format, clearly to reflect the contrast relationship of original test case and XML file, convenient for looking into
It sees.Finally, target detection use-case is imported into test frame and is tested, and based on the generation test report in test frame
Method generate corresponding test report, to analyze system to be tested, to optimize test system to be measured in time.
In a specific embodiment, as shown in figure 3, in step S40, i.e., format conversion is carried out to original test case,
The target detection use-case for obtaining XML format, specifically comprises the following steps:
S41:Original test case is traversed line by line, and by number corresponding with object element in original test case
According to being stored in data structure.
Wherein, data structure refer in Java in the form of key-value pair existing for structure, i.e. Map interfaces in Java.
Map interfaces are the interfaces stored in the form of key-value pair.The data structure includes HashTable, HashMap and TreeMap
The methods of.Wherein, HashMap is a most common Map class, it is to store data according to the one-to-one relationship of key assignments,
Server can be made to be directly obtained its corresponding value according to key.HashMap methods at most only allow the key of a record to be sky,
It is sky to allow the value of a plurality of record, ensures the integrality of data, also, HashMap methods are asynchronous progress, to improve data
Storage efficiency.
In the present embodiment, server can traverse original test case line by line, obtain the data of original use-case, and will
Data corresponding with object element, are stored in data structure in original test case.Specifically, the side HashMap can be used
Method stores data corresponding with object element in original test case, it is ensured that the integrality of data, the storage for improving data
Efficiency and the convenience of inquiry.
In one embodiment, as shown in figure 4, in step S41, i.e., original test case is traversed line by line, and will be former
Data corresponding with object element, are stored in data structure, specifically comprise the following steps in beginning test case:
S411:Using the method function for reading file, every data line in original test case is read line by line, and will be every
Data line separates according to preset format, is stored in array.
Wherein, preset format is to separate to be split using comma symbol.In the present embodiment, the method function for reading file is adopted
File is read with InputStreamReader methods, InputStreamReader methods are the bridges of byte stream and character stream,
It reads byte using specified charset and decodes it as character.Specifically, server is using the method letter for reading file
Number, reads every data line in original test case line by line, and often data line be separated according to preset format, by data with
The form of key-value pair is stored in array, without being defined for each variable (data), is conveniently checked.Also, due to definition
It when array, is defined using same variable name, improves the access efficiency of data in subsequent access array.
S412:The data corresponding with object element in array are read, and are stored data in data structure.
Specifically, server is adopted by accessing aray variable to read the data corresponding with object element in array
Data, that is, key-value pair of reading is stored in data structure with put (key, the value) methods in HashMap.Wherein, put
Method is by designated value and the associated method of assignment key, and this method is easy to operate, it is easy to accomplish.In the present embodiment, server is adopted
Data corresponding with object element in array are read with the method for accessing aray variable, and using the put methods in HashMap
The data of reading are stored in data structure one by one, so that the data in data structure are written in XML file.
In the present embodiment, server is read each in original test case line by line using the method function for reading file
Row data, and separating according to preset format per data line, are stored in array, without to each variable (data) into
Row definition, is conveniently checked.Finally, server reads the data corresponding with object element in array, and using in HashMap
Put methods the data read are stored in data structure one by one, to improve the storage efficiency of data.
S42:Data in data structure are written in XML file, target detection use-case is obtained.
Wherein, XML file includes data label i.e. key (key)-value (value).Specifically, using object element as XML
Key (key) in file, traverses original test case line by line, obtains object element, which includes target element
Plain and corresponding element value.Then, by the data label in the relationship map to XML file of object element and corresponding element value
In.It is to be appreciated that object element is mapped to the key (key) in XML file, and the mapping based on object element and element value
Corresponding (value) being mapped in XML file of element value is convenient for testing by relationship to obtain target detection use-case.
In the present embodiment, original test case is traversed line by line, and by original test case with object element phase
Data corresponding with object element in original test case are stored in data knot by corresponding data using HashMap methods
In structure, so that mapping relations of the data in data structure based on object element and element value are mapped in XML file, to obtain
Target detection use-case is taken, which is not necessarily to the target detection use-case of manual creation XML format, completely automatic by use-case test platform
It generates, reduces cost of labor, and improve the formation efficiency of test case.
In a specific embodiment, as shown in figure 5, in step S50, i.e., target detection use-case is imported into test frame
In tested, obtain test report, specifically comprise the following steps:
S51:Target detection use-case is imported into test frame and is tested, test result is obtained.
Wherein, test result includes passing through number, unsuccessfully counting, skip number, percent of pass and failure problem reason.Failure problem is former
Because being the error point by the obtained testing procedure of implementation of test cases.Specifically, target detection use-case is imported into test
It is tested in frame, to obtain test result.In the present embodiment, if the quantity of test system to be measured is more, tester
Test system to be measured in use-case test platform can be grouped to batch testing, increase working efficiency.
S52:Based on test result, attribute value corresponding with object element is obtained, and attribute value is mapped to target element
In element, test report is obtained.
Specifically, it is based on by number, unsuccessfully counting, skipping number, percent of pass and failure problem reason etc. based on test result
The test result of element obtains attribute value corresponding with object element, and attribute value is mapped to object element accordingly
In, using the method for the generation test report in test frame, the test report of html formats is automatically generated, which is not necessarily to people
Test report can be automatically generated to intervene, to improve working efficiency, reduces cost of labor.
Further, after obtaining test report, use-case test platform can will obtain test report and be sent to and tester
The corresponding mailbox of member optimizes test system to be measured so that tester can analyze according to test report in time.
In the present embodiment, target detection use-case is imported into test frame in use-case test platform and is tested, obtained
Test result obtains attribute value corresponding with object element to be based on test result, and attribute value is mapped to target element
In element, test report is obtained, the test report got is sent to mailbox corresponding with tester, so that tester's energy
It is enough that test report is analyzed in time, the real time synchronization of automatic test management process is enhanced, working efficiency is improved.
In a specific embodiment, before step S10, as shown in fig. 6, the automatic test management method further include as
Lower step:
S60:The original test case of the first edit format is created in use-case editing platform, and original test case is sent out
Give use-case audit platform.
Wherein, use-case editing platform refers to the management platform that tester is used for creating original test case.Use-case is audited
Platform is the platform for referring to audit the original test case transmitted by tester.In the present embodiment, compiled in use-case
The original test case that the first edit format is created in volume platform, due to test case editor whether specification or reasonable direct shadow
The accuracy rate of test is rung, therefore original test case need to be sent to use-case audit platform and audited.
S70:Use-case auditing result is obtained on use-case audit platform, it, will if use-case auditing result is when auditing to pass through
Original test case is sent to use-case test platform.
Specifically, if use-case auditing result is that the audit fails, use-case audit platform can send original test case
It modifies to use-case editing platform, modified original test case can be sent to use-case audit by use-case editing platform later
Platform is audited, the original test case passed through until obtaining audit.Alternatively, when if the audit fails, use-case audits platform
The audit modification instruction of auditor's input can be obtained, and original test case is repaiied based on audit modification instruction
Change, to obtain the original test case that audit passes through.In the present embodiment, the original test case that audit passes through only is sent to use
Example test platform improves the accuracy rate of test to increase the reliability of original test case.
In the present embodiment, use-case editing platform, use-case audit platform and use-case test platform are connected by B/S frameworks
It connects.Wherein, B/S frameworks, that is, browser and server structure, under this configuration, user job interface is to pass through web browser
It realizes, few partial transaction logic is realized at browser (Browser), but major affairs logic is at server (Server)
It realizes.B/S frameworks are a kind of network structure patterns after WEB rises, and web browser is the most important application software of client.
Use-case editing platform, use-case audit platform and use-case test platform are connected by B/S frameworks, can be used family without downloading, as long as
Browser is installed to can be used, substantially reduces maintenance cost.
In a specific embodiment, as shown in fig. 7, in step S60, i.e., original test case is sent to use-case audit
Platform specifically comprises the following steps:
S61:Privileges configuration request is obtained in use-case editing platform, privileges configuration request includes auditor ID and use-case
ID。
Specifically, if desired tester specifies auditor to the original when preserving the original test case editted
When beginning test case is audited, the audit authority configuration button shown on interface can be clicked, use-case editing platform can obtain at this time
Audit privileges configuration request input by user is got, which includes auditor ID and use-case ID, so as to
The corresponding original test cases of use-case ID are distributed into the corresponding auditors of auditor ID.Wherein, auditor ID is to use
In the unique mark of identification auditor.Use-case ID is the unique mark of original test case for identification.
S62:Based on privileges configuration request, original test case is sent to use-case and audits platform, so that auditor ID
Corresponding audit interface display original test case corresponding with use-case ID.
Specifically, tester audits original test case in the corresponding auditors of specified auditor ID
When, it clicks and uploads, original test case can be sent to audit corresponding with auditor ID interface by use-case editing platform,
And give the corresponding audit mailboxes of auditor ID and send prompting message, so that auditor can be in time to original test case
It is audited, improves testing efficiency.
In the present embodiment, privileges configuration request is obtained in use-case editing platform, which includes auditor
Member ID and use-case ID, is based on privileges configuration request, and original test case, which is sent to use-case, audits platform, so that auditor ID
Corresponding audit interface display original test case corresponding with use-case ID distributes the corresponding original test cases of use-case ID
Give the auditor ID corresponding auditors, so as to auditor can timely processing, enhancing automatic test management process
Real time synchronization is less prone to careless mistake, improves working efficiency.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process
Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit
It is fixed.
In one embodiment, a kind of automatic test management system is provided, which manages system and above-mentioned reality
Automatic test management method in example is applied to correspond.As shown in figure 8, automatic test management system includes that use-case editor is flat
Platform, use-case audit platform and use-case test platform.Wherein, use-case editing platform includes original test case creation module 60.With
Example audit platform includes original test case auditing module 70.Use-case test platform include original test case acquisition module 10,
Test request acquisition module 20, object element determining module 30, target detection use-case acquisition module 40 and test report obtain mould
Block 50.Detailed description are as follows for each function module:
Automatic test management system includes use-case editing platform, use-case audit platform and use-case test platform.
Preferably, use-case editing platform includes original test case creation module 60.
Original test case creation module 60, the original test for creating the first edit format in use-case editing platform
Use-case, and original test case is sent to use-case and audits platform.
Preferably, original test case creation module 60 includes privileges configuration request acquiring unit 61 and original test case
Transmission unit 62.
Privileges configuration request obtains subelement 61, and for obtaining privileges configuration request in use-case editing platform, permission is matched
It includes auditor ID and use-case ID to set request.
Original test case is sent to use by original test case transmission sub-unit 62 for being based on privileges configuration request
Example audit platform, so that the corresponding audit interface displays of auditor ID original test case corresponding with use-case ID.
Preferably, use-case audit platform includes original test case auditing module 70.
Original test case auditing module 70, for obtaining use-case auditing result on use-case audit platform, if use-case is examined
When core result is that audit passes through, then original test case is sent to use-case test platform.
Wherein, use-case editing platform, use-case audit platform and use-case test platform are attached by B/S frameworks.
Preferably, use-case test platform includes original test case acquisition module 10, test request acquisition module 20, target
Element determining module 30, target detection use-case acquisition module 40 and test report acquisition module 50.
Original test case acquisition module 10, the original test case for obtaining the first edit format, original test are used
Example includes at least one primitive element.
Test request acquisition module 20, for obtaining test request, test request includes test-types.
Object element determining module 30 determines corresponding at least one object element for being based on test-types.
Target detection use-case acquisition module 40, if for including all at least one primitive element of original test case
Object element then carries out format conversion to original test case, obtains the target detection use-case of XML format.
Test report acquisition module 50 is tested for target detection use-case to be imported into test frame, is obtained and is surveyed
Examination report.
Preferably, target detection use-case acquisition module 40 includes original test case Traversal Unit 41 and target detection use-case
Acquiring unit 42.
Original test case Traversal Unit 41, is traversed line by line for original test case, and by original test case
In data corresponding with object element, be stored in data structure.
Target detection use-case acquiring unit 42 obtains target for the data in data structure to be written in XML file
Test case.
Preferably, original test case Traversal Unit 41 includes that original test case reading unit 411 and data storage are single
Member 412.
Original test case reading unit 411, for using the method function for reading file, reading original test line by line and using
Every data line in example, and will separate according to preset format per data line, it is stored in array.
Data storage cell 412 for reading the data corresponding with object element in array, and stores data in
In data structure.
Preferably, test report acquisition module 50 includes test result acquiring unit 51 and test report acquiring unit 52.
Test result acquiring unit 51 is tested for target detection use-case to be imported into test frame, is obtained and is surveyed
Test result.
Test report acquiring unit 52 obtains attribute value corresponding with object element, and will for being based on test result
Attribute value is mapped in object element, obtains test report.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each work(
Can unit, module division progress for example, in practical application, can be as needed and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of the system are divided into different functional units or module, more than completion
The all or part of function of description.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to aforementioned reality
Applying example, invention is explained in detail, it will be understood by those of ordinary skill in the art that:It still can be to aforementioned each
Technical solution recorded in embodiment is modified or equivalent replacement of some of the technical features;And these are changed
Or replace, the spirit and scope for various embodiments of the present invention technical solution that it does not separate the essence of the corresponding technical solution should all
It is included within protection scope of the present invention.