Issue
I'm using the Espresso-framework for my Android testing and additionally I'm using the Testdroid-Cloud for automatic testing on real devices.
Does anybody know, how to tell Espresso to make a screenshot, which is shown on the Testdroid Dashboard?
If I disable Espresso, the Testdroid crawler automatically make screenshots. By uing the Espresso-framework it doesn't! See screenshot:
Solution
as I know Testdroid Crawler
is an instrumentation testing tool similar to Google's monkey UI/Application Exerciser
based on Appium
testing framework.
The auto Testdroid crawler makes screenshots without this permission!
You're wrong. All necessary system permissions are provided by adb
(Android Debug Bridge
) or appium
script at app runtime. Notice, that you don't see Crawler
implementation, just the results.
Does anybody know, how to tell Espresso to make a screenshot, which is shown on the Testdroid Dashboard?
Here'a a quick tutorial how to do it using your own custom Espresso method: http://testdroid.com/tech/tips-and-tricks-taking-screenshots-with-espresso-or-espresso-v2-0
Remember of adding this line to AndroidMainfest.xml
:
Another possibility is to use Spoon
along with Espresso
. The test would looks like then:
@Test
public void checkIfSettingsMenuItemsAreVisible() throws InterruptedException {
//open OptionsMenu to see available items
openActionBarOverflowOrOptionsMenu(mRule.getActivity());
//create a screenshot with 'options_menu' TAG
Spoon.screenshot(mRule.getActivity(), "options_menu");
//check if Settings item is Visible
onView(withText(R.string.action_settings)).check(matches(isDisplayed()));
//check if `Sort` item is Visible
onView(withText(R.string.action_sort)).check(matches(isDisplayed()));
//perform click on `Sort` OptionsMenu item
onView(withText(R.string.action_sort)).perform(click());
//create a screenshot with 'options_menu_sort' TAG
Spoon.screenshot(mRule.getActivity(), "options_menu_sort");
//check if `Sort -> By Value id` item is Visible
onView(withText(R.string.menu_sort_length)).check(matches(isDisplayed()));
//check if `Sort -> By Joke length` item is Visible
onView(withText(R.string.menu_sort_a_z)).check(matches(isDisplayed()));
}
Please check official Spoon
site: http://square.github.io/spoon/
and this article: http://elekslabs.com/2014/05/creating-test-reports-for-android-with-spoon-and-emma.html
Hope it will help
Answered By - piotrek1543
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.