Browse Source

opps: restore correct behavour for setting basetest attributes

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@463447 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 18 years ago
parent
commit
911c5901fc
1 changed files with 23 additions and 16 deletions
  1. +23
    -16
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

+ 23
- 16
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -492,6 +492,27 @@ public class JUnitTask extends Task {
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.
* @param test a new single testcase
@@ -501,6 +522,7 @@ public class JUnitTask extends Task {
*/
public void addTest(JUnitTest test) {
tests.addElement(test);
preConfigure(test);
}

/**
@@ -514,6 +536,7 @@ public class JUnitTask extends Task {
public BatchTest createBatchTest() {
BatchTest test = new BatchTest(getProject());
batchTests.addElement(test);
preConfigure(test);
return test;
}

@@ -722,22 +745,6 @@ public class JUnitTask extends Task {
* @since Ant 1.2
*/
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 mirrorLoader;
if (splitJunit) {


Loading…
Cancel
Save