You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/10/30 01:39:17 UTC

svn commit: r709059 - in /incubator/buildr/trunk: CHANGELOG lib/buildr/java/tests.rb

Author: assaf
Date: Wed Oct 29 17:39:17 2008
New Revision: 709059

URL: http://svn.apache.org/viewvc?rev=709059&view=rev
Log:
Fixed: BUILDR-192 TestNG report results are overwritten (Alexis Midon).

Modified:
    incubator/buildr/trunk/CHANGELOG
    incubator/buildr/trunk/lib/buildr/java/tests.rb

Modified: incubator/buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=709059&r1=709058&r2=709059&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Wed Oct 29 17:39:17 2008
@@ -15,6 +15,7 @@
 * Fixed:  Removed double complete/fail messages showing up on console.
 * Fixed:  BUILDR-158 Nailgun is now a delegate for buildr/drb (a pure-ruby dRuby server)
 * Fixed:  BUILDR-172 Scala compiler not loaded by default.
+* Fixed:  BUILDR-192 TestNG report results are overwritten (Alexis Midon).
 
 1.3.3 (2008-10-08)
 * Added:  JtestR support. Implemented pending jtestr specs.

Modified: incubator/buildr/trunk/lib/buildr/java/tests.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/tests.rb?rev=709059&r1=709058&r2=709059&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/tests.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/tests.rb Wed Oct 29 17:39:17 2008
@@ -303,15 +303,20 @@
     def run(tests, dependencies) #:nodoc:
       cmd_args = [ 'org.testng.TestNG', '-sourcedir', task.compile.sources.join(';'), '-suitename', task.send(:project).name ]
       cmd_args << '-d' << task.report_to.to_s
+      # run all tests in the same suite
+      cmd_args << '-testclass' << tests
       cmd_options = { :properties=>options[:properties], :java_args=>options[:java_args],
-                      :classpath=>dependencies }
-      tests.inject([]) do |passed, test|
-        begin
-          Java::Commands.java cmd_args, '-testclass', test, cmd_options.merge(:name=>test)
-          passed << test
-        rescue
-          passed
-        end
+        :classpath=>dependencies, :name => "TestNG in #{task.send(:project).name}" }
+
+      begin
+        Java::Commands.java cmd_args, cmd_options
+        return tests
+      rescue
+        # testng-failed.xml contains the list of failed tests *only*
+        report = File.read(File.join(task.report_to.to_s, 'testng-failed.xml'))
+        failed = report.scan(/(<class name=")([^"]*)(">)/im).map { |s, testname, e| testname }
+        # return the list of passed tests
+        return tests - failed
       end
     end