mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Annotate all Android tests
This commit is contained in:
2
build.sh
2
build.sh
@@ -122,8 +122,8 @@ uninstall_apk() {
|
|||||||
|
|
||||||
install_test_butler() {
|
install_test_butler() {
|
||||||
log_info "Installing Test Butler"
|
log_info "Installing Test Butler"
|
||||||
$ADB install tools/test-butler-app-1.3.1.apk
|
|
||||||
$ADB uninstall com.linkedin.android.testbutler
|
$ADB uninstall com.linkedin.android.testbutler
|
||||||
|
$ADB install tools/test-butler-app-1.3.1.apk
|
||||||
}
|
}
|
||||||
|
|
||||||
install_apk() {
|
install_apk() {
|
||||||
|
|||||||
@@ -72,30 +72,28 @@ dependencies {
|
|||||||
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
annotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
||||||
annotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
annotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
|
|
||||||
androidTestImplementation project(":uhabits-core")
|
androidTestAnnotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
|
androidTestAnnotationProcessor 'com.google.dagger:dagger-compiler:2.9'
|
||||||
|
androidTestAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
||||||
|
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:2.2.2'
|
||||||
|
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
|
||||||
|
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
|
||||||
|
androidTestImplementation 'com.google.dagger:dagger:2.9'
|
||||||
|
androidTestImplementation 'com.linkedin.testbutler:test-butler-library:1.3.1'
|
||||||
|
androidTestImplementation "org.mockito:mockito-android:2.8.9"
|
||||||
|
androidTestCompileOnly 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
androidTestImplementation 'com.android.support:support-annotations:25.3.1'
|
androidTestImplementation 'com.android.support:support-annotations:25.3.1'
|
||||||
androidTestImplementation 'com.android.support.test:rules:0.5'
|
androidTestImplementation 'com.android.support.test:rules:0.5'
|
||||||
androidTestImplementation 'com.android.support.test:runner:0.5'
|
androidTestImplementation 'com.android.support.test:runner:0.5'
|
||||||
androidTestImplementation 'com.google.guava:guava:20.0'
|
androidTestImplementation 'com.google.guava:guava:20.0'
|
||||||
androidTestCompileOnly 'com.google.auto.factory:auto-factory:1.0-beta3'
|
androidTestImplementation project(":uhabits-core")
|
||||||
androidTestAnnotationProcessor 'com.google.dagger:dagger-compiler:2.9'
|
|
||||||
androidTestAnnotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
|
||||||
androidTestAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
|
||||||
|
|
||||||
testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.9'
|
|
||||||
testAnnotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
testAnnotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||||
|
testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.9'
|
||||||
testAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
testAnnotationProcessor 'com.jakewharton:butterknife-compiler:8.6.1-SNAPSHOT'
|
||||||
|
|
||||||
testCompile 'com.google.dagger:dagger:2.9'
|
testCompile 'com.google.dagger:dagger:2.9'
|
||||||
testCompile "org.mockito:mockito-core:2.8.9"
|
testCompile "org.mockito:mockito-core:2.8.9"
|
||||||
testCompile "org.mockito:mockito-inline:2.8.9"
|
testCompile "org.mockito:mockito-inline:2.8.9"
|
||||||
androidTestCompile 'com.google.dagger:dagger:2.9'
|
|
||||||
androidTestCompile "org.mockito:mockito-android:2.8.9"
|
|
||||||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
|
||||||
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
|
|
||||||
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
|
|
||||||
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2.2'
|
|
||||||
androidTestCompile 'com.linkedin.testbutler:test-butler-library:1.3.1'
|
|
||||||
|
|
||||||
implementation('com.opencsv:opencsv:3.9') {
|
implementation('com.opencsv:opencsv:3.9') {
|
||||||
exclude group: 'commons-logging', module: 'commons-logging'
|
exclude group: 'commons-logging', module: 'commons-logging'
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
package org.isoron.uhabits;
|
package org.isoron.uhabits;
|
||||||
|
|
||||||
import android.content.*;
|
import android.content.*;
|
||||||
import android.support.test.filters.*;
|
|
||||||
import android.support.test.uiautomator.*;
|
import android.support.test.uiautomator.*;
|
||||||
|
|
||||||
import com.linkedin.android.testbutler.*;
|
import com.linkedin.android.testbutler.*;
|
||||||
@@ -36,7 +35,6 @@ import java.io.*;
|
|||||||
import static android.support.test.InstrumentationRegistry.*;
|
import static android.support.test.InstrumentationRegistry.*;
|
||||||
import static android.support.test.uiautomator.UiDevice.*;
|
import static android.support.test.uiautomator.UiDevice.*;
|
||||||
|
|
||||||
@LargeTest
|
|
||||||
public class BaseUIAutomatorTest
|
public class BaseUIAutomatorTest
|
||||||
{
|
{
|
||||||
private static final String PKG = "org.isoron.uhabits";
|
private static final String PKG = "org.isoron.uhabits";
|
||||||
|
|||||||
@@ -19,13 +19,19 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.acceptance;
|
package org.isoron.uhabits.acceptance;
|
||||||
|
|
||||||
|
import android.support.test.filters.*;
|
||||||
|
import android.support.test.runner.*;
|
||||||
|
|
||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
import org.junit.runner.*;
|
||||||
|
|
||||||
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*;
|
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*;
|
||||||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*;
|
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*;
|
||||||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*;
|
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@LargeTest
|
||||||
public class AboutTest extends BaseUIAutomatorTest
|
public class AboutTest extends BaseUIAutomatorTest
|
||||||
{
|
{
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -19,14 +19,20 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.acceptance;
|
package org.isoron.uhabits.acceptance;
|
||||||
|
|
||||||
|
import android.support.test.filters.*;
|
||||||
|
import android.support.test.runner.*;
|
||||||
|
|
||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
import org.junit.runner.*;
|
||||||
|
|
||||||
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*;
|
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*;
|
||||||
import static org.isoron.uhabits.acceptance.steps.EditHabitSteps.*;
|
import static org.isoron.uhabits.acceptance.steps.EditHabitSteps.*;
|
||||||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*;
|
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*;
|
||||||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*;
|
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@LargeTest
|
||||||
public class HabitsTest extends BaseUIAutomatorTest
|
public class HabitsTest extends BaseUIAutomatorTest
|
||||||
{
|
{
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -19,15 +19,19 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.acceptance;
|
package org.isoron.uhabits.acceptance;
|
||||||
|
|
||||||
|
import android.support.test.filters.*;
|
||||||
|
import android.support.test.runner.*;
|
||||||
|
|
||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
import org.junit.runner.*;
|
||||||
|
|
||||||
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*;
|
import static org.isoron.uhabits.acceptance.steps.CommonSteps.*;
|
||||||
|
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.*;
|
||||||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*;
|
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.*;
|
||||||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.ABOUT;
|
|
||||||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.HELP;
|
|
||||||
import static org.isoron.uhabits.acceptance.steps.ListHabitsSteps.MenuItem.SETTINGS;
|
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@LargeTest
|
||||||
public class LinksTest extends BaseUIAutomatorTest
|
public class LinksTest extends BaseUIAutomatorTest
|
||||||
{
|
{
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -20,14 +20,17 @@
|
|||||||
package org.isoron.uhabits.integration;
|
package org.isoron.uhabits.integration;
|
||||||
|
|
||||||
import android.support.test.filters.*;
|
import android.support.test.filters.*;
|
||||||
|
import android.support.test.runner.*;
|
||||||
|
|
||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.isoron.uhabits.activities.about.*;
|
import org.isoron.uhabits.activities.about.*;
|
||||||
import org.isoron.uhabits.activities.habits.list.*;
|
import org.isoron.uhabits.activities.habits.list.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
import org.junit.runner.*;
|
||||||
|
|
||||||
import static java.lang.Thread.*;
|
import static java.lang.Thread.*;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
@LargeTest
|
@LargeTest
|
||||||
public class SavedStateTest extends BaseUIAutomatorTest
|
public class SavedStateTest extends BaseUIAutomatorTest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import static org.hamcrest.MatcherAssert.*;
|
|||||||
import static org.hamcrest.core.IsEqual.equalTo;
|
import static org.hamcrest.core.IsEqual.equalTo;
|
||||||
import static org.isoron.uhabits.core.models.HabitList.Order.*;
|
import static org.isoron.uhabits.core.models.HabitList.Order.*;
|
||||||
|
|
||||||
@SuppressWarnings("JavaDoc")
|
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
@MediumTest
|
@MediumTest
|
||||||
public class HabitListTest extends BaseAndroidTest
|
public class HabitListTest extends BaseAndroidTest
|
||||||
|
|||||||
@@ -20,12 +20,15 @@
|
|||||||
package org.isoron.uhabits.performance;
|
package org.isoron.uhabits.performance;
|
||||||
|
|
||||||
import android.support.test.filters.*;
|
import android.support.test.filters.*;
|
||||||
|
import android.support.test.runner.*;
|
||||||
|
|
||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.isoron.uhabits.core.models.*;
|
import org.isoron.uhabits.core.models.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
import org.junit.runner.*;
|
||||||
|
|
||||||
@MediumTest
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@LargeTest
|
||||||
public class PerformanceTest extends BaseAndroidTest
|
public class PerformanceTest extends BaseAndroidTest
|
||||||
{
|
{
|
||||||
private Habit habit;
|
private Habit habit;
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
package org.isoron.uhabits.utils;
|
package org.isoron.uhabits.utils;
|
||||||
|
|
||||||
import android.app.*;
|
import android.app.*;
|
||||||
|
import android.support.test.runner.*;
|
||||||
|
import android.test.suitebuilder.annotation.*;
|
||||||
|
|
||||||
import org.isoron.uhabits.*;
|
import org.isoron.uhabits.*;
|
||||||
import org.isoron.uhabits.core.commands.*;
|
import org.isoron.uhabits.core.commands.*;
|
||||||
@@ -27,12 +29,15 @@ import org.isoron.uhabits.core.models.*;
|
|||||||
import org.isoron.uhabits.core.utils.*;
|
import org.isoron.uhabits.core.utils.*;
|
||||||
import org.isoron.uhabits.intents.*;
|
import org.isoron.uhabits.intents.*;
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
import org.junit.runner.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static java.util.Arrays.asList;
|
import static java.util.Arrays.*;
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
@RunWith(AndroidJUnit4.class)
|
||||||
|
@MediumTest
|
||||||
public class ReminderSchedulerTest extends BaseAndroidTest
|
public class ReminderSchedulerTest extends BaseAndroidTest
|
||||||
{
|
{
|
||||||
private Habit habit;
|
private Habit habit;
|
||||||
@@ -96,6 +101,7 @@ public class ReminderSchedulerTest extends BaseAndroidTest
|
|||||||
long now = timestamp(2015, 1, 26, 13, 0);
|
long now = timestamp(2015, 1, 26, 13, 0);
|
||||||
DateUtils.setFixedLocalTime(now);
|
DateUtils.setFixedLocalTime(now);
|
||||||
|
|
||||||
|
fixtures.purgeHabits(habitList);
|
||||||
Habit h1 = fixtures.createEmptyHabit();
|
Habit h1 = fixtures.createEmptyHabit();
|
||||||
Habit h2 = fixtures.createEmptyHabit();
|
Habit h2 = fixtures.createEmptyHabit();
|
||||||
Habit h3 = fixtures.createEmptyHabit();
|
Habit h3 = fixtures.createEmptyHabit();
|
||||||
|
|||||||
@@ -238,7 +238,8 @@ public class Habit
|
|||||||
public synchronized void setTargetType(int targetType)
|
public synchronized void setTargetType(int targetType)
|
||||||
{
|
{
|
||||||
if (targetType != AT_LEAST && targetType != AT_MOST)
|
if (targetType != AT_LEAST && targetType != AT_MOST)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException(
|
||||||
|
String.format("invalid targetType: %d", targetType));
|
||||||
data.targetType = targetType;
|
data.targetType = targetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user