I downloaded a simple app from appium github and tried to write an automated test for it using Appium Server (version 1.3.3). Here is my code
import io.appium.java_client.AppiumDriver;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import static org.testng.AssertJUnit.assertEquals;
public class AppiumDemo {
private AppiumDriver ad;
@Before
public void setupTest(){
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appium-version", "1.3.3");
capabilities.setCapability("platformName", "iOS");
capabilities.setCapability("platformVersion", "7.1");
capabilities.setCapability("deviceName", "iPhone 5s");
capabilities.setCapability("app", "/Users/admin/Downloads/TestApp.app");
try {
ad = new AppiumDriver(new URL("http://ift.tt/1eWSHgW"), capabilities);
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
@After
public void tearDown(){
if(ad != null) ad.quit();
}
@Test
public void simpleTest() {
ad.findElement(By.name("IntegerA")).sendKeys("11");
ad.findElement(By.name("IntegerB")).sendKeys("1");
ad.findElement(By.name("ComputeSumButton")).click();
int ans = Integer.parseInt(ad.findElement(By.name("Answer")).getText());
assertEquals(ans, 12);
ad.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
}
it opens the simulator, enters 2 numbers, when when should click on the button to calculate the sum, test crashes, simulator is killed. in intellij it shows that it failed on the line I press click. and - Process finished with exit code 255. I use Yosemite , v. 10.10.1 installed on wmware. Please help me, what can be the reason of it ? thanks a lot.
Aucun commentaire:
Enregistrer un commentaire