0
有人可以告诉我一个工作代码来对这段代码进行单元测试吗?本地单元测试Android
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
}
请使用本地单元测试(如果可能,请使用roboelectric等)和仪器测试。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/login"
android:text="Login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
显然,测试将检查是否存在与创建的文本登录按钮。
您是否尝试阅读任何文档? https://developer.android.com/training/testing/start/index.html http://www.vogella.com/tutorials/Robotium/article.html –