@@ -492,6 +492,27 @@ public class JUnitTask extends Task {
newEnvironment = newenv;
newEnvironment = newenv;
}
}
/**
* Preset the attributes of the test
* before configuration in the build
* script.
* This allows attributes in the <junit> task
* be be defaults for the tests, but allows
* individual tests to override the defaults.
*/
private void preConfigure(BaseTest test) {
test.setFiltertrace(filterTrace);
test.setHaltonerror(haltOnError);
if (errorProperty != null) {
test.setErrorProperty(errorProperty);
}
test.setHaltonfailure(haltOnFail);
if (failureProperty != null) {
test.setFailureProperty(failureProperty);
}
test.setFork(fork);
}
/**
/**
* Add a new single testcase.
* Add a new single testcase.
* @param test a new single testcase
* @param test a new single testcase
@@ -501,6 +522,7 @@ public class JUnitTask extends Task {
*/
*/
public void addTest(JUnitTest test) {
public void addTest(JUnitTest test) {
tests.addElement(test);
tests.addElement(test);
preConfigure(test);
}
}
/**
/**
@@ -514,6 +536,7 @@ public class JUnitTask extends Task {
public BatchTest createBatchTest() {
public BatchTest createBatchTest() {
BatchTest test = new BatchTest(getProject());
BatchTest test = new BatchTest(getProject());
batchTests.addElement(test);
batchTests.addElement(test);
preConfigure(test);
return test;
return test;
}
}
@@ -722,22 +745,6 @@ public class JUnitTask extends Task {
* @since Ant 1.2
* @since Ant 1.2
*/
*/
public void execute() throws BuildException {
public void execute() throws BuildException {
// Apply the basetest attributes
Enumeration e = allTests();
while (e.hasMoreElements()) {
BaseTest test = (BaseTest) e.nextElement();
test.setFiltertrace(filterTrace);
test.setHaltonerror(haltOnError);
if (errorProperty != null) {
test.setErrorProperty(errorProperty);
}
test.setHaltonfailure(haltOnFail);
if (failureProperty != null) {
test.setFailureProperty(failureProperty);
}
test.setFork(fork);
}
ClassLoader myLoader = JUnitTask.class.getClassLoader();
ClassLoader myLoader = JUnitTask.class.getClassLoader();
ClassLoader mirrorLoader;
ClassLoader mirrorLoader;
if (splitJunit) {
if (splitJunit) {