class Buildr::TestFramework::Base

Base class for all test frameworks, with common functionality. Extend and over-ride as you see fit (see JUnit as an example).



Options for this test framework.


The test task we belong to

Public Class Methods

applies_to?(project) click to toggle source

Returns true if this framework applies to the current project. For example, JUnit returns true if the tests are written in Java.

# File lib/buildr/core/test.rb, line 75
def applies_to?(project)
  raise 'Not implemented'
dependencies() click to toggle source

Returns a list of dependencies for this framework. Default is an empty list, override to add dependencies.

# File lib/buildr/core/test.rb, line 81
def dependencies
  @dependencies ||= []
new(test_task, options) click to toggle source

Construct a new test framework with the specified options. Note that options may change before the framework is run.

# File lib/buildr/core/test.rb, line 89
def initialize(test_task, options)
  @options = options
  @task = test_task
to_sym() click to toggle source

The framework’s identifier (e.g. :junit). Inferred from the class name.

# File lib/buildr/core/test.rb, line 69
def to_sym
  @symbol ||= name.split('::').last.downcase.to_sym

Public Instance Methods

dependencies() click to toggle source

Returns a list of dependenices for this framework. Defaults to calling the dependencies method on the class.

# File lib/buildr/core/test.rb, line 101
def dependencies
run(tests, dependencies) click to toggle source

TestTask calls this method to run the named (and only those) tests. This method returns the list of tests that ran successfully.

# File lib/buildr/core/test.rb, line 118
def run(tests, dependencies)
  raise 'Not implemented'
tests(dependencies) click to toggle source

TestTask calls this method to return a list of test names that can be run in this project. It then applies the include/exclude patterns to arrive at the list of tests that will be run, and call the run method with that list.

This method should return a list suitable for using with the run method, but also suitable for the user to manage. For example, JUnit locates all the tests in the directory, and returns the class names, which are easier to work with than file names.

# File lib/buildr/core/test.rb, line 112
def tests(dependencies)
  raise 'Not implemented'