Finally the times come, when we will write our First Appium Test to Launch Amazon App. This will include following steps:

Launch Appium Node server

Create your first test script

Execute your first test

Launch Appium Node Server

1) I am expecting that your Appiumwindow is already opened on your machine. If you have restarted your system then please start Appium by navigate to Appium directory in your system and start Appium by double clicking Appium.exe file.

Android Icon is for Configuration settings

Settings Icon is for General Settings

Play Icon is for Starting Node server

2) Click on Androidicon to open the configuration of the Appium run. There you need to select the check box of ‘No Reset‘. This will ensure that the Appium will not install or uninstall App on every run.

3) Click on General Setting icon and make sure that Server Address and Port is populated.

Note: Do not alter the IP address or port number. Your Appium console start at 127.0.0.1:4723 as shown in below.

4) Now its time to start the Appium server, juct click on the Launch Appium Node Server button on the top right corner of Appium window and wait for few seconds. Appium server started and running on your system.

Run The First Test

Now you are all set to write your first test script. Create a small test Program for opening a Amazon application on your device using Appium.

1) Copy & paste the below code to your StartApplicationclass and give it a run.

2) Do no get in to details for now and simply run the test. To start the test just select Run > Run As > Java Application Or Right Click on Eclipse code and ClickRun As > Java Application.

3) After a few Seconds, you will see that with the help of your script, Amazonapplication will be launched on your device. Once the execution is finished, you will see a long list of messages on the Appium console.We will come back to these messages later.

Code Explanation

Lets now discuss what each line of code means in the above test. I hope you are enjoying your journey of learning Appium.

Path to APK file

Since the Amazon app apk is stored in the computer and is not already installed on the device we need to create a file object which represents the actual apk file on the disk. I placed the folder ‘/Apps/Amazon/‘ which contains the apkfile inside the Eclipse project.

Desired Capabilities

To be able to test the app on an actual device Desired Capabilities need to be set. Desired Capabilities are a set of keys and values sent to the Appium server to tell the server what kind of automation session we’re interested in starting up. There are also capabilities used to modify the behavior of the server during automation.

// To create an object of Desired CapabilitiesDesiredCapabilities capabilities = new DesiredCapabilities();

// Name of mobile web browser to automate. It should be an empty string, as we are automation an appcapabilities.setCapability(CapabilityType.BROWSER_NAME, “”);

// Name of the OS: Android, iOS or FirefoxOScapabilities.setCapability(“platformName”, “Android”);