Skip to content

Commit

Permalink
Merge pull request #2728 from owncloud/new_arch/modularization_tests_…
Browse files Browse the repository at this point in the history
…cleanup

[New arch] [Modularization] Tests and cleanup
  • Loading branch information
davigonz authored Dec 4, 2019
2 parents 260620b + 62b6ec6 commit a804306
Show file tree
Hide file tree
Showing 141 changed files with 6,768 additions and 11,443 deletions.
28 changes: 22 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
buildscript {
ext {
// SDK
sdkCompileVersion = 28
sdkMinVersion = 19
sdkTargetVersion = 28

// Android jetpack
archLifecycleVersion = '2.1.0'
roomVersion = '2.1.0'
archLifecycleVersion = "2.1.0"
roomVersion = "2.2.2"
appCompat = "1.1.0"
sqliteVersion = "2.0.1"
lifecycleLiveData = "2.0.0"

// Kotlin
kotlinVersion = '1.3.50'
kotlinVersion = "1.3.50"
coroutinesVersion = "1.3.2"

// Koin
koinVersion = '2.0.1'
mockkVersion = '1.9.3'
koinVersion = "2.0.1"
mockkVersion = "1.9.3"

// Testing
junitVersion = "4.12"
extJunitVersion = "1.1.1"
androidTestVersion = "1.2.0"
mockitoVersion = "2.24.0"
espressoTestVersion = "3.2.0"
fragmentTestVersion = "1.1.0"
uiAutomatorTestVersion = "2.2.0"
annotationTestVersion = "1.1.0"

// Extensions
ktxVersion = "1.1.0"

// KTX extensions
ktxCoreVersion = "1.0.2"
ktxCoreVersion = "1.1.0"
ktxViewModelVersion = "2.2.0-alpha01"
ktxFragmentVersion = "1.0.0"
ktxLiveData = "2.1.0"
}

repositories {
Expand Down
60 changes: 24 additions & 36 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,35 @@ dependencies {
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'com.google.android.exoplayer:exoplayer:r2.2.0'
implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.appcompat:appcompat:$appCompat"
implementation 'com.getbase:floatingactionbutton:1.10.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.browser:browser:$androidX"
implementation 'commons-io:commons-io:2.6'
implementation "androidx.sqlite:sqlite:$sqliteVersion"

// Dependencies for unit tests
// Tests
testImplementation project(':owncloudTestUtil')
testImplementation "junit:junit:$junitVersion"
testImplementation "androidx.arch.core:core-testing:$archLifecycleVersion"
testImplementation "io.mockk:mockk:$mockkVersion"

// Dependencies for instrumented tests
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
// JUnit4 Rules
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
// Android JUnit Runner
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'androidx.annotation:annotation:1.1.0'
androidTestImplementation "androidx.room:room-testing:$roomVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"

// Instrumented tests
androidTestImplementation project(':owncloudTestUtil')
androidTestImplementation "androidx.test:core:$androidTestVersion"
androidTestImplementation "androidx.test:rules:$androidTestVersion"
androidTestImplementation "androidx.test:runner:$androidTestVersion"
androidTestImplementation "androidx.test:runner:$androidTestVersion"
androidTestImplementation "androidx.test.ext:junit:$extJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoTestVersion"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoTestVersion"
androidTestImplementation "androidx.test.espresso:espresso-intents:$espressoTestVersion"
androidTestImplementation "androidx.test.espresso:espresso-web:$espressoTestVersion"
androidTestImplementation "androidx.test.uiautomator:uiautomator:$uiAutomatorTestVersion"
androidTestImplementation "androidx.annotation:annotation:$annotationTestVersion"
androidTestImplementation "androidx.arch.core:core-testing:$archLifecycleVersion"
androidTestImplementation ("io.mockk:mockk-android:$mockkVersion") {
androidTestImplementation("io.mockk:mockk-android:$mockkVersion") {
exclude module: 'objenesis'
}

Expand All @@ -64,10 +66,9 @@ dependencies {

implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel:$archLifecycleVersion"
kapt "androidx.lifecycle:lifecycle-compiler:$archLifecycleVersion"
kapt "androidx.lifecycle:lifecycle-common-java8:$archLifecycleVersion"

implementation "androidx.room:room-runtime:$roomVersion"
kapt "androidx.room:room-compiler:$roomVersion"

// Koin dependency injector
implementation "org.koin:koin-androidx-viewmodel:$koinVersion"
Expand All @@ -76,12 +77,6 @@ dependencies {
implementation "androidx.core:core-ktx:$ktxCoreVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$ktxViewModelVersion"
implementation "androidx.fragment:fragment-ktx:$ktxFragmentVersion"

// Kotlin library to mock
testImplementation "io.mockk:mockk:$mockkVersion"
androidTestImplementation ("io.mockk:mockk-android:$mockkVersion") {
exclude module: 'objenesis'
}
}

tasks.withType(Test) {
Expand All @@ -97,24 +92,18 @@ allOpen {
}

android {
compileSdkVersion 28
compileSdkVersion sdkCompileVersion

defaultConfig {
minSdkVersion 19
targetSdkVersion 28
minSdkVersion sdkMinVersion
targetSdkVersion sdkTargetVersion

versionCode = 21300100
versionName = "2.13.1"

buildConfigField "String", gitRemote, "\"" + getGitOriginRemote() + "\""
buildConfigField "String", commitSHA1, "\"" + getLatestGitHash() + "\""

javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand All @@ -126,7 +115,6 @@ android {
sourceSets {
androidTest.java.srcDirs += "src/test-common/java"
test.java.srcDirs += "src/test-common/java"
androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
}

lintOptions {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
*
* @author David A. Velasco
* Copyright (C) 2017 ownCloud GmbH.
* <p>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
* <p>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
Expand All @@ -21,11 +21,9 @@

import android.os.Parcel;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
Expand All @@ -39,7 +37,6 @@
*
* See http://developer.android.com/intl/es/training/testing/unit-testing/instrumented-unit-tests.html .
*/
@RunWith(AndroidJUnit4.class)
@SmallTest
public class OCFileUnitTest {

Expand Down
Loading

0 comments on commit a804306

Please sign in to comment.