DTR – Distributed Test Runner
Supporting DTR version: 0.0.x
This package contains DTR, a distributed test runner program for decreasing build time.
DTR has the following features:
-
Run tests in mutli processes/machines.
-
Hot plug distributed runners.
-
Runtime injection, all tests run in same environment including TestRunner.
DTR works in three parts: DTR Server, Runner and Test Suite Injection.
-
DTR Server is a Rinda Server which allows DRb services and clients to automatically find each other without knowing where they live.
-
Runner is a DRb service host on distributed machines to run tests.
-
Test Suite Injection works by loading ‘dtr/inject_with_svn.rb’ with all test files.
DTR only supports Subversion to update codebase now, you may need to consider using sychronize tools (likes rsync(samba.anu.edu.au/rsync/)) to synchronize project files between machines.
Download
The latest version of DTR can be found at
Installation
Normal Installation
You can install DTR with the following command.
% ruby install.rb
from its distribution directory.
GEM Installation
Download and install DTR with the following.
gem install --remote dtr
Running the DTR Test Suite
If you wish to run the unit and functional tests that come with DTR:
-
CD into the top project directory of dtr.
-
Type one of the following:
rake # You need a version of rake installed
Online Resources
DTR References
-
DTR Documentation Home: docs.rubydtr.org
-
DTR Project Page: rubyforge.org/projects/dtr
-
DTR API Documents: dtr.rubyforge.org
Simple Example
Once installed, you can run DTR server anywhere:
% dtr -s
After server started, you can run DTR runner at your project directory as follows:
% dtr --server_address dtr_server_ip -r runner_name
Type “dtr –help” for an up-to-date option summary. Invoking dtr
without any options causes dtr to run with option ‘–server_address localhost’
Most of time your project test suite need setup environment before run tests, you can set setup command by option ‘–setup’, for example:
% dtr --server_address dtr_server_ip --r runner1 --setup "rake db:test:prepare"
At last, you need to add ‘dtr/inject_with_svn.rb’ into test_files of your test task in your Rakefile, and for load it, you also need add dtr lib path:
require 'dtr'
Rake::TestTask.new(:dtr_tests) do |t|
t.libs << DTR.lib_path
t.test_files = FileList['dtr/inject_with_svn.rb', 'test/*test.rb']
t.warning = false
t.verbose = false
end
Run tests in multi-processes on one machine
In your Rakefile:
require 'dtr/raketasks'
DTR::MPTask.new :test do |t|
t.test_files = FileList['test/*test.rb']
t.processes = 2 #default is 2
end
Credits
- Josh Price
-
For fixing tests packer in release 0.0.1.
- Wang Pengchao
-
For share of lots of ideas.
License
DTR is available under an Apache License Version 2.
Support
The DTR homepage is dtr.rubyforge.org. You can find the DTR RubyForge page at rubyforge.org/projects/dtr.
Feel free to submit commits or feature requests. If you send a patch, remember to update the corresponding unit tests. If fact, I prefer new feature to be submitted in the form of new unit tests.
For other information, feel free to ask on the ruby-talk mailing list or contact [email protected].
Usage
DTR client is invoked from the command line using:
% dtr [<em>options</em> ...]
Options are:
-s, --server Start DTR service server. There must be a DTR
server running.
-r runner1_name,runner2_name Start DTR test runner agent. The name should
be uniq of all runners. Every runner will be
start in different process. The daemons gem
must be installed, when start multiple runners
-i, --setup COMMAND Set the command for initializing test environment
for test runner, the default is no setup command
-a, --server_address ADDRESS Set server address. The default is 'localhost'.
It should be domain name or ip address, for
example: 192.168.0.1
-D, --daemon Start server/runners in daemon mode. The daemon
gem must be installed
-S, --stop_server Stop server run in daemon mode.
-R, --stop_runners Stop runners run in daemon mode.
-d, --debug Output debug log
-v, --version Show version
-h, --help Show this help doc
Other stuff
- Author
-
Li Xiao <[email protected]>
- Requires
-
Ruby 1.8.6 or later
- License
-
Copyright 2007 by Li Xiao. Released under an Apache License 2. See the LICENSE file included in the distribution.
Warranty
This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.