samedi 5 décembre 2015

How to write simple unit tests to test the parsing of a JSON?

[NSURLConnection sendAsynchronousRequest:[[NSURLRequest alloc] initWithURL:url] queue:[[NSOperationQueue alloc] init] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {

    if (error) {
        NSLog(@"Error");
    } else {
        NSError *e = nil;
        NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData: data options: NSJSONReadingMutableContainers error: &e];

        if (!jsonDict) {
            NSLog(@"Error parsing JSON: %@", e);
        } else {


        }
    }
}];

Hi There,

I am trying to write a simple unit test to check if the parsing of the json was successful?

I have no experience with unit testing.

thanks

Aucun commentaire:

Enregistrer un commentaire