<!--
{
  "availability" : [
    "Swift: 6.1.0 -",
    "Xcode: 16.3.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/Trait/scopeProvider(for:testCase:)-inmj",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift Testing",
      "Testing"
    ],
    "preciseIdentifier" : "s:7Testing10SuiteTraitPA2A11TestScopingRzrlE13scopeProvider3for8testCasexSgAA0D0V_AJ0J0VSgtF"
  },
  "title" : "scopeProvider(for:testCase:)"
}
-->

# scopeProvider(for:testCase:)

Get this trait’s scope provider for the specified test and optional test
case.

```
func scopeProvider(for test: Test, testCase: Test.Case?) -> Self?
```

## Parameters

`test`

The test for which the testing library requests a scope
provider.

`testCase`

The test case for which the testing library requests a scope
provider, if any. When `test` represents a suite, the value of this
argument is `nil`.

## Discussion

The testing library uses this implementation of
`Trait/scopeProvider(for:testCase:)-cjmg` when the trait type conforms
to both `SuiteTrait` and `TestScoping`.

---

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)