Appium iOS Automation setup with XCUI TEST
WebDriver Agent
STEP BY STEP PROCEDURE::
Brew
install and Update:
Homebrew
is a free and open-source software package management system that simplifies
the installation of software on Apple’s OS X operation system.
To
install brew:
Ruby –e “$(curl –fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
To update the Homebrew: brew
update
Install
npm and Update:
Installing
Node.js and NPM is pretty straightforward using Homebrew. Homebrew handles
downloading,unpacking and installing Node and NPM on your system.
Open the Terminal app and
type brew install node
To see if Node is installed, type node -v in Terminal. This
should print the version number of Node
To see if NPM is installed, type npm -v in Terminal. This should
print the npm version number.
For
Updating Node and NPM:
New versions of Node and NPM come out
frequently. You can use Homebrew to update the software it installs.
- Make sure Homebrew has the latest version of the Node package.
In Terminal type
brew update
- Upgrade Node: brew
upgrade node
To Uninstall Node and NPM:
Use
Homebrew to uninstall packages that it installed:
brew uninstall node
.
Use
Homebrew to uninstall npm:
brew uninstall npm
.
Install
Xcode:
Apple’s
XCode development software is used to build Mac and iOS apps, but it also
includes the tools you need to compile software for use on your Mac.
Download XCode from: https://developer.apple.com/xcode/download/ and
install.
Install
Appium, XcuitestDriver and Appium Doctor:
Appium:
Appium is an open-source tool for automating native, mobile
web, and hybrid applications on iOS and Android platforms.
Download latest Appium version from: https://bitbucket.org/appium/appium.app/downloads/ and
install.
Note: use “Sudo”, if you
want to install as ADMIN
2.
To check Appium version : Appium –v
3.
To uninstall Appium: Sudo npm uninstall –g Appium
XCUITEST:
1.
Command to install Xcuitest Driver: npm install appiun-xcuitest-driver
2.
To uninstall Appium: Sudo npm uninstall appiun-xcuitest-driver
3.
Appium Doctor:
1.
Command to install AppiumDoctor: npm install appiun-doctor –g
2.
To check iOS configuration: Appium-doctor --ios
3.
To uninstall Appium: Sudo npm uninstall appiun-doctor
4.
Usage:
--ios
|
To Check iOS setup
|
--android
|
To check Android Setup
|
--dev
|
To check dev setup
|
--debug
|
To show Debug message
|
--yes
|
Always respond Yes
|
--no
|
Always Respond No
|
--demo
|
To run Appium-doctor demo for dev
|
-h or –help
|
To show help
|
Appium Inspector:
No official Appium Inspector is released for Appium 1.6 or above. So
there are few workarounds to identify iOS native elements.
Workaround-1: Accessibily
Inspector
a.
Open XcodeàOpen
Developer Tool à
Click on Accessibility Inspector.
b.
Connect
an iOS device to MAC machine and
open that device in Quick Time player
c.
Select
connected device as Target Device in Accessibility Inspector
d.
Inspect required elements
Workaround-2: By Using Older
Version Appium GUI
a.
Open GUI of Appium (Older version, ex:1.5.3)and
set all required capabilities.
b.
Start Appium 1.6.3(1.6 or above) from command
prompt.
c.
Once server is started, start inspecting
elements by click on Appium Inspector on GUI
Install
External Dependencies:
Ideviceinstaller:
Ideviceinstaller
is a tool to interact with the installation_proxy of an iOS device allowing installing,
upgrading, uninstalling, archiving, restoring and enumerating installed or
archived apps.
In
order to install this tool, Open the terminal and run the following command:
Command: brew install --HEAD ideviceinstaller
Carthage:
Carthage
builds your dependencies and provides you with binary frameworks, but you
retain full control over your project structure and setup. Carthage does not
automatically modify your project files or your build settings.
Command: brew install carthage
Note: if you previously installed the binary version
of Carthage, you should delete “/Library/Frameworks/CarthageKit.framework”
Ios-deploy:
Install
and debug iOS apps without using Xcode. Designed to work on un-jailbroken
devices.
Command: npm install –g ios-deploy
DeviceConsole:
Command: npm install –g deviceconsole
Xcpretty:
Xcpretty is a fast and flexible formatter for xcodebuild.
It does one thing, and it should do it well.
Command: gem install xcpretty
Libimobiledevice:
Command: brew install libimobiledevice –HEAD #install from head to get important
update
WebDriverAgent
Configuration:
1.
Go to node_modules/appium-xcuitest-driver/WebDriverAgent
2. mkdir –p Resources/WebDriverAgent.bundle
3. sh ./Scripts/bootstrap.sh –d
4.
Open Xcode with WebDriverAgent.xcodproj
5.
Build WebDriverAgent Project with Sign.
Steps
to execute XCUITEST scripts:
a.
Sign WebDriverAgent and WebDriverAgentRunner
with Apple Account and Check by building it on Simulator and Real Device.
b.
Resign the Application which you want to
automate and provide the path of the resigned ipa file in script.
c.
Create the script, Start Appium and Run the
testcases.
Links:
Hi,
ReplyDeleteAppreciate your work, very informative blog and STEP BY STEP PROCEDURE on Appium iOS Automation. I just wanted to share information about Appium Online Training.
One of the key features said to be coming to
ReplyDeletethe HomePod is the ability to make or receive phone calls
Read More At iOS Online Training Hyderabad
Thanks for sharing a great article, Mobile Automation Testing .
ReplyDelete