Download Appium - Run First Android Automation Test Using In Eclipse - Software Testing Tutorials graphic type that can be scaled to use with the Silhouette Cameo or Cricut. An SVG's size can be increased or decreased without a loss of quality. All of our downloads include an image, Silhouette file, and SVG file. It should be everything you need for your next project. Our SVG files can be used on adhesive vinyl, heat transfer and t-shirt vinyl, or any other cutting surface
- Find Android Device Name : As described in THIS POST, Connect your android device with PC and get device name by running adb devices command in command prompt. My android device name Is : ZX1B32FFXF. Find your device name.
- Find Android Software App Package Name : You can view THIS POST to know how to get android app package name. Package name for my calculator app (Which Is Installed in my android device) is com.android.calculator2. Find your app package name.
- Find App Activity Name : You can view THIS POST to know how to get android app activity name. Activity name for my calculator app (Which Is Installed in my android device) is com.android.calculator2.Calculator. Find your app activity name.
- Find Android OS Version : In your android device, Open settings -> About phone -> Android version. My device's Android version Is : 4.4.2.
- Launch Appium from Windows Start menu.
- For me, Server Address is : 127.0.0.1 and Port Number is : 4723.
3. Create Appium Test Script In Eclipse
- Calculator app should be installed in your android device.
- Install TestNG in eclipse if it is not installed. View THIS POST.
- Also replace capabilities values of bellow given list with your own values in script. Otherwise it will not works.
- deviceName - Name of device which is connected with PC.
- CapabilityType.VERSION - OS version of your android device.
- appPackage - Calculator app's Package name.
- appActivity - Calculator app's Activity name.
SimpleAndroidCalcTest.java
package Android;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
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;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class SimpleAndroidCalcTest {
WebDriver driver;
@BeforeTest
public void setUp() throws MalformedURLException {
// Created object of DesiredCapabilities class.
DesiredCapabilities capabilities = new DesiredCapabilities();
// Set android deviceName desired capability. Set your device name.
capabilities.setCapability("deviceName", "ZX1B32FFXF");
// Set BROWSER_NAME desired capability. It's Android in our case here.
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Android");
// Set android VERSION desired capability. Set your mobile device's OS version.
capabilities.setCapability(CapabilityType.VERSION, "4.4.2");
// Set android platformName desired capability. It's Android in our case here.
capabilities.setCapability("platformName", "Android");
// Set android appPackage desired capability. It is
// com.android.calculator2 for calculator application.
// Set your application's appPackage if you are using any other app.
capabilities.setCapability("appPackage", "com.android.calculator2");
// Set android appActivity desired capability. It is
// com.android.calculator2.Calculator for calculator application.
// Set your application's appPackage if you are using any other app.
capabilities.setCapability("appActivity", "com.android.calculator2.Calculator");
// Created object of RemoteWebDriver will all set capabilities.
// Set appium server address and port number in URL string.
// It will launch calculator app in android device.
driver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
}
@Test
public void Sum() {
// Click on DELETE/CLR button to clear result text box before running test.
driver.findElements(By.xpath("//android.widget.Button")).get(0).click();
// Click on number 2 button.
driver.findElement(By.name("2")).click();
// Click on + button.
driver.findElement(By.name("+")).click();
// Click on number 5 button.
driver.findElement(By.name("5")).click();
// Click on = button.
driver.findElement(By.name("=")).click();
// Get result from result text box.
String result = driver.findElement(By.className("android.widget.EditText")).getText();
System.out.println("Number sum result is : " + result);
}
@AfterTest
public void End() {
driver.quit();
}
}
- Open calculator app in your mobile device.
- Tap on buttons in this sequence -> CLR, 2, +, 5 and =.
- Get result from text area of calculator app.
- Print result in eclipse console.
Download Appium - Run First Android Automation Test Using In Eclipse - Software Testing Tutorials All SVG file downloads also come bundled with DXF, PNG, and EPS file formats. All designs come with a small business commercial license. These SVG cut files are great for use with Silhouette Cameo or Cricut and other Machine Tools.