In the world of mobile app development, automated testing is essential to ensure that your app delivers a flawless user experience. Appium is one of the most popular tools for mobile automation testing, and to get the most out of it, you need to install and configure two powerful tools: Android Studio and Xcode. In this blog post, we will walk you through the process of setting up these tools effectively.
Download Android Studio
Visit the official Android Studio download page and grab the latest version for your operating system.
Install Android Studio
Once downloaded, open the installer and follow the prompts to install the IDE. On Windows and Mac, it usually comprises typical installation steps (click 'Next' or 'Install').
Configure Android SDK
C:\Users\<Your-Username>\AppData\Local\Android\Sdk
on Windows and /Users/<Your-Username>/Library/Android/sdk
on macOS).Set Environment Variables
Windows:
Go to System Properties > Environment Variables. Under 'System Variables', click 'New' and add a variable:
ANDROID_HOME
C:\Users\<Your-Username>\AppData\Local\Android\Sdk
).macOS/Linux:
Open your terminal and add the following lines to your ~/.bash_profile
or ~/.zshrc
:
export ANDROID_HOME=/Users/<Your-Username>/Library/Android/sdk export PATH=$PATH:$ANDROID_HOME/emulator export PATH=$PATH:$ANDROID_HOME/tools export PATH=$PATH:$ANDROID_HOME/tools/bin export PATH=$PATH:$ANDROID_HOME/platform-tools
After editing the file, run source ~/.bash_profile
or source ~/.zshrc
.
Verify Installation
Open a terminal (or Command Prompt) and type:
adb --version
If installed correctly, you should see the version of ADB listed.
Download Xcode
Go to the Mac App Store and search for Xcode, or use this link to download it directly.
Install Xcode
Click on 'Get' or 'Download', and once completed, open Xcode to begin the installation process. Ensure that you accept the terms and conditions when prompted.
Install Command Line Tools
After installation, open the terminal and run the command:
xcode-select --install
This ensures that you have all the necessary development tools installed.
Verify Installation
To check if Xcode has been installed correctly, open the terminal and run:
xcodebuild -version
You should see the version of Xcode displayed.
Install Node.js and NPM
Appium requires Node.js. Go to the Node.js website and download the LTS version, then follow the installation process.
Install Appium
Open your terminal and run the command:
npm install -g appium
This command installs Appium globally.
Install Appium Doctor
You can check if your environment is set up correctly by using Appium Doctor. Install it using:
npm install -g appium-doctor
After installation, run:
appium-doctor
This command will analyze your environment and highlight any missing dependencies.
Set Up Appium Desktop (Optional)
If you prefer a GUI, you can download Appium Desktop from the Appium release page. This tool provides an easy-to-use interface to set up and manage your Appium sessions.
Once both Android Studio and Xcode are configured, you can run a simple test using the following sample codes in your favorite programming language. Let’s say you’re using Java with TestNG for testing:
import io.appium.java_client.MobileElement; import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.remote.MobileCapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import java.net.URL; public class SampleTest { public static void main(String[] args) { try { DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android"); caps.setCapability(MobileCapabilityType.APP, "<path-to-your-app>.apk"); AndroidDriver<MobileElement> driver = new AndroidDriver<MobileElement>(new URL("http://localhost:4723/wd/hub"), caps); // Your test code goes here driver.quit(); } catch (Exception e) { e.printStackTrace(); } } }
Make sure to replace <path-to-your-app>.apk
with the actual path of the app you want to test. You can then execute this code and start your automation journey.
Now you’re all set to automate your mobile applications using Appium! Happy testing!
18/09/2024 | Mobile Testing
30/09/2024 | Mobile Testing
21/09/2024 | Mobile Testing
21/09/2024 | Mobile Testing
21/09/2024 | Mobile Testing
21/09/2024 | Mobile Testing
30/09/2024 | Mobile Testing
30/09/2024 | Mobile Testing
21/09/2024 | Mobile Testing