Author: boisvert
Date: Thu Sep 17 23:47:46 2009
New Revision: 816413
URL: http://svn.apache.org/viewvc?rev=816413&view=rev
Log:
BUILDR-301 TestNG doesn't report failure if more than one test fails; fix is to
use a non-greedy regexp for matching failed test case name
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/java/tests.rb
buildr/trunk/spec/java/tests_spec.rb
Modified: buildr/trunk/CHANGELOG
URL:
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=816413&r1=816412&r2=816413&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Sep 17 23:47:46 2009
@@ -1,7 +1,8 @@
1.3.5 (Pending)
-* Fixed: BUILDR-313: Prevent release with uncommitted_files on Git 1.4.3+
(Alexis Midon)
-* Fixed: BUILDR-315: Fix Eclipse .classpath for local libraries (Mat Schaffer)
-* Added: BUILDR-300: Make Eclipse task more configurable (Antoine Toulme,
Alex Boisvert)
+* Fixed: BUILDR-301 TestNG doesn't report failure if more than one test fails
+* Fixed: BUILDR-313 Prevent release with uncommitted_files on Git 1.4.3+
(Alexis Midon)
+* Fixed: BUILDR-315 Fix Eclipse .classpath for local libraries (Mat Schaffer)
+* Added: BUILDR-300 Make Eclipse task more configurable (Antoine Toulme, Alex
Boisvert)
* Fixed: BUILDR-307 Failures are not reported correctly for ScalaTest
(Jeremie Lenfant-Engelmann)
* Fixed: BUILDR-278 tasks/*.rake files are loaded after the buildfile (Rhett
Sutphin)
* Fixed: BUILDR-304 Referencing an existing package task using the package
Modified: buildr/trunk/lib/buildr/java/tests.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/tests.rb?rev=816413&r1=816412&r2=816413&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/tests.rb (original)
+++ buildr/trunk/lib/buildr/java/tests.rb Thu Sep 17 23:47:46 2009
@@ -317,7 +317,8 @@
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).flatten
+ failed = report.scan(/<class name="(.*?)">/im).flatten
+ error "TestNG regexp returned unexpected failed tests
#{failed.inspect}" unless (failed - tests).empty?
# return the list of passed tests
return tests - failed
end
Modified: buildr/trunk/spec/java/tests_spec.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/spec/java/tests_spec.rb?rev=816413&r1=816412&r2=816413&view=diff
==============================================================================
--- buildr/trunk/spec/java/tests_spec.rb (original)
+++ buildr/trunk/spec/java/tests_spec.rb Thu Sep 17 23:47:46 2009
@@ -439,6 +439,27 @@
lambda { project('foo').test.invoke }.should raise_error(RuntimeError,
/Tests failed/)
end
+ it 'should fail when multiple TestNG test case fail' do
+ write 'src/test/java/FailingTest1.java', <<-JAVA
+ public class FailingTest1 {
+ @org.testng.annotations.Test
+ public void testNothing() {
+ org.testng.AssertJUnit.assertTrue(false);
+ }
+ }
+ JAVA
+ write 'src/test/java/FailingTest2.java', <<-JAVA
+ public class FailingTest2 {
+ @org.testng.annotations.Test
+ public void testNothing() {
+ org.testng.AssertJUnit.assertTrue(false);
+ }
+ }
+ JAVA
+ define('foo') { test.using(:testng) }
+ lambda { project('foo').test.invoke }.should raise_error(RuntimeError,
/Tests failed/)
+ end
+
it 'should report failed test names' do
write 'src/test/java/FailingTest.java', <<-JAVA
public class FailingTest {