Class: Buildr::MultiTest
- Inherits:
-
TestFramework::Java
- Object
- TestFramework::Base
- TestFramework::Java
- Buildr::MultiTest
- Defined in:
- lib/buildr/java/tests.rb
Overview
A composite test framework that runs multiple other test frameworks.
e.g.,
test.using :multitest, :frameworks => [ Buildr::JUnit, Buildr::TestNG ], :options = {
:junit => { :fork => true },
:testng => { ... }
}
Instance Attribute Summary collapse
-
#frameworks ⇒ Object
Returns the value of attribute frameworks.
Attributes inherited from TestFramework::Base
Class Method Summary collapse
-
.applies_to?(project) ⇒ Boolean
:nodoc:.
Instance Method Summary collapse
-
#dependencies ⇒ Object
:nodoc:.
-
#initialize(task, options) ⇒ MultiTest
constructor
:nodoc:.
-
#run(tests, dependencies) ⇒ Object
:nodoc:.
- #tests(dependencies) ⇒ Object
Methods inherited from TestFramework::Java
Methods inherited from TestFramework::Base
Constructor Details
#initialize(task, options) ⇒ MultiTest
:nodoc:
367 368 369 370 371 372 373 374 |
# File 'lib/buildr/java/tests.rb', line 367 def initialize(task, ) #:nodoc: super fail 'Missing :frameworks option' unless [:frameworks] @frameworks = [:frameworks].map do |f| = ([:options] || {})[f.to_sym] || {} f.new(task, ) end end |
Instance Attribute Details
#frameworks ⇒ Object
Returns the value of attribute frameworks.
365 366 367 |
# File 'lib/buildr/java/tests.rb', line 365 def frameworks @frameworks end |
Class Method Details
.applies_to?(project) ⇒ Boolean
:nodoc:
360 361 362 |
# File 'lib/buildr/java/tests.rb', line 360 def applies_to?(project) #:nodoc: false # no auto-detection, should be set explicitly end |
Instance Method Details
#dependencies ⇒ Object
:nodoc:
376 377 378 379 380 381 382 |
# File 'lib/buildr/java/tests.rb', line 376 def dependencies #:nodoc: unless @dependencies @dependencies = TestFramework::Java.dependencies @dependencies += @frameworks.map { |f| f.dependencies }.flatten end @dependencies end |
#run(tests, dependencies) ⇒ Object
:nodoc:
389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/buildr/java/tests.rb', line 389 def run(tests, dependencies) #:nodoc: framework_for_test = @frameworks.inject({}) do |hash, f| f.tests(dependencies).each { |t| hash[t] = f } hash end tests_by_framework = tests.group_by { |t| framework_for_test[t] } passed = [] tests_by_framework.each do |f, tests| passed += f.run(tests, dependencies) end passed end |
#tests(dependencies) ⇒ Object
385 386 387 |
# File 'lib/buildr/java/tests.rb', line 385 def tests(dependencies) @frameworks.map { |f| f.tests(dependencies) }.flatten end |