我正在使用Espresso -framework 进行 Android 测试,另外我正在使用Testdroid-Cloud在真实设备上进行自动测试。
有谁知道,如何告诉Espresso制作屏幕截图,显示在 Testdroid 仪表板上?
如果我禁用Espresso,Testdroid爬虫会自动截屏。通过使用Espresso框架,它不会!看截图:
我正在使用Espresso -framework 进行 Android 测试,另外我正在使用Testdroid-Cloud在真实设备上进行自动测试。
有谁知道,如何告诉Espresso制作屏幕截图,显示在 Testdroid 仪表板上?
如果我禁用Espresso,Testdroid爬虫会自动截屏。通过使用Espresso框架,它不会!看截图:
据我所知,这Testdroid Crawler
是一个类似于谷歌monkey UI/Application Exerciser
基于Appium
测试框架的仪器测试工具。
自动 Testdroid 爬虫在没有此权限的情况下制作屏幕截图!
你错了。所有必要的系统权限都由adb
( Android Debug Bridge
) 或appium
应用程序运行时的脚本提供。请注意,您看不到Crawler
实现,只看到结果。
有谁知道,如何告诉 Espresso 制作屏幕截图,显示在 Testdroid 仪表板上?
这是一个快速教程,如何使用您自己的自定义 Espresso 方法进行操作:http: //testdroid.com/tech/tips-and-tricks-taking-screenshots-with-espresso-or-espresso-v2-0
请记住将此行添加到AndroidMainfest.xml
:
另一种可能性是与Spoon
一起使用Espresso
。测试看起来像这样:
@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()));
}
请查看官方Spoon
网站:http ://square.github.io/spoon/
和这篇文章:http ://elekslabs.com/2014/05/creating-test-reports-for-android-with-spoon-and-emma.html
希望它会有所帮助