module Buildr::Test

Methods added to Project to support compilation and running of tests.

Public Instance Methods

integration { |task| .... } click to toggle source
integration → IntegrationTestTask

Use this method to return the integration tests task, or enhance it with a block to execute.

There is one integration tests task you can execute directly, or as a result of running the package task (or tasks that depend on it, like install and upload). It contains all the tests marked with :integration=>true, all other tests are considered unit tests and run by the test task before packaging. So essentially: build=>test=>packaging=>integration=>install/upload.

You add new tests from projects that define integration tests using the regular test task, but with the following addition:

test.using :integration

Use this method to enhance the setup and teardown tasks that are executed before (and after) all integration tests are run, for example, to start a Web server or create a database.

# File lib/buildr/core/test.rb, line 762
def integration(*deps, &block)
  Rake::Task['rake:integration'].enhance deps, &block
end
test(*prereqs) → TestTask click to toggle source
test(*prereqs) { |task| .. } → TestTask

Returns the test task. The test task controls the entire test lifecycle.

You can use the test task in three ways. You can access and configure specific test tasks, e.g. enhance the compile task by calling test.compile, setup for the tests by enhancing test.setup and so forth.

You can use convenient methods that handle the most common settings. For example, add dependencies using test.with, or include only specific tests using test.include.

You can also enhance this task directly. This method accepts a list of arguments that are used as prerequisites and an optional block that will be executed by the test task.

This task compiles the project and the tests (in that order) before running any tests. It execute the setup task, runs all the tests, any enhancements, and ends with the teardown tasks.

# File lib/buildr/core/test.rb, line 741
def test(*prereqs, &block)
  task('test').enhance prereqs, &block
end