Invention content
In view of the foregoing deficiencies of prior art, the test that the purpose of the present invention is to provide a kind of based on Hadoop is used
Example distributed test method and system can realize the parallel distribution and execution of test case, to simultaneously based on Hadoop platform
Automatic test is carried out capablely, greatly improves testing efficiency.
In order to achieve the above objects and other related objects, it is distributed to provide a kind of test case based on Hadoop by the present invention
Test method includes the following steps:Step S1, test case list is downloaded;Step S2, using Hadoop platform to every node
The CPU and memory source of machine are calculated, will be in test case list parallel distribution at most platform node machine;Step S3, more
Platform node machine executes test case thereon parallel, and generates test report and daily record.
In one embodiment of the invention, in the step S1, downloaded from test case library by SVN servers needed for
Test case list.
In one embodiment of the invention, the step S2 includes the following steps:
21) number of slots of the available task tracker of every node machine is obtained;
22) the test case list in every node machine is generated.
In one embodiment of the invention, in the step 22), tested in the test case list in every node machine
Use-case quantity is the ratio of the sum and the number of slots of task tracker of test case.
In one embodiment of the invention, the step S3 includes the following steps:
31) setup test use-case list;
32) test case is downloaded according to test case list;
33) libraries installation lib;
34) test environment is installed;
35) implementation of test cases;
36) test report is pushed.
Meanwhile the present invention also provides a kind of test case distributed test system based on Hadoop, including download module,
Distribution module and execution module;
The download module is for downloading test case list;
The distribution module is used to calculate the CPU and memory source of every node machine using Hadoop platform,
It will be in test case list parallel distribution at most platform node machine;
The execution module is used in the more parallel implementations of test cases of node machine, and generates test report and daily record.
In one embodiment of the invention, needed for the download module is downloaded by SVN servers from test case library
Test case list.
In one embodiment of the invention, the distribution module passes through following steps allocation for test use-case list:
21) number of slots of the available task tracker of every node machine is obtained;
22) the test case list in every node machine is generated.
In one embodiment of the invention, in the step 22), tested in the test case list in every node machine
Use-case quantity is the ratio of the sum and the number of slots of task tracker of test case.
In one embodiment of the invention, the execution module passes through following steps implementation of test cases:
31) setup test use-case list;
32) test case is downloaded according to test case list;
33) libraries installation lib;
34) test environment is installed;
35) implementation of test cases;
36) test report is pushed.
As described above, the test case distributed test method and system based on Hadoop of the present invention, has with following
Beneficial effect:
(1) the parallel distribution and execution of test case are realized based on Hadoop platform;
(2) automatic test can be concurrently carried out, testing efficiency is greatly improved.
Specific implementation mode
Illustrate that embodiments of the present invention, those skilled in the art can be by this specification below by way of specific specific example
Disclosed content understands other advantages and effect of the present invention easily.The present invention can also pass through in addition different specific realities
The mode of applying is embodied or practiced, the various details in this specification can also be based on different viewpoints with application, without departing from
Various modifications or alterations are carried out under the spirit of the present invention.It should be noted that in the absence of conflict, following embodiment and implementation
Feature in example can be combined with each other.
It should be noted that the diagram provided in following embodiment only illustrates the basic structure of the present invention in a schematic way
Think, component count, shape and size when only display is with related component in the present invention rather than according to actual implementation in schema then
Draw, when actual implementation kenel, quantity and the ratio of each component can be a kind of random change, and its assembly layout kenel
It is likely more complexity.
The test case distributed test method based on Hadoop and system of the present invention is in automatization test system
Business Logic introduces Hadoop distributed processing platforms, includes two parts, i.e. local part and distributed node machine altogether
Device part.Specifically, the phase downloads test case list by SVN servers before testing, is disposed, then calls Hadoop
Platform calculates the CPU and memory source of every machine, and the reasonable distribution of resource is carried out according to the demand of concurrent testing, is finally executed
And generate test report and daily record.
Referring to Figures 1 and 2, the test case distributed test method of the invention based on Hadoop includes the following steps:
Step S1, test case (case) list is downloaded.
Wherein, required test case list is downloaded from test case library by SVN servers.
Step S2, the CPU and memory source of every node machine are calculated using Hadoop platform, by test case
List is parallel in distribution at most platform node machine.
Wherein, the local portion of the corresponding test case distributed test method based on Hadoop for being the present invention of the step
Point.
Specifically, step S2 includes the following steps:
21) number of slots of the available task tracker (tasktracker) of every node machine is obtained.
Wherein, Tasktracker is the child node of Hadoop computing systems.Slot position is the minimum of computation of tasktracker
Allocation unit, a slot position can correspond to a map task, one tasktracker of a machine startup.In general, according to machine
The CPU core number of device comes distributing trough position.In general, the number of slots of tasktracker subtracts 1 equal to CPU core number.
22) the test case list in every node machine is generated.
Wherein, sum and slot position of the test case quantity for test case in the test case list in every node machine
Several ratio.
Specifically, in Hadoop platform, by the top control module Jobtracker of Hadoop computing systems in distribution
When executing test assignment, unified allocation of resources resource distributes resource, controls implementation procedure, returns to test report.Jobtracker is to connect
Connect local part and the bridge of node section.
When controlling implementation procedure, Jobtracker executes following operation:
A, control operation layer executes self-defining operation.
For example, the program or configuration that are needed when operation layer test execution obtain.
B, the work (job) of Hadoop is configured.
Wherein, job include test case list input, test case list output, execute job needed for file or pressure
Contracting packet etc..
C, test job is executed.
D, summarize the operation result of every node machine, and send out report.
Step S3, more node machines execute test case thereon parallel, and generate test report and daily record.
Wherein, the distribution of the corresponding test case distributed test method based on Hadoop for being the present invention of the step
Node machine part.
Specifically, step S3 includes the following steps:
31) setup test use-case list.
Wherein, test case list is obtained from the test case list importation of map tasks.
32) test case is downloaded according to test case list.
Wherein, the test case for being similar to local standalone version here obtains.The source of test case is still SVN servers
Or test case library.
33) libraries installation lib.
34) test environment is installed.
35) implementation of test cases.
36) test report is pushed.
With reference to Fig. 3, the test case distributed test system of the invention based on Hadoop includes download module, distribution mould
Block and execution module.
Download module is for downloading test case list.
Wherein, download module downloads required test case list by SVN servers from test case library.
Distribution module is connected with download module, for the CPU and memory money using Hadoop platform to every node machine
Source is calculated, will be in test case list parallel distribution at most platform node machine.
Wherein, the local portion of the corresponding test case distributed test system based on Hadoop for being the present invention of the step
Point.
Specifically, distribution module carries out test case list distribution by following steps:
21) number of slots of the available tasktracker of every node machine is obtained.
Wherein, Tasktracker is the child node of Hadoop computing systems.Slot position is the minimum of computation of tasktracker
Allocation unit, a slot position can correspond to a map task, one tasktracker of a machine startup.In general, according to machine
The CPU core number of device comes distributing trough position.In general, the number of slots of tasktracker subtracts 1 equal to CPU core number.
22) the test case list in every node machine is generated.
Wherein, sum and slot position of the test case quantity for test case in the test case list in every node machine
Several ratio.
Specifically, in Hadoop platform, by the top control module Jobtracker of Hadoop computing systems in distribution
When executing test assignment, unified allocation of resources resource distributes resource, controls implementation procedure, returns to test report.Jobtracker is to connect
Connect local part and the bridge of node section.
When controlling implementation procedure, Jobtracker executes following operation:
A, control operation layer executes self-defining operation.
For example, the program or configuration that are needed when operation layer test execution obtain.
B, the work (job) of Hadoop is configured.
Wherein, job include test case list input, test case list output, execute job needed for file or pressure
Contracting packet etc..
C, test job is executed.
D, summarize the operation result of every node machine, and send out report.
Execution module is connected with distribution module, is used in the more parallel implementations of test cases of node machine, and generate test
Report and daily record.
Wherein, the distribution of the corresponding test case distributed test system based on Hadoop for being the present invention of the step
Node machine part.
Specifically, execution module carries out the execution of test case by following steps:
31) setup test use-case list.
Wherein, test case list is obtained from the test case list importation of map tasks.
32) test case is downloaded according to test case list.
Wherein, the test case for being similar to local standalone version here obtains.The source of test case is still SVN servers
Or test case library.
33) libraries installation lib.
34) test environment is installed.
35) implementation of test cases.
36) test report is pushed.
In conclusion the test case distributed test method based on Hadoop and system of the present invention are flat based on Hadoop
Platform realizes the parallel distribution and execution of test case;Automatic test can be concurrently carried out, testing efficiency is greatly improved.
So the present invention effectively overcomes various shortcoming in the prior art and has high industrial utilization.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripe
The personage for knowing this technology can all carry out modifications and changes to above-described embodiment without violating the spirit and scope of the present invention.Cause
This, institute is complete without departing from the spirit and technical ideas disclosed in the present invention by those of ordinary skill in the art such as
At all equivalent modifications or change, should by the present invention claim be covered.