Hi,
Together with my colleague @mmysliwiec , we created Swift Macro useful in unit testing.
With this macro you can get rid of boilerplate code by writing a single test method and parametrizing it with input and output arguments.
We think that with this approach tests are easier to read and maintain.
now with latest version 0.1.0
@Parametrize(
input: [APIEndpoint.profile,
APIEndpoint.transactions,
APIEndpoint.order("2345")],
output: ["https://example.com/api/me",
"https://example.com/api/transactions",
"https://example.com/api/order/2345"],
labels: ["profile",
"transactions",
"order"])
func testEndpointURL(input endpoint: APIEndpoint, output expectedUrl: String) throws {
XCTAssertEqual(endpoint.buildURL?.absoluteString, expectedUrl)
}
Hope you give it a try!
If you like it please leave a star.
Ofc if you have any feedback/suggestion create an github issue.