我的android espresso单元测试被阻止了,因为一些后台线程没有空闲。我如何确定哪个线程阻塞了我的应用程序的执行?
android.support.test.espresso.AppNotIdleException: Looped for 246 iterations over 60 SECONDS. The following Idle Conditions failed ASYNC_TASKS_HAVE_IDLED.
at dalvik.system.VMStack.getThreadStackTrace(Native Method)
我正在试着用Espresso测试我的应用程序。 我有一个问题:在一个用例中,我需要打开一个PDF来读取“用户条件”,并且我不能用Espresso.pressBack()从这一点返回,我总是有下面的错误: android.support.test.espresso.NoActivityResumedException: No activities in stage RESUMED. Did you t to launch the activity. (test.getActivity() or similar)?
at dalvik.system.VMStack.getThreadStack
public abstract class Beverage
{
public string description = "Unknown Beverage";
public string GetDescription()
{
return description;
}
}
public abstract class CondimentDecorator : Beverage
{
public abstract new string GetDescription();
}
public class Espresso
如果我设置了无效的密码--用文本“无效数据!”显示password.setError(getResources().getString(R.string.incorrect_data));,我需要用Espresso测试它,我写到:
onView(withText(R.string.incorrect_data)).check(matches(isDisplayed()));
但这是错误的,我有:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with st
嗨,我想知道是否可以验证"checkbox"和"number"。我真的很难解释我想要什么,但我会尽我最大的努力;)不管怎样,我有这样的代码:
<input type = "checkbox" name = "coffee[]" value = "cappuccino"/>Cappuccino
<input type = "number" value = "qty." name = "cappuccino_qty" size = "2
当我在一周前运行我的测试时,一切都很好,但是现在我得到了这个错误: java.lang.NoSuchMethodError: No static method loadSingleServiceOrNull(Ljava/lang/Class;)Ljava/lang/Object; in class Landroidx/test/internal/platform/ServiceLoaderWrapper; or its super classes (declaration of 'androidx.test.internal.platform.ServiceLoaderWrapper
我正尝试在android studio中运行一个测试用例,它应该打开导航抽屉,单击菜单项,并检查它是否导航到该菜单项。 当我尝试运行测试时,我得到以下错误 Started running tests
Test running failed: Instrumentation run failed due to 'Process crashed.'
Empty test suite. Logcat显示; -02-04 13:41:17.703 10121-10121/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: co
我无法在我的设备上运行测试,并获得错误No instrumentation registered! Must run under a registering instrumentation.,这里是我的测试类:
package com.pecode.itrustyou.ui.login;
import android.support.test.filters.MediumTest;
import android.support.test.runner.AndroidJUnit4;
import com.pecode.itrustyou.R;
import org.junit.Rule;
我正在学习Android的TDD,使用这个demo: https://github.com/NileshJarad/TDD_Demo 我可以运行所有的单元测试和Mockito测试,但是"activityTests“失败了,错误如下: error: package android.support.test.rule does not exist
error: package android.support.test.espresso does not exist
error: package android.support.test.espresso.action does not
我在试着用Espresso。但是我有这个错误,如果我遗漏了一些代码,我就没有错误。
任何想法都将受到高度赞赏。
错误日志:
java.lang.NullPointerException: No instrumentation registered. Must run under a registering instrumentation.
at com.google.android.apps.common.testing.testrunner.util.Checks.checkNotNull(Checks.java:28)
at com.google.android.apps.
我想简单地阻塞插装(测试)线程,直到Espresso空闲。
fun test(){
// do some stuff
Espresso.waitForIdle()
// do some more stuff once Espresso reports that the application is idle
}
做这件事最好的方法是什么?
注意:Espresso.waitForIdle()是我虚构的一个方法
我正在使用Espresso在android中测试视图。我想确保文本不可见,但" not“功能不起作用:
这将检查文本是否匹配:
onView(withId(R.id.detailTitle)).check(matches(withText("This is the title " + number)));
但我想确保文本不匹配:
onView(withId(R.id.detailTitle)).check(matches(not(withText(number))));
然后我得到了Cannot resolve method not
这是我的gradle文件的一部分: