Sunday, January 3, 2016

Mockito

Hi


Motivation
realy excellent
only drawback is that it can not handle static method but this is solved by PowerMockito).





References


Nathan

Test GUI - Espresso

Hi

Motivation
How can i autotest the UI ?


Solution
Espresso
  • very simple functionality : onView\onData->perform->check



  • ViewMatchers : withId , ...
  • ViewActions : click , typeText , pressKey , clearText
  • ViewAssertions : matches(Matcher) , ....

  • onView(withId(R.id.my_view)) // withId(R.id.my_view) is a ViewMatcher
.perform(click()) // click() is a ViewAction .check(matches(isDisplayed())); // matches(isDisplayed()) is a ViewAssertion
  • notice 3 operations : 1. get view 2. perform operation 3. check result
Espresso runs under "androidTest" i.e. under Device\Emulator


Espresso with intents
suppose i have activity which return info - how can i test it ?
looks like the following link has the answer - here


Questions :