从百度 MTC 网站上下载了百度的 MTC 录制回放工具, MTCclient 很厚重, 是个使用 RCP 技术设计的 GUI 工具.
为了方便部署, 他集成了 java.
在他的代码例子中翻到了这个代码, 可以看到他其实是调用 cafe 框架.
今天他们网站不太稳定, 所以没深入研究. 我看 cafe 的 ppt, 貌似是 hook 了 app 的监听器, 这是否意味着他并不能很好的支持混合 app?
package com.baidu.recordreplay.test;
import java.io.IOException;
import java.util.ArrayList;
import com.baidu.cafe.CafeTestCase;
import android.view.KeyEvent;
public class MyTest extends CafeTestCase {
private static final String LAUNCHER_ACTIVITY_FULL_CLASSNAME = "com.baidu.netdisk.ui.Navigate";
private static final String TARGET_PACKAGE = "com.baidu.netdisk";
private static Class<?> launcherActivityClass;
static {
try {
launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
public MyTest() {
super(TARGET_PACKAGE, launcherActivityClass);
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
public void test_NewCase_0() {
local.sleep(3000);;
local.sleep(4855);
local.dragPercent(0.6314338f, 0.6314338f, 0.38125f, 0.38125f, 4);
local.screenShotNamedCaseName("pic_0001");
local.sleep(1000);
local.enterText("100001100", "gggh", false);
local.screenShotNamedCaseName("pic_0002");
local.sleep(8114);
local.dragPercent(0.6222427f, 0.63051474f, 0.521875f, 0.509375f, 4);
local.screenShotNamedCaseName("pic_0003");
local.waitForTextByFamilyString("00100" , "普通登录");
local.screenShotNamedCaseName("pic_0004");
}
}