Last active
April 25, 2019 07:14
-
-
Save leechunhoe/28fd3303551be7f55712e2d3725f51ca to your computer and use it in GitHub Desktop.
Template of view model unit test with Kotlin (androidTest)
This file contains 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
import android.support.test.rule.ActivityTestRule | |
import android.support.test.runner.AndroidJUnit4 | |
import com.myapp.MyActivity | |
import org.junit.Before | |
import org.junit.Rule | |
import org.junit.Test | |
import org.junit.runner.RunWith | |
@RunWith(AndroidJUnit4::class) | |
class MyViewModelTest { | |
@Rule @JvmField | |
var testRule = ActivityTestRule(MyActivity::class.java) | |
private lateinit var myViewModel: MyViewModel | |
@Before | |
fun setup() { | |
myViewModel = MyViewModel(testRule.activity.application) | |
} | |
@Test | |
fun doWhatevetTest() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment