<!--
{
  "availability" : [
    "Xcode: 16.0.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/Trait/disabled(_:sourceLocation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift Testing",
      "Testing"
    ],
    "preciseIdentifier" : "s:7Testing5TraitPA2A09ConditionB0VRszrlE8disabled_14sourceLocationAeA7CommentVSg_AA06SourceF0VtFZ"
  },
  "title" : "disabled(_:sourceLocation:)"
}
-->

# disabled(_:sourceLocation:)

Constructs a condition trait that disables a test unconditionally.

```
static func disabled(_ comment: Comment? = nil, sourceLocation: SourceLocation = #_sourceLocation) -> Self
```

## Parameters

`comment`

An optional comment that describes this trait.

`sourceLocation`

The source location of the trait.

## Return Value

An instance of [`ConditionTrait`](/documentation/Testing/ConditionTrait) that always disables the
test to which it is added.

---

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)