<!--
{
  "availability" : [
    "Swift: 6.2.0 -",
    "Xcode: 26.0.0 -",
    "macOS: -",
    "swift: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/ExitTest/Result/standardErrorContent",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Swift Testing"
    ],
    "preciseIdentifier" : "s:7Testing8ExitTestV6ResultV20standardErrorContentSays5UInt8VGvp"
  },
  "title" : "standardErrorContent"
}
-->

# standardErrorContent

All bytes written to the standard error stream of the exit test before
it exited.

```
var standardErrorContent: [UInt8]
```

## Discussion

The value of this property may contain any arbitrary sequence of bytes,
including sequences that are not valid UTF-8 and cannot be decoded by
[`String.init(cString:)`](https://developer.apple.com/documentation/swift/string/init(cstring:)-6kr8s).
Consider using [`String.init(validating:as:)`](https://developer.apple.com/documentation/swift/string/init(validating:as:)-84qr9)
instead.

When checking the value of this property, keep in mind that the standard
output stream is globally accessible, and any code running in an exit
test may write to it including the operating system and any third-party
dependencies you have declared in your package. Rather than comparing
the value of this property with [`==`](https://developer.apple.com/documentation/swift/array/==(_:_:)),
use [`contains(_:)`](https://developer.apple.com/documentation/swift/collection/contains(_:))
to check if expected output is present.

To enable gathering output from the standard error stream during an exit
test, pass `\.standardErrorContent` in the `observedValues` argument of
[`expect(processExitsWith:observing:_:sourceLocation:performing:)`](/documentation/Testing/expect(processExitsWith:observing:_:sourceLocation:performing:)) or
[`require(processExitsWith:observing:_:sourceLocation:performing:)`](/documentation/Testing/require(processExitsWith:observing:_:sourceLocation:performing:)).

If you did not request standard error content when running an exit test,
the value of this property is the empty array.

---

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)