Skip to content

Commit 86365a8

Browse files
committed
add basic instrumentation test
1 parent 923e0b4 commit 86365a8

File tree

2 files changed

+38
-6
lines changed

2 files changed

+38
-6
lines changed

visionSamples/FaceTracker/app/build.gradle

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ android {
55
config {
66
keyAlias 'test'
77
keyPassword 'test123321'
8-
storeFile file('E:/Work/android-vision/signing/test.jks')
8+
storeFile file('C:/Work/android-vision/signing/test.jks')
99
storePassword 'test123321'
1010
}
1111
}
12-
compileSdkVersion 24
12+
compileSdkVersion 23
1313
buildToolsVersion '27.0.3'
1414
defaultConfig {
1515
applicationId "com.google.android.gms.samples.vision.face.facetracker"
1616
minSdkVersion 15
17-
targetSdkVersion 24
17+
targetSdkVersion 23
1818
versionCode 1
1919
versionName "1.0"
2020
externalNativeBuild {
@@ -29,8 +29,9 @@ android {
2929
//cFlags "-D__STDC_FORMAT_MACROS"
3030

3131
}
32-
}
32+
}
3333
signingConfig signingConfigs.config
34+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3435
}
3536
buildTypes {
3637
release {
@@ -39,6 +40,7 @@ android {
3940
signingConfig signingConfigs.config
4041
}
4142
}
43+
testBuildType "release"
4244
externalNativeBuild {
4345
cmake {
4446
path "CMakeLists.txt"
@@ -49,9 +51,18 @@ android {
4951
}
5052

5153
dependencies {
54+
implementation 'com.android.support:support-annotations:27.1.1'
55+
56+
androidTestImplementation 'junit:junit:4.12'
57+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
58+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
59+
androidTestImplementation 'com.android.support.test:rules:1.0.2'
60+
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
61+
5262
implementation fileTree(include: ['*.jar'], dir: 'libs')
53-
implementation 'com.android.support:support-v4:24.2.0'
54-
implementation 'com.android.support:design:24.2.0'
63+
implementation 'com.android.support:support-v4:23.4.0'
64+
implementation 'com.android.support:design:23.4.0'
5565
implementation 'com.google.android.gms:play-services-vision:9.4.0+'
5666
implementation 'com.shamanland:xdroid-toaster:0.2.4'
67+
5768
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.google.android.gms.samples.vision.face.facetracker;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static junit.framework.Assert.assertEquals;
11+
12+
@RunWith(AndroidJUnit4.class)
13+
public class ExampleInstrumentedTest {
14+
@Test
15+
public void useAppContext() throws Exception {
16+
// Context of the app under test.
17+
Context appContext = InstrumentationRegistry.getTargetContext();
18+
19+
assertEquals("ch.hepia.iti.opencvnativeandroidstudio", appContext.getPackageName());
20+
}
21+
}

0 commit comments

Comments
 (0)