Skip to content

Commit 998835b

Browse files
committed
Move project to unit/ directory and make updates based on feedback
1 parent 2969b53 commit 998835b

File tree

19 files changed

+32
-23
lines changed

19 files changed

+32
-23
lines changed

native/GTestExample/.gitignore

Lines changed: 0 additions & 16 deletions
This file was deleted.

projects.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ ui/espresso/RecyclerViewSample
1515
ui/espresso/ScreenshotSample
1616
ui/espresso/WebBasicSample
1717
ui/uiautomator/BasicSample
18+
unit/BasicNativeAndroidTest
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/*
5+
.DS_Store
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
.cxx
10+
local.properties
11+
File renamed without changes.

native/GTestExample/app/build.gradle renamed to unit/BasicNativeAndroidTest/app/build.gradle

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ plugins {
55
apply plugin: 'kotlin-android'
66

77
android {
8-
compileSdk 31
8+
compileSdk 32
99

1010
defaultConfig {
1111
applicationId "com.example.android.testing.nativesample"
1212
minSdk 18
13-
targetSdk 31
13+
targetSdk 32
1414
versionCode 1
1515
versionName "1.0"
1616

@@ -44,14 +44,26 @@ android {
4444
kotlinOptions {
4545
jvmTarget = '1.8'
4646
}
47+
testOptions {
48+
managedDevices {
49+
devices {
50+
// run with ../gradlew nexusOneApi30DebugAndroidTest
51+
nexusOneApi30(com.android.build.api.dsl.ManagedVirtualDevice) {
52+
// A lower resolution device is used here for better emulator performance
53+
device = "Nexus One"
54+
apiLevel = 30
55+
// Also use the AOSP ATD image for better emulator performance
56+
systemImageSource = "aosp-atd"
57+
}
58+
}
59+
}
60+
}
4761
}
4862

4963
dependencies {
5064
androidTestImplementation "junit:junit:$rootProject.junitVersion"
5165
implementation "androidx.test.ext:junit-gtest:$rootProject.junitGtestVersion"
5266
implementation "com.android.ndk.thirdparty:googletest:$rootProject.googletestVersion"
53-
androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion"
54-
androidTestImplementation "androidx.test.espresso:espresso-remote:$rootProject.espressoVersion"
5567
androidTestImplementation "androidx.test:runner:$rootProject.runnerVersion"
5668
androidTestImplementation "androidx.test.ext:junit-ktx:$extJUnitVersion"
5769
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import androidx.test.ext.junitgtest.GtestRunner
44
import androidx.test.ext.junitgtest.TargetLibrary
55
import org.junit.runner.RunWith
66

7+
8+
// Run our tests with the `GtestRunner`, which knows how to load and run GTest suites.
79
@RunWith(GtestRunner::class)
10+
// Specify the name of the artifact which contains our tests, as configured in CMakeLists.txt
811
@TargetLibrary(libraryName = "adder-test")
912
class AdderTest

0 commit comments

Comments
 (0)