support use of --tests for specific test class/method selection Project: http://git-wip-us.apache.org/repos/asf/incubator-edgent/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-edgent/commit/99241920 Tree: http://git-wip-us.apache.org/repos/asf/incubator-edgent/tree/99241920 Diff: http://git-wip-us.apache.org/repos/asf/incubator-edgent/diff/99241920
Branch: refs/heads/master Commit: 9924192006a2cb64f254546bf9c5d90a3208a4d4 Parents: be8c935 Author: Dale LaBossiere <[email protected]> Authored: Wed Aug 31 10:14:41 2016 -0400 Committer: Dale LaBossiere <[email protected]> Committed: Wed Aug 31 10:14:41 2016 -0400 ---------------------------------------------------------------------- DEVELOPMENT.md | 6 ++++-- build.gradle | 20 +++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/99241920/DEVELOPMENT.md ---------------------------------------------------------------------- diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 28f0920..70efaea 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -113,7 +113,7 @@ maintain the build success of `clean, assemble, test, reports`.** The Gradle wrapper `edgent/{gradlew,gradlew.bat}` should be used to ensure an appropriate version of Gradle is used. e.g. `$ ./gradlew clean build` -The top-level Gradle file is `edgent/build.gradle` and contains several +The top-level Gradle file is `edgent/build.gradle` and it contains several unique tasks: * `assemble` (default) : Build all code and Javadoc into `build\distributions`. The build will fail on any code error or Javadoc warning or error. @@ -121,10 +121,12 @@ unique tasks: * `build` : essentially like "assemble test reports" * `clean` : Clean the project * `test` : Run the JUnit tests, if any test fails the test run stops. - * use a project test task and optionally the `--tests` option to run a subset of the tests: + * use a project test task and optionally the `--tests` option to run a subset of the tests. Multiple `--tests` options may be specified following each test task. * `./gradlew <project>:test` * `./gradlew <project>:test --tests '*.SomeTest'` * `./gradlew <project>:test --tests '*.SomeTest.someMethod'` + * use the `cleanTest` task to force rerunning a previously successful test task (without forcing a rerun of all of the task's dependencies): + * `./gradlew [<project>:]cleanTest [<project>:]test` * `reports` : Generate JUnit and Code Coverage reports in `build\distributions\reports`. Use after executing the `test` target. * `reports\tests\overview-summary.html` - JUnit test report * `reports\coverage\index.html` - Code coverage report http://git-wip-us.apache.org/repos/asf/incubator-edgent/blob/99241920/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index c26ae29..897ad74 100644 --- a/build.gradle +++ b/build.gradle @@ -272,11 +272,12 @@ def String mkManifestClassPath(Project proj) { } test { - println "\nHINT: to include tests than **/*Test.class you can: ./gradlew -Ptest.base.pattern='<path-pattern>.class' [project-scope:]test" - println "e.g. ./gradlew -Ptest.base.pattern='**/*TestManual.class' test" - println "e.g. ./gradlew -Ptest.base.pattern='**/MqttOpenTest.class' :connectors:mqtt:test" - println "To force a rerun of previously successful test task you can first specify the 'cleanTest' task" - println "e.g., ./gradlew :connectors:mqtt:cleanTest :connectors:mqtt:test" + println "\nHINTs: Use the '--tests <testClassNamePattern>[.<testMethodNamePattern>]' option to select specific test classes or methods." + println " ./gradlew :api:topology:test --tests '*JsonFunctionsTest'" + println " ./gradlew :api:topology:test --tests '*JsonFunctionsTest.testBytes'" + println "Use the 'cleanTest' task to force a rerun of a previously successful test task:" + println " ./gradlew :api:topology:cleanTest :api:topology:test" + println " ./gradlew cleanTest test" println "" sleep 1 } @@ -349,12 +350,9 @@ subprojects { dependsOn ":console:servlets" } - // see HINT in rootProject test task - def test_base_pattern = rootProject.hasProperty('test.base.pattern') - ? rootProject.getProperty('test.base.pattern') - : '**/*Test.class' - - include test_base_pattern + filter { + includeTestsMatching '*Test' // can override via --tests command line option + } systemProperty 'edgent.test.top.dir.file.path', rootProject.projectDir systemProperty 'edgent.test.root.dir', rootProject.projectDir
