jeudi 2 juillet 2015

Working with Parse and unit test

I'm learning unit testing and it's all very new to for me. I wonder if there are any Parse developers who can show example on how to properly unit test PFObject and PFUser for example.

As I said I'm really new to unit testing and this is what I have done:

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.

    // Test object
    self.testObject = [PFObject objectWithClassName:@"TestObject"];
    self.testObject[@"testString"] = @"test string";
    self.testObject[@"testNumber"] = @12;
    self.testObject[@"testBool"] = [NSNumber numberWithBool:YES];
    self.testObject[@"testDate"] = [NSDate date];
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    [super tearDown];
}

- (void)testSaveUser {
    [self.testObject saveInBackground];
}

Maybe I'm approaching this the wrong way, the test passes but it's not saving anything to my Parse app online.

I've done some basic unit testing tutorials (some calculations and expectations), but now I would like to learn on how to unit test with external web services, in this case Parse. I can't seem to find any info on this in the Parse documentation or when Googling. So all help is appreciated.

Aucun commentaire:

Enregistrer un commentaire