---
title: Instrumenting your Swift tests with RUM
description: >-
  Learn how to use Test Optimization and RUM to connect your Swift test results
  with application sessions and session replays.
breadcrumbs: Docs > Test Optimization in Datadog > Instrumenting your Swift tests with RUM
---

# Instrumenting your Swift tests with RUM

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ().
{% /alert %}

{% /callout %}

## Overview{% #overview %}

Ensure that [Test Optimization](https://docs.datadoghq.com/tests/setup/swift.md) is already set up for Swift.

### Compatibility{% #compatibility %}

The Test Optimization - RUM integration is available for these versions of `dd-sdk-swift-testing` and `dd-sdk-ios`:

- `dd-sdk-swift-testing` >= 2.0.0
- `dd-sdk-ios` >= 1.10.0

## Connect Swift tests and RUM{% #connect-swift-tests-and-rum %}

If you link `dd-sdk-swift-testing` for your UI tests bundle and the application being tested is instrumented using [Real User Monitoring](https://docs.datadoghq.com/real_user_monitoring/ios.md), your test results and their generated RUM application sessions and session replays are automatically linked.

A **RUM Sessions** tab appears in the Test Optimization test detail side panel.

{% image
   source="https://docs.dd-static.net/images/ci/ci-swift-rum-session-tab.95721b70907ab2a49365515317f9ffd7.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/ci/ci-swift-rum-session-tab.95721b70907ab2a49365515317f9ffd7.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Browser Session Tab in Test Detail" /%}

The RUM session has all the data that [RUM normally collects](https://docs.datadoghq.com/real_user_monitoring/ios/data_collected.md) so you can debug potential issues in your iOS tests, such as user name or unexpected errors.

{% image
   source="https://docs.dd-static.net/images/ci/ci-swift-rum-session-tab-errors.91c4d3d508e245c8e2ed9e6882b7df71.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/ci/ci-swift-rum-session-tab-errors.91c4d3d508e245c8e2ed9e6882b7df71.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="Browser Session Tab Errors in Test Detail" /%}

## Further reading{% #further-reading %}

- [Learn about Test Optimization](https://docs.datadoghq.com/tests.md)
- [Learn about RUM iOS and tvOS Monitoring](https://docs.datadoghq.com/real_user_monitoring/ios.md)
