Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4803835d authored by weldoncyngn's avatar weldoncyngn Committed by Gerrit Code Review
Browse files

Initial commit for Espresso tests.

Change-Id: Ie2cd998d9399d51ad646d7ffe3e82cf9ca61a6b7
parent 60b5090a
Loading
Loading
Loading
Loading

androidTest/.gitignore

0 → 100644
+7 −0
Original line number Diff line number Diff line
/.settings
/bin
/gen
/.checkstyle
/.classpath
/.project
/project.properties

androidTest/Android.mk

0 → 100755
+54 −0
Original line number Diff line number Diff line
#
# Copyright (C) 2012 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

# We only want this apk build for tests.
LOCAL_MODULE_TAGS := tests

LOCAL_JAVA_LIBRARIES := android.test.runner

LOCAL_STATIC_JAVA_LIBRARIES := espresso

annotation_dir := ../../../../frameworks/testing/runner/src/main/java/android/support/test/annotation
rules_dir := ../../../../frameworks/testing/rules/src/main

# Include all test java files.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += $(call all-java-files-under, $(annotation_dir))
LOCAL_SRC_FILES += $(call all-java-files-under, $(rules_dir))

# Notice that we don't have to include the src files of CMFileManager because, by
# running the tests using an instrumentation targeting CMFileManager, we
# automatically get all of its classes loaded into our environment.

LOCAL_PACKAGE_NAME := CMFileManagerAndroidTests

LOCAL_INSTRUMENTATION_FOR := CMFileManager

LOCAL_CERTIFICATE := platform

LOCAL_PROGUARD_ENABLED := disabled

include $(BUILD_PACKAGE)

include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
        espresso:../../../../prebuilts/misc/common/android-support-test/espresso-core.jar

include $(BUILD_MULTI_PREBUILT)
+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.cyanogenmod.filemanager.test">

  <original-package android:name="com.cyanogenmod.filemanager.test" />

  <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17" />

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />

  <instrumentation
    android:name="android.support.test.runner.AndroidJUnitRunner"
    android:targetPackage="com.cyanogenmod.filemanager" />

  <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <uses-library android:name="android.test.runner" />
  </application>

</manifest>

androidTest/README.md

0 → 100755
+8 −0
Original line number Diff line number Diff line
To run the espresso tests:

mm

adb install -r $OUT/data/app/CMFileManagerAndroidTests/CMFileManagerAndroidTests.apk

adb shell am instrument -w -e class com.cyanogenmod.filemanager.activities.WelcomeActivityTest com.cyanogenmod.filemanager.test/android.support.test.runner.AndroidJUnitRunner
adb shell am instrument -w -e class com.cyanogenmod.filemanager.activities.MainActivityTest com.cyanogenmod.filemanager.test/android.support.test.runner.AndroidJUnitRunner
+4.7 KiB
Loading image diff...
Loading