我的 SDK 是 v17,这段代码没有任何错误。但是在 emulator 或 Junit 上没有显示。
只是在控制台上显示这个:
这是否意味着我的代码测试成功?
[2012-05-20 17:26:08 - MobilEpostaUyg-Test] Installing MobilEpostaUyg-Test.apk...
[2012-05-20 17:26:15 - MobilEpostaUyg-Test] Success!
[2012-05-20 17:26:15 - MobilEpostaUyg-Test] Project dependency found, installing: MobilEpostaUyg
[2012-05-20 17:26:17 - MobilEpostaUyg] Application already deployed. No need to reinstall.
[2012-05-20 17:26:17 - MobilEpostaUyg-Test] Launching instrumentation android.test.InstrumentationTestRunner on device emulator-5554
[2012-05-20 17:26:18 - MobilEpostaUyg-Test] Collecting test information
[2012-05-20 17:26:21 - MobilEpostaUyg-Test] Sending test information to Eclipse
[2012-05-20 17:26:21 - MobilEpostaUyg-Test] Running tests...
[2012-05-20 17:26:23 - MobilEpostaUyg-Test] Test run finished
测试代码:
package com.mobil.eposta.test;
import android.test.ActivityInstrumentationTestCase2;
import com.jayway.android.robotium.solo.Solo;
import com.mobil.eposta.MobilEpostaUygActivity;
public class LoginButtonTest extends
ActivityInstrumentationTestCase2<MobilEpostaUygActivity> {
private Solo solo;
public LoginButtonTest() {
super("com.mobil.eposta" ,MobilEpostaUygActivity.class );
// TODO Auto-generated constructor stub
}
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation() , getActivity());
}
public void loginTest()
{
solo.assertCurrentActivity("First Activity", MobilEpostaUygActivity.class );
}
}