Attachments are a popular feature of Swift Testing (and XCTest on Apple's platforms). When a test saves an attachment, it should be recoverable later by whatever tool(s) is used to analyze the test run. This is easy enough in Xcode or when using the Swift VS Code plugin, but we're starting to add support for Embedded Swift, where there might not even be a file system where attachments can be saved in the first place.
Swift Testing in Embedded Swift will rely on the JSON event stream to feed information to a host system (not the embedded target). The host system ought to be able to recover saved attachments. As of today, the JSON event stream has a very minimal representation of attachments that is not sufficient for Embedded Swift's needs. I propose we augment this area of the JSON event stream schema to support saving attachments!
Given the general use of attachments might be screenshots, and devices like tablets might have screens of a resolution such that a screenshot might be several MB, are you not concerned about including several MB (*4/3) of base64 text per attachment in the JSON? That seems like it could get out of hand very quickly.
When you run tests via swift test, you don't get this JSON output unless you specifically request it. Tools such as VS Code that are able to consume the JSON event stream and have file system access will be able to specify SWIFT_TESTING_EVENT_STREAM_ATTACHMENT_BYTES_FIELD_ENABLED=0 to turn off the extra data. (It's possible the default for this setting should be 0, and I'm more than happy to entertain the idea, but I had to pick one default or another for the pitch, ya know?)
If the JSON is being streamed to a consumer that does not have file system access, or (in the case of Embedded Swift) there is no file system, then there is no way to get the bytes from an attachment except to send them over-the-wire to the consumer. It could be a different wire (i.e. communications mechanism/channel) entirely in some implementations, but not the lowest-common-denominator implementation.