chrislacy / TweetLanes

Tweet Lanes for Android

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to add espresso Unittest?

scheung38 opened this issue · comments

Since there is webview testing feature in espresso, not sure where to where the build.gradle dependencies.

I know I have to add the following, but not sure which build.gradle as there are one in each of the client, clientbeta, Social, and Tweetlanes packages.

Say for the initial TwitterAuthActivity class, since it is using Webview and i wish to test login success and test to display next page.

apply plugin: 'com.android.application'

android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.example.android.testing.espresso.BasicSample"
minSdkVersion 10
targetSdkVersion 22
versionCode 1
versionName "1.0"

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
    exclude 'LICENSE.txt'
}
lintOptions {
    abortOnError false
}
productFlavors {
}

}

dependencies {
// App dependencies
compile 'com.android.support:support-annotations:22.2.0'
// Testing-only dependencies
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
}

EDIT:

After adding espresso dependencies now getting this ProcessException error while running Espresso tests:

screen shot 2015-06-26 at 02 03 56

if adding espresso UI testing, the build.gradle to modify to include would be the build.gradle for TweetLaneCore or the client module?