DTR – Distributed Test Runner
Supporting DTR version: 0.0.x
This package contains DTR, a distributed test runner program for decreasing build time.
DTR works in two parts: DTR Client and DTR Server. DTR Server controls all tests running or setting up test env. DTR Clients is always waiting for commands from DTR server to:
-
set up test env
-
run test and update report to DTR Server
DTR has the following features:
-
Run tests in mutli-processes/machines
-
Setup test env before running test.
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 client at your project directory as follows …
% dtr --server druby://build_server_ip:1314 --name client_name --port 3344
(The default port of dtr server is '1314')
Type “dtr –help” for an up-to-date option summary. Invoking dtr
without any options causes dtr to run with option ‘–server druby://localhost:1314 –port 3344’
In your Rakefile, you can custom a task to let DTR server run tests:
require "rubygems"
require 'dtr'
task :cruise do
tests = FileList["test/unit/**/*test.rb].to_a
fail "Failed" unless DTR.run(tests, ['druby://client_1_ip:3344', 'druby://localhost:3344'])
end
Run tests in multi-processes on one machine
In your Rakefile:
task :dtr => ["start_clients", "db:test:prepare"] do
fail "Failed" unless DTR.run(FileList["test/unit/**/*test.rb].to_a, ['druby://localhost:3345', 'druby://localhost:3346'])
ensure
DTR::ClientServer.stop_all
end
task :start_clients do
DTR::ClientServer.new(:client_name => "client 1", :port => "3345").start
puts "client 1 started"
DTR::ClientServer.new(:client_name => "client 2", :port => "3346").start
puts "client 2 started"
sleep(2)
end
Credits
- Josh Price
-
For fixing tests packer.
- 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_uri SERVER_URI DTR server uri
-n, --name NAME DTR client name, the default is string 'client' with a time stamp.
-o, --output_dir OUTPUT_DIR the dir for DTR client to output logs, the default is 'dtr_tmp'.
-i, --setup COMMAND Define the command for initializing test environment, the default is 'rake db:test:prepare'
-p, --port PORT Define DTR client port, the default is 3344
-t, --trace Turn on invoke/execute tracing.
-u, --stdout Print all log into stdout.
-v, --version Show version
-h, --help Show this help doc
Other stuff
- Author
-
Li Xiao <[email protected]>
- Requires
-
Ruby 1.8.0 or later
- License
-
Copyright 2007 by Li Xiao. Released under an Apache License. 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.