Skip to content

Instantly share code, notes, and snippets.

View fo2rist's full-sized avatar

Dmitry Sitnikov fo2rist

View GitHub Profile
@fo2rist
fo2rist / SimpleEspressoTest.kt
Last active June 18, 2019 02:39
Simple Espresso Test Setup / Basic Test
@RunWith(AndroidJUnit4::class)
class BaseMainActivityTest {
@get:Rule
var activityRule = ActivityTestRule(MainActivity::class.java)
// the context is often needed in more complex Espresso tests
protected val context: Context by lazy { activityRule.activity }
@Test
@fo2rist
fo2rist / InfiniteEspressoTest.kt
Last active June 18, 2019 02:38
Simple Espresso Test Setup / Infinite Test
@RunWith(AndroidJUnit4::class)
class BaseMainActivityTest {
@get:Rule
var activityRule = ActivityTestRule(MainActivity::class.java)
@Test
fun acitivityIsRunning() {
if (true) while(true) Thread.sleep(100); /*DEBUG*/
}
@fo2rist
fo2rist / EmptyEspressoTest.kt
Last active June 18, 2019 02:17
Simple Espresso Test Setup / Empty Test
@RunWith(AndroidJUnit4::class)
class BaseMainActivityTest {
@get:Rule
var activityRule = ActivityTestRule(MainActivity::class.java)
protected val context: Context by lazy { activityRule.activity }
// test goes here just like this example from Espresso documentation
}