Skip to content

Instantly share code, notes, and snippets.

@xdtianyu
Created June 26, 2015 10:03
Show Gist options
  • Save xdtianyu/d6d725aedacdecdc236a to your computer and use it in GitHub Desktop.
Save xdtianyu/d6d725aedacdecdc236a to your computer and use it in GitHub Desktop.
package org.xdty.buttontest;
import android.test.ActivityInstrumentationTestCase2;
/**
* Created by ty on 15-6-26.
*/
public class ActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
public ActivityTest() {
super(MainActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
@Override
protected void runTest() throws Throwable {
super.runTest();
}
public void testName() throws Exception {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().textView.setText(":xxx");
}
});
getInstrumentation().waitForIdleSync();
assertEquals(":xxx", getActivity().textView.getText().toString());
}
public void testColor() throws Exception {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().editText.setText(":xxx");
}
});
getInstrumentation().waitForIdleSync();
assertEquals(":xxx", getActivity().button.getText());
}
public void testButton() throws Exception {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
getActivity().button2.performClick();
}
});
getInstrumentation().waitForIdleSync();
assertEquals(false, getActivity().buttonFloatShare.isShow);
Thread.sleep(3000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment