Summary of the invention
Technical matters to be solved by this invention is to provide a kind of method and the device that realize software automatic test, can improve the efficiency of software test further.
In order to solve the problems of the technologies described above, the invention provides a kind of method realizing software automatic test, relate to testing tool, the method comprises:
The input and output rule of tested module is set;
According to the input and output rule editing arranged or importing test script on testing tool, setting test case and parameter thereof;
Start testing tool to run, by testing tool implementation of test cases, tested module is tested.
Further, according to the input and output rule editing arranged or importing test script on testing tool, setting test case and parameter thereof, specifically comprise:
According to input and output rule editing test script on testing tool, or import the test script according to input and output rule editing by testing tool;
Set one or more test case, for one or more parameters in the time interval performed between the number of times of each test case setting execution, the time interval of execution and two test cases.
Further, by testing tool implementation of test cases, tested module is tested, comprise in following test one or more:
Normal function test is carried out to tested module;
Tested module is carried out to the test of abnormality processing, comprise tested module receive other module export abnormal input, meet tested module input rule border or out-of-bounds input and do not meet the test of one or more abnormality processing in the input of tested module input rule;
Test under pressure condition is in tested module, comprise software perform various operation or operate in each stage under tested module situation is taken to CPU, internal memory or virtual memory and handle, count the operating situation of tested module according to research and application result data.
Further, while testing tool sets test case and parameter thereof, go back the parameter of initialization system monitoring resource, comprise one or more parameters taken in CPU, internal memory or virtual memory and handle;
By testing tool implementation of test cases, tested module is tested, also comprise: the resource of tested module being carried out to monitoring system in test process, comprise: under software performs various operation or operates in each stage, tested module takies situation to CPU, internal memory or virtual memory and handle, counts the operating situation of tested module according to research and application result data.
Further, the method also comprises:
Test result is obtained after end to be tested, the correctness of checking tested module, analyze the performance of tested module and/or software, specifically comprise: the test result obtained is analyzed, comprise the verification of correctness of tested module process and the analysis to tested module and/or software performance Monitoring Data, and show analysis result by the form of form or figure.
In order to solve the problems of the technologies described above, the invention provides a kind of device realizing software automatic test, comprise the input and output rule connected successively and module, Scripting Edition/importing module, test case setting module, testing execution module and test result analysis module are set, wherein:
Input and output rule arranges module, for arranging the input and output rule of tested module;
Scripting Edition/importing module, for input and output rule editing or the importing test script of the tested module according to setting;
Test case setting module, for setting test case and parameter thereof according to test script;
Testing execution module, for testing tested module by implementation of test cases;
Test result analysis module, for obtaining test result after end to be tested, the correctness that checking tested module runs, analyzes the performance of tested module and/or software.
Further,
Testing execution module is except carrying out except normal function test by proper testing unit to tested module, also by abnormality test unit, tested module is carried out to the test of abnormality processing, or the test be in tested module by pressure test unit under pressure condition, or by monitoring resource unit in the resource of tested module being carried out to monitoring system in test process.
Further,
Abnormality test unit carries out the test of abnormality processing to tested module, comprise tested module receive other module export abnormal input, meet tested module input rule border or out-of-bounds input and do not meet the test of one or more abnormality processing in the input of tested module input rule.
Further,
Pressure test unit is in the test under pressure condition to tested module, comprise software perform various operation or operate in each stage under tested module situation is taken to CPU, internal memory or virtual memory and handle, count the operating situation of tested module according to research and application result data.
Further,
Monitoring resource unit is carrying out the resource of monitoring system in test process to tested module, comprise software perform various operation or operate in each stage under tested module situation is taken to CPU, internal memory or virtual memory and handle, count the operating situation of tested module according to research and application result data.
The present invention is by the data transmission format to testing tool unified agreement tested software intermodule, testing tool is edited the automatic generating test use case of test script, and set the number of times of test case, there is provided and tested software single module is tested in all cases automatically, comprise the test under normal, exception, pressure condition, and the monitoring to system resource is provided in test process.Meanwhile, testing tool of the present invention can obtain the result that tested single module performs after implementation of test cases, resolves result, by judging that correcting errors of execution result verifies the correctness of tested single module.The present invention improves 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 set forth in detail.Should be appreciated that, the embodiment below enumerated only for instruction and explanation of the present invention, and does not form the restriction to technical solution of the present invention.
The embodiment of the method realizing software automatic test of the present invention, its flow process as shown in Figure 1, comprises the steps:
110: the input and output rule that tested module is set;
In order to realize the test to specific single module, by such setting, testing tool can be made by the input of the tested single module of simulation, can to communicate with other module with the communication mode of tested module support, thus the environment that simulation tested module is residing in software systems as far as possible; And the correctness of tested single module is judged by the output of resolving tested single module.
120: editor or importing test script, setting test case and parameter thereof, the parameter of initialization system monitoring resource;
By editing test script according to specified format (input and output rule) on testing tool of the present invention, or imported the test script edited according to specified format by this testing tool outward, and set the time interval etc. performed between the number of times of test case and execution thereof, the time interval of execution and two test cases; Also can set the parameter of carrying out system resource monitoring in test process simultaneously.
130: start testing tool and run, implementation of test cases;
After test script completes the setting of editor and test case and parameter thereof, start testing tool, start to test according to the test case that script is arranged.
140: except carrying out except normal function test to tested module, also one or more following tests are carried out to tested module:
1401: abnormality test, mainly comprise:
1) abnormal input of other module that in software anomaly situation, tested module receives, returns to the message of this tested module, notifies that other module of this tested module has abnormal generation when namely other module breaks down; Whether can normal process this abnormal input, perform the error handle of specifying if testing this tested module.
The form of this abnormal input should meet tested module input rule.
2) meet tested module input rule but the border that cannot process or out-of-bounds input, whether test tested module can correctly perform the process that reports an error.
For example, tested module can process the numeral within the scope of 1-30, if input is 31, just in the scope that place's tested module cannot process, but it meets input rule, and whether the mechanism that reports an error of testing tested module is thus normal.
3) do not meet the input of tested module input rule, such as, test tested module and whether normally can identify format error.
Such as module can processing format be the input of 2,3}, and for this input 2.3, then do not meet input rule, then test tested module whether can identify this unacceptable input.
1402: pressure test, mainly comprise:
1) whether can normally run under the pressure that test tested module is caused by multi-thread concurrent
When multi-thread concurrent to tested module input data, can the overall operation build-up of pressure of software be given.Whether now will test tested module under large pressure condition still can normal operation.
2) test tested module whether can normally run under system pressure
For example simulating system CPU utilization rate is 99%, or internal memory exhausts or close to situation about exhausting, under judging this situation, whether tested module still can normally run.
1403: monitoring of system resource, mainly comprise:
1) when software performs various operation, 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, the different input of process, exits), to the CPU usage of tested module, to taking of internal memory or virtual memory, and taking handle
3) to these data analysis, the situation of tested module operational process can be counted, such as, when in tested module operational process, monitor EMS memory occupation constantly to increase, illustrate that this tested module exists the abnormal condition of RAM leakage, need to search problem place solving.
In test process, both can monitoring system resource separately, also the process corresponding to tested module can take resource and monitor, record Monitoring Data, so that below to the performance evaluation of tested module.
The invention provides in test process the function that system resource is monitored, the service condition of every resource in automatic monitor operating system is set according to edit script, the system resource of the corresponding process of tested module takies situation, shown by the form of data available or chart, to grasp the behavior pattern that tested module runs all sidedly.
150: obtain test result, the correctness that checking tested module runs, analyzes its performance.
After the whole test process of software completes, test result is arranged, comprise the verification of correctness of tested module process and the arrangement to tested module performance monitoring data.What the performance monitoring due to tested module directly obtained is data result, therefore can be shown by the form of form or figure.
The present invention is directed to said method embodiment, correspondingly additionally provide the device embodiment realizing software automatic test, its structure as shown in Figure 2, comprise the input and output rule connected successively and module, Scripting Edition/importing module, test case setting module, testing execution module and test result analysis module are set, wherein:
Input and output rule arranges module, for arranging the input and output rule of tested module;
Scripting Edition/importing module, for input and output rule editing or the importing test script of the tested module according to setting;
Test case setting module, for setting test case and parameter thereof according to test script;
Testing execution module, for testing tested module by implementation of test cases;
Test result analysis module, for obtaining test result after end to be tested, the correctness that checking tested module runs, analyzes the performance of tested module and/or software.
In said apparatus embodiment,
Testing execution module is except carrying out except normal function test by proper testing unit to tested module, also by abnormality test unit, tested module is carried out to the test of abnormality processing, or the test be in tested module by pressure test unit under pressure condition, or by monitoring resource unit in the resource of tested module being carried out to monitoring system in test process.
In said apparatus embodiment,
Testing execution module carries out the test of abnormal input processing to tested module by abnormality test unit, comprise tested module receive other module export abnormal input, meet tested module input rule border or out-of-bounds input and do not meet the test of one or more abnormality processing in the input of tested module input rule.
In said apparatus embodiment,
Whether testing execution module is in the test under pressure condition to tested module by pressure test unit, comprise test tested module and can normally run under the pressure caused by multi-thread concurrent and under system pressure respectively.
In said apparatus embodiment,
Testing execution module by monitoring resource unit in the resource of tested module being carried out to monitoring system in test process, comprise: under software performs various operation or operates in each stage, tested module takies situation to CPU, internal memory or virtual memory and handle, counts the operating situation of tested module according to research and application result data.
In said apparatus embodiment,
After test result analysis module process to be tested completes, the test result obtained is analyzed, comprise the verification of correctness of tested module process and the analysis to tested module and/or software performance Monitoring Data, and show analysis result by the form of form or figure.
For those skilled in the art; after having understood content of the present invention and principle; can when not deviating from the principle and scope of the present invention; carry out various correction in form and details and change according to method of the present invention, but these are based on correction of the present invention with change still within claims of the present invention.