Skip to content

Commit

Permalink
Wording and spelling
Browse files Browse the repository at this point in the history
Co-authored-by: Thiago Veronese <[email protected]>
  • Loading branch information
si-net and thiagosaucelabs authored Mar 6, 2025
1 parent 39d56ea commit ae84917
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
48 changes: 24 additions & 24 deletions docs/mobile-apps/automated-testing/espresso-xcuitest/xctest.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ import useBaseUrl from '@docusaurus/useBaseUrl';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

Apple's native testing framework, [XCTest](https://developer.apple.com/documentation/xctest) , supports the creation of unit tests, UI tests, and performance tests. In XCTest, [XCUITest](https://developer.apple.com/documentation/xctest/user-interface-tests) is specifically designed for UI testing. Additionally, Apple allows you to organize and configure your tests into [Test Plans](https://developer.apple.com/documentation/xcode/organizing-tests-to-improve-feedback), enabling you to bundle multiple test targets into a single test run.
Apple's native testing framework, [XCTest](https://developer.apple.com/documentation/xctest), supports creating unit, UI, and performance tests. In XCTest, [XCUITest](https://developer.apple.com/documentation/xctest/user-interface-tests) is specifically designed for UI testing. Additionally, Apple allows you to organize and configure your tests into [Test Plans](https://developer.apple.com/documentation/xcode/organizing-tests-to-improve-feedback), enabling you to bundle multiple test targets into a single test run.

