Module: Buildr::Test
Overview
Methods added to Project to support compilation and running of tests.
Instance Method Summary collapse
-
#integration(*deps, &block) ⇒ Object
:call-seq: integration { |task| .… } integration => IntegrationTestTask.
-
#test(*prereqs, &block) ⇒ Object
:call-seq: test(*prereqs) => TestTask test(*prereqs) { |task| .. } => TestTask.
Methods included from Extension
Instance Method Details
#integration(*deps, &block) ⇒ Object
:call-seq:
integration { |task| .... }
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.
699 700 701 |
# File 'lib/buildr/core/test.rb', line 699 def integration(*deps, &block) Rake::Task['rake:integration'].enhance deps, &block end |
#test(*prereqs, &block) ⇒ Object
:call-seq:
test(*prereqs) => TestTask
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.
678 679 680 |
# File 'lib/buildr/core/test.rb', line 678 def test(*prereqs, &block) task('test').enhance prereqs, &block end |