Tag: android testing

testing运行失败:无法find检测信息:ComponentInfo {} – 尝试在IntelliJ中使用Gradle进行testing的错误

每次我尝试运行testing时,控制台都会这样说: Running tests Test running startedTest running failed: Unable to find instrumentation info for: ComponentInfo{com.employeeappv2.employeeappv2.test/android.test.InstrumentationTestRunner} Empty test suite. 我一直坚持这一段时间,迄今为止在网上看到的解决scheme没有帮助。 我的项目结构是这样设置的: *主模块-src * instrumentTest -java *主-java -manifest * build.gradle 我的build.gradle文件如下所示: buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 19 buildToolsVersion "19.1.0" defaultConfig […]

为Robolectric的SharedPreferences提供testing数据

刚开始使用Robolectric,这似乎是我所需要的。 不过,就使用SharedPreferences而言,我遇到了一些障碍。 我有两个testing用例 活动期望新的/空的sharedPreferences 活动期望已经有一些数据的sharedPreferences 对于testing用例1,testing正在按预期方式通过,所以都好:) 然而,对于testing用例2,我似乎无法find一个给Robolectric提供一些伪造数据的好方法,所以活动能够访问这个假数据。 这感觉像是一个非常常见的用例,但我似乎无法弄清楚如何去做!

src / androidtest和src / test文件夹有什么区别?

在Android Studio中默认的项目中有两个testing文件夹。 首先是src/androidTest 。 此文件夹已经存在于以前版本的Android Studio中。 尽pipe如此,有一段时间以来,默认的src/test和build.gradle新build依赖testCompile 'junit: junit: 4.12'有一个新的testing文件夹。 我的问题是: 我使用哪个文件夹进行testing以及两者之间的区别?

对Android Gradle中的testCompile和androidTestCompile感到困惑

我是新来的testing世界,甚至更多的Androidtesting世界。 在Robolectric上进行研究的时候,对Android的testing帮助一件事最迷惑我。 有时在Web上,当引用Robolectric而另一些人使用androidTestCompile时,我发现人们在gradle构build脚本的依赖关系中使用testCompile关键字。 当然两者都不能有效? 有人可以解释两者之间的区别,哪些应该是使用Robolectric时使用的?

使用RobolectrictestingViewPager(和CursorLoader)

有谁知道如何使用Robolectrictesting以下设置? 包含ViewPager的片段,用CursorLoader加载的数据。 使用下面的代码,CursorLoader永远不会被推入视图寻呼机的适配器。 我遇到了await()调用。 EventsFragmentTest.java: @RunWith(CustomRobolectricTestRunner.class) public class EventsFragmentTest extends AbstractDbAndUiDriver { // which element in the view pager we are testing private static final int TEST_INDEX = 0; protected SherlockFragmentActivity mActivity; protected EventsFragment_ mFragment; @Override @Before public void setUp() throws Exception { // create activity to hold the fragment this.mActivity = CustomRobolectricTestRunner.getActivity(); // create […]

Google Espresso或Robotium

我必须使用自动化的UItesting工具,并且在使用Robotium与Google Espresso之间感到困惑。 两者之间的主要区别是什么? 在一个中是否存在特征而不是另一个?

如何使用adb(android platform-tools)在远程运行的设备上部署/执行应用程序?

我需要部署一个testing应用程序,并在与同一networking中的IP xxx.yyy.zz.pp机器连接的设备上发出命令。 我阅读了http://developer.android.com/tools/help/adb.html#directing命令,但我无法得到答案。 我试过使用platform-tools/adb connect <remote machine IP>但没有我got unable to connect错误。 有没有一种方法可以使用adb工具在远程运行的模拟器或设备上部署和执行命令?