我要测试工具栏中的“设置”选项。在点击“设置”选项,它将启动新的活动,并从工具栏标题名称,我想确认它是否成功启动。下面是代码:- java代码
@RunWith(AndroidJUnit4.class)
@SmallTest
public class MainActivityTest {
@Rule
public ActivityTestRule<MainActivity> mainActivityActivityTestRule = new ActivityTestRule<>(MainActivity.class);
@Before
我有一个安卓测试,检查外部文本消息是否被截断,并在应用android:ellipsize="end“时以三个点结尾。我不知道为什么测试失败,尽管在一个活动中显示的文本是正确格式化的。
@Test
fun when_errorMessage_is_very_long_then_text_of_errorMessageTextView_ends_with_dots() {
//given
val errorMessage = """
Very long error, Very long error, Very lo
我正在学习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测试我的应用程序。 我有一个问题:在一个用例中,我需要打开一个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
如果我设置了无效的密码--用文本“无效数据!”显示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
我的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在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文件的一部分: