草庐IT

instrumented

全部标签

android - onTouchEvent 通过代码通过 Instrumentation

我要完成以下任务:Ihavetwobuttons.Whenfirstbuttonispressed,itwillfireonTouchEventonsecondbutton,thuspressingsecondbutton.这是触发事件的代码摘录:inttest1[]=newint[2];button2.getLocationInWindow(test1);//--->gettingcoordinatesofsecondbuttonInstrumentationm_Instrumentation=newInstrumentation();//firingeventm_Instrumen

Android:如何在 headless 主机中将 Instrumentation APK 安装到 AVD 上

我正在尝试将AndroidJUnit测试与我们的BambooAnt构建集成。我已经在本地测试了设置,并且能够运行测试。但是当我在我们的Bamboo服务器中尝试相同的设置时,在运行测试时出现以下错误:INSTRUMENTATION_STATUS:id=ActivityManagerServiceINSTRUMENTATION_STATUS:Error=Unabletofindinstrumentationinfofor:ComponentInfo{com.synapticstuff.guitartabs/pl.polidea.instrumentation.PolideaInstrume

java - 在 Android Instrumentation 测试中使用 PowerMock 和 Mockito - 错误 - 重复文件 - org.mockito.plugins.MockMaker

我正在尝试使用PowerMock通过静态方法模拟一个类,但我特别希望在AndroidInstrumentation测试中执行此操作。明确地说,我希望在真实的Android设备或模拟器上运行测试。我正在使用AndroidStudio(1.5.1)和Gradle(1.5.0)。为了避免转移注意力,我创建了一个非常基本且相当粗糙的“helloworld”应用程序。此应用仅显示2段文本,一段从静态方法中检索,一段从非静态方法中检索。我已经为这两个“文本提供者”类编写了仪器测试。你可以在这里看到这个应用程序:https://github.com/Kai2k/PowerMockAndroidTes

Android Instrumentation 测试在 Travis CI AVD 上失败但在本地模拟器上工作

如果我在我的本地模拟器上运行仪器测试,它们可以完美运行10次中的10次,但是当我尝试在TravisCI中的AVD上运行相同的测试时,我随机得到失败java.lang.RuntimeException:无法在45秒内启动IntentIntent{}。也许主线程在合理的时间内没有空闲?可能会有动画或不断重绘屏幕的东西。或者该Activity正在创建时进行网络调用?请参阅线程转储日志。供您引用,在您的Activity启动请求之前事件队列最后一次空闲是xxxxxxx,现在队列最后一次空闲是:xxxxxxxxx。如果这些数字相同,您的Activity可能会占用事件队列。我已经尝试删除所有进度条和

android - 在 Android Instrumentation jUnit 测试中访问 R.raw 资源

我正在尝试在AndroidStudio中创建一些AndroidInstrumentation类,以便我可以测试我的ormlite类。ormlite的DBHelper类需要从ormlite配置文件中读取,该文件位于我的res/raw/ormlite_config.txt中,并使用R.raw.ormlite_config.这不是我使用openRawResource(R.raw.ormlite_config)获取的东西,因为DBHelper父类(superclass)的构造函数需要int资源。当我运行我的测试时,它找不到它:android.content.res.Resources$NotF

Android Studio 单元测试 : unable to find instrumentation OR class not found ex

我的Android工作室中有一个测试套件,它具有以下目录结构:-MainProject-src--com--tests--java.xx.xxx.xx.test在我的AndroidManifest中,我有以下内容:当我使用./gradlewconnectedInstrumentTest从命令行运行测试时,我只得到:TestsonNexus5-4.4.2failed:Instrumentationrunfaileddueto'java.lang.ClassNotFoundException'当我从AndroidStudio中运行测试时,我得到:RunningtestsTestrunnin

Android Studio 2.3 在 UI 中没有 Test Instrumentation 说明符

更新到AndroidStudio2.3后,当我尝试运行一些espresso测试时,出现以下错误:Testrunningfailed:Unabletofindinstrumentationinfofor:ComponentInfo{com.example.android/android.test.InstrumentationTestRunner}Emptytestsuite.这在过去很容易修复,我可以在运行配置中指定我自己的InstrumentationRunner。现在我似乎找不到这个选项,所以我现在不能真正指定我的运行者类。请注意,我的构建gradle确实包含defaultConf

android - Espresso 2 升级后测试失败(失败 : Instrumentation run failed due to 'java.lang.IllegalAccessError' )

将Espresso升级到版本2后,我的所有单元测试都不会在Lollipop之前的设备上运行。请参见下面的跟踪:15:07:07.627[WARN][org.gradle.api.Project]TestsonSamsungGalaxyS3-4.3-API18-720x1280-4.3failed:Instrumentationrunfaileddueto'java.lang.IllegalAccessError'15:07:07.832[WARN][org.gradle.api.Project]com.android.builder.testing.ConnectedDevice>ha

android - 测试运行失败 : Instrumentation run failed due to 'Process crashed.' when testing multiple Android activity

我在测试我的Android应用程序时遇到问题。我有2个testCase类,如果我单独执行它们,没有问题,测试运行到最后。但是,如果我“右键单击”我的测试项目并选择“以AndroidJunit测试方式运行”,我会收到一条消息Launchinginstrumentationandroid.test.InstrumentationTestRunnerondeviceemulator-5554[2012-03-2715:56:27-matroussedemaquillageTest]Collectingtestinformation[2012-03-2715:56:31-matroussede

安卓工作室 : Cannot write to Shared Preferences in instrumented test

我正在尝试编写一个测试用例来验证写入共享首选项的类。我正在使用AndroidStudiov1.5。在旧的eclipse中,当使用AndroidTestCase时,第二个apk文件被部署到设备,并且可以使用检测上下文运行测试,因此您可以使用检测apk的共享来运行测试preferences而无需更改主apk的现有共享首选项文件。我花了整个上午试图弄清楚如何在AndroidStudio测试中获取非空上下文。显然,为eclipse进行的单元测试与AndroidStudio测试框架不兼容,因为调用getContext()返回null。我以为我已经找到了这个问题的答案:Getcontextofte