Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
89e481e
Bump kotlin and gradle plugin versions
dazza5000 Feb 14, 2021
744b07d
Update grammar of documentation
dazza5000 Feb 20, 2021
dd263e5
Fix spelling
dazza5000 Feb 20, 2021
b75778f
Merge pull request #365 from dazza5000/patch-2
brettchabot Feb 24, 2021
379022f
Merge pull request #366 from dazza5000/patch-3
brettchabot Feb 24, 2021
3dbf6da
Merge pull request #361 from dazza5000/bump_kotlin_and_gradle_versions
brettchabot Feb 24, 2021
2268cec
Update RBE config to target the new worker pool. (#327)
coeuvre Mar 8, 2021
43e89a9
Update orchestrator sample to use clearPackageData
brettchabot Mar 15, 2021
a28eef8
Updated the test samples to use AndroidX Test 1.4.0-alpha05.
adazh Mar 15, 2021
7577ac9
Merge pull request #373 from android/1_4_0_alpha05
adazh Mar 15, 2021
a1c7572
Merge pull request #372 from android/ftl
brettchabot Mar 15, 2021
793719e
Update to androidx test 1.4.0-alpha06
brettchabot Apr 29, 2021
3b25018
Merge pull request #378 from android/140alpha06
brettchabot Apr 30, 2021
ca0aaae
Fixed deprecations in IntentsAdvancedSample tests
marcodallaba May 3, 2021
7d531ec
Removed BoundedMatcher import.
marcodallaba May 3, 2021
e8aacbf
Updated return type of hasDrawable method to Matcher<View>
marcodallaba May 3, 2021
5295da9
Removed extra space
marcodallaba May 3, 2021
6d913ae
Update to androidx test 1.4.0-beta01
brettchabot May 17, 2021
ac535c1
Merge pull request #383 from android/140beta01
brettchabot May 17, 2021
482321c
Remove build_tools_version and api_level
ahumesky May 20, 2021
441049e
Merge pull request #384 from ahumesky/ahumesky-remove-build-tools-ver…
brettchabot May 20, 2021
d1e3a81
Update to androidx.test 1.4.0-beta02
brettchabot Jun 7, 2021
456eadc
Merge pull request #386 from android/140beta02
brettchabot Jun 7, 2021
280f761
Update to androidx.test 1.4.0 / espresso 3.4.0
brettchabot Jun 30, 2021
0387cdf
Merge pull request #390 from android/140
brettchabot Jul 1, 2021
8f88eee
Workaround for org.checkerframework duplicate class errors.
brettchabot Jul 1, 2021
414e815
Migrate links in README.md to main branch
utzcoz Jul 2, 2021
e7eebc9
Merge pull request #392 from android/classdupeworkaround
brettchabot Jul 14, 2021
785b089
Remove ubuntu1604 from buildkite-pipeline.yml (#391)
philwo Aug 13, 2021
f5b36dc
Stop running android_instrumentation_test on Bazel CI (#397)
comius Aug 13, 2021
30b1b36
Merge pull request #393 from utzcoz/migrate-links-in-READM.md-to-main…
brettchabot Aug 16, 2021
cb136a9
Disable android_instrumentation_test explicitly (#398)
comius Aug 17, 2021
879b764
Merge pull request #381 from marcodb97/deprecations_intents_advanced_…
adazh Sep 9, 2021
8135409
Upgrade to androidx.test alpha libraries released on 08.23.21
brettchabot Sep 9, 2021
a391553
Merge pull request #399 from android/141alpha01
brettchabot Sep 9, 2021
ad2409b
Update to latest dependencies.
brettchabot Sep 18, 2021
d46e049
Update to latest dependencies.
brettchabot Sep 18, 2021
a46d7c5
Merge pull request #401 from android/updategradle
brettchabot Sep 20, 2021
a65295b
Merge branch 'main' into updategradle2
brettchabot Sep 20, 2021
3c4aa68
Merge pull request #402 from android/updategradle2
brettchabot Sep 20, 2021
7f3c696
Update to androidx.test artifacts released on 09.28.2021
brettchabot Sep 29, 2021
e523dbf
Merge pull request #404 from android/141alpha02
brettchabot Sep 29, 2021
214b236
WIP screenshot sample
brettchabot Oct 4, 2021
f7ee5f4
Introduce variables to store versions
brettchabot Oct 4, 2021
2587afb
Fix ws
brettchabot Oct 4, 2021
9dbc3cd
Update to androidx.test versions released on Oct 4, 2021
brettchabot Oct 4, 2021
91c8b6c
Address review comments
brettchabot Oct 4, 2021
f16309a
Add ScreenshotSample entry to main README.md
brettchabot Oct 4, 2021
ef6881a
reorganize imports
brettchabot Oct 4, 2021
64d9846
Merge pull request #405 from android/screenshotsample
brettchabot Oct 5, 2021
1d4bb1f
Merge pull request #406 from android/10042021
brettchabot Oct 5, 2021
f32d2df
WIP: try out gradle managed devices + automated test device image
brettchabot Oct 5, 2021
e15d5e7
Merge branch 'gmd' of github.com:android/testing-samples into gmd
brettchabot Oct 5, 2021
2eabfdb
Add comments
brettchabot Oct 5, 2021
f2d1a49
Address code review comments
brettchabot Oct 6, 2021
7a77c10
Address code review comments
brettchabot Oct 6, 2021
80120fc
put changes in the right gradle file
brettchabot Oct 6, 2021
0e7dd4d
fix ws
brettchabot Oct 6, 2021
eb90ed5
Add an example project that demonstrates how to use Jacoco test cover…
yuuki3655 Oct 14, 2021
2aa6c5c
Upgrade AGP to 7.2.0-alpha03
brettchabot Oct 30, 2021
fb3f187
Merge pull request #407 from android/gmd
brettchabot Nov 3, 2021
2cb1bbd
Remove unused libraries and obsolete instructions from build.gradle a…
yuuki3655 Nov 4, 2021
df830e2
Update screenshot sample to AGP 7.2.0-alpha03.
brettchabot Nov 7, 2021
b1df703
Merge pull request #412 from android/pluginver
brettchabot Nov 8, 2021
e4c651d
Update AndroidTestOrchestrator sample to monitor 1.5.0-beta01,
brettchabot Nov 8, 2021
7f68e65
Update to monitor 1.5.0-rc01 and orchestrator 1.4.1-rc01
brettchabot Nov 18, 2021
4ba0198
Merge pull request #415 from android/monitor150rc01
brettchabot Nov 18, 2021
c94bed7
Update to latest androidx.test stable release for monitor, services,
brettchabot Dec 14, 2021
66a9896
Merge pull request #419 from android/12132021stable
brettchabot Dec 14, 2021
d1baaf8
Update versions to handle single-quote versions & settings.gradle.
Feb 11, 2022
e16dcc3
Update versions numbers to match release Feb 10, 2022.
Feb 11, 2022
cc196e5
Update subprojects versions released on Feb 10, 2022.
Feb 11, 2022
4858929
Merge pull request #411 from yuuki3655/orchestrator_with_coverage_exa…
brettchabot Feb 15, 2022
a5c7c26
Merge pull request #427 from android/update_2022_02_11
ralf-at-android Feb 15, 2022
f013769
build: upgrade AGP from 7.1.0-alpha12 to 7.1.1 to be compatible with …
DevDengChao Feb 23, 2022
bb4805b
Update to androidx.test 03.21.2022 release.
brettchabot Mar 21, 2022
77b3146
Merge pull request #431 from android/axt03212022
ralf-at-android Mar 21, 2022
1d82a8d
Merge pull request #430 from DevDengChao/refactor/upgrade-agp
brettchabot Mar 21, 2022
5ece086
build: depend on google truth
DevDengChao Mar 22, 2022
cce0a9b
refactor: replace Assert.assertThat with Truth.assertThat
DevDengChao Mar 22, 2022
0d56e60
refactor: replace Assert.assertThat with Truth.assertThat
DevDengChao Mar 22, 2022
33dafd0
refactor: replace Assert.assertThat with Truth.assertThat
DevDengChao Mar 22, 2022
fb23d5f
Update to AGP 7.3-alpha07.
brettchabot Mar 24, 2022
c4c8ead
Merge pull request #433 from android/agp
brettchabot Mar 24, 2022
e243ae1
refactor: rearrange dependencies
DevDengChao Mar 25, 2022
af2475e
Add gradle managed device configs for all samples and update test-all.sh
brettchabot Apr 19, 2022
4132118
Add gradle managed device configs for all samples and update test-all.sh
brettchabot Apr 19, 2022
fcb0fb7
Merge branch 'gmd2' of github.com:android/testing-samples into gmd2
brettchabot Apr 19, 2022
b3bb4c1
Remove abi from GMD config.
brettchabot May 2, 2022
c57af7f
Update to use the new release axt libraries 04.28.2022.
adazh May 2, 2022
5a799d9
Merge pull request #436 from android/version
brettchabot May 2, 2022
5fba65c
Use managedDevices syntax.
brettchabot May 3, 2022
9ee5a21
Merge pull request #434 from android/gmd2
brettchabot May 10, 2022
705b28d
Merge branch 'main' into refactor/truth
DevDengChao May 19, 2022
379c12e
Add sample application with native gtest tests run by junit-gtest
fsladkey May 20, 2022
2969b53
Clean up build file
fsladkey May 20, 2022
9a9e354
Merge pull request #432 from DevDengChao/refactor/truth
brettchabot May 23, 2022
998835b
Move project to unit/ directory and make updates based on feedback
fsladkey May 24, 2022
da5cb58
Add README
fsladkey May 24, 2022
c45a0ad
Merge pull request #437 from fsladkey/add-junit-gtest-sample
brettchabot May 24, 2022
7ddfbd1
Bump Robolectric to 4.8.1
utzcoz May 25, 2022
b3e64ad
Merge pull request #439 from utzcoz/bump-versions
brettchabot May 29, 2022
1c17d9a
Update to androidx.test artifacts released on 06.01.2022
brettchabot Jun 1, 2022
22d47ab
Merge pull request #440 from android/axt_06_01_22
adazh Jun 1, 2022
b732476
Version update.
brettchabot Jun 2, 2022
fc9ca44
Merge pull request #441 from android/agpversion
brettchabot Jun 2, 2022
52a3631
Update to androidx.test.core 1.5.0-alpha01
brettchabot Jun 21, 2022
29050c0
Merge pull request #442 from android/core150alpha01
adazh Jun 22, 2022
ef1e449
Add gradle wrapper validation
utzcoz May 23, 2022
abc9f31
Update gradle wrapper for integration/ServiceTestRuleSample
utzcoz May 23, 2022
bbe82cb
Update gradle wrapper for runner/AndroidJunitRunnerSample
utzcoz May 23, 2022
90fdd75
Update gradle wrapper for runner/AndroidTestOrchestratorSample
utzcoz May 23, 2022
7b109ed
Update gradle wrapper for ui
utzcoz May 23, 2022
bc511c1
Update gradle wrapper for unit
utzcoz May 23, 2022
9754b12
Update gradle wrapper for runner/AndroidTestOrchestratorWithTestCover…
utzcoz May 23, 2022
4d3f3f8
Merge pull request #438 from utzcoz/add-gradle-wrapper-validation
yuuki3655 Jun 27, 2022
ed582a7
Update to androidx.test 08.22.2022 release
brettchabot Aug 23, 2022
7090e97
Merge pull request #446 from android/axt2
ralf-at-android Aug 23, 2022
50e41c7
Bump Robolectric to 4.9
utzcoz Oct 1, 2022
6604e75
Merge pull request #447 from utzcoz/bump-Robolectric-to-4.9
brettchabot Oct 6, 2022
f533f18
Update versions.
brettchabot Oct 7, 2022
e83318e
Add testing sample for Espresso Device
Oct 14, 2022
92d9c5f
Add testing sample for Espresso Device
Oct 14, 2022
8c821b7
Add testing sample for Espresso Device
Oct 17, 2022
02a642e
Add testing sample for Espresso Device
Oct 17, 2022
f729369
Undo new line at end of projects.conf
paigemca Oct 17, 2022
f590b02
Merge pull request #449 from kmcauliffe6/espressoDeviceSample
brettchabot Oct 17, 2022
b844c2e
Update to androidx.test 10.24.2022 releases
brettchabot Oct 24, 2022
71cd058
Merge pull request #451 from android/axtBeta1021
brettchabot Oct 24, 2022
dfa5b29
Update to AGP 7.3.1
brettchabot Oct 25, 2022
42228b5
Merge pull request #452 from android/updateAGP
brettchabot Oct 26, 2022
cf85e91
Update to androidx.test 10.26.2022 RC release.
brettchabot Oct 26, 2022
d603281
Merge pull request #453 from android/axtrc01
brettchabot Oct 26, 2022
0288279
Update to androidx.test stable 11.08.2022 release
brettchabot Nov 9, 2022
0f22e68
Merge pull request #457 from android/stable1108
brettchabot Nov 9, 2022
eb3bfbc
Remove obsolete BasicSampleBundled.
brettchabot Dec 20, 2022
0920cbc
Merge pull request #463 from android/rmBundledJars
brettchabot Dec 20, 2022
646f908
Update to androidx.test artifacts released on 01/03/2023
brettchabot Jan 3, 2023
dc7a21f
Merge pull request #464 from android/axt12272022
brettchabot Jan 4, 2023
d597965
Update to androidx.test 03.21.2023 release
brettchabot Mar 21, 2023
a76330b
Merge pull request #472 from android/axt_test_03_13_2023
brettchabot Mar 21, 2023
03c4d64
Update to androidx.test.runner 1.6.0-alpha02
brettchabot Apr 25, 2023
80d62b2
Merge pull request #476 from android/axt_04_24_23
brettchabot Apr 27, 2023
942a207
Update runner version to 1.6.0-alpha03.
brettchabot Jun 27, 2023
66c9a10
Merge pull request #481 from android/runner160alpha03
brettchabot Jun 27, 2023
211c778
Migrate buildToolVersion to property style
utzcoz Jul 8, 2023
2fc9a4c
Merge pull request #483 from utzcoz/migrate-buildToolVersion
brettchabot Jul 10, 2023
5ff52a7
Upgrade to AGP 8.1.0 and kotlin 1.8.20.
brettchabot Aug 22, 2023
a8d4940
Upgrade to AGP 8.1.1/gradle 8.20 and robolectric 4.10.3.
brettchabot Aug 23, 2023
e60b0b0
Merge pull request #485 from android/updateagp
brettchabot Sep 5, 2023
4b8454a
Upgrade to robolectric 4.10.3.
brettchabot Sep 5, 2023
3dd50a1
Merge pull request #486 from android/robo4103
brettchabot Sep 5, 2023
164ffd6
Switch to use double quotes consistently in build.gradle files.
brettchabot Sep 6, 2023
e5733e5
Fix App"s
brettchabot Sep 12, 2023
910bd7c
Merge pull request #487 from android/double_quote_to_single
brettchabot Sep 12, 2023
13e76a4
Adds new ResizeDisplayTest
JoseAlcerreca Feb 2, 2024
e859e49
Adds copyright to test file
JoseAlcerreca Feb 2, 2024
18a85b3
Adds new ResizeDisplayTest
JoseAlcerreca Feb 5, 2024
b2a4999
Update Screenshot sample ot latest versions and API.
brettchabot Apr 29, 2024
0e8efa1
Upgrade espresso device sample to latest versions
brettchabot Apr 29, 2024
a59d128
Merge pull request #511 from android/screenshot
brettchabot Apr 29, 2024
0ba996f
Adds Compose Preview Screenshot sample
JoseAlcerreca May 14, 2024
72bf339
Adds screenshots and README
JoseAlcerreca May 14, 2024
987bf47
Merge pull request #513 from JoseAlcerreca/composepreview
JoseAlcerreca May 14, 2024
8def210
Merge pull request #512 from android/espressoDevice
JoseAlcerreca May 16, 2024
ee515c8
Update versions of test dependencies + AGP.
brettchabot Aug 1, 2024
1b96a49
Merge pull request #517 from android/updateVers
brettchabot Aug 14, 2024
b15b99f
Add renovate.json
renovate[bot] Dec 3, 2024
75fe978
Adds renovate configuration
JoseAlcerreca Dec 3, 2024
bb1c517
Create test-all.yml workflow
JoseAlcerreca Dec 3, 2024
5712371
Update test-all.yml to accept licenses
JoseAlcerreca Dec 3, 2024
46831cc
Enables KVM and more tweaks to CI
JoseAlcerreca Dec 3, 2024
cdb134f
Merge pull request #524 from android/jose/test-all-workflow
JoseAlcerreca Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Empty file added .github/ci-gradle.properties
Empty file.
24 changes: 24 additions & 0 deletions .github/workflows/composescreenshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Workflow name
name: Compose Preview Screenshot
on:
# When it will be triggered
# And in which branch
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'

- name: Build project and run screenshot tests
working-directory: ./ui/PreviewScreenshot
run: ./gradlew validateDebugScreenshotTest
16 changes: 16 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Validate Gradle Wrapper

on:
push:
branches: [ main ]

pull_request:
branches: [ main ]

jobs:
validation:
name: Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
43 changes: 43 additions & 0 deletions .github/workflows/test-all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Workflow name
name: Build + Test all
on:
# When it will be triggered
# And in which branch
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls /dev/kvm

- name: Set Up JDK
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'
cache: 'gradle'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Build project and run local and device tests
run: ./test_all.sh

- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports
path: '**/app/build/reports/androidTests'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ build
.settings/
.classpath
bazel-*
.DS_Store
4 changes: 4 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,9 @@ platform(
name: "dockerPrivileged"
value: "true"
}
properties: {
name: "gceMachineType"
value: "n1-standard-2"
}
""",
)
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,48 @@ A collection of samples demonstrating different frameworks and techniques for au

### Espresso Samples

**[BasicSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/BasicSample)** - Basic Espresso sample
**[BasicSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/BasicSample)** - Basic Espresso sample

**[CustomMatcherSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/CustomMatcherSample)** - Shows how to extend Espresso to match the *hint* property of an EditText
**[CustomMatcherSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/CustomMatcherSample)** - Shows how to extend Espresso to match the *hint* property of an EditText

**[DataAdapterSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/DataAdapterSample)** - Showcases the `onData()` entry point for Espresso, for lists and AdapterViews
**[DataAdapterSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/DataAdapterSample)** - Showcases the `onData()` entry point for Espresso, for lists and AdapterViews

**[FragmentScenarioSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/FragmentScenarioSample)** - Basic usage of `FragmentScenario` with Espresso.
**[FragmentScenarioSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/FragmentScenarioSample)** - Basic usage of `FragmentScenario` with Espresso.

**[IdlingResourceSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/IdlingResourceSample)** - Synchronization with background jobs
**[IdlingResourceSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/IdlingResourceSample)** - Synchronization with background jobs

**[IntentsBasicSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/IntentsBasicSample)** - Basic usage of `intended()` and `intending()`
**[IntentsBasicSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/IntentsBasicSample)** - Basic usage of `intended()` and `intending()`

**[IntentsAdvancedSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/IntentsAdvancedSample)** - Simulates a user fetching a bitmap using the camera
**[IntentsAdvancedSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/IntentsAdvancedSample)** - Simulates a user fetching a bitmap using the camera

**[MultiWindowSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/MultiWindowSample)** - Shows how to point Espresso to different windows
**[MultiWindowSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/MultiWindowSample)** - Shows how to point Espresso to different windows

**[RecyclerViewSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/RecyclerViewSample)** - RecyclerView actions for Espresso
**[RecyclerViewSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/RecyclerViewSample)** - RecyclerView actions for Espresso

**[WebBasicSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/WebBasicSample)** - Use Espresso-web to interact with WebViews
**[ScreenshotSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/ScreenshotSample)** - Screenshot capturing and saving using Espresso and androidx.test.core APIs

**[BasicSampleBundled](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/BasicSampleBundled)** - Basic sample for Eclipse and other IDEs
**[WebBasicSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/WebBasicSample)** - Use Espresso-web to interact with WebViews

**[MultiProcessSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/MultiProcessSample)** - Showcases how to use multiprocess Espresso.
**[BasicSampleBundled](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/BasicSampleBundled)** - Basic sample for Eclipse and other IDEs

**[MultiProcessSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/MultiProcessSample)** - Showcases how to use multiprocess Espresso.
### UiAutomator Sample

**[BasicSample](https://github.com/googlesamples/android-testing/tree/master/ui/uiautomator/BasicSample)** - Basic UI Automator sample
**[BasicSample](https://github.com/googlesamples/android-testing/tree/main/ui/uiautomator/BasicSample)** - Basic UI Automator sample

### AndroidJUnitRunner Sample

**[AndroidJunitRunnerSample](https://github.com/googlesamples/android-testing/tree/master/runner/AndroidJunitRunnerSample)** - Showcases test annotations, parameterized tests and testsuite creation
**[AndroidJunitRunnerSample](https://github.com/googlesamples/android-testing/tree/main/runner/AndroidJunitRunnerSample)** - Showcases test annotations, parameterized tests and testsuite creation

### JUnit4 Rules Sample

**All previous samples use ActivityTestRule or IntentsTestRule but there's one specific to ServiceTestRule:

**[BasicSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/BasicSample)** - Simple usage of `ActivityTestRule`
**[BasicSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/BasicSample)** - Simple usage of `ActivityTestRule`

**[IntentsBasicSample](https://github.com/googlesamples/android-testing/blob/master/ui/espresso/IntentsBasicSample)** - Simple usage of `IntentsTestRule`
**[IntentsBasicSample](https://github.com/googlesamples/android-testing/blob/main/ui/espresso/IntentsBasicSample)** - Simple usage of `IntentsTestRule`

**[ServiceTestRuleSample](https://github.com/googlesamples/android-testing/tree/master/integration/ServiceTestRuleSample)** - Simple usage of `ServiceTestRule`
**[ServiceTestRuleSample](https://github.com/googlesamples/android-testing/tree/main/integration/ServiceTestRuleSample)** - Simple usage of `ServiceTestRule`

Prerequisites
--------------
Expand Down
7 changes: 1 addition & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external")

# Set the path to your local SDK installation, or use the ANDROID_HOME environment variable.
android_sdk_repository(
name = "androidsdk",
api_level = 28,
build_tools_version = "28.0.2",
# path = "/path/to/sdk",
)
android_sdk_repository(name = "androidsdk")

# Required for running emulator tests on RBE on Bazel CI
android_ndk_repository(name = "androidndk")
Expand Down
89 changes: 80 additions & 9 deletions bazelci/buildkite-pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,95 @@
# https://github.com/googlesamples/android-testing#experimental-bazel-support
---
platforms:
ubuntu1604:
build_targets:
- "//..."
test_flags:
- "--config=remote_android"
- "--flaky_test_attempts=3"
test_targets:
- "//..."
- "-//ui/espresso/AccessibilitySample/..."
ubuntu1804:
build_targets:
- "//..."
- "-//ui/uiautomator/BasicSample:BasicSampleInstrumentationTest_23_x86" # BazelCI does not have Android Emulator
- "-//ui/uiautomator/BasicSample:BasicSampleInstrumentationTest_22_x86"
- "-//ui/uiautomator/BasicSample:BasicSampleInstrumentationTest_21_x86"
- "-//ui/uiautomator/BasicSample:BasicSampleInstrumentationTest_19_x86"
- "-//ui/espresso/RecyclerViewSample:RecyclerViewSampleInstrumentationTest_23_x86"
- "-//ui/espresso/RecyclerViewSample:RecyclerViewSampleInstrumentationTest_22_x86"
- "-//ui/espresso/RecyclerViewSample:RecyclerViewSampleInstrumentationTest_21_x86"
- "-//ui/espresso/RecyclerViewSample:RecyclerViewSampleInstrumentationTest_19_x86"
- "-//ui/espresso/MultiWindowSample:MultiWindowSampleInstrumentationTest_23_x86"
- "-//ui/espresso/MultiWindowSample:MultiWindowSampleInstrumentationTest_22_x86"
- "-//ui/espresso/MultiWindowSample:MultiWindowSampleInstrumentationTest_21_x86"
- "-//ui/espresso/MultiWindowSample:MultiWindowSampleInstrumentationTest_19_x86"
- "-//ui/espresso/IntentsBasicSample:IntentsBasicSampleInstrumentationTest_23_x86"
- "-//ui/espresso/IntentsBasicSample:IntentsBasicSampleInstrumentationTest_22_x86"
- "-//ui/espresso/IntentsBasicSample:IntentsBasicSampleInstrumentationTest_21_x86"
- "-//ui/espresso/IntentsBasicSample:IntentsBasicSampleInstrumentationTest_19_x86"
- "-//ui/espresso/IntentsAdvancedSample:IntentsAdvancedSampleInstrumentationTest_23_x86"
- "-//ui/espresso/IntentsAdvancedSample:IntentsAdvancedSampleInstrumentationTest_22_x86"
- "-//ui/espresso/IntentsAdvancedSample:IntentsAdvancedSampleInstrumentationTest_21_x86"
- "-//ui/espresso/IntentsAdvancedSample:IntentsAdvancedSampleInstrumentationTest_19_x86"
- "-//ui/espresso/IdlingResourceSample:IdlingResourceSampleInstrumentationTest_23_x86"
- "-//ui/espresso/IdlingResourceSample:IdlingResourceSampleInstrumentationTest_22_x86"
- "-//ui/espresso/IdlingResourceSample:IdlingResourceSampleInstrumentationTest_21_x86"
- "-//ui/espresso/IdlingResourceSample:IdlingResourceSampleInstrumentationTest_19_x86"
- "-//ui/espresso/DataAdapterSample:DataAdapterSampleInstrumentationTest_23_x86"
- "-//ui/espresso/DataAdapterSample:DataAdapterSampleInstrumentationTest_22_x86"
- "-//ui/espresso/DataAdapterSample:DataAdapterSampleInstrumentationTest_21_x86"
- "-//ui/espresso/DataAdapterSample:DataAdapterSampleInstrumentationTest_19_x86"
- "-//ui/espresso/CustomMatcherSample:CustomMatcherSampleInstrumentationTest_23_x86"
- "-//ui/espresso/CustomMatcherSample:CustomMatcherSampleInstrumentationTest_22_x86"
- "-//ui/espresso/CustomMatcherSample:CustomMatcherSampleInstrumentationTest_21_x86"
- "-//ui/espresso/CustomMatcherSample:CustomMatcherSampleInstrumentationTest_19_x86"
- "-//ui/espresso/BasicSample:BasicSampleInstrumentationTest_23_x86"
- "-//ui/espresso/BasicSample:BasicSampleInstrumentationTest_22_x86"
- "-//ui/espresso/BasicSample:BasicSampleInstrumentationTest_21_x86"
- "-//ui/espresso/BasicSample:BasicSampleInstrumentationTest_19_x86"
- "-//ui/espresso/AccessibilitySample:BasicSampleInstrumentationTest_23_x86"
- "-//ui/espresso/AccessibilitySample:BasicSampleInstrumentationTest_22_x86"
- "-//ui/espresso/AccessibilitySample:BasicSampleInstrumentationTest_21_x86"
- "-//ui/espresso/AccessibilitySample:BasicSampleInstrumentationTest_19_x86"
test_flags:
- "--config=remote_android"
- "--flaky_test_attempts=3"
test_targets:
- "//..."
- "-//ui/espresso/AccessibilitySample/..."
- "-//ui/uiautomator/BasicSample:BasicSampleInstrumentationTest_23_x86" # BazelCI does not have Android Emulator
- "-//ui/uiautomator/BasicSample:BasicSampleInstrumentationTest_22_x86"
- "-//ui/uiautomator/BasicSample:BasicSampleInstrumentationTest_21_x86"
- "-//ui/uiautomator/BasicSample:BasicSampleInstrumentationTest_19_x86"
- "-//ui/espresso/RecyclerViewSample:RecyclerViewSampleInstrumentationTest_23_x86"
- "-//ui/espresso/RecyclerViewSample:RecyclerViewSampleInstrumentationTest_22_x86"
- "-//ui/espresso/RecyclerViewSample:RecyclerViewSampleInstrumentationTest_21_x86"
- "-//ui/espresso/RecyclerViewSample:RecyclerViewSampleInstrumentationTest_19_x86"
- "-//ui/espresso/MultiWindowSample:MultiWindowSampleInstrumentationTest_23_x86"
- "-//ui/espresso/MultiWindowSample:MultiWindowSampleInstrumentationTest_22_x86"
- "-//ui/espresso/MultiWindowSample:MultiWindowSampleInstrumentationTest_21_x86"
- "-//ui/espresso/MultiWindowSample:MultiWindowSampleInstrumentationTest_19_x86"
- "-//ui/espresso/IntentsBasicSample:IntentsBasicSampleInstrumentationTest_23_x86"
- "-//ui/espresso/IntentsBasicSample:IntentsBasicSampleInstrumentationTest_22_x86"
- "-//ui/espresso/IntentsBasicSample:IntentsBasicSampleInstrumentationTest_21_x86"
- "-//ui/espresso/IntentsBasicSample:IntentsBasicSampleInstrumentationTest_19_x86"
- "-//ui/espresso/IntentsAdvancedSample:IntentsAdvancedSampleInstrumentationTest_23_x86"
- "-//ui/espresso/IntentsAdvancedSample:IntentsAdvancedSampleInstrumentationTest_22_x86"
- "-//ui/espresso/IntentsAdvancedSample:IntentsAdvancedSampleInstrumentationTest_21_x86"
- "-//ui/espresso/IntentsAdvancedSample:IntentsAdvancedSampleInstrumentationTest_19_x86"
- "-//ui/espresso/IdlingResourceSample:IdlingResourceSampleInstrumentationTest_23_x86"
- "-//ui/espresso/IdlingResourceSample:IdlingResourceSampleInstrumentationTest_22_x86"
- "-//ui/espresso/IdlingResourceSample:IdlingResourceSampleInstrumentationTest_21_x86"
- "-//ui/espresso/IdlingResourceSample:IdlingResourceSampleInstrumentationTest_19_x86"
- "-//ui/espresso/DataAdapterSample:DataAdapterSampleInstrumentationTest_23_x86"
- "-//ui/espresso/DataAdapterSample:DataAdapterSampleInstrumentationTest_22_x86"
- "-//ui/espresso/DataAdapterSample:DataAdapterSampleInstrumentationTest_21_x86"
- "-//ui/espresso/DataAdapterSample:DataAdapterSampleInstrumentationTest_19_x86"
- "-//ui/espresso/CustomMatcherSample:CustomMatcherSampleInstrumentationTest_23_x86"
- "-//ui/espresso/CustomMatcherSample:CustomMatcherSampleInstrumentationTest_22_x86"
- "-//ui/espresso/CustomMatcherSample:CustomMatcherSampleInstrumentationTest_21_x86"
- "-//ui/espresso/CustomMatcherSample:CustomMatcherSampleInstrumentationTest_19_x86"
- "-//ui/espresso/BasicSample:BasicSampleInstrumentationTest_23_x86"
- "-//ui/espresso/BasicSample:BasicSampleInstrumentationTest_22_x86"
- "-//ui/espresso/BasicSample:BasicSampleInstrumentationTest_21_x86"
- "-//ui/espresso/BasicSample:BasicSampleInstrumentationTest_19_x86"
- "-//ui/espresso/AccessibilitySample:BasicSampleInstrumentationTest_23_x86"
- "-//ui/espresso/AccessibilitySample:BasicSampleInstrumentationTest_22_x86"
- "-//ui/espresso/AccessibilitySample:BasicSampleInstrumentationTest_21_x86"
- "-//ui/espresso/AccessibilitySample:BasicSampleInstrumentationTest_19_x86"
macos:
# Testing does not work for macos and windows yet
build_targets: # Results of `bazel query 'kind(android_binary, //...)'
Expand Down
38 changes: 26 additions & 12 deletions integration/ServiceTestRuleSample/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
apply plugin: 'com.android.application'
apply plugin: "com.android.application"

android {
compileSdkVersion 30
buildToolsVersion rootProject.buildToolsVersion
compileSdk 34
defaultConfig {
applicationId "com.example.android.testing.integrationtesting.ServiceTestRuleSample"
minSdkVersion 14
targetSdkVersion 30
minSdkVersion 21
targetSdkVersion 34
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
abortOnError false
}
productFlavors {
}
testOptions {
managedDevices {
devices {
// run with ../gradlew nexusOneApi30DebugAndroidTest
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
// A lower resolution device is used here for better emulator performance
device = "Nexus One"
apiLevel = 30
// Also use the AOSP ATD image for better emulator performance
systemImageSource = "aosp-atd"
}
}
}
}
namespace "com.example.android.testing.ServiceTestRuleSample"
lint {
abortOnError false
}
}

dependencies {
// Testing-only dependencies
androidTestImplementation 'androidx.test:core:' + rootProject.coreVersion;
androidTestImplementation 'androidx.test.ext:junit:' + rootProject.extJUnitVersion;
androidTestImplementation 'androidx.test:runner:' + rootProject.runnerVersion;
androidTestImplementation 'androidx.test:rules:' + rootProject.rulesVersion;
androidTestImplementation "androidx.test:core:" + rootProject.coreVersion;
androidTestImplementation "androidx.test.ext:junit:" + rootProject.extJUnitVersion;
androidTestImplementation "androidx.test:runner:" + rootProject.runnerVersion;
androidTestImplementation "androidx.test:rules:" + rootProject.rulesVersion;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
-->


<manifest package="com.example.android.testing.ServiceTestRuleSample"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:icon="@mipmap/ic_launcher"
Expand Down
16 changes: 8 additions & 8 deletions integration/ServiceTestRuleSample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.agpVersion = "8.5.0"
repositories {
// Insert local test repo here
jcenter()
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "com.android.tools.build:gradle:$agpVersion"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -17,15 +18,14 @@ buildscript {
allprojects {
repositories {
// Insert local test repo here
jcenter()
google()
mavenCentral()
}
}

ext {
buildToolsVersion = "30.0.2"
coreVersion = "1.4.0-alpha04"
extJUnitVersion = "1.1.3-alpha04"
runnerVersion = "1.4.0-alpha04"
rulesVersion = "1.4.0-alpha04"
coreVersion = "1.6.1"
extJUnitVersion = "1.2.1"
runnerVersion = "1.6.1"
rulesVersion = "1.6.1"
}
Loading