**To run your XCTest plan on Sauce Labs infrastructure we require the following test artifacts from you:**
**To run your XCTest plan on Sauce Labs infrastructure, we require the following test artifacts from you:**
1. All iOS apps that are part of your XCTest plan as an `.app` or `.ipa` file.
2. All XCUITest apps that are part of your XCTest plan as an `.app` or `.ipa` file (only if your Test plan actually includes a UI test).
3. The `.xctestrun` file for your XCTest plan. The [.xctestrun file](https://keith.github.io/xcode-man-pages/xcodebuild.xctestrun.5.html) is a compiled version of your XCTest plan and contains all the configuration for your tests. This file contains the same config that Xcode uses when it runs your tests on your development machine.
2. All XCUITest apps included in your XCTest plan as an `.app` or `.ipa` file (only if your test plan contains a UI test).
3. The `.xctestrun` file associated with your XCTest plan. The [.xctestrun file](https://keith.github.io/xcode-man-pages/xcodebuild.xctestrun.5.html) is a compiled version of your XCTest plan and includes all the configurations for your tests. This file holds the same configurations that Xcode utilizes when it runs your tests during development.


### Content
1. [How to build the '.app' and '.xctestrun' files from your XCode project.](#1-how-to-build-the-app-and-xctestrun-files)
2. [How to run your entire XCTest plan on Sauce Labs infrastructure.](#2-how-to-run-your-xctest-plan-on-sauce-labs-infrastructure)
3. [Special cases and trouble shooting](#3-special-cases-and-trouble-shooting)
3. [Special cases and troubleshooting](#3-special-cases-and-troubleshooting)
3. [Sample Implementation](#4-example-implementation)


## 1. How to build the '.app' and '.xctestrun' files
By default, Xcode will not persist the `.xctestrun` file if you kick off an XCTest on your development machine. To persist the `.xctestrun` file we need to use the `xcodebuild build-for-testing` command. Make sure you are using the correct `scheme` so it includes your desired tests.
By default, Xcode does not persist the `.xctestrun` file when you initiate an XCTest on your development machine. To persist the `.xctestrun` file, you need to use the `xcodebuild build-for-testing` command. Ensure you use the correct `scheme` to include your desired tests.

```shell
# Example xcodebuild command to build your scheme.
Expand All @@ -34,23 +34,23 @@ xcodebuild build-for-testing \
-sdk iphoneos \
-derivedDataPath ${output}

# the test artifacts will now be present in your output directory: In this case `saucelabs_integration/Build/Products
The test artifacts will now be available in your output directory: in this case `saucelabs_integration/Build/Products
ls ${output}/Build/Products
```
Explanation:
1. `output` a variable for the output directory, choose whatever path you prefer
2. `xcodebuild build-for-testing` builds all test artifacts, but does not run the tests.
1. `output` a variable for the output directory; choose any path you prefer
2. `xcodebuild build-for-testing` builds all test artifacts but does not run the tests.
3. `-scheme` builds the selected scheme. Make sure you select the scheme that contains the XCTest plan you want to run.
4. `sdk iphoneos` build binaries for iOS devices
5. `-derivedDataPath` (optional) defines where the test artifacts should be written to.
4. `sdk iphoneos` builds binaries for iOS devices
5. `-derivedDataPath` (optional) specifies the location where the test artifacts should be written to.


## 2. How to Run Your XCTest Plan on Sauce Labs Infrastructure
To run your XCTest plan on Sauce Labs, you have two options: use `saucectl` or integrate with our APIs yourself. If you are unfamiliar with our APIs, we recommend using `saucectl` for ease of use and getting you started quickly.
To run your XCTest plan on Sauce Labs, you have two options: use `saucectl` or integrate with our APIs on your own. If you're unfamiliar with our APIs, we recommend using `saucectl` for its ease of use and for helping you get started quickly.
### 2.1. Run XCTests via saucectl
First install [saucectl](/docs/dev/cli/saucectl.md#installing-saucectl). **Note: minimum version is `0.192.0`.** Then you can use `saucectl` command to configure and run your test on Sauce Labs infrastructure.
First, install [saucectl](/docs/dev/cli/saucectl.md#installing-saucectl). **Note: the minimum version is `0.192.0`.** After that, you can use the `saucectl` command to configure and run your test on Sauce Labs infrastructure.
```shell
# If it's the first time you're using saucectl, run:
Expand All @@ -63,37 +63,37 @@ saucectl init xctest
saucectl run
```
Visit the [XCUITest configuration](/docs/mobile-apps/automated-testing/espresso-xcuitest/xcuitest.md) page to see more options and info for `saucectl`.
Visit the [XCUITest configuration](/docs/mobile-apps/automated-testing/espresso-xcuitest/xcuitest.md) page for more options and information on `saucectl`.
### 2.2. Run XCTests Without Saucectl
If you prefer not to use saucectl, you can directly integrate with our APIs.
You can integrate directly with our APIs if you would rather not use `saucectl`.
**First**, compile your `.app` as an `.ipa` file as described [here](/docs/mobile-apps/automated-testing/ipa-files.md#building-an-ipa-from-an-app-bundle).
**First**, compile your `.app` into an `.ipa` file as described [here](/docs/mobile-apps/automated-testing/ipa-files.md#building-an-ipa-from-an-app-bundle).

Check warning on line 72 in docs/mobile-apps/automated-testing/espresso-xcuitest/xctest.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/mobile-apps/automated-testing/espresso-xcuitest/xctest.md#L72

[sauce.MeaningfulLinkWords] Improve SEO and accessibility by rewriting 'here' in the link text.
Raw output
{"message": "[sauce.MeaningfulLinkWords] Improve SEO and accessibility by rewriting 'here' in the link text.", "location": {"path": "docs/mobile-apps/automated-testing/espresso-xcuitest/xctest.md", "range": {"start": {"line": 72, "column": 66}}}, "severity": "WARNING"}
**Second**, upload your `.ipa` and `.xctestrun` files to our AppStorage backend, see [AppStorage APIs](/docs/mobile-apps/app-storage.md#upload-apps-via-rest-api).
**Second**, upload your `.ipa` and `.xctestrun` files to our AppStorage backend. See [AppStorage APIs](/docs/mobile-apps/app-storage.md#upload-apps-via-rest-api).
**Third**, call our native testing API with the AppStorage IDs of the two files you just uploaded. See [RDC native /test API](/docs/dev/api/rdc.md#start-a-xctest-xcuitest-or-espresso-job).
**Third**, call our native testing API using the AppStorage IDs of the two files you just uploaded. See [RDC native /test API](/docs/dev/api/rdc.md#start-a-xctest-xcuitest-or-espresso-job).
**Fourth**, poll the state of the job and wait until the `status` is `passed|failed|error|complete`. You can do this through the [Jobs API](/docs/dev/api/rdc.md#get-a-specific-real-device-job).
**Fourth**, poll the job status and wait until it is `passed`, `failed`, `error`, or `complete`. You can do this through the [Jobs API](/docs/dev/api/rdc.md#get-a-specific-real-device-job).
## 3. Special Cases And Trouble Shooting
## 3. Special Cases and Troubleshooting
### 3.1. XCTest Plan Contains A XCUITest
XCUITests require a second app that simulates the user interactions with your app under test. They usually have the suffix `UITests-Runner.app`. Before we can run this as part of your tests, this app will need to be installed on the device, just like any other app. You can do this through the [otherApps capability](/docs/mobile-apps/automated-testing/espresso-xcuitest/xcuitest.md#otherapps).
XCUITests require a second app that simulates user interactions with your app under test. These apps typically have the suffix `UITests-Runner.app`. Before running this as part of your tests, you'll need to install this app on the device, just like any other app. You can do this through the [otherApps capability](/docs/mobile-apps/automated-testing/espresso-xcuitest/xcuitest.md#otherapps).

### 3.2. XCTest Plan Contains A Target That Is For A Different App
A XCTest plan can contain multiple Test Targets, even for different apps. If this is the case they will need to be installed on the device before we can run the tests. If a scheme or XCTest plan contains multiple apps, they will be written to the same directory that you defined in [step 1](#1-how-to-build-the-app-and-xctestrun-files). To install them on a device you can use the [otherApps capability](/docs/mobile-apps/automated-testing/espresso-xcuitest/xcuitest.md#otherapps).
An XCTest plan can contain multiple test targets, even for different apps. If this is the case, they need to be installed on the device before running the tests. If a scheme or XCTest plan includes multiple apps, they will be written to the same directory defined in [step 1](#1-how-to-build-the-app-and-xctestrun-files). To install them on a device, you can use the [otherApps capability](/docs/mobile-apps/automated-testing/espresso-xcuitest/xcuitest.md#otherapps).


## 4. Example Implementation

For a practical example of how to set up and run your XCTest and XCUITest plans on Sauce Labs infrastructure, you can refer to
the [demo-xctest repository](https://github.com/saucelabs-training/demo-xctest).

This repository contains multiple examples of how to run XCTest plan on Sauce Labs cloud, along with the source code for the demonstration app
used in these examples. By leveraging `xctestplan` and `xctestrun` configuration files, this demo shows how to run an XCTest plan, similar to
This repository includes several examples of how to run an XCTest plan on Sauce Labs cloud, along with the source code for the demo app
used in these examples. By utilizing `xctestplan` and `xctestrun` configuration files, this demo shows how to run an XCTest plan, similar to
using the following xcodebuild command:

```shell
Expand Down
8 changes: 4 additions & 4 deletions docs/mobile-apps/features/xctest-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import useBaseUrl from '@docusaurus/useBaseUrl';

### XCTest Plan Support at Sauce Labs

Sauce Labs offers native support for XCTest Plans, making it easier than ever to run your entire iOS test suite in the cloud with
minimal configuration changes. With this new capability, you can leverage XCTest Plans to organize, customize, and scale your test runs
efficiently on ***Sauce Labs' real devices.***
Sauce Labs provides native support for XCTest Plans, making it easier than ever to run your entire iOS test suite in the cloud with
minimal configuration changes. With this new feature, you can leverage XCTest Plans to organize, customize, and efficiently scale your test runs
on Sauce Labs' real devices.***

### What is an XCTest Plan?

Expand All @@ -21,7 +21,7 @@ organization, selective execution of test cases, and more granular control over

### Why Use XCTest Plans on Sauce Labs?

XCTest Plans provide greater flexibility and control over test execution, and with Sauce Labs' real device cloud, you can maximize
XCTest Plans offer increased flexibility and control over test execution. With Sauce Labs' real device cloud, you can maximize
efficiency, scalability, and reliability. Here’s why running XCTest Plans on Sauce Labs is a game-changer:

Check warning on line 25 in docs/mobile-apps/features/xctest-plan.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/mobile-apps/features/xctest-plan.md#L25

[sauce.MeaningfulLinkWords] Improve SEO and accessibility by rewriting 'Here' in the link text.
Raw output
{"message": "[sauce.MeaningfulLinkWords] Improve SEO and accessibility by rewriting 'Here' in the link text.", "location": {"path": "docs/mobile-apps/features/xctest-plan.md", "range": {"start": {"line": 25, "column": 43}}}, "severity": "WARNING"}

-***Seamless Integration***
Expand Down

0 comments on commit ae84917

Please sign in to comment.