0


Android Studio系列-Activity单元测试,字节Android高级岗

新建Activity单元测试类

===============

package com.devilwwj.unittestdemo;

import android.content.Intent;

import android.test.ActivityUnitTestCase;

import android.test.suitebuilder.annotation.MediumTest;

import android.widget.Button;

/**

  • Created by wwj_748 on 2016/2/22.17.12

*/

public class LoginActivityTest extends ActivityUnitTestCase {

private Intent mLoginIntent;

// 要这样才不会报错

public LoginActivityTest() {

super(LoginActivity.class);

}

@Override

protected void setUp() throws Exception {

super.setUp();

mLoginIntent = new Intent(getInstrumentation().getTargetContext(), LoginActivity.class);

}

@MediumTest

public void testLoginButton_labelTest() {

startActivity(mLoginIntent, null, null);

fina


本文转载自: https://blog.csdn.net/m0_63174529/article/details/136956428
版权归原作者 Java极客1024 所有, 如有侵权,请联系我们删除。

“Android Studio系列-Activity单元测试,字节Android高级岗”的评论:

还没有评论