Summary of the invention
Technical matters to be solved by this invention provides a kind of method and device of realizing software automatic test, can further improve the efficient of software test.
In order to solve the problems of the technologies described above, the invention provides a kind of method that realizes software automatic test, relate to testing tool, this method comprises:
The input and output rule of tested module is set;
On testing tool,, set test case and parameter thereof according to input and output rule editing that is provided with or importing test script;
Start the testing tool operation, tested module is tested through the testing tool implementation of test cases.
Further, on testing tool,, set test case and parameter thereof, specifically comprise according to input and output rule editing that is provided with or importing test script:
On testing tool,, perhaps import test script according to the input and output rule editing through testing tool according to input and output rule editing test script;
Set one or more test cases, set one or more parameters in the time interval of carrying out between the time interval and two test cases of the number of times carried out, execution to each test case.
Further, tested module is tested, is comprised in the following test one or more through the testing tool implementation of test cases:
Tested module is carried out the normal function test;
Tested module is carried out the test of abnormality processing, comprise that tested module receives the improper input of other module output, meets the border of tested module input rule or out-of-bounds imports and do not meet the test of one or more abnormality processing in the input of tested module input rule;
Tested module is in the test under the pressure condition; Comprise the various operations of software executing or operate under each stage tested module, go out the operating situation of tested module according to analyzing the monitoring result data statistics to the situation that takies of CPU, internal memory or virtual memory and handle.
Further, on testing tool, set in test case and the parameter thereof, the parameter of going back the initialization system monitoring resource comprises one or more parameters that take in CPU, internal memory or virtual memory and the handle;
Through the testing tool implementation of test cases tested module is tested; Also comprise: the resource of tested module being carried out monitoring system in the test process; Comprise: various operations of software executing or operate under each stage tested module to the situation that takies of CPU, internal memory or virtual memory and handle go out the operating situation of tested module according to analyzing the monitoring result data statistics.
Further, this method also comprises:
Obtain test result after the end to be tested; The correctness of checking tested module; Analyze the performance of tested module and/or software; Specifically comprise: the test result to obtaining is analyzed, and comprises to the verification of correctness of tested module processing with to tested module and/or software performance monitoring data analysis, and passes through the presented analysis result of form or figure.
In order to solve the problems of the technologies described above; The invention provides a kind of device of realizing software automatic test; Comprise that the input and output rule that connects successively is provided with module, script editor/importing module, test case setting module, testing execution module and test result analysis module, wherein:
The input and output rule is provided with module, is used to be provided with the input and output rule of tested module;
Script editor/importing module is used for input and output rule editing or importing test script according to the tested module that is provided with;
The test case setting module is used for setting test case and parameter thereof according to test script;
Testing execution module is used for through implementation of test cases tested module being tested;
The test result analysis module is used for obtaining test result after the end to be tested, the correctness of checking tested module operation, the performance of analysis tested module and/or software.
Further,
Testing execution module is except carrying out the normal function test tested module through the proper testing unit; Also tested module is carried out the test of abnormality processing through the abnormality test unit; Or through the pressure test unit tested module is in the test under the pressure condition, or through the monitoring resource unit in the resource of tested module being carried out monitoring system in the test process.
Further,
The abnormality test unit carries out the test of abnormality processing to tested module, comprises that tested module receives the improper input of other module output, meets the border of tested module input rule or out-of-bounds imports and do not meet the test of one or more abnormality processing in the input of tested module input rule.
Further,
The pressure test unit is in the test under the pressure condition to tested module; Comprise the various operations of software executing or operate under each stage tested module, go out the operating situation of tested module according to analyzing the monitoring result data statistics to the situation that takies of CPU, internal memory or virtual memory and handle.
Further,
The monitoring resource unit is in the resource of tested module being carried out monitoring system in the test process; Comprise the various operations of software executing or operate under each stage tested module, go out the operating situation of tested module according to analyzing the monitoring result data statistics to the situation that takies of CPU, internal memory or virtual memory and handle.
The present invention is through the data transmission format to the unified agreement of testing tool tested software intermodule; Editor's test script generates test case automatically on testing tool; And the number of times of setting test case; Provide the tested software single module is tested under various situation automatically, comprise the test under normal, unusual, the pressure condition, and the monitoring to system resource is provided in test process.Simultaneously, testing tool of the present invention can obtain the result that tested single module is carried out after implementation of test cases, and the result is resolved, and verifies the correctness of tested single module through judging correcting errors of execution result.The present invention has improved the work efficiency of software single module test largely, and can multianalysis running software situation.
Embodiment
Below in conjunction with accompanying drawing and preferred embodiment technical scheme of the present invention is at length set forth.Should be appreciated that following listed examples only is used for explanation and explains the present invention, and does not constitute the restriction to technical scheme of the present invention.
The method embodiment of realization software automatic test of the present invention, its flow process is as shown in Figure 1, comprises the steps:
110: the input and output rule that tested module is set;
In order to realize test to specific single module; Through such setting; Can make testing tool to communicate with communication mode and other module of tested module support, thereby to simulate tested module residing environment in software systems as far as possible through the input of the tested single module of simulation; And judge the correctness of tested single module through the output of resolving tested single module.
120: editor or importing test script, set test case and parameter thereof, the parameter of initialization system monitoring resource;
Through on testing tool of the present invention, editing test script according to specified format (input and output rule); Perhaps import test script, and set time interval of carrying out between the time interval and two test cases of number of times, execution of test case and execution thereof etc. according to the outer editor of specified format through this testing tool; Also can set the parameter of carrying out the system resource monitoring in the test process simultaneously.
130: start the testing tool operation, implementation of test cases;
After test script is accomplished the setting of editor and test case and parameter thereof, start testing tool, begin to test according to the test case of script setting.
140: except tested module being carried out the normal function test, also tested module is carried out one or more following tests:
1401: abnormality test mainly comprises:
The improper input of other module that 1) tested module receives under the software anomaly situation returns to the message of this tested module when promptly other module breaks down, notify other module of this tested module that unusual generation is arranged; Whether can normal process this improper input, carry out the fault processing of appointment if testing this tested module.
The form of this improper input should meet the tested module input rule.
2) meet the tested module input rule but the border that can't handle or out-of-bounds input, the processing that whether can correct execution reports an error of test tested module.
For example, tested module can be handled the numeral in the 1-30 scope, if input is 31, just in locating the scope that tested module can't handle, but it meets input rule, and whether the mechanism that reports an error of testing tested module thus is normal.
3) do not meet the input of tested module input rule, for example test tested module and whether can normally discern format error.
Such as module can processing format be 2, the input of 3}, and input hereto 2.3, then do not meet input rule, then test tested module and whether can discern this unacceptable input.
1402: pressure test mainly comprises:
1) whether can normally move under the pressure that the test tested module is caused by multi-thread concurrent
When multi-thread concurrent to tested module input data, can give the overall operation build-up of pressure of software.To test whether tested module still can move normally under big pressure condition this moment.
2) whether the test tested module can normally move under system pressure
For example simulating the system CPU utilization rate is 99%, and perhaps internal memory exhausts or near situation about exhausting, judges whether tested module still can normally move under this situation.
1403: the system resource monitoring mainly comprises:
1) when the various operation of software executing, to total occupancy of the CPU of system, to the CPU usage of tested module, to taking of internal memory and virtual memory, and taking handle;
2) running software is each stage (start, handle different inputs, withdraw from etc.), to the CPU usage of tested module, and to taking of internal memory or virtual memory, and taking handle
3) these data are analyzed, can be counted the situation of tested module operational process, for example; In the tested module operational process; Monitor EMS memory occupation and constantly increase, the improper situation that this tested module exists internal memory to reveal is described, need search problem belongs to and solves.
In test process, both monitoring system resource separately also can take resource to the corresponding process of tested module and monitor, and the record Monitoring Data is so that the back is to the performance evaluation of tested module.
The present invention provides the function of in the test process system resource being monitored; Set the operating position of each item resource in the automatic monitor operating system according to edit script; The system resource of the corresponding process of tested module takies situation; Form through data available or chart is showed, to grasp the performance situation of tested module operation all sidedly.
150: obtain test result, the correctness of checking tested module operation is analyzed its performance.
After treating that the software whole test process is accomplished, test result is put in order, comprise verification of correctness that tested module is handled and the arrangement of tested module performance monitoring data.Because what the performance monitoring of tested module directly obtained is data result, so can show through the form of form or figure.
The present invention is directed to said method embodiment; The device embodiment that realizes software automatic test correspondingly also is provided; Its structure is as shown in Figure 2; Comprise that the input and output rule that connects successively is provided with module, script editor/importing module, test case setting module, testing execution module and test result analysis module, wherein:
The input and output rule is provided with module, is used to be provided with the input and output rule of tested module;
Script editor/importing module is used for input and output rule editing or importing test script according to the tested module that is provided with;
The test case setting module is used for setting test case and parameter thereof according to test script;
Testing execution module is used for through implementation of test cases tested module being tested;
The test result analysis module is used for obtaining test result after the end to be tested, the correctness of checking tested module operation, the performance of analysis tested module and/or software.
In said apparatus embodiment,
Testing execution module is except carrying out the normal function test tested module through the proper testing unit; Also tested module is carried out the test of abnormality processing through the abnormality test unit; Or through the pressure test unit tested module is in the test under the pressure condition, or through the monitoring resource unit in the resource of tested module being carried out monitoring system in the test process.
In said apparatus embodiment,
Testing execution module is imported the test of processing through the abnormality test unit to tested module unusually, comprises that tested module receives the improper input of other module output, meets the border of tested module input rule or out-of-bounds imports and do not meet the test of one or more abnormality processing in the input of tested module input rule.
In said apparatus embodiment,
Testing execution module is in the test under the pressure condition through the pressure test unit to tested module, comprises whether the test tested module can normally move under the pressure that is caused by multi-thread concurrent and under system pressure respectively.
In said apparatus embodiment,
Testing execution module through the monitoring resource unit in the resource of tested module being carried out monitoring system in the test process; Comprise: various operations of software executing or operate under each stage tested module to the situation that takies of CPU, internal memory or virtual memory and handle go out the operating situation of tested module according to analyzing the monitoring result data statistics.
In said apparatus embodiment,
After test result analysis module process to be tested is accomplished; Test result to obtaining is analyzed; Comprise to the verification of correctness of tested module processing with to tested module and/or software performance monitoring data analysis, and pass through the presented analysis result of form or figure.
To those skilled in the art; After having understood content of the present invention and principle; Can be under the situation that does not deviate from the principle and scope of the present invention; Carry out various corrections and change on form and the details according to the method for the invention, but these are based on correction of the present invention with change still within claim protection domain of the present invention.