Skip to content

Commit

Permalink
Merge pull request #371 from testsigmahq/dev
Browse files Browse the repository at this point in the history
New troubleshooting & WDA file creation docs.
  • Loading branch information
bharathk08 authored Mar 9, 2024
2 parents bfb0bf4 + 2e7edf9 commit 11560d6
Show file tree
Hide file tree
Showing 5 changed files with 442 additions and 66 deletions.
84 changes: 84 additions & 0 deletions src/pages/docs/configuration/generate-wda-file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
---
title: "Creating WDA File for iOS App Testing"
page_title: "Creating WDA File for iOS App Testing"
order: 19.6
page_id: "Steps to Create WDA File for iOS App Testing"
metadesc: "Creating WebDriverAgent (WDA) is important for automating iOS tests | Learn how to generate WDA file for iOS app testing to ensure quality of application"
search_keyword: "Create WDA File"
warning: false
contextual_links:
- type: section
name: "Contents"
- type: link
name: "Prerequisites"
url: "#prerequisites"
- type: link
name: "Steps to Create WDA File"
url: "#steps-to-create-wda-file"
---

---

WebDriverAgent (WDA) plays an important role in automating iOS tests. It bridges the code we write for testing and the actual iOS app, which helps us control the app, test how it behaves, and make sure it works correctly. This article discusses the steps and prerequisites for creating WDA files.

---

## **Prerequisites**

- Paid Apple Developer Account

- Mac Machine

- Xcode and Xcode Command line tools

---

## **Steps to Create WDA File**

1. Download from [Appium Github](https://github.com/appium/WebDriverAgent).

2. Open **WDA Xcode Project** in **Xcode**.

![Xcode Project](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/repimgwda.png)

3. On **Signing & Capabilities**, add Apple Account for wherever necessary in **Target OS & Integrations**.

![Signing & Capabilities](https://s3.amazonaws.com/static-docs.testsigma.com/new_images/projects/applications/setcap.png)

4. Once the signing is done, run the following command to build the latest WDA WebDriverAgent. This command will build the WDA project and prepare it for testing.

```
xcodebuild build-for-testing \
-project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner \
-destination 'id=<DEVICE_UDID>'
```
[[info | **NOTE**:]]
| Replace **<DEVICE_UDID>** with the actual **UDID** (Unique Device Identifier) of the iOS device or simulator where you want to run the tests.
5. Create a Zip Archive from the Products Folder
Locate the **Products** folder within the Xcode derived data directory. The path looks like this: <br>
```
zip/Users/<user>/Library/Developer/Xcode/DerivedData/WebDriverAgent-<RANDOM-STRING>/Build/Products
```
Here, you need to replace **<user>** with your username and **<RANDOM-STRING>** with the random string associated with your WDA build.
6. Generating a New WDA for Installation
Run the following commands to create a new WDA package for installation.
```
xcodebuild -scheme WebDriverAgentRunner -sdk iphoneos -configuration Release -derivedDataPath /tmp/derivedDataPath
cd /tmp/derivedDataPath/Build/Products/Release-iphoneos
mkdir -p Payload
mv WebDriverAgentRunner-Runner Payload
zip Payload wda.zip
mv wda.zip wda.ipa
```
The above commands will generate a new **wda.ipa** file.
---
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ noindex: false
order: 4.625
page_id: "Recording tests with webview for hybrid iOS apps"
warning: false
contextual_links:
- type: section
name: "Contents"
- type: link
name: "Executing Native Android/iOS App Tests in Hybrid Model"
url: "#executing-native-androidios-app-tests-in-hybrid-model"
---
---

Expand Down Expand Up @@ -38,4 +44,50 @@ On selecting the WebView the following NLP is added,
[[info | **NOTE**:]]
| Recording tests with multiple webviews will be the same for Android and iOS applications.

---

## **Executing Native Android/iOS App Tests in Hybrid Model**

Considering you already have a Test Suite containing iOS Application Test Cases, the procedure for executing a native iOS Application using Testsigma in a local environment is as follows:

**1. Register a Local Agent.**

We need to add a local agent in Testsigma and link this agent as a Test Machine to Test Suites while creating the Test Plan.


**2. Setup the Local Mac and iOS Device for Hybrid Execution.**

We must configure the local machine once the local agent is added to Testsigma. This is done so that the local machine can accept communication in the form of HTTP packets from Testsigma servers. This step is preconfigured in other Cloud Execution Models such as Testsigma Labs, Sauce Labs, and BrowserStack. If you prefer the easy method, use the cloud execution models to select the execution environment from the list of available devices.

Continuing with the Hybrid Execution setup, we must first set up the Testsigma agent on the local Mac. Please check the following article for a detailed guide on [setting up Testsigma Agent](https://testsigma.com/docs/agent/setup-on-windows-mac-linux/).

Assuming you already have the prerequisites, such as Appium and XCode configured, we will run tests once the Testsigma Agent is configured.

**2. Create Execution and add Execution Configuration.**

While creating the Execution Configuration for iOS, we need to provide some extra information in case of Hybrid Executions for Testsigma to properly connect to the local iOS device. The most important fields on the page are:

**Machine:** Select the local System we added in the previous Step. This is the Mac device which Testsigma directly communicates with, and from there, the communication data is passed to the Test iOS device connected to this Mac.

**OS Version:** Select the iOS version in the Test Device.

**Appium URL:** Enter the Appium URL you started the server with. If you used the default configuration, the URL would be:
http://0.0.0.0:4723/wd/hub

**Device Name:** Enter the serial number of the iOS Device.

**UDID:** Enter the unique device identifier UDID code for your iOS device. Here's a guide to finding your UDID using Itunes App on your Mac - WhatsmyUDID

**BundleID:** Use this option if the app has already been installed on the Test iOS device (Recommended).
- **BundleID:** BundleID is the unique identifier of an iOS App. Here's a guide to finding your App BundleID - [Finding the App Bundle ID](https://pspdfkit.com/guides/ios/faq/finding-the-app-bundle-id/)

**App Path:** Use this option if the app to be tested is located on the Mac and you want to avoid installing it on the test device.
- **Use IPA:** Specify the local Mac machine's path to the IPA file.

Once the Execution Configuration is created, we can finalize the Execution creation by clicking on the Create button.


[[info | **NOTE**:]]
| The steps remain the same for executing native Android tests in the hybrid model as well. We use APK files instead of IPA for Android tests.

---
Loading

0 comments on commit 11560d6

Please sign in to comment.