You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2009/11/18 23:48:37 UTC
svn commit: r881978 - in /buildr/trunk: CHANGELOG doc/testing.textile
lib/buildr/core/test.rb spec/core/test_spec.rb
Author: boisvert
Date: Wed Nov 18 22:48:37 2009
New Revision: 881978
URL: http://svn.apache.org/viewvc?rev=881978&view=rev
Log:
"buildr test=only" will only run tests explicitly specified on the command line
(and ignore transitive test dependencies)
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/doc/testing.textile
buildr/trunk/lib/buildr/core/test.rb
buildr/trunk/spec/core/test_spec.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=881978&r1=881977&r2=881978&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Wed Nov 18 22:48:37 2009
@@ -10,6 +10,8 @@
eclipse.exclude_libs += ['/path/to/some/library.jar']
* Added: Environment variable IGNORE_BUILDFILE can be set to "yes" or
"true" to ignore changes in Buildfile when running tests.
+* Added: "buildr test=only" will only run tests explicitly specified on the
+ command line (and ignore transitive test dependencies)
* Change: Updated to JRuby 1.4.0
* Change: Updated to JtestR 0.5
* Change: Updated to JUnit 4.7
Modified: buildr/trunk/doc/testing.textile
URL: http://svn.apache.org/viewvc/buildr/trunk/doc/testing.textile?rev=881978&r1=881977&r2=881978&view=diff
==============================================================================
--- buildr/trunk/doc/testing.textile (original)
+++ buildr/trunk/doc/testing.textile Wed Nov 18 22:48:37 2009
@@ -106,6 +106,11 @@
We're using @package@ and not @build@ above. When using a continuous build system, you want to make sure that packages are created, contain the right files, and also run the integration tests.
+One last note on running tests. By default when you run tests, Buildr will automatically run all transitive test dependencies. This mean if you run "buildr test" inside project @bar@ and @bar@ depends on project @foo@, Buildr will first run tests in project @foo@ if there have been any changes affecting @foo@ that haven't been taken into account yet. This behavior often surprises people, especially when they are trying to get things done and only care about tests in @bar@ at that moment. For those times when you'd like to focus your testing on specific projects, Buildr has the @only@ option that will only run tests for projects specified on the command line,
+
+{% highlight sh %}
+$ buildr test=only bar:test
+{% endhighlight %}
h2(#integration). Integration Tests
Modified: buildr/trunk/lib/buildr/core/test.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/test.rb?rev=881978&r1=881977&r2=881978&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/test.rb (original)
+++ buildr/trunk/lib/buildr/core/test.rb Wed Nov 18 22:48:37 2009
@@ -602,7 +602,7 @@
# Picking up the test frameworks adds further dependencies.
test.framework
- project.build test unless test.options[:integration]
+ project.build test unless test.options[:integration] || Buildr.options.test == :only
project.clean do
rm_rf test.compile.target.to_s if test.compile.target
@@ -687,6 +687,8 @@
false
when /^all$/i
:all
+ when /^only$/i
+ :only
when /^(yes|on|true)$/i, nil
true
else
Modified: buildr/trunk/spec/core/test_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/test_spec.rb?rev=881978&r1=881977&r2=881978&view=diff
==============================================================================
--- buildr/trunk/spec/core/test_spec.rb (original)
+++ buildr/trunk/spec/core/test_spec.rb Wed Nov 18 22:48:37 2009
@@ -268,6 +268,14 @@
mkpath project('foo').test.report_to.to_s
lambda { task('clean').invoke }.should change { File.exist?(project('foo').test.report_to.to_s) }.to(false)
end
+
+ it 'should only run tests explicitly specified if options.test is :only' do
+ Buildr.options.test = :only
+ write 'bar/src/main/java/Bar.java', 'public class Bar {}'
+ define('bar', :version=>'1.0', :base_dir=>'bar') { package :jar }
+ define('foo') { compile.with project('bar') }
+ lambda { task('foo:test').invoke rescue nil }.should_not run_tasks('bar:test')
+ end
end