An experimentation with having the methods of a spy class described as enums and stored in an array for comparison in the test.
I really like this approach because, with multicursors, it's very easy to copy the funcs and turn them into enum cases. One only has to go to each method and the line to append the enum to the call list. Then, in the tests, you can check if all the calls where made with the expected arguments. And there's no giant list of variables in the spy and all arguments are stored and compared. For the tests I was working on this is pretty cool because some methods do several calls, some of them to the same method but with different arguments and this allows full validation.
The only issue I have with this approach is that when the test fails, the error contains the full path of the enum case and it's quite long. If could get it to just output the enum case name and the associated values (without manually creating it), this would be golden.
Sample output of an error, that I separated in lines but in Xcode is all one line:
XCTAssertEqual failed: ("[
CEFSomethingCore.FakeSomethingGateway.Methods.uploadSomething(data: CEFSpotifyDoubles.Something(id: nil, data: "qwerty")),
CEFSomethingCore.FakeSomethingGateway.Methods.fetchSomething(id: "2", offset: 123)
]")
is not equal to ("[
CEFSomethingCore.FakeSomethingGateway.Methods.uploadSomething(data: CEFSomethingCore.Something(id: Optional("2"), data: "qwerty")),
CEFSomethingCore.FakeSomethingGateway.Methods.fetchSomething(id: "2", offset: 123)
]")
I'm comparing the full array but one could do an assert per call, or even check if a call exists in the array without verifying order.