zoukankan      html  css  js  c++  java
  • AndroidTestCase简单使用

    1.根据需求创建TestCase类,实现测试用例。此类需继承AndroidTestCase类

     1 public class TestCase extends AndroidTestCase {
     2 
     3     @Override
     4     protected void setUp() throws Exception {
     5         // TODO Auto-generated method stub
     6         super.setUp();
     7         Log.d("debug", "enter setUp method");
     8     }
     9     
    10     public void case() {
    11                 Log.d("debug", "enter case method");
    12     }
    13 
    14     @Override
    15     protected void tearDown() throws Exception {
    16         // TODO Auto-generated method stub
    17         super.tearDown();
    18         Log.d("debug", "enter tearDown method");
    19     }
    20 }

    2.修改AndroidManifest.xml
    (1)在Application TAG 外部(同级)添加instrumentation

     <instrumentation android:name="android.test.InstrumentationTestRunner" android:label="Test" android:targetPackage="com.example.test" /> 

    (2)在Application内部添加 uses-library

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

    3.选中case 方法名,右键 Run As --> Android JUnit Test 执行即可

  • 相关阅读:
    PHP touch() 函数
    PHP tmpfile() 函数
    PHP tempnam() 函数
    PHP symlink() 函数
    PHP stat() 函数
    pt-table-sync
    P4233 射命丸文的笔记
    C# Task.Run 和 Task.Factory.StartNew 区别
    C# Task.Run 和 Task.Factory.StartNew 区别
    SourceYard 制作源代码包
  • 原文地址:https://www.cnblogs.com/pillowzhou/p/5132633.html
Copyright © 2011-2022 走看看