<!--
{
  "availability" : [
    "Xcode: 16.0.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/ConditionTrait",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift Testing"
    ],
    "preciseIdentifier" : "s:7Testing14ConditionTraitV"
  },
  "title" : "ConditionTrait"
}
-->

# ConditionTrait

A type that defines a condition which must be satisfied for the testing
library to enable a test.

```
struct ConditionTrait
```

## Overview

To add this trait to a test, use one of the following functions:

- [`enabled(if:_:sourceLocation:)`](/documentation/Testing/Trait/enabled(if:_:sourceLocation:))
- [`enabled(_:sourceLocation:_:)`](/documentation/Testing/Trait/enabled(_:sourceLocation:_:))
- [`disabled(_:sourceLocation:)`](/documentation/Testing/Trait/disabled(_:sourceLocation:))
- [`disabled(if:_:sourceLocation:)`](/documentation/Testing/Trait/disabled(if:_:sourceLocation:))
- [`disabled(_:sourceLocation:_:)`](/documentation/Testing/Trait/disabled(_:sourceLocation:_:))

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)