blob: 595f82495ac2288f73805189f3fc4f041eb33b6d [file] [log] [blame]
Jeremy Goldmance46d9b2020-10-21 02:21:54 +00001The simplest way to run all SettingsUnitTests is with atest
2$ atest SettingsUnitTests
3
4A single class can also be tested with the following command
5$ atest -c <YourClassName>
6
Xinyi Zhou7871ccf2021-11-02 14:04:46 -07007// The following instructions show how to run the test suite using make + adb //
Jeremy Goldmance46d9b2020-10-21 02:21:54 +00008
Benjamin Franzd11b7132016-01-21 12:27:36 +00009To build the tests you can use the following command at the root of your android source tree
Roozbeh Pournaderad389342017-07-12 11:37:59 -070010$ make -j SettingsUnitTests
Benjamin Franzd11b7132016-01-21 12:27:36 +000011
Jeremy Goldman6e6d7852020-10-19 08:11:32 +000012The test apk then needs to be installed onto your test device. The apk's location will vary
13depending on your device model and architecture. At the end of the make command's output, there
14should be a line similar to the following:
Roozbeh Pournaderad389342017-07-12 11:37:59 -070015"Copy: ${ANDROID_PRODUCT_OUT}/testcases/SettingsUnitTests/arm64/SettingsUnitTests.apk"
Jeremy Goldman6e6d7852020-10-19 08:11:32 +000016Install via the following command:
Roozbeh Pournaderad389342017-07-12 11:37:59 -070017$ adb install -r ${ANDROID_PRODUCT_OUT}/testcases/SettingsUnitTests/arm64/SettingsUnitTests.apk
Benjamin Franzd11b7132016-01-21 12:27:36 +000018
19To run all tests:
Brett Chabot031dcf52018-12-13 19:06:32 -080020$ adb shell am instrument -w com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner
Benjamin Franzd11b7132016-01-21 12:27:36 +000021
22To run all tests in a specific class:
Brett Chabot031dcf52018-12-13 19:06:32 -080023$ adb shell am instrument -w -e class com.android.settings.<class> com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner
Benjamin Franzd11b7132016-01-21 12:27:36 +000024
25To run a specific test:
Brett Chabot031dcf52018-12-13 19:06:32 -080026$ adb shell am instrument -w -e class com.android.settings.<class>#<test> com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner
Benjamin Franzd11b7132016-01-21 12:27:36 +000027
28More general information can be found at
29http://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html