我使用下面的代码来检查和取消选中 Android 的 Switch 组件。如何在 Android Junit 测试中通过触摸实用程序选中或取消选中 Switch?
// wait 2 seconds for the start of the activity
final FinalizeCalibrationActivity finalActivity = (FinalizeCalibrationActivity) monitorFinalActivity
.waitForActivityWithTimeout(2000);
assertNotNull("FinalizeCalibrationActivity is null", finalActivity);
final Switch swtSignedRdwPortal = (Switch) finalActivity
.findViewById(R.id.swt_signed_rdw_portal);
JunitUtils.waitTime(3);
swtSignedRdwPortal.setChecked(false);
JunitUtils.waitTime(3);
swtSignedRdwPortal.setChecked(true);