module Buildr::TestFramework
The underlying test framework used by TestTask. To add a new test framework, extend TestFramework::Base and add your framework using:
Buildr::TestFramework << MyFramework
Public Class Methods
add(framework)
click to toggle source
Adds a test framework to the list of supported frameworks.
For example:
Buildr::TestFramework << Buildr::JUnit
# File lib/buildr/core/test.rb, line 49 def add(framework) @frameworks ||= [] @frameworks |= [framework] end
Also aliased as: <<
frameworks()
click to toggle source
Returns a list of available test frameworks.
# File lib/buildr/core/test.rb, line 56 def frameworks @frameworks ||= [] end
has?(name)
click to toggle source
Returns true if the specified test framework exists.
# File lib/buildr/core/test.rb, line 26 def has?(name) frameworks.any? { |framework| framework.to_sym == name.to_sym } end
select(name)
click to toggle source
Select a test framework by its name.
# File lib/buildr/core/test.rb, line 31 def select(name) frameworks.detect { |framework| framework.to_sym == name.to_sym } end
select_from(project)
click to toggle source
Identify which test framework applies for this project.
# File lib/buildr/core/test.rb, line 36 def select_from(project) # Look for a suitable test framework based on the compiled language, # which may return multiple candidates, e.g. JUnit and TestNG for Java. # Pick the one used in the parent project, if not, whichever comes first. candidates = frameworks.select { |framework| framework.applies_to?(project) } parent = project.parent parent && candidates.detect { |framework| framework.to_sym == parent.test.framework } || candidates.first end