Skip to content

Commit 65d9919

Browse files
authored
Filter tests through Gradle properties (#644)
Enable test filtering through Gradle properties. See README.md for more information In addition, - Update reportAllTestsResult task to include test type and test module information. - Update README.md to include information about test-related properties.
1 parent 5fa2aec commit 65d9919

File tree

2 files changed

+518
-82
lines changed

2 files changed

+518
-82
lines changed

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,74 @@ or Windows:
746746
./gradlew.bat build
747747
```
748748

749+
# Testing
750+
751+
To run the tests, you need the following tools installed:
752+
* Unity (with iOS and Android modules installed)
753+
754+
You can run the tests by running the following from your shell
755+
(Linux / OSX):
756+
757+
```
758+
./gradlew test
759+
```
760+
761+
or Windows:
762+
763+
```
764+
./gradlew.bat test
765+
```
766+
767+
The following properties can be set to narrow down the tests to run or change
768+
the test run behavior.
769+
770+
* `INTERACTIVE_MODE_TESTS_ENABLED` - Default to `1`. Set to `1` to enable
771+
interactive mode tests, which requires GPU on the machine. Otherwise, only run
772+
tests in the batch mode.
773+
* `INCLUDE_TEST_TYPES` - Default to empty string, which means to include every
774+
type of the test. To narrow down the types of test to run, set this properties
775+
with a list of case-insensitive type strings separated by comma. For instance,
776+
`-PINCLUDE_TEST_TYPES="Python,NUnit"` means to include only Python tests and
777+
NUnit tests.
778+
See `TestTypeEnum` in `build.gradle` for available options.
779+
* `EXCLUDE_TEST_TYPES` - Default to empty string, which means to exclude none.
780+
To add types of tests to exclude, set this properties with
781+
a list of case-insensitive type strings separated by comma. For instance,
782+
`-PEXCLUDE_TEST_TYPES="Python,NUnit"` means to exclude Python tests and NUnit
783+
tests.
784+
See `TestTypeEnum` in `build.gradle` for available options.
785+
* `INCLUDE_TEST_MODULES` - Default to empty string, which means to include the
786+
tests for every modules. To narrow down modules to test, set this properties
787+
with a list of case-insensitive module strings separated by comma. For
788+
instance, `-PINCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests
789+
for tools and Android Resolver only.
790+
See `TestModuleEnum` in `build.gradle` for available options.
791+
* `EXCLUDE_TEST_MODULES` - Default to empty string, which means to exclude none.
792+
To add modules to exclude, set this properties with a list of case-insensitive
793+
module strings separated by comma. For instance,
794+
`-PEXCLUDE_TEST_MODULES="Tool,AndroidResolver"` means to run tests for any
795+
modules other than tools and Android Resolver.
796+
See `TestModuleEnum` in `build.gradle` for available options.
797+
* `EXCLUDE_TESTS` - Default to empty string, which means to exclude none.
798+
To add tests to exclude, set this properties with a list of case-insensitive
799+
test names separated by comma. For instance,
800+
`-PEXCLUDE_TESTS="testGenGuids,testDownloadArtifacts"` means to run tests
801+
except the tests with name of `testGenGuids` and `testDownloadArtifacts`.
802+
* `CONTINUE_ON_FAIL_FOR_TESTS_ENABLED` - Default to `1`. Set to `1` to continue
803+
running the next test when the current one fails. Otherwise, the build script
804+
stops whenever any test fails.
805+
806+
For instance, by running the following command, it only runs the Unity integration
807+
tests that does not requires GPU, but exclude tests for Android Resolver module
808+
and iOS Resolver module.
809+
810+
```
811+
./gradlew test \
812+
-PINTERACTIVE_MODE_TESTS_ENABLED=0 \
813+
-PINCLUDE_TEST_TYPES="Integration" \
814+
-PEXCLUDE_TEST_MODULES="AndroidResolver,iOSResolver"
815+
```
816+
749817
# Releasing
750818

751819
Each time a new build of this plugin is checked into the source tree you

0 commit comments

Comments
 (0)