草庐IT

run_test

全部标签

android - onPostExecute() 的 "runs on UI thread"到底是什么意思?

考虑在Activity中启动的AsyncTask。如果Activity被暂停或销毁会怎样?onPostExecute()会运行吗?如果是,将使用什么UI线程?只是想知道。非常感谢。 最佳答案 UI线程在您的应用程序的可见生命周期内可用,可能跨越多个Activity的组合。您在View中所做的任何更改都必须在UI线程上执行,AsyncTask的onPostExecute通过在UI线程中执行内部指令来反射(reflect)相同的逻辑。您可以在自己的Thread中使用runOnUiThread来更改View。但是因为AsyncTask有o

Eclipse 中的 Android 单元测试 : "Failed to launch test"

我刚刚开始尝试在本质上是我的第一个Android应用程序中设置一些单元测试。我花了很多时间为此寻找资源,但最终能够拼凑出我希望的正确前进道路。首先,这就是我所做的。在Eclipse中,我右键单击了我要为其创建测试项目的项目。我选择了AndroidTools->NewTestProject我填写了必要的信息,为新项目选择了../MyApp/tests的位置,并选择MyApp作为要测试的项目。其他一切都保留为默认值。在执行过程中,我收到以下错误信息:[2011-04-0108:13:02-WPMSTest]R.javawasmodifiedmanually!Revertingtogener

android - 如果 gradle-android-test-plugin 测试失败,不要让 gradle 构建失败

我将我的项目设置为使用Robolectric和gradle-android-test-plugin运行.这一切工作正常,第一个测试正在运行但失败了。如果测试失败,这也将导致gradle构建失败。有没有办法让构建继续进行,并记下失败的测试以供后续步骤评估?计划是将测试集成到持续集成服务器中,只有在测试失败时构建才会不稳定。 最佳答案 嗯。好吧,我认为你有两个选择。一种是使用testTask.ignoreFailures=true当测试失败时不让任务失败。另一种方法是使用“--continue”运行gradle命令。这将执行尽可能多的任

android - 没有找到类 "android.support.test.runner.AndroidJUnitRunner"

我正在尝试使用插桩测试,并将我的项目更新为AndroidX。但是在尝试运行时出现以下错误:2018-10-0914:22:29.46813263-13263/xxx.yyyE/AndroidRuntime:FATALEXCEPTION:mainProcess:xxx.yyy,PID:13263java.lang.RuntimeException:UnabletoinstantiateinstrumentationComponentInfo{xxx.yyy.test/android.support.test.runner.AndroidJUnitRunner}:java.lang.Cla

android - "No tests found"用于 Lollipop 及更高版本的仪器测试

我基于仪器的(espresso)测试无法在Lollipop+设备和模拟器上运行。它们可以在任何其他平台上正确运行。我和这个线程中的人有相同的症状-https://groups.google.com/forum/?fromgroups#!topic/adt-dev/QW5SuzQizNk我的测试在src/androidTest/java/我已经设置了testInstrumentationRunner'android.support.test.runner.AndroidJUnitRunner'测试类是@RunWith(AndroidJUnit4.class)个别测试用@Test注解我可以

android - java.lang.SecurityException : Permission Denial: getIntentSender() when using UiAutomation in a test 错误

每当我尝试使用UiAutomation在通过getInstrumentation().getUiAutomation()进行的任何测试中,进程崩溃并出现以下异常:java.lang.SecurityException:PermissionDenial:getIntentSender()frompid=30334,uid=2000,(needuid=1000)isnotallowedtosendaspackageandroidatandroid.os.Parcel.readException(Parcel.java:1540)atandroid.os.Parcel.readExcepti

android - 测试运行失败 : Test run failed to complete. 预期 1 次测试,收到 0

我尝试为我的应用启动JUnit测试(robotium):publicclassMainTestextendsActivityInstrumentationTestCase2{privateSolosolo;publicMainTest(){super("nix.android.contact",MainActivity.class);//TODOAuto-generatedconstructorstub}protectedvoidsetUp()throwsException{super.setUp();solo=newSolo(getInstrumentation(),getActiv

android - 找不到错误 :resource style/TextAppearance. Compat.Notification.Info(又名 {packageId}.test :style/TextAppearance. Compat.Notification.Info)

我刚刚将build.gradle编译SDK更新为27API。compileSdkVersion27buildToolsVersion'27.0.3'targetSdkVersion27但是一旦我点击同步按钮它就​​会抛出error:resourcestyle/TextAppearance.Compat.Notification.Info(aka{packageId}.test:style/TextAppearance.Compat.Notification.Info)notfound.error:resourcestyle/TextAppearance.Compat.Notificat

android - Instant Run 执行了完整的构建和安装,因为设备上的安装与磁盘上的本地构建不匹配

AndroidStudio在启用即时运行的情况下运行应用程序时出错。我今天将我的androidstudio更新到2.3,从那时起它就显示了以上信息。 最佳答案 在androidstudio3.0.1上我在启用即时运行后立即运行了完整构建。一旦完成。错误消失了,即时运行有效。 关于android-InstantRun执行了完整的构建和安装,因为设备上的安装与磁盘上的本地构建不匹配,我们在StackOverflow上找到一个类似的问题: https://stack

android - 在 Android Studio 项目上找不到参数的方法 test()

在我的Android应用程序中,我想在包中排除一些测试用例,以便我在build.gradle文件中使用test任务。例如:applyplugin:'com.android.library'test{exclude'**/calltest/Summary.class'}如果同步项目我得到以下异常:*Whatwentwrong:Aproblemoccurredevaluatingproject':SdkModule'.>Couldnotfindmethodtest()forarguments[build_4g3vf7b615x3x1p7i9ty0pt1l$_run_closure1@73d