How do I apply the same test suite to two different target objects?

I have written a mock implementation (MockFoo) of a slow/expensive dependency (ProdFoo), that will see heavy use in the tests of several dependent components.

Unfortunately, MockFoo isn't trivial, so I wrote some unit tests for it. However, I wrote those unit tests from my (potentially wrong) understanding of ProdFoo behavior, so I have no certainty that these tests are an accurate reflection of ProdFoo. So naturally, I would like to test my ProdFoo with the same test suite, to ensure that MockFoo accurately mocks ProdFoo.

How can I do that in Swift? Is this approach even a good idea?

I recommend some variation on this:

Terms of Service

Privacy Policy

Cookie Policy