tlb-testunit19 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
## Using tlb.rb:
|
2
|
+
|
3
|
+
__tlb.rb__ uses [tlb](https://github.com/test-load-balancer/tlb "TLB") under the hood. It runs a sub-process which talks to the actual tlb-server(or equivallent) to balance and post run-feedback.
|
4
|
+
Balancer process is actually an HTTP server which listen to a certain TCP port so tlb-ruby library can talk to it.
|
5
|
+
This is controlled by an environment variable named *'TLB_BALANCER_PORT'*, which can be set to any port number(integer between 1024 to 65535) that is guaranteed to remain un-bound while the build runs.
|
6
|
+
|
7
|
+
In addition to this extra environment variable, the usual TLB environment variable setup is required(so the balancer knows things like what partitioning algorithm to use or the type of server it has to talk to etc).
|
8
|
+
Detailed documentation of TLB environment variable configuration is available at [http://test-load-balancer.github.com](http://test-load-balancer.github.com "Tlb Documentation")
|
9
|
+
|
10
|
+
__tlb.rb__ supports RSpec(1.x and 2.x), Cucumber and Test::Unit, which are the most widely used testing frameworks in the Ruby world.
|
11
|
+
|
12
|
+
__tlb.rb__ is fully compatible with both Ruby 1.9 and 1.8 across __MRI__ and __JRuby__. However, 1.9 support will be available only version 0.3.2 onwards.
|
13
|
+
|
14
|
+
We test __tlb.rb__ on MRI and JRuby, however it should work with other flavours of Ruby(like REE) as well.
|
15
|
+
|
16
|
+
## Getting tlb.rb:
|
17
|
+
|
18
|
+
__RSpec2__ support(both __1.9__ and __1.8__):
|
19
|
+
$ gem install tlb-rspec2
|
20
|
+
|
21
|
+
__Cucumber__ support(both __1.9__ and __1.8__):
|
22
|
+
$ gem install tlb-cucumber
|
23
|
+
|
24
|
+
__RSpec1__ support(both __1.9__ and __1.8__):
|
25
|
+
$ gem install tlb-rspec1
|
26
|
+
|
27
|
+
__Test::Unit__ support on Ruby __1.9__:(available 0.3.2 onwards)
|
28
|
+
$ gem install tlb-testunit19
|
29
|
+
|
30
|
+
__Test::Unit__ support on Ruby __1.8__:(available 0.3.2 onwards)
|
31
|
+
$ gem install tlb-testunit18
|
32
|
+
|
33
|
+
If a version older than 0.3.2, please use
|
34
|
+
$ gem install tlb-testunit
|
35
|
+
for Test::Unit support.
|
36
|
+
|
37
|
+
## Setting it up for your project
|
38
|
+
|
39
|
+
Please refer documentation on [http://test-load-balancer.github.com/](http://test-load-balancer.github.com/ "TLB Website") for detailed setup instructions.
|
40
|
+
|
41
|
+
Documentation also explains TLB concepts and customization options in fair amount of detail. We highly recomend going through the TLB documentation.
|
42
|
+
|
43
|
+
## Want a feature? Found a bug?
|
44
|
+
|
45
|
+
Post it at [Issue Tracker](http://code.google.com/p/tlb/issues/list "Issue Tracker").
|
46
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'tlb'
|
3
|
+
require 'tlb/test_unit/test_splitter'
|
4
|
+
require 'tlb/test_unit/test_observer'
|
5
|
+
require 'test/unit/ui/testrunnermediator'
|
6
|
+
|
7
|
+
module Tlb::TestUnit::MediatorInflection
|
8
|
+
def self.included base
|
9
|
+
base.send(:alias_method, :run_suite_without_tlb, :run_suite)
|
10
|
+
base.send(:remove_method, :run_suite)
|
11
|
+
base.send(:include, InstanceMethods)
|
12
|
+
|
13
|
+
base.send(:include, Tlb::TestUnit::TestSplitter)
|
14
|
+
base.send(:include, Tlb::TestUnit::TestObserver)
|
15
|
+
end
|
16
|
+
|
17
|
+
module InstanceMethods
|
18
|
+
def run_suite
|
19
|
+
register_observers
|
20
|
+
prune_suite
|
21
|
+
run_suite_without_tlb
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
Test::Unit::UI::TestRunnerMediator.class_eval do
|
28
|
+
include Tlb::TestUnit::MediatorInflection
|
29
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'tlb'
|
2
|
+
require 'tlb/run_data'
|
3
|
+
|
4
|
+
module Tlb::TestUnit::TestObserver
|
5
|
+
class TestUnitRunData
|
6
|
+
include Tlb::RunData
|
7
|
+
|
8
|
+
def suite_failed(failure)
|
9
|
+
update_suite_failed(suite_name_for(failure.test_name))
|
10
|
+
end
|
11
|
+
|
12
|
+
def suite_name_for(test_name)
|
13
|
+
test_name.scan(/\((.+)\)$/).flatten.first
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def register_observers
|
18
|
+
run_data = TestUnitRunData.new
|
19
|
+
|
20
|
+
add_listener(Test::Unit::TestResult::FAULT) do |fault|
|
21
|
+
run_data.suite_failed(fault)
|
22
|
+
end
|
23
|
+
|
24
|
+
add_listener(Test::Unit::UI::TestRunnerMediator::FINISHED) do |*elapsed_time|
|
25
|
+
run_data.report_all_suite_data
|
26
|
+
end
|
27
|
+
|
28
|
+
add_listener(Test::Unit::TestSuite::STARTED) do |suite_name|
|
29
|
+
run_data.suite_started(suite_name)
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
add_listener(Test::Unit::TestSuite::FINISHED) do |suite_name|
|
34
|
+
run_data.update_suite_data(suite_name)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'tlb'
|
2
|
+
|
3
|
+
module Tlb::TestUnit::TestSplitter
|
4
|
+
def prune_suite
|
5
|
+
name_suite_map = @suite.tests.inject({}) { |map, test| map[test.name] = test; map }
|
6
|
+
names_to_run = Tlb.balance_and_order(@suite.tests.map { |test| test.name })
|
7
|
+
tests_to_run = names_to_run.inject([]) { |tests, name| tests << name_suite_map[name]; tests }
|
8
|
+
@suite.instance_variable_set('@tests', tests_to_run)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'tlb'
|
4
|
+
require 'tlb/util'
|
5
|
+
|
6
|
+
class Tlb::TestUnit::TestTask < Rake::TestTask
|
7
|
+
def initialize *args
|
8
|
+
super do |this|
|
9
|
+
this.ruby_opts.unshift " -r#{Tlb::Util.quote_path(File.dirname(__FILE__), 'mediator_inflection')} "
|
10
|
+
yield this if block_given?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tlb-testunit19
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.2
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Janmejay Singh
|
9
|
+
- Pavan KS
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
|
14
|
+
date: 2011-05-27 00:00:00 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: rake
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tlb-core
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - "="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.3.2
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: test-unit
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
|
+
description: |
|
50
|
+
TLB-Ruby component that provides support for load balancing tests written using test::unit. This library consumes APIs provided by tlb-core.
|
51
|
+
|
52
|
+
email: singh.janmejay@gmail.com;itspanzi@gmail.com
|
53
|
+
executables: []
|
54
|
+
|
55
|
+
extensions: []
|
56
|
+
|
57
|
+
extra_rdoc_files:
|
58
|
+
- README.markdown
|
59
|
+
files:
|
60
|
+
- testunit/lib/tlb/test_unit/mediator_inflection.rb
|
61
|
+
- testunit/lib/tlb/test_unit/test_observer.rb
|
62
|
+
- testunit/lib/tlb/test_unit/test_splitter.rb
|
63
|
+
- testunit/lib/tlb/test_unit/test_task.rb
|
64
|
+
- README.markdown
|
65
|
+
homepage: http://github.com/test-load-balancer/tlb.rb
|
66
|
+
licenses: []
|
67
|
+
|
68
|
+
post_install_message: |
|
69
|
+
=========================================================================
|
70
|
+
Documentation: Detailed configuration documentation can be found at http://test-load-balancer.github.com. Documentation section in this website hosts documentation for every public release.
|
71
|
+
|
72
|
+
-------------------------------------------------------------------------
|
73
|
+
TLB Setup: You'll need a TLB-Server in your network that is reachable over the network from the machines you use to execute your project's test-suite. Please refer the TLB documentation for details.
|
74
|
+
|
75
|
+
-------------------------------------------------------------------------
|
76
|
+
Example(s): We maintain a directory of tlb-enabled dummy projects written in different languages using different testing and build frameworks to help new TLB users get started and provide users a working project to refer to while hooking up TLB on their project(s).
|
77
|
+
Each of these projects have a shell script(named run_balanced.sh) that is meant to demonstrate a typical tlb-enabled build(by starting a local tlb server, and executing two partitions that run dummy tests locally). This script also starts its own server(so you do not need to worry about the TLB server for trying it out).
|
78
|
+
We recommend playing with the configuration-variable values being set in the shell-script(s) to understand the effect different values have on load-balancing/reordering behavior.
|
79
|
+
|
80
|
+
Examples archive is released along-with TLB and is available for download at http://code.google.com/p/tlb/downloads/list.
|
81
|
+
|
82
|
+
To execute the example project, drop into the example project directory(examples/rspec2_example for instance) and invoke the './run_balanced.sh'.
|
83
|
+
|
84
|
+
-------------------------------------------------------------------------
|
85
|
+
Issue Tracker: http://code.google.com/p/tlb/issues/list
|
86
|
+
|
87
|
+
=========================================================================
|
88
|
+
|
89
|
+
rdoc_options:
|
90
|
+
- --charset=UTF-8
|
91
|
+
require_paths:
|
92
|
+
- testunit/lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.9.1
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: "0"
|
105
|
+
requirements: []
|
106
|
+
|
107
|
+
rubyforge_project: tlb-rb
|
108
|
+
rubygems_version: 1.8.3
|
109
|
+
signing_key:
|
110
|
+
specification_version: 3
|
111
|
+
summary: tlb-testunit19-0.3.2
|
112
|
+
test_files: []
|
113
|
+
|