update to robolectric 4.2.1, fix unit test and include test in ci
This commit is contained in:
parent
842b5ee591
commit
da10499b7d
4 changed files with 38 additions and 23 deletions
|
@ -26,9 +26,39 @@ jobs:
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: News-Android-App/build/outputs/apk
|
path: News-Android-App/build/outputs/apk
|
||||||
destination: apks
|
destination: apks
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: News-Android-App
|
||||||
|
paths:
|
||||||
|
- build
|
||||||
|
|
||||||
|
test:
|
||||||
|
docker:
|
||||||
|
- image: circleci/android:api-28
|
||||||
|
environment:
|
||||||
|
JVM_OPTS: -Xmx3200m
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- attach_workspace:
|
||||||
|
at: News-Android-App
|
||||||
|
- restore_cache:
|
||||||
|
key: jars-{{ checksum "build.gradle" }}-{{ checksum "News-Android-App/build.gradle" }}
|
||||||
|
- run:
|
||||||
|
name: chmod permissions
|
||||||
|
command: chmod +x ./gradlew
|
||||||
|
- run:
|
||||||
|
name: Run unit tests
|
||||||
|
command: ./gradlew test
|
||||||
|
- store_artifacts:
|
||||||
|
path: News-Android-App/build/reports
|
||||||
|
destination: reports
|
||||||
|
- store_test_results:
|
||||||
|
path: News-Android-App/build/test-results
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build:
|
build-test:
|
||||||
jobs:
|
jobs:
|
||||||
- build
|
- build
|
||||||
|
- test:
|
||||||
|
requires:
|
||||||
|
- build
|
||||||
|
|
|
@ -12,6 +12,8 @@ android {
|
||||||
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
|
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
|
||||||
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
|
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
|
||||||
|
|
||||||
|
testOptions.unitTests.includeAndroidResources = true
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
|
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
|
||||||
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
|
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
|
||||||
|
@ -198,7 +200,7 @@ dependencies {
|
||||||
//androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
|
//androidTestImplementation 'com.google.dexmaker:dexmaker:1.2'
|
||||||
//androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
|
//androidTestImplementation 'com.google.dexmaker:dexmaker-mockito:1.2'
|
||||||
|
|
||||||
//androidTestImplementation 'org.robolectric:robolectric:3.0-rc3'
|
testImplementation 'org.robolectric:robolectric:4.2.1'
|
||||||
|
|
||||||
// Core library
|
// Core library
|
||||||
androidTestImplementation 'androidx.test:core:1.1.0'
|
androidTestImplementation 'androidx.test:core:1.1.0'
|
||||||
|
|
|
@ -4,23 +4,18 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.Robolectric;
|
import org.robolectric.Robolectric;
|
||||||
import org.robolectric.RobolectricGradleTestRunner;
|
import org.robolectric.RobolectricTestRunner;
|
||||||
import org.robolectric.annotation.Config;
|
|
||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import de.luhmer.owncloudnewsreader.BuildConfig;
|
|
||||||
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
import de.luhmer.owncloudnewsreader.NewsReaderListActivity;
|
||||||
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
|
import de.luhmer.owncloudnewsreader.database.DatabaseConnectionOrm;
|
||||||
import de.luhmer.owncloudnewsreader.database.model.Feed;
|
import de.luhmer.owncloudnewsreader.database.model.Feed;
|
||||||
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
import de.luhmer.owncloudnewsreader.database.model.RssItem;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
|
||||||
@RunWith(RobolectricGradleTestRunner.class)
|
|
||||||
@Config(constants = BuildConfig.class, sdk = 21)
|
|
||||||
public class TestDbTest {
|
public class TestDbTest {
|
||||||
|
|
||||||
private NewsReaderListActivity activity;
|
private NewsReaderListActivity activity;
|
||||||
|
@ -32,19 +27,6 @@ public class TestDbTest {
|
||||||
activity = Robolectric.buildActivity(NewsReaderListActivity.class).create().get();
|
activity = Robolectric.buildActivity(NewsReaderListActivity.class).create().get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test() {
|
|
||||||
assertTrue(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
@Test
|
|
||||||
public void checkActivityNotNull() throws Exception {
|
|
||||||
assertNotNull(activity);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDatabaseOversize() {
|
public void testDatabaseOversize() {
|
||||||
final DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(activity);
|
final DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(activity);
|
||||||
|
|
|
@ -22,4 +22,5 @@ ANDROID_BUILD_TARGET_SDK_VERSION=28
|
||||||
ANDROID_BUILD_TOOLS_VERSION=28.0.3
|
ANDROID_BUILD_TOOLS_VERSION=28.0.3
|
||||||
ANDROID_BUILD_SDK_VERSION=28
|
ANDROID_BUILD_SDK_VERSION=28
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
android.enableUnitTestBinaryResources=true
|
||||||
|
|
Loading…
Reference in a new issue