Android automation test without target application src
来源:互联网 发布:vue2.0数据绑定原理 编辑:程序博客网 时间:2024/05/16 10:25
src code:
package com.june.test;
import com.jayway.android.robotium.solo.Solo;
import android.app.Instrumentation;
import android.os.SystemClock;
import android.test.ActivityInstrumentationTestCase2;
import android.view.KeyEvent;
public class LaunchApp extends ActivityInstrumentationTestCase2 {
private static final String TARGET_PACKAGE = "com.app.package";
private static final String LAUNCHER_ACTIVITY = "com.app.package.MainActivity";
private static Class<?> className;
Instrumentation mInst;
private Solo solo;
static {
try {
className = Class.forName(LAUNCHER_ACTIVITY);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
@SuppressWarnings("unchecked")
public LaunchQQ() throws ClassNotFoundException {
super(TARGET_PACKAGE, className);
}
@Override
protected void setUp() throws Exception {
mInst = getInstrumentation();
solo = new Solo(mInst, getActivity());
}
@Override
public void tearDown() throws Exception {
try {
solo.finalize();
} catch (Throwable e) {
e.printStackTrace();
}
getActivity().finish();
super.tearDown();
}
public void testCanOpenSettings() throws Exception {
SystemClock.sleep(5000);
mInst.sendKeyDownUpSync(KeyEvent.KEYCODE_MENU);
SystemClock.sleep(1000);
mInst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_UP);
SystemClock.sleep(1000);
mInst.sendKeyDownUpSync(KeyEvent.KEYCODE_DPAD_CENTER);
SystemClock.sleep(1000);
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.june.test"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<uses-library android:name="android.test.runner" />
</application>
<uses-sdk android:minSdkVersion="3" />
<instrumentation android:targetPackage="com.app.package"
android:name="android.test.InstrumentationTestRunner" />
</manifest>
- Android automation test without target application src
- Automation Test
- Automation Test
- Top popular android test automation tools introduction
- Android Test Automation Robotium VS. UIAutomator
- 构建android UI automation test测试环境
- Android Studio Application Test详解
- Android Studio Application Test详解
- Android Factory Reset Without Losing Application Data
- Xamarin.Android + Build/Test Cloud TFS Automation - Issues and Workground
- 转 Test Automation Frameworks
- TEST AUTOMATION EFFORT ESTIMATION
- Test Automation Using C#
- Automation test Analyze
- UI Automation test
- UI automation test
- Test Automation tools: trends
- Ranorex automation test qt
- STL顺序容器
- 【Swing入门教程】一步一步做Netbeans(1):类Netbeans的主界面
- microsoft library (.lib) format
- CodeIngniter学习第一天——Hello World
- 小波变换的概念、操作
- Android automation test without target application src
- JAVA二进制文件读写
- 二代小波
- cocos2d的多点触控
- HTTP 错误 401.3 - 未经授权:访问由于 ACL 对所请求资源的设置被拒绝。
- 学习笔记10—JAVA高级视频04_Applet
- 学习笔记11—JAVA高级视频02_IO输入与输出
- kick boll
- linux性能监控,很全面