Files
app_Settings/tests/unit
Simon Wingrove 25686219d3 Distinguish multiple PendingIntents via requestCode
Settings uses a system of intent extras to open subsettings pages. When
PendingIntents are created from these Intents, the system does not think
they are unique as extras are not included in this equality check. So
only one of them is likely to work.

A unique request code can be used to distinguish between them.

Bug: 238605613
Test: atest LockScreenSafetySourceTest
Merged-In: Ia59197eeb86e988d9ffbb86caff4bbda7b30f059
Change-Id: Ia59197eeb86e988d9ffbb86caff4bbda7b30f059
(cherry picked from commit f2b0cedcd0)
2022-07-18 11:18:28 +00:00
..
2022-01-27 08:46:18 +00:00
2022-01-13 23:26:35 -08:00

The simplest way to run all SettingsUnitTests is with atest
$ atest SettingsUnitTests

A single class can also be tested with the following command
$ atest -c <YourClassName>

// The following instructions show how to run the test suite using make + adb //

To build the tests you can use the following command at the root of your android source tree
$ make SettingsUnitTests

The test apk then needs to be installed onto your test device. The apk's location will vary
depending on your device model and architecture. At the end of the make command's output, there
should be a line similar to the following:
"Copy: out/target/product/shamu/testcases/SettingsUnitTests/arm64/SettingsUnitTests.apk"
Install via the following command:
$ adb install -r out/target/product/shamu/testcases/SettingsUnitTests/arm64/SettingsUnitTests.apk

To run all tests:
$ adb shell am instrument -w com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner

To run all tests in a specific class:
$ adb shell am instrument -w -e class com.android.settings.<class> com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner

To run a specific test:
$ adb shell am instrument -w -e class com.android.settings.<class>#<test> com.android.settings.tests.unit/androidx.test.runner.AndroidJUnitRunner

More general information can be found at
http://developer.android.com/reference/android/support/test/runner/AndroidJUnitRunner.html