Setup Mobile Automation Test with Appium in MacOS
What is an Appium?
Appium is the open-source tool for automating the test for native apps, mobile web and hybrid apps, like iOS mobile apps, Android mobile apps and windows desktop platforms. In the Appium, we can write in various programming languages ( ex. Java, Python, JavaScript, Ruby, etc).
The framework used by Appium:
- iOS 9.3 and above = Apple’s XCUITest
- iOS 9.3 and below = Apple’s UIAutomation
- Android 4.3 and above = UiAutomator or UiAutomator2
- Windows = Microsoft’s WinAppDriver
The installation terms;
- Nodejs 10+ dan NPM
- Java +8
- Android SDK +16
- MacOS X 10.13 ke atas
- Xcode +10
- Carthage
- Ideviceinstaller
- iOS-deploy
- Apple development account
- Apple developer tools
- Appium desktop
Installing Java
You can download the Java SE installer from the site below and install it in your notebook.
https://www.oracle.com/java/technologies/downloads
After the installation finish, run this command in your terminal to see the Java version you installed.
Java -version
Installing NodeJS
Download the installer for NodeJS from the site below and install the downloaded file.
Download | Node.js
Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
nodejs.org
After installing NodeJS, let’s check the version for installed NodeJS and NPM (Node Package Manager) by running this command.
node -vnpm -v
Installing Android Studio
Download the Android Studio installer from this site.
Run and install the downloaded file. If the installation is finished, download your SDK version in “SDK Manager” and after it, create the virtual device in “AVD Manager” or “Virtual Device Manager”.
Installing XCode
Download the latest version of XCode from the App Store.
You can choose the simulator for the iOS version and run a simple project to start the simulator.
Installing Homebrew
For the installation of homebrew, you can follow the step from this site.
Or, you can run this command.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
And if the installation has finished, check the installed homebrew with this command.
brew -v
Install Carthage
Follow the step from this site.
Installing Appium and Appium Desktop
Besides you can follow the steps in the link above, you can also install it directly by running this command.
npm install -g appium
When the installation is finished, let’s check the installed version of the installed Appium.
appium -v
After installing Appium, if you want to use the Appium desktop, please go to this site and then download and install the latest version of Appium Desktop.
Installing Ideviceinstaller
You can see the step from this site.
Or, you are also able to run the command below to install ideviceinstaller.
brew install ideviceinstaller
Installing iOS-Deploy
You can refer to this site to install the ios-deploy.
Or, you can use this command to install it using the homebrew command.
brew install ios-deploy
If you want to use the npm command, use this.
sudo npm install -g ios-deploy
Install and Run the Appium-Doctor
The Appium-doctor is using to diagnose and fix common Node, iOS and Android configuration issues before starting Appium (npm). And run this command to install.
npm i appium-doctor
After installing appium-doctor, you can run it and diagnose by the command below.
appium-doctor
Running Appium by Command Line
If the installations above are successful, now we try to run the Appium using the command line or terminal. There are 2 ways to run the Appium. The first way is a run Appium as default (localhost).
appium
If you want to run the Appium using the specific address and port, for example.
appium -a 172.0.0.1 -p 4723
Intermezzo
For my project, I used Apache Maven. If you want to know about what is an Apache Maven, you able to see further about it on this site.
And, this is the way to install Apache Maven, by running the command below.
brew install maven
Then, some people use the IntelliJ IDEA as an integrated development environment (IDE) written in Java for developing computer software written in Java, Kotlin, Groovy, and other JVM-based languages (Wiki).
And, let’s install the Intellij IDEA. You are able to download the installer of Intellij IDEA from this site.
Choose the “Comunity” version if you want for it free, download the .dmg file and follow the step to install it.
There is also another IDE that is commonly used by developers, namely Visual Studio Code. Visit the site below to download the installer and then install it in your notebook.
Closing
That’s all my scribbles, hope it helps. See you in my next scribble.
Bibliography
Nabil, Moataz; Test Automation University — Mobile Automation with Appium in Java; https://testautomationu.applitools.com/appium-java-tutorial/