Preparing Mac for Mobile Test Automation
- ravi.chandran (Unlicensed)
- Anonymous
Qualitia uses third-party software components, which needs to be downloaded separately for successful mobile test automation.
In order to prepare your Mac for mobile automation testing, you need to download and install Appium and Xcode.
Download and Install Xcode
Xcode is an integrated development environment (IDE) for macOS containing a suite of software development tools developed by Apple. Xcode helps in creating a set of virtual devices for mobile application testing.
- Download and install the latest version of Xcode (from the app store).
Download Simulators
You need to download the required simulators if you want to execute test cases on simulators.
To download simulators:
- Launch Xcode and navigate to Xcode > Preferences.
- Select Components from the top.
All the available simulators are listed here. - Select one or more simulators from the list to download.
A pop-up appears asking password. - Enter Password and then click Install Software.
Install and Configure Appium Dependencies for iOS Physical Device on Mac
In order to prepare your Mac for automating test cases on iOS physical device, please install following components using terminal after you have downloaded Appium Desktop and Xcode.
For automating test cases on simulators, you do not need to download and install these components.
For more information on these dependencies, GitHub or Appium documentation.
- Install Homebrew, if not present.
- To check whether Homebrew is installed, execute following commands in terminal:
brew --version. - To install Homebrew, execute the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - Once completed, confirm the installation executing brew --version command.
- Install Node js, if not present.
- To check whether Node js is installed, execute the following command in terminal:
npm --version. - To install Node js, execute following commands in terminal:
brew update and brew install node. - Once completed, confirm the installation executing following command.
npm --version - Install appium from NPM.
- npm install –g appium
This will install the latest appium version - Launch terminal and install packages using the following commands:
- brew install usbmuxd –HEAD
This command installs libimobiledevice. - brew install libimobiledevice --HEAD
This command installs libimobiledevice. - brew install ideviceinstaller
This command installs ideviceinstaller required for iOS 9. - npm install -g ios-deploy
This command installs iOS-deploy required for iOS 10. - gem install xcpretty
This command installs xcpretty. - brew install ios-webkit-debug-proxy
This installs iOS Web kit debug proxy. - brew install carthage
This command installs carthage dependency manager. - Configure WebDriver Agent project using the following steps:
- Download a WebDriverAgent xcode project from GitHub.
If user is using Mac OS Mojave, please download the WebDriverAgent from here. - Extract the downloaded WebDriverAgent-master.zip.
- Rename extracted folder to WebDriverAgent.
- Copy and replace the extracted folder to /Applications/Appium.app/Contents/Resources/app/node_modules/appium-xcuitest-driver/WebDriverAgent.
- /Applications is the location where you have installed Appium server.
In case Appium is installed on different directory, replace the above path accordingly. - Launch terminal and go to /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent.
- Execute command:
./Scripts/bootstrap.sh - Launch Finder and go to the same location mentioned above.
- Double-click WebDriverAgent.xcodeproj.
This launches the Xcode. - Connect your physical device and select it using the drop-down list from the top menu bar.
- Add developer account in Xcode, if not added.
For more information on adding developer account, click here. - Select each Target from the General section, select the Automatically Manage Signing check box from the Signing section.
Select the developer account details from the Team drop-down list for each Target if not added select add Account. Add the developer account for auto signing.
View image- From the top menu items, select Product > Build For > Testing.
Xcode then builds the WedDriver agent project for testing. If the project builds successfully, your Mac setup is ready for testing.
If the build fails, click here for troubleshooting. - Select the target as a “WebDriverAgentRunner” and Go to “Product -> Test”.
WebDriverAgent should get installed. WebDriverAgent should be launched and minimized. Xcode status should display “Testing”. - Stop the test and try launching appium object spy inspector launching the application under test.
Enable the Develop Menu on Safari
The Develop menu can be turned on by following the steps mentioned below.
- Launch the Safari browser.
- Go to Safari > Preferences > Advanced.
- Ensure that Show Develop menu check box is selected.
Enable Remote Automation in the Develop Menu
- Launch the Safari browser.
- Go to Develop > Allow Remote Automation.
Troubleshooting
You may face some issues while setting up the Mac for automation testing. You may refer to this troubleshooting section to resolve these issues.