mercredi 28 janvier 2015

Mock CLLocationManager (swift) for Testing

Question 1


Before I actually start writing something myself are there existing frameworks (either obj-c or swift) that wrap CLLocationManager into a mocking framework?


Question 2


What is the best way to go about making a mock Location Manager?




  • Create a class that wraps around CLLocationManager, any calls into that class will return test data or actual CLLocation data depending on what "mode" we are running in




  • Extend CLLocationManager and override all the calls I want to "muck" with




  • Is there a 3rd option I haven't thought of?




Mostly I'm wondering what the pro/con of each approach would be here assuming there isn't anything already available


[edit]


Although there is a simulate location feature in XCode it does not give me exactly what I need. If I remember correctly it does not do headings, they have to be interpolated. Furthermore I may ultimately modify this class to drive CLLocationManager from a flight simulator


Aucun commentaire:

Enregistrer un commentaire