objective c - Faking http connection in unit tests that use RestKit -
i want run unit tests, use restkit load objects (into coredata). don't want unit tests (or restkit) connect server, since server might not reachable.
how tell restkit use fixture (predefined json file) response, instead of connecting remote server? know rkfixture , unit testing restkit doesn't cover problem.
the last answer given in this thread may useful specific problem. way, have looked ghunit? unit testing framework allows asynchronous unit tests. typically server failure should tested anyway.
if unit test designed test mapping feature have alternative also:
//create object mapper rkobjectmapper* mapper = [rkobjectmapper mapperwithobject: obj mappingprovider:mappingprovider]; mapper.context = rkobjectmappingprovidercontextobjectsbykeypath; //perform mapping rkobjectmappingresult* mappingresult = [mapper performmapping]; nsarray *results = [mappingresult ascollection]
this happens inside rkobjectloader. here obj parsed json object (nsdictionary or nsarray) may create using test data.
Comments
Post a Comment