Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Kotlin functions providing ActivityTestRule and IntentsTestRule with a simplified syntax.
inline fun <reified T : Activity> activityTestRule(initialTouchMode: Boolean = false, launchActivity: Boolean = true) =
ActivityTestRule(, initialTouchMode, launchActivity)
inline fun <reified T : Activity> intentsTestRule(initialTouchMode: Boolean = false, launchActivity: Boolean = true) =
IntentsTestRule(, initialTouchMode, launchActivity)

This comment has been minimized.

Copy link
Owner Author

@sczerwinski sczerwinski commented Jun 3, 2017

Example usage:

class MyTestClass {

	val activityRule = activityTestRule<MainActivity>()

	val intentsRule = intentsTestRule<MainActivity>(launchActivity = false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment