Who as monirul in swift, and how to test services?

Writing tests for services, except that the tests themselves are bulky due to the fact that the service uses 5-6 sites ( networking, urlProvider, networkingMapper, objectMapper, responseStatusHandler), so also it is necessary to write Moki for each of these objects(I need to materbate and classes and structures). Does anyone know is there any framework, similar to mockito, which is not necessary to write Moki himself. All I got is the fact that swift supports read-only reflection, which does not allow to change object behavior at runtime, and therefore, such libo impossible to write.
June 26th 19 at 14:25
1 answer
June 26th 19 at 14:27
In runtime to create a mock of the impossible in swift unfortunately :( moreover, the behavior of the structure cannot be. Therefore, we use 2 things:

1. Dependencies everywhere via specified protocols
2. Moki can not slip in runtime, but can be generated at build time using Sourcery. This Tula helps to generate code automatically for templates.
show an example of generating mocks through sorcery? - Ramona_Bednar64 commented on June 26th 19 at 14:30
The decision is not bad for small projects. We have used viper, and the number of classes, structures and protocols is very large. I think to increase their not a good idea. - perry77 commented on June 26th 19 at 14:33
: So Moki because in the Test target are, therefore, the project is not contaminated - yadira_Halvorson63 commented on June 26th 19 at 14:36
do empty extension on your protocols, all enclosed in anatatsii from sorcery, in the end, your Moki only in the test target. Here is more information: https://github.com/krzysztofzablocki/Sourcery/issu... - Ramona_Bednar64 commented on June 26th 19 at 14:39
Tried, Yes, generates Moki. Marked as the solution. But still the approach smacks of crutches. In this extremely dull libs documentation. - perry77 commented on June 26th 19 at 14:42

Find more questions by tags Mobile developmentSwiftModular testing