mardi 26 mai 2015

How to create eclipse Testcase with appium for Android

I managed to get my windows environmental set up and working.

I am able to run the Appium sample test from http://ift.tt/13aJByJ

But now, How Do I create My own Test case for my app which is already installed on the device ?

I tried: but it does not work - thank guys

package appium.learning;

import java.net.MalformedURLException;
import java.net.URL;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;

public class LearningTest {

    WebDriver driver;

    @BeforeClass
    public void setUp() throws MalformedURLException{
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability("device", "Android");
        capabilities.setCapability(CapabilityType.BROWSER_NAME, ""); //Name of mobile web browser to automate. Should be an empty string if automating an app instead.
        capabilities.setCapability(CapabilityType.VERSION, "4.4");
        capabilities.setCapability(CapabilityType.PLATFORM, "Android");
        capabilities.setCapability("app-package", "com.myapp"); //Replace with your app's package
        capabilities.setCapability("app-activity", ".myapp"); //Replace with app's Activity
        driver = new RemoteWebDriver(new URL("http://ift.tt/1eWSHgW"), capabilities);
    }







    @Test
    public void Cal(){
        driver.findElement(By.name("btnSkip")).click();
    }

    @AfterClass
    public void tearDown(){
        driver.quit();
    }

}

Aucun commentaire:

Enregistrer un commentaire