Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not merge: test module and GMD repro #414

Draft
wants to merge 1 commit into
base: jv/gradle-managed-virtual-devices
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions TestConfigurationSample/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import com.android.build.api.dsl.ManagedVirtualDevice

plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
Expand Down Expand Up @@ -48,21 +50,21 @@ android {

testOptions {
devices {
pixel2api29(com.android.build.api.dsl.ManagedVirtualDevice) {
pixel2api29(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio
device = "Pixel 2"
apiLevel = 29
// You can also specify "google" if you require Google Play Services.
systemImageSource = "aosp"
abi = "x86"
}
pixel2api26(com.android.build.api.dsl.ManagedVirtualDevice) {
pixel2api26(ManagedVirtualDevice) {
device = "Pixel 2"
apiLevel = 26
systemImageSource = "aosp"
abi = "x86"
}
nexus9api29(com.android.build.api.dsl.ManagedVirtualDevice) {
nexus9api29(ManagedVirtualDevice) {
device = "Nexus 9"
apiLevel = 29
systemImageSource = "aosp"
Expand Down
1 change: 1 addition & 0 deletions TestConfigurationSample/nav-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pointless

69 changes: 69 additions & 0 deletions TestConfigurationSample/nav-tests/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import com.android.build.api.dsl.ManagedVirtualDevice

plugins {
id 'com.android.test'
id 'org.jetbrains.kotlin.android'
}

android {

targetProjectPath ':app'

compileSdk 31

defaultConfig {
applicationId "com.example.android.testing.navtests"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"

testApplicationId "com.example.android.testing.navtests"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}

testOptions {
devices {
pixel2api29(ManagedVirtualDevice) {
// Use device profiles you typically see in Android Studio
device = "Pixel 2"
apiLevel = 29
// You can also specify "google" if you require Google Play Services.
systemImageSource = "aosp"
abi = "x86"
}
pixel2api26(ManagedVirtualDevice) {
device = "Pixel 2"
apiLevel = 26
systemImageSource = "aosp"
abi = "x86"
}
nexus9api29(ManagedVirtualDevice) {
device = "Nexus 9"
apiLevel = 29
systemImageSource = "aosp"
abi = "x86"
}
}
}
}

dependencies {

implementation 'junit:junit:4.13.2'
implementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.testing.navtests">

<application
android:supportsRtl="true" />

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.example.android.testing.navtests

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.android.testing.navtests", appContext.packageName)
}
}
1 change: 1 addition & 0 deletions TestConfigurationSample/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
rootProject.name = "TestConfigurationSample"
include ':app'
include ':nav-tests'