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

# TestTrait

A protocol describing a trait that you can add to a test function.

```
protocol TestTrait : Trait
```

## Overview

The testing library defines a number of traits that you can add to test
functions. You can also define your own traits by creating types
that conform to this protocol, or to the [`SuiteTrait`](/documentation/Testing/SuiteTrait) protocol.

---

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)