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 2010/03/22 04:51:29 UTC

svn commit: r925948 - in /buildr/trunk: CHANGELOG lib/buildr/scala/tests.rb spec/scala/tests_spec.rb

Author: boisvert
Date: Mon Mar 22 03:51:29 2010
New Revision: 925948

URL: http://svn.apache.org/viewvc?rev=925948&view=rev
Log:
ScalaTest now generates JUnit XML reports in addition to text files.

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/scala/tests.rb
    buildr/trunk/spec/scala/tests_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=925948&r1=925947&r2=925948&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Mon Mar 22 03:51:29 2010
@@ -26,6 +26,7 @@
 * Added:  BUILDR-375 Buildr now recognizes buildfile.rb and Buildfile.rb
           (Kerry Wilson)
 * Added:  BUILDR-390 Buildr::group() should accept :classifier argument
+* Added:  ScalaTest now generates JUnit XML reports in addition to text files.
 * Change: Updated to Ant 1.8.0
 * Change: Updated to Groovy 1.7.1
 * Change: Updated to JRuby 1.4.0

Modified: buildr/trunk/lib/buildr/scala/tests.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/scala/tests.rb?rev=925948&r1=925947&r2=925948&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/scala/tests.rb (original)
+++ buildr/trunk/lib/buildr/scala/tests.rb Mon Mar 22 03:51:29 2010
@@ -104,7 +104,8 @@ module Buildr::Scala
       scalatest.each do |suite|
         info "ScalaTest #{suite.inspect}"
         # Use Ant to execute the ScalaTest task, gives us performance and reporting.
-        reportFile = File.join(task.report_to.to_s, "TEST-#{suite}.txt")
+        reportDir = task.report_to.to_s
+        reportFile = File.join(reportDir, "TEST-#{suite}.txt")
         taskdef = Buildr.artifacts(self.class.dependencies).each(&:invoke).map(&:to_s)
         Buildr.ant('scalatest') do |ant|
           ant.taskdef :name=>'scalatest', :classname=>'org.scalatest.tools.ScalaTestTask',
@@ -113,6 +114,8 @@ module Buildr::Scala
             ant.suite    :classname=>suite
             ant.reporter :type=>'stdout', :config=>reporter_options
             ant.reporter :type=>'file', :filename=> reportFile, :config=>reporter_options
+            ant.reporter :type=>(ScalaTest.version == "1.0") ? "xml" : "junitxml",
+                         :directory=> reportDir, :config=>reporter_options
             # TODO: This should be name=>value pairs!
             #ant.includes group_includes.join(" ") if group_includes
             #ant.excludes group_excludes.join(" ") if group_excludes

Modified: buildr/trunk/spec/scala/tests_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/scala/tests_spec.rb?rev=925948&r1=925947&r2=925948&view=diff
==============================================================================
--- buildr/trunk/spec/scala/tests_spec.rb (original)
+++ buildr/trunk/spec/scala/tests_spec.rb Mon Mar 22 03:51:29 2010
@@ -161,6 +161,21 @@ describe Buildr::Scala::ScalaTest do
     project('foo').test.failed_tests.should include('FailingSuite')
   end
 
+  it 'should report to reports/scalatest/TEST-TestSuiteName.xml' do
+    write 'src/test/scala/PassingSuite.scala', <<-SCALA
+      class PassingSuite extends org.scalatest.FunSuite {
+        test("passing") {
+          assert(true)
+        }
+      }
+    SCALA
+    define 'foo' do
+      test.report_to.should be(file('reports/scalatest'))
+    end
+    project('foo').test.invoke
+    project('foo').file('reports/scalatest/TEST-PassingSuite.xml').should exist
+  end
+
   it 'should report to reports/scalatest/TEST-TestSuiteName.txt' do
     write 'src/test/scala/PassingSuite.scala', <<-SCALA
       class PassingSuite extends org.scalatest.FunSuite {