# ST-0012: Capturing Values in Exit Tests

**URL:** <https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963>\
**Category:** Proposal Reviews\
**Tags:** swift-testing\
**Created:** [July 7, 2025, 3:44pm UTC](https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963 "2025-07-07T15:44:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![plemarquand](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/plemarquand/32/32097_2.png) [@plemarquand](https://forums.swift.org/u/plemarquand)\
**Post date:** [July 7, 2025, 3:44pm UTC](https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963/1 "2025-07-07T15:44:38Z")

</div>

Hello Swift community,

The review of [ST-0012 "Capturing Values in Exit Tests"](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0012-exit-test-value-capturing.md) begins now and runs through **Monday July 21, 2025**. The proposal is available here:

> [swift-evolution/proposals/testing/0012-exit-test-value-capturing.md at main · swiftlang/swift-evolution · GitHub](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0012-exit-test-value-capturing.md)

Reviews are an important part of the Swift evolution process. All review feedback should be either on this forum thread or, if you would like to keep your feedback private, directly to the review manager. When emailing the review manager directly, please keep the proposal link at the top of the message.

##### Trying it out

To try this feature out, add a dependency to the `main` branch of `swift-testing` to your project and enable the `ExperimentalExitTestValueCapture` package trait\[1\]:

```swift
...
dependencies: [
  ...
  .package(
    url: "https://github.com/swiftlang/swift-testing.git",
    branch: "main",
    traits: [.defaults, "ExperimentalExitTestValueCapture"]
  ),
]

```

Then, add a target dependency to your test target:

```swift
.testTarget(
  ...
  dependencies: [
    ...
    .product(name: "Testing", package: "swift-testing"),
  ]

```

Finally, import Swift Testing using `@_spi(Experimental) import Testing`.

##### What goes into a review?

The goal of the review process is to improve the proposal under review  
through constructive criticism and, eventually, determine the direction of  
Swift. When writing your review, here are some questions you might want to  
answer in your review:

- What is your evaluation of the proposal?
- Is the problem being addressed significant enough to warrant a change to Swift?
- Does this proposal fit well with the feel and direction of Swift?
- If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
- How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

More information about the Swift evolution process is available at

> [swift-evolution/process.md at main · swiftlang/swift-evolution · GitHub](https://github.com/swiftlang/swift-evolution/blob/main/process.md)

Thank you for contributing to Swift!

Paul LeMarquand

Review Manager

* * *

1. Package traits require a package tools version of 6.2 or newer. You specify the package tools version with a comment at the top of Package.swift of the form `// swift-tools-version: 6.2`.

---

<div class="post-metadata">

**Author:** ![suzannaratcliff](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/suzannaratcliff/32/31770_2.png) [@suzannaratcliff](https://forums.swift.org/u/suzannaratcliff)\
**Post date:** [July 14, 2025, 7:26pm UTC](https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963/2 "2025-07-14T19:26:22Z")

</div>

I am excited for this!

---

<div class="post-metadata">

**Author:** ![maartene](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/maartene/32/42076_2.png) [@maartene](https://forums.swift.org/u/maartene)\
**Post date:** [July 14, 2025, 8:16pm UTC](https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963/3 "2025-07-14T20:16:45Z")

</div>

Full disclosure: didn't read this in all details, but I read through all the feedback so far. 😇

Anyway, sounds like a clear win to me. +1

---

<div class="post-metadata">

**Author:** ![younata](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/younata/32/34709_2.png) [@younata](https://forums.swift.org/u/younata)\
**Post date:** [July 14, 2025, 8:18pm UTC](https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963/4 "2025-07-14T20:18:48Z")

</div>

This is an obvious win, as well as obvious next step, so... yes! I'm looking forward to it!

I'm somewhat bummed about the limitations for Sendable & Codable, but given the limitations (sure you can get a copy of the memory in fork/posix\_spawn, but that's not the mechanism that every platform will or even can use) it makes sense to serialize these values.

---

<div class="post-metadata">

**Author:** ![smontgomery](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/smontgomery/32/965_2.png) [@smontgomery](https://forums.swift.org/u/smontgomery)\
**Post date:** [July 15, 2025, 4:33pm UTC](https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963/5 "2025-07-15T16:33:20Z")

</div>

+1, I agree that this feature will be incredibly useful. I appreciate the acknowledgment of the less-than-ideal need to explicitly specify the type of a captured value. However, I also appreciate the clever techniques that allow skipping this step whenever possible, such as for arguments to the test function.

I would like to emphasize that it would be extremely beneficial to have something analogous to `decltype` or `typeof`, as was mentioned in the Future Directions, since it would simplify this aspect. This would be a general enhancement to the language, but it would particularly benefit macros.

---

<div class="post-metadata">

**Author:** ![plemarquand](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/plemarquand/32/32097_2.png) [@plemarquand](https://forums.swift.org/u/plemarquand)\
**Post date:** [July 22, 2025, 5:53pm UTC](https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963/6 "2025-07-22T17:53:07Z")

</div>

ST-0012 has been [accepted](https://forums.swift.org/t/accepted-st-0012-capturing-values-in-exit-tests/81250). Thanks for participating!

Paul LeMarquand  
Review Manager

---

<div class="post-metadata">

**Author:** ![John\_McCall](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/john_mccall/32/1351_2.png) [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Post date:** [July 30, 2025, 4:25am UTC](https://forums.swift.org/t/st-0012-capturing-values-in-exit-tests/80963/7 "2025-07-30T04:25:59Z")

</div>

Closed on July 30, 2025, 4:25am UTC


