嘿,
我是 Android 测试的新手。我尝试编写使用editText 将两个数字相乘的测试。它似乎没有运行并且在模拟器上没有显示任何内容。我的测试代码如下
import android.test.ActivityInstrumentationTestCase2;
import com.example.calculator.MainActivity;
import com.jayway.android.robotium.solo.Solo;
public class MathValidation extends ActivityInstrumentationTestCase2<MainActivity> {
private Solo solo;
public MathValidation() {
super(MainActivity.class);
}
protected void setUp() throws Exception {
solo=new Solo(getInstrumentation(),getActivity());
}
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
}
public void Test() throws Exception{
solo.assertCurrentActivity("wrong activity", MainActivity.class);
solo.enterText(0, String.valueOf("10"));
solo.enterText(1,String.valueOf("30"));
solo.clickOnButton("Multiply");
assertTrue(solo.searchText("300"));
}
这是我的日志猫
01-15 16:23:27.832: E/Trace(1190): error opening trace file: No such file or directory (2)
01-15 16:23:27.832: W/Trace(1190): Unexpected value from nativeGetEnabledTags: 0
01-15 16:23:27.832: W/Trace(1190): Unexpected value from nativeGetEnabledTags: 0
01-15 16:23:27.832: W/Trace(1190): Unexpected value from nativeGetEnabledTags: 0
01-15 16:23:28.322: D/dalvikvm(1190): GC_CONCURRENT freed 331K, 15% free 2565K/3012K, paused 72ms+101ms, total 265ms
01-15 16:23:28.322: D/dalvikvm(1190): WAIT_FOR_CONCURRENT_GC blocked 12ms
01-15 16:23:28.713: D/dalvikvm(1190): GC_CONCURRENT freed 484K, 20% free 2540K/3144K, paused 73ms+85ms, total 215ms
01-15 16:23:28.862: W/Trace(1190): Unexpected value from nativeGetEnabledTags: 0
01-15 16:23:28.862: W/dalvikvm(1190): method Landroid/test/InstrumentationTestRunner$StringResultPrinter;.print incorrectly overrides package-private method with same name in Ljunit/textui/ResultPrinter;
01-15 16:23:31.202: E/Trace(1216): error opening trace file: No such file or directory (2)
01-15 16:23:31.212: W/Trace(1216): Unexpected value from nativeGetEnabledTags: 0
01-15 16:23:31.212: W/Trace(1216): Unexpected value from nativeGetEnabledTags: 0
01-15 16:23:31.212: W/Trace(1216): Unexpected value from nativeGetEnabledTags: 0
01-15 16:23:31.772: D/dalvikvm(1216): GC_CONCURRENT freed 334K, 16% free 2558K/3012K, paused 72ms+85ms, total 246ms
01-15 16:23:32.182: D/dalvikvm(1216): GC_CONCURRENT freed 491K, 18% free 2571K/3124K, paused 72ms+73ms, total 220ms
01-15 16:23:32.332: W/Trace(1216): Unexpected value from nativeGetEnabledTags: 0
01-15 16:23:32.332: W/dalvikvm(1216): method Landroid/test/InstrumentationTestRunner$StringResultPrinter;.print incorrectly overrides package-private method with same name in Ljunit/textui/ResultPrinter;