yxy8023ustc
  1. Menifest.xml中加入:

    <application>中加入:

    <uses-library android:name="android.test.runner" />

    <application>外面加入:

    <uses-permission android:name="android.permission.RUN_INSTRUMENTATION" />

    <instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="name.feisky.android.test"

    android:label="Test for my app"/>

  2. 编写单元测试代码:必须继承自AndroidTestCase类

    package name.feisky.android.test;

    import android.test.AndroidTestCase;

    import junit.framework.Assert;

    public class MyTest extends AndroidTestCase {

    private static final String Tag="MyTest";

分类:

技术点:

相关文章:

  • 2021-09-30
  • 2022-01-09
  • 2021-06-09
  • 2021-11-26
  • 2021-06-12
  • 2021-12-31
  • 2021-11-27
  • 2021-04-03
猜你喜欢
  • 2021-11-08
  • 2021-07-06
  • 2021-07-11
  • 2021-05-02
  • 2021-06-09
  • 2021-05-17
  • 2021-08-19
  • 2021-05-13
相关资源
相似解决方案