What is Appium?
Appium is a free automation framework that lets you test and automate mobile apps on different platforms, such as iOS. It offers a single interface to work with iOS devices, simulators, and emulators, which makes it easy for developers and testers to write automation scripts in various programming languages.
Why Use Appium for iOS Automation?
Cross-platform Compatibility
- Appium testing supports cross-platform automation, allowing you to write tests that you can execute on multiple platforms, including iOS, Android, and Windows. The ability to work on various platforms without any issues saves time and effort when creating and managing automation frameworks for different platforms.
Open-source and Community Support
- Appium is an open-source automation framework freely available and well-supported. This active community provides regular updates, bug fixes, and enhancements, ensuring the framework stays up-to-date and reliable.
Native App Testing
- Appium enables the testing of native iOS applications, providing access to native controls and functionality. It allows you to interact with elements such as buttons, text fields, menus, and alerts, simulating real user interactions and verifying the behavior of your application.
Web App and Hybrid App Support
- In addition to native apps, Appium also supports testing web applications and hybrid apps. It provides the capability to automate web views within an app, allowing you to perform end-to-end testing across different app components seamlessly.
Multiple Language Support
- Appium supports various programming languages. This flexibility allows you to write tests in a language of your choice, making it easier to integrate with your existing development and testing processes.
Seamless Integration with Continuous Integration (CI) Systems
- You can easily integrate Appium with popular CI systems like Jenkins, Travis CI, and CircleCI. This integration enables automated test execution as part of your CI/CD pipeline, ensuring efficient and reliable testing throughout the development lifecycle.
Real Device and Simulator Testing
- iOS app testing using Appium works on both real devices and simulators; this allows you to validate your application’s behavior on various device configurations, ensuring compatibility and a consistent user experience across different devices.
Extensive Test Coverage
- With Appium, you can cover a wide range of testing scenarios. This comprehensive test coverage helps identify issues early in the development cycle, improving the overall quality of your iOS applications.
This guide will help set up and utilize Appium Desktop for iOS automation on real devices and simulators.
Requirements
Before starting, ensure you meet these requirements:
- Operating System: Mac OS High Sierra (10.13) or higher.
- CPU: 64-bit.
- Software:
- Xcode: This IDE enables app development on macOS and iOS. Install Xcode from [official source].
- Homebrew: A package management software that simplifies the installation of additional tools. Install Homebrew from [official source].
- Carthage: Carthage is a dependency builder for binary frameworks required for WebDriverAgent. Install Carthage using: brew install Carthage.
- ios-deploy: Command-line utility to install and debug iPhone apps without Xcode. Install ios-deploy using: brew install ios-deploy.
- ideviceinstaller: Tool to interact with iOS device installations. Install ideviceinstaller using: brew install ideviceinstaller.
- ios_webkit_debug_proxy: This tool helps Appium access web views. Install ios_webkit_debug_proxy using: brew install ios-webkit-debug-proxy.
- (Optional) Node.js and npm: JavaScript runtime environment and package manager. Node.js is bundled with Appium Desktop, so this installation is optional. Install Node.js and npm using the command: brew install node.
Appium Desktop
- Install Appium Desktop by following the instructions found [here]. Appium Desktop provides a user-friendly interface and includes the Appium automation server.
Setting Up WebDriverAgent
Follow these steps to set up WebDriverAgent for iOS automation:
- Launch Appium Desktop and start the server.
- Use a USB cable – connect iOS device.
- In the Appium Inspector, select “Automatic Server” as the configuration.
- Prepare desired capabilities based on your device’s configuration, including deviceName, platformName, platformVersion, automationName, udid, bundleId, xcodeOrgId, and xcodeSigningId.
- Note: To obtain the xcodeOrgId, log in to your Apple developer account, navigate to Membership, and find your Team ID.
- Edit the JSON Representation section in the Appium Inspector, replacing the existing “{}” with your prepared desired capabilities. Save the changes.
- Click on the “Start Session” button, being aware that there might be initial failures that the tutorial will address.
- Observe the Appium terminal for relevant information, such as the WebDriverAgent.xcodeproj file path. You can find it at: “/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj”.
- Open the terminal window and execute: “open /Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj” to launch Xcode with the WebDriverAgent project.
- Add your developer credentials to Xcode Menu > Preferences > Accounts in Xcode, and provide your account details. Download your manual profiles if prompted.
- Configure the WebDriverAgentRunner target application in Xcode:
- Select the WebDriverAgentRunner target.
- In the “Signing & Capabilities” tab, enable “Automatically manage signing” and choose your team from the dropdown.
- Verify that the errors are resolved.
- Change the bundle identifier for WebDriverAgentRunner in the “General” tab by appending “.xctrunner” to the existing bundle identifier.
- Build the WebDriverAgentRunner target by selecting “Product” from the menu bar and then “Build”.
- Trust the developer on your iOS device by navigating to Settings > General > Device Management > [Your Apple ID] > Trust.
- Congratulations! You have successfully set up WebDriverAgent for iOS automation using Appium Desktop.
Conclusion
Appium is a powerful tool for testing. Organizations also leverage software testing tools adept at using Appium to help with mobile test automation with Appium. HeadSpin uses Appium to test and provides users with the tools necessary to test better. Reach out!