|
请教如何在appium用Junit执行第二个@Test?这个设计的自动化测试会好看一点,有会的,麻烦提醒一下,感激不尽
代码部份
Junit版本为4.12
类头增加了@FixMethodOrder(MethodSorters.NAME_ASCENDING)按次序执行
@Test
public void Test001() throws InterruptedException, MalformedURLException
{
cycleswipe(400, 630, 100, 630,200,3,"划屏");
}
@Test
public void Test002() throws InterruptedException, MalformedURLException
{
ClickByPointNameLongtime("马上理财","马上理财");//若该内容放到Test001()里的cycleswipey方法后是可以执行的,目前不知道如何才能让第二个@Test执行正常
}
private void cycleswipe(int x,int y,int t,int z, int fast,int times,String log) throws InterruptedException, MalformedURLException
{
for(int i=0;i<times;i++){
System.out.println("划屏开始");
driver.swipe(x, y, t, z,fast);
System.out.println("Click " + log+(i+1));
PrintScreen(reportPath+udid+"_" + log+(i+1) + ".jpg");
Thread.sleep(4000);
}
}
private void ClickByPointNameLongtime(String name, String log) throws InterruptedException, MalformedURLException
{
Thread.sleep(2000);
System.out.println("Click " + log);
driver.findElement(By.name(name)).click();
Thread.sleep(sleepBase * 30);
PrintScreen(reportPath+udid+"_" + log + ".jpg");
}
|
|