Last active
August 29, 2015 14:26
-
-
Save t-kashima/2fca22ef2babf6b818fe to your computer and use it in GitHub Desktop.
JUnit4を使ったテスト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 22 | |
buildToolsVersion "22.0.1" | |
defaultConfig { | |
applicationId "com.unuuu.myapp" | |
minSdkVersion 14 | |
targetSdkVersion 22 | |
versionCode 1 | |
versionName "1.0" | |
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' | |
} | |
buildTypes { | |
release { | |
minifyEnabled false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
} | |
} | |
packagingOptions { | |
exclude 'LICENSE.txt' | |
} | |
} | |
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
compile 'com.android.support:appcompat-v7:22.2.0' | |
androidTestCompile 'com.android.support.test:testing-support-lib:0.1' | |
androidTestCompile 'org.hamcrest:hamcrest-library:1.3' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.unuuu.myapp; | |
import android.support.test.runner.AndroidJUnit4; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import static org.hamcrest.Matchers.is; | |
@RunWith(AndroidJUnit4.class) | |
public class MainActivityTest { | |
@Before | |
public void setUp() throws Exception { | |
} | |
@Test | |
public void テストのテスト() { | |
assertThat("hoge", is("hoge")); | |
} | |
@After | |
public void tearDown() throws Exception { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment