<!--
{
  "availability" : [
    "Xcode: 27.0.0 -",
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Evaluations",
  "identifier" : "/documentation/Evaluations/EvaluationTrait/provideScope(for:testCase:performing:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Evaluations"
    ],
    "preciseIdentifier" : "s:11Evaluations15EvaluationTraitV12provideScope3for8testCase10performingy7Testing4TestV_AJ0H0VSgyyYaYbKXEtYaKF"
  },
  "title" : "provideScope(for:testCase:performing:)"
}
-->

# provideScope(for:testCase:performing:)

Runs the evaluation and makes its result available to the test body through an evaluation context.

```
nonisolated(nonsending) func provideScope(for test: Test, testCase: Test.Case?, performing function: @Sendable () async throws -> Void) async throws
```

## Parameters

`test`

The test to which this trait is attached.

`testCase`

The specific test case being run, or `nil` when running the whole test.

`function`

The test body closure to invoke after the evaluation completes.

## Discussion

The Swift Testing framework calls this method automatically when you attach the trait to
a test. The evaluation runs first, the framework stores its result in [`EvaluationContext`](/documentation/Evaluations/EvaluationContext), and then
the test body executes inside that context.

---

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)