Hi Jonathan,
Having an option to cancel all test cases when one fails at once sounds like a smart addition. Especially if tests are expensive to run.
For the cancel a single test case case, is there a difference between Test.Case.cancel
and Issue.record
(and return
-ing early)?
For instance, is there a difference in behaviour between the code example:
@Test(arguments: Species.all(in: .dinosauria))
func `Are all dinosaurs extinct?`(_ species: Species) throws {
if species.in(.aves) {
try Test.Case.cancel("\(species) is birds!")
}
// ...
}
and what is suggested in Migrating a test from XCTest | Apple Developer Documentation :
@Test(arguments: Species.all(in: .dinosauria))
func `Are all dinosaurs extinct?`(_ species: Species) throws {
if species.in(.aves) {
Issue.record("\(species) is birds!")
return
}
// ...
}
I.e. is this an api improvement (not having to worry about early return is a win in itself) and/or is there an actual behavioural difference?