Swift Parameterized Testing
Swift Testing calls the test function once for each value in the arguments collection. […] If you pass a second argument, Swift Testing generates test cases for all combinations of the two arguments. […] You’re limited to at most two arguments. If you don’t need every combination you can zip the arguments to pair them.
Why use a parameterized test instead of just writing a for
loop?
Each call of the test function with a different argument is an independent test case than can run in parallel. It’s much clearer when a test case fails. You can also rerun just the failing argument from the test navigator by clicking on the red failure icon[…]
Previously: