Author: bodewig
Date: Sat Aug 26 11:48:30 2006
New Revision: 437204
URL: http://svn.apache.org/viewvc?rev=437204&view=rev
Log:
Add an errorProperty attribute, document failOnError attribute
Modified:
ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
URL:
http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?rev=437204&r1=437203&r2=437204&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
(original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Sat
Aug 26 11:48:30 2006
@@ -97,6 +97,10 @@
* stop testing if an error or failure occurs?
*/
private boolean failOnError=true;
+ /**
+ * Name of a property to set in case of an error.
+ */
+ private String errorProperty = null;
/**
* Message to print if an error or failure occured.
@@ -137,6 +141,13 @@
}
/**
+ * Sets the name of a property to set if an error or failure occurs.
+ */
+ public void setErrorProperty(String s) {
+ errorProperty = s;
+ }
+
+ /**
* stop testing if an error or failure occurs?
*/
public void setFailOnError(boolean failOnError) {
@@ -148,11 +159,16 @@
throw new BuildException(ERROR_NO_TESTS);
}
doResourceCollection(buildFiles);
- if (failOnError && (failures > 0 || errors > 0)) {
+ if (failures > 0 || errors > 0) {
+ if (errorProperty != null) {
+ getProject().setNewProperty(errorProperty, "true");
+ }
+ if (failOnError) {
throw new BuildException(ERROR_TESTS_FAILED
+ failures + " failure" + (failures != 1 ? "s" : "")
+ " and "
+ errors + " error" + (errors != 1 ? "s" : ""));
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]