diff options
author | wisberg <wisberg> | 2003-05-25 00:44:40 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-05-25 00:44:40 +0000 |
commit | 265e9d63e96947f0701d5a8ea81218b940a5ea21 (patch) | |
tree | 83c706bfd6b56d9def3c81a6e5a2f88365d0ef04 /testing-drivers | |
parent | 5dd34ad8e4567687c774a03587bdd2a2338639c7 (diff) | |
download | aspectj-265e9d63e96947f0701d5a8ea81218b940a5ea21.tar.gz aspectj-265e9d63e96947f0701d5a8ea81218b940a5ea21.zip |
tests for new feature to select tests by title
Diffstat (limited to 'testing-drivers')
4 files changed, 136 insertions, 4 deletions
diff --git a/testing-drivers/testdata/incremental/harness/selectionTest.xml b/testing-drivers/testdata/incremental/harness/selectionTest.xml index abdb7c0ae..0ae449a1d 100644 --- a/testing-drivers/testdata/incremental/harness/selectionTest.xml +++ b/testing-drivers/testdata/incremental/harness/selectionTest.xml @@ -11,7 +11,7 @@ -eclipse This is used by a JUnit test HarnessSelectionTest. - Do not change the outcome without changing that test. + Do not change the outcome or attributes without passing that test. --> <ajc-test dir="." title="run and pass" diff --git a/testing-drivers/testdata/incremental/harness/titleListOne.txt b/testing-drivers/testdata/incremental/harness/titleListOne.txt new file mode 100644 index 000000000..70cac2e07 --- /dev/null +++ b/testing-drivers/testdata/incremental/harness/titleListOne.txt @@ -0,0 +1,17 @@ + +This is for the harness selection tests +that pick up test titles from -traceTestsMin harness output +(where lines start with PASS or FAIL). + +All other lines should be ignored, as should the Suite.Spec summary. + +PASS run and pass() +stuff + + FAIL omit if skipKeyword() Not this line either + +more stuff + +with empty lines + +FAIL Suite.Spec(ignore this line...) diff --git a/testing-drivers/testdata/incremental/harness/titleListPlural.txt b/testing-drivers/testdata/incremental/harness/titleListPlural.txt new file mode 100644 index 000000000..6e965c6b5 --- /dev/null +++ b/testing-drivers/testdata/incremental/harness/titleListPlural.txt @@ -0,0 +1,23 @@ + +This is for the harness selection tests +that pick up test titles from -traceTestsMin harness output +(where lines start with PASS or FAIL). + +All other lines should be ignored, as should the Suite.Spec summary. + +PASS run and pass() +stuff + +FAIL omit if skipKeyword() + +more stuff + +with empty lines + +FAIL Suite.Spec(ignore this line...) + +Should also test: +- commas in test titles +- internal (), e.g., + FAIL accept (internal) parentheses() + diff --git a/testing-drivers/testsrc/org/aspectj/testing/drivers/HarnessSelectionTest.java b/testing-drivers/testsrc/org/aspectj/testing/drivers/HarnessSelectionTest.java index 51ab1ea05..40f780cb4 100644 --- a/testing-drivers/testsrc/org/aspectj/testing/drivers/HarnessSelectionTest.java +++ b/testing-drivers/testsrc/org/aspectj/testing/drivers/HarnessSelectionTest.java @@ -34,15 +34,26 @@ import java.util.List; import junit.framework.TestCase; /** - * + * The harness supports custom-coded queries based on + * -ajctest{kind}={query} parameters + * (until we move to an XML database with real queries). */ public class HarnessSelectionTest extends TestCase { + private static final String TESTDATA = "../testing-drivers/testdata"; + private static final String INC_HARNESS_DIR + = TESTDATA + "/incremental/harness"; private static final String SELECT - = "testdata/incremental/harness/selectionTest.xml"; + = INC_HARNESS_DIR + "/selectionTest.xml"; /** @see testIncrementalSuite() */ private static final String INCREMENTAL - = "testdata/incremental/harness/suite.xml"; + = INC_HARNESS_DIR + "/suite.xml"; + + private static final String TITLE_LIST_ONE + = INC_HARNESS_DIR + "/titleListOne.txt"; + + private static final String TITLE_LIST_PLURAL + = INC_HARNESS_DIR + "/titleListPlural.txt"; private static Hashtable SPECS = new Hashtable(); @@ -65,6 +76,15 @@ public class HarnessSelectionTest extends TestCase { super(name); } + public void testFilesAvailable() { + String[] files = new String[] { + SELECT, INCREMENTAL, TITLE_LIST_ONE, TITLE_LIST_PLURAL + }; + for (int i = 0; i < files.length; i++) { + assertTrue(files[i], new File(files[i]).canRead()); + } + } + public void testIncrementalSuite() { if (!eclipseAvailable()) { System.err.println("skipping test - eclipse classes not available"); @@ -176,6 +196,78 @@ public class HarnessSelectionTest extends TestCase { Exp exp = new Exp(17, 2, 15, 2, 0, 0, 15); checkSelection(SELECT, options, "bugId required", exp); } + + public void testTitleContainsSubstringSelection() { + String[] options = new String[] + { "-ajctestTitleContains=run and " + }; + Exp exp = new Exp(17, 1, 16, 1, 0, 0, 16); + checkSelection(SELECT, options, "run and", exp); + } + + public void testTitleContainsSubstringSelectionPlural() { + String[] options = new String[] + { "-ajctestTitleContains= run and , if skipKeyword " + }; + Exp exp = new Exp(17, 2, 15, 2, 0, 0, 15); + checkSelection(SELECT, options, "title", exp); + } + + public void testTitleContainsExactSelection() { + String[] options = new String[] + { "-ajctestTitleContains=run and pass" + }; + Exp exp = new Exp(17, 1, 16, 1, 0, 0, 16); + checkSelection(SELECT, options, "run and pass", exp); + } + + public void testTitleContainsExactSelectionPlural() { + String[] options = new String[] + { "-ajctestTitleContains= run and pass , omit if skipKeyword " + }; + Exp exp = new Exp(17, 2, 15, 2, 0, 0, 15); + checkSelection(SELECT, options, "title", exp); + } + + public void testTitleListSelection() { + String[] options = new String[] + { "-ajctestTitleList=run and pass" + }; + Exp exp = new Exp(17, 1, 16, 1, 0, 0, 16); + checkSelection(SELECT, options, "run and pass", exp); + } + + public void testTitleListSelectionPlural() { + String[] options = new String[] + { "-ajctestTitleList= run and pass , omit if skipKeyword " + }; + Exp exp = new Exp(17, 2, 15, 2, 0, 0, 15); + checkSelection(SELECT, options, "title", exp); + } + + public void testTitleListFileSelection() { + String[] options = new String[] + { "-ajctestTitleList=" + TITLE_LIST_ONE + }; + Exp exp = new Exp(17, 1, 16, 1, 0, 0, 16); + checkSelection(SELECT, options, TITLE_LIST_ONE, exp); + } + + public void testTitleListFileSelectionPlural() { + String[] options = new String[] + { "-ajctestTitleList=" + TITLE_LIST_PLURAL + }; + Exp exp = new Exp(17, 2, 15, 2, 0, 0, 15); + checkSelection(SELECT, options, TITLE_LIST_PLURAL, exp); + } + + public void testTitleListFileSelectionPluralFailOnly() { + String[] options = new String[] + { "-ajctestTitleFailList=" + TITLE_LIST_PLURAL + }; + Exp exp = new Exp(17, 1, 16, 1, 0, 0, 16); + checkSelection(SELECT, options, TITLE_LIST_PLURAL, exp); + } /** * Run the static test suite with the given options. |