Add DoNotRunOnTravis annotation

pull/493/head
Mattia Iavarone 5 years ago
parent 301d5d5dc2
commit c64f3bf06e
  1. 16
      cameraview/build.gradle
  2. 5
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/DoNotRunOnTravis.java
  3. 3
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/engine/CameraIntegration1Test.java
  4. 3
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/engine/CameraIntegration2Test.java

@ -8,6 +8,8 @@ group = 'com.otaliastudios'
//region android dependencies //region android dependencies
def travis = System.getenv("TRAVIS")
android { android {
compileSdkVersion rootProject.ext.compileSdkVersion compileSdkVersion rootProject.ext.compileSdkVersion
// buildToolsVersion rootProject.ext.buildToolsVersion // buildToolsVersion rootProject.ext.buildToolsVersion
@ -18,6 +20,9 @@ android {
versionCode 1 versionCode 1
versionName project.version versionName project.version
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
if (travis) {
testInstrumentationRunnerArgument "notAnnotation", "com.otaliastudios.cameraview.DoNotRunOnTravis"
}
} }
buildTypes { buildTypes {
@ -34,13 +39,12 @@ android {
dependencies { dependencies {
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.28.2' testImplementation 'org.mockito:mockito-inline:2.28.2'
androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0' androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'com.google.dexmaker:dexmaker:1.2' androidTestImplementation 'org.mockito:mockito-android:2.28.2'
androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
api 'androidx.exifinterface:exifinterface:1.0.0' api 'androidx.exifinterface:exifinterface:1.0.0'
@ -90,7 +94,6 @@ install {
def bintrayUser def bintrayUser
def bintrayKey def bintrayKey
def travis = System.getenv("TRAVIS")
if (travis) { if (travis) {
bintrayUser = System.getenv("BINTRAY_USER") bintrayUser = System.getenv("BINTRAY_USER")
bintrayKey = System.getenv("BINTRAY_KEY") bintrayKey = System.getenv("BINTRAY_KEY")
@ -215,8 +218,9 @@ task mergedCoverageReport(type: JacocoReport) {
] ]
if (travis) { if (travis) {
// Since this is not testable on the emulator... // Since this is not testable on the emulator...
classFilter.add('com.otaliastudios.cameraview.engine.Camera1Engine') classFilter.add('com.otaliastudios.cameraview.engine.CameraEngine.*')
classFilter.add('com.otaliastudios.cameraview.engine.Camera2Engine') classFilter.add('com.otaliastudios.cameraview.engine.Camera1Engine.*')
classFilter.add('com.otaliastudios.cameraview.engine.Camera2Engine.*')
} }
classDirectories = fileTree(dir: classDir, excludes: classFilter); classDirectories = fileTree(dir: classDir, excludes: classFilter);

@ -0,0 +1,5 @@
package com.otaliastudios.cameraview;
public @interface DoNotRunOnTravis {
String because() default "";
}

@ -1,5 +1,6 @@
package com.otaliastudios.cameraview.engine; package com.otaliastudios.cameraview.engine;
import com.otaliastudios.cameraview.DoNotRunOnTravis;
import com.otaliastudios.cameraview.controls.Engine; import com.otaliastudios.cameraview.controls.Engine;
import org.junit.Ignore; import org.junit.Ignore;
@ -18,7 +19,7 @@ import androidx.test.filters.LargeTest;
*/ */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
@LargeTest @LargeTest
@Ignore("These do work but fail on CI emulators, due to bugs in the Camera1 emulated devices.") @DoNotRunOnTravis(because = "These do work but fail on CI emulators, due to bugs in the Camera1 emulated devices.")
public class CameraIntegration1Test extends CameraIntegrationTest { public class CameraIntegration1Test extends CameraIntegrationTest {
@NonNull @NonNull

@ -1,5 +1,6 @@
package com.otaliastudios.cameraview.engine; package com.otaliastudios.cameraview.engine;
import com.otaliastudios.cameraview.DoNotRunOnTravis;
import com.otaliastudios.cameraview.controls.Engine; import com.otaliastudios.cameraview.controls.Engine;
import org.junit.Ignore; import org.junit.Ignore;
@ -17,7 +18,7 @@ import androidx.test.filters.LargeTest;
*/ */
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
@LargeTest @LargeTest
@Ignore("These do work but fail on CI emulators.") @DoNotRunOnTravis(because = "These do work but fail on CI emulators.")
public class CameraIntegration2Test extends CameraIntegrationTest { public class CameraIntegration2Test extends CameraIntegrationTest {
@NonNull @NonNull

Loading…
Cancel
Save