I have a project that imports a Git submodule to run a part of an XCTest test suite. If the submodule is not available (not checked out), I want the test suite to succeed, but issue a warning that not all tests were run. Is that possible?
Searching for similar issue I have found out that we could add messages to test logs as string attachments. If you want to have a warning sign you can add ⚠️ emoji in name. Here is a function example that adds it.
func addLogMessage(_ message: String, attachmentLifetime: XCTAttachment.Lifetime = .keepAlways) {
XCTContext.runActivity(named: "Log message") { activity in
let messageAttachment = XCTAttachment(string: message)
messageAttachment.lifetime = attachmentLifetime
activity.add(messageAttachment)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With