Steps To Create App Launching Test Script (We used Real Device and Play Store App)
- Start Appium Server.
Click on Advance and Select Check-box “Allow Session Override”.
Now Click on Start Server and if it is successful then see text “server is running”
Now open Eclipse and Create Project ( Read:- http://qatestingtips.com/create-project-in-eclipse/ )
– Created project code may be like below. I have taken package name “apppack” and class name “AppClass”.
Note:- We have taken example of “Play Store App”
package apppack;
public class AppClass {
public static void main(String[] args) {
}
}
Need To Add Desired Capabilities and Instantiate Appium Driver. Code can be like below.
package apppack;
public class AppClass {
public static void main(String[] args) {
//Need to add the Desired Capabilities
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(“deviceName”, “MyDevice”); // Name of your mobile phone
caps.setCapability(“udid”, “device id”); //Device ID of your mobile phone – How to get “Device ID” please go to” http://qatestingtips.com/how-to-get-device-id/ ”
caps.setCapability(“platform Name”, “Android”);
caps.setCapability(“platform Version”, “OS Version”); // OS Version of your device
caps.setCapability(“appPackage”, “com.android.vending”);
caps.setCapability(“appActivity”,”appActivity”, “com.android.vending.AssetBrowserActivity”);
// How to get app activity name and app package name please go to “ http://qatestingtips.com/how-to-get-app-package-name-and-activity-name/ ”
caps.setCapability(“noReset”, “true”);
//Need to instantiate Appium Driver
try {
AppiumDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL(“http://127.0.0.1:4723/wd/hub”), caps);
} catch (MalformedURLException e) {
System.out.println(e.getMessage());
}
}
Now there will be need to import statements under package.
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
Now need to add supporting jar files “Appium jar file, Selenium Web Driver Jar files (If not added during project creation then need to add), need to add some other jar files also like “J unit, commans-lang and harmcrest-core.
Once all errors are removed and configuration is done then run this test script to know result.
Before running test script make sure server is running.
Output:- See app is launched
Note: If getting any problem then please be clear about configuration. Means each and every required software is installed and configured properly or not. If not then please read more about process, required things and configuration.
2 comments
Hi,
I am an avid reader of your website and I must say your content is to the point. However as I was reading about APPIUM testing, there is a little issue on your website- The favicon of your website is not clearly visible. Thought you might like to know. :p
Thanks
Thanks for your feedback.