---
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

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

{% /callout %}

## Overview{% #overview %}

Ensure that [Test Optimization](https://docs.datadoghq.com/tests/setup/swift/) 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/), 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"
   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/) 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"
   alt="Browser Session Tab Errors in Test Detail" /%}

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

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