---
title: Test Impact Analysis for Swift
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: >-
  Docs > Test Optimization in Datadog > Test Impact Analysis > Configure Test
  Impact Analysis > Test Impact Analysis for Swift
---

# Test Impact Analysis for Swift

{% 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.md). ().
{% /alert %}

{% /callout %}

## Compatibility{% #compatibility %}

Test Impact Analysis is only supported on [`dd-sdk-swift-testing`](https://github.com/DataDog/dd-sdk-swift-testing) in versions `2.2.0`+.

### Swift Testing{% #swift-testing %}

Test Impact Analysis supports the Swift Testing framework only in serial mode. Parallelization must be disabled:

- In Xcode, disable parallel execution in your test plan or scheme settings.
- When running with the Swift Package Manager, pass the `--no-parallel` flag:

```shell
swift test --no-parallel
```

The SDK automatically detects whether parallelization is disabled and enables Test Impact Analysis for Swift Testing accordingly. To override this detection, set the `DD_SWIFT_TESTING_TEST_IMPACT_ANALYSIS_ENABLED` environment variable to `true` or `false`.

## Setup{% #setup %}

### Test Optimization{% #test-optimization %}

Prior to setting up Test Impact Analysis, set up [Test Optimization for Swift](https://docs.datadoghq.com/tests/setup/swift.md). The **code coverage** option must also be enabled in the test settings of your scheme or test plan, or `--enable-code-coverage` must be added to your Swift test command (if using a SPM target).

If you are reporting data through the Agent, use v6.40 and later or v7.40 and later.

### Activate Test Impact Analysis for the test service{% #activate-test-impact-analysis-for-the-test-service %}

You, or a user in your organization with the **Intelligent Test Runner Activation** (`intelligent_test_runner_activation_write`) permission, must activate Test Impact Analysis on the [Test Service Settings](https://app.datadoghq.com/ci/settings/test-service) page.

## Run tests with Test Impact Analysis enabled{% #run-tests-with-test-impact-analysis-enabled %}

After completing setup, run your tests as you normally do.

## Disabling skipping for specific tests{% #disabling-skipping-for-specific-tests %}

You can override the Test Impact Analysis's behavior and prevent specific tests from being skipped. These tests are referred to as unskippable tests.

### Why make tests unskippable?{% #why-make-tests-unskippable %}

Test Impact Analysis uses code coverage data to determine whether or not tests should be skipped. In some cases, this data may not be sufficient to make this determination.

Examples include:

- Tests that read data from text files
- Tests that interact with APIs outside of the code being tested (such as remote REST APIs)
- Tests that run external processes
- Tests that depend on global shared state (for example, caches created by a different test or process)
- Tests that use forked processes (per test code coverage only collects coverage for the main process)
- Integration tests that use capybara or selenium-webdriver

Designating tests as unskippable ensures that Test Impact Analysis runs them regardless of coverage data.

### Marking tests as unskippable{% #marking-tests-as-unskippable %}

{% tab title="XCTest" %}

```swift
import XCTest
import DatadogSDKTesting

class SomeTestCase: XCTestCase {
  func testMethod() {}
}

extension SomeTestCase: ExtendableTaggedType {
  static func extendableTypeTags() -> ExtendableTypeTags {
    withTagger { tagger in
      // Mark all class unskippable
      tagger.set(type: .tiaSkippable, to: false)
      // Set only one method unskippable
      tagger.set(instance: .tiaSkippable, to: false, method: #selector(testMethod))
    }
  }
}
```

{% /tab %}

{% tab title="Swift Testing" %}

```swift
import Testing
import DatadogSDKTesting

// Mark an entire suite as unskippable
@Suite(.tags(.dd.tia.unskippable))
struct SomeSuite {
  @Test func testMethod() {}
}

// Mark only a specific test as unskippable
@Suite
struct SomeSuite {
  @Test(.tags(.dd.tia.unskippable))
  func testMethod() {}
}
```

{% /tab %}

### Temporarily disabling Test Impact Analysis{% #temporarily-disabling-test-impact-analysis %}

Test Impact Analysis can be disabled locally by setting the `DD_TEST_IMPACT_ANALYSIS_ENABLED` environment variable to `false` or `0`.

{% dl %}

{% dt %}
`DD_TEST_IMPACT_ANALYSIS_ENABLED` (Optional)
{% /dt %}

{% dd %}
Enable the Test Impact Analysis coverage and test skipping features**Default**: `(true)`
{% /dd %}

{% /dl %}

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

- [Explore Test Results and Performance](https://docs.datadoghq.com/tests.md)
- [Troubleshooting Test Optimisation](https://docs.datadoghq.com/tests/troubleshooting.md)
