Browse Source

whitespace changes only

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@644321 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 17 years ago
parent
commit
b229582ff1
1 changed files with 82 additions and 64 deletions
  1. +82
    -64
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java

+ 82
- 64
src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitTaskTest.java View File

@@ -101,82 +101,100 @@ public class JUnitTaskTest extends BuildFileTest {
// But running the JUnit testcase fails in 4th run.
public void testFailureRecorder() {
try {
File testDir = new File(getProjectDir(), "out");
File collectorFile = new File(getProjectDir(), "out/FailedTests.java");
File testDir = new File(getProjectDir(), "out");
File collectorFile = new File(getProjectDir(),
"out/FailedTests.java");
// ensure that there is a clean test environment
assertFalse("Test directory '" + testDir.getAbsolutePath() + "' must not exist before the test preparation.",
testDir.exists());
assertFalse("The collector file '" + collectorFile.getAbsolutePath() + "'must not exist before the test preparation.",
collectorFile.exists());
// ensure that there is a clean test environment
assertFalse("Test directory '" + testDir.getAbsolutePath()
+ "' must not exist before the test preparation.",
testDir.exists());
assertFalse("The collector file '"
+ collectorFile.getAbsolutePath()
+ "'must not exist before the test preparation.",
collectorFile.exists());

// prepare the test environment
executeTarget("failureRecorder.prepare");
assertTrue("Test directory '" + testDir.getAbsolutePath() + "' was not created.", testDir.exists());
assertTrue("There should be one class.", (new File(testDir, "A.class")).exists());
assertFalse("The collector file '" + collectorFile.getAbsolutePath()
+ "' should not exist before the 1st run.", collectorFile.exists());
// prepare the test environment
executeTarget("failureRecorder.prepare");
assertTrue("Test directory '" + testDir.getAbsolutePath()
+ "' was not created.", testDir.exists());
assertTrue("There should be one class.",
(new File(testDir, "A.class")).exists());
assertFalse("The collector file '"
+ collectorFile.getAbsolutePath()
+ "' should not exist before the 1st run.",
collectorFile.exists());
// 1st junit run: should do all tests - failing and not failing tests
executeTarget("failureRecorder.runtest");
assertTrue("The collector file '" + collectorFile.getAbsolutePath()
+ "' should exist after the 1st run.", collectorFile.exists());
// the passing test cases
assertOutputContaining("1st run: should run A.test01", "A.test01");
assertOutputContaining("1st run: should run B.test05", "B.test05");
assertOutputContaining("1st run: should run B.test06", "B.test06");
assertOutputContaining("1st run: should run C.test07", "C.test07");
assertOutputContaining("1st run: should run C.test08", "C.test08");
assertOutputContaining("1st run: should run C.test09", "C.test09");
// the failing test cases
assertOutputContaining("1st run: should run A.test02", "A.test02");
assertOutputContaining("1st run: should run A.test03", "A.test03");
assertOutputContaining("1st run: should run B.test04", "B.test04");
assertOutputContaining("1st run: should run D.test10", "D.test10");
// 1st junit run: should do all tests - failing and not failing tests
executeTarget("failureRecorder.runtest");
assertTrue("The collector file '" + collectorFile.getAbsolutePath()
+ "' should exist after the 1st run.",
collectorFile.exists());
// the passing test cases
assertOutputContaining("1st run: should run A.test01", "A.test01");
assertOutputContaining("1st run: should run B.test05", "B.test05");
assertOutputContaining("1st run: should run B.test06", "B.test06");
assertOutputContaining("1st run: should run C.test07", "C.test07");
assertOutputContaining("1st run: should run C.test08", "C.test08");
assertOutputContaining("1st run: should run C.test09", "C.test09");
// the failing test cases
assertOutputContaining("1st run: should run A.test02", "A.test02");
assertOutputContaining("1st run: should run A.test03", "A.test03");
assertOutputContaining("1st run: should run B.test04", "B.test04");
assertOutputContaining("1st run: should run D.test10", "D.test10");

// 2nd junit run: should do only failing tests
executeTarget("failureRecorder.runtest");
assertTrue("The collector file '" + collectorFile.getAbsolutePath()
+ "' should exist after the 2nd run.", collectorFile.exists());
// the passing test cases
assertOutputNotContaining("2nd run: should not run A.test01", "A.test01");
assertOutputNotContaining("2nd run: should not run A.test05", "B.test05");
assertOutputNotContaining("2nd run: should not run B.test06", "B.test06");
assertOutputNotContaining("2nd run: should not run C.test07", "C.test07");
assertOutputNotContaining("2nd run: should not run C.test08", "C.test08");
assertOutputNotContaining("2nd run: should not run C.test09", "C.test09");
// the failing test cases
assertOutputContaining("2nd run: should run A.test02", "A.test02");
assertOutputContaining("2nd run: should run A.test03", "A.test03");
assertOutputContaining("2nd run: should run B.test04", "B.test04");
assertOutputContaining("2nd run: should run D.test10", "D.test10");
// 2nd junit run: should do only failing tests
executeTarget("failureRecorder.runtest");
assertTrue("The collector file '" + collectorFile.getAbsolutePath()
+ "' should exist after the 2nd run.",
collectorFile.exists());
// the passing test cases
assertOutputNotContaining("2nd run: should not run A.test01",
"A.test01");
assertOutputNotContaining("2nd run: should not run A.test05",
"B.test05");
assertOutputNotContaining("2nd run: should not run B.test06",
"B.test06");
assertOutputNotContaining("2nd run: should not run C.test07",
"C.test07");
assertOutputNotContaining("2nd run: should not run C.test08",
"C.test08");
assertOutputNotContaining("2nd run: should not run C.test09",
"C.test09");
// the failing test cases
assertOutputContaining("2nd run: should run A.test02", "A.test02");
assertOutputContaining("2nd run: should run A.test03", "A.test03");
assertOutputContaining("2nd run: should run B.test04", "B.test04");
assertOutputContaining("2nd run: should run D.test10", "D.test10");
// "fix" errors in class A
executeTarget("failureRecorder.fixing");
// "fix" errors in class A
executeTarget("failureRecorder.fixing");
// 3rd run: four running tests with two errors
executeTarget("failureRecorder.runtest");
assertTrue("The collector file '" + collectorFile.getAbsolutePath()
+ "' should exist after the 3rd run.", collectorFile.exists());
assertOutputContaining("3rd run: should run A.test02", "A.test02");
assertOutputContaining("3rd run: should run A.test03", "A.test03");
assertOutputContaining("3rd run: should run B.test04", "B.test04");
assertOutputContaining("3rd run: should run D.test10", "D.test10");
// 3rd run: four running tests with two errors
executeTarget("failureRecorder.runtest");
assertTrue("The collector file '" + collectorFile.getAbsolutePath()
+ "' should exist after the 3rd run.",
collectorFile.exists());
assertOutputContaining("3rd run: should run A.test02", "A.test02");
assertOutputContaining("3rd run: should run A.test03", "A.test03");
assertOutputContaining("3rd run: should run B.test04", "B.test04");
assertOutputContaining("3rd run: should run D.test10", "D.test10");
// 4rd run: two running tests with errors
executeTarget("failureRecorder.runtest");
assertTrue("The collector file '" + collectorFile.getAbsolutePath()
+ "' should exist after the 4th run.", collectorFile.exists());
//TODO: these two statements fail
//assertOutputNotContaining("4th run: should not run A.test02", "A.test02");
//assertOutputNotContaining("4th run: should not run A.test03", "A.test03");
assertOutputContaining("4th run: should run B.test04", "B.test04");
assertOutputContaining("4th run: should run D.test10", "D.test10");
// 4rd run: two running tests with errors
executeTarget("failureRecorder.runtest");
assertTrue("The collector file '" + collectorFile.getAbsolutePath()
+ "' should exist after the 4th run.",
collectorFile.exists());
//TODO: these two statements fail
//assertOutputNotContaining("4th run: should not run A.test02", "A.test02");
//assertOutputNotContaining("4th run: should not run A.test03", "A.test03");
assertOutputContaining("4th run: should run B.test04", "B.test04");
assertOutputContaining("4th run: should run D.test10", "D.test10");
} catch (BuildException be) {
be.printStackTrace();
System.err.println("nested build's log: " + getLog());


Loading…
Cancel
Save