|
2#
楼主 |
发表于 2016-6-23 16:24:26
|
只看该作者
被测项目只有“Hello word”和两个按钮“Button”、“Button2”
测试代码:
public class testmm extends ActivityInstrumentationTestCase2<MainActivity>{
private Solo solo;
@SuppressWarnings("deprecation")
public testmm(){
super("com.example.texthello", MainActivity.class);
}
@Before
public void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
}
@After
public void tearDown() throws Exception {
}
@Test
public void test1() {
solo.clickOnButton("Button");
}
@Test
public void test2() {
solo.clickOnButton("Button2");
}
@Test
public void test3() {
boolean expected = true;
boolean actual = solo.searchText("Hello") && solo.searchText("world");
assertEquals("This and/or is are not found", expected, actual);
}
|
|