While we now have async versions of the per-test setUp() and tearDown() functions, we don't yet have an async version of the class-wide tearDown(). Adding this would allow tests that are able to ensure that any artifacts left behind by the main testing are cleaned up before the test suite ends:
override class func tearDown() async {
super.tearDown()
do {
await someCleanupFunction()
} catch {
/* do error handling */
}
}
I've tried using a Task() and a semaphore in the class tearDown(), but the task gets terminated early when the main test program exits.
While we now have async versions of the per-test
setUp()
andtearDown()
functions, we don't yet have an async version of the class-widetearDown()
. Adding this would allow tests that are able to ensure that any artifacts left behind by the main testing are cleaned up before the test suite ends:I've tried using a
Task()
and a semaphore in the classtearDown()
, but the task gets terminated early when the main test program exits.