0

I am using KIF to test our iOS app. I am trying to make some tests that will go before and after my whole test sweet. I made a SenTestSuite category and overrode -setUp and -tearDown:

 -(void)setUp
 {
     [tester loginCurrentVersion];
     NSLog(@"setup");
 }

 -(void)tearDown
 {
     [tester logoutFromAnywhereIfNeeded];

     NSLog(@"teardown");
 }

These methods do get called, but my problem is that they both get called twice. I can't access any of the SenTestSuite.m methods. I am unsure why they are getting called twice. Why is it doing this and how can I solve this?

Thanks!!

SirRupertIII
  • 12,324
  • 20
  • 72
  • 121

2 Answers2

2

Using a category to override a class's methods is really, really iffy. Instead, subclass SenTestCase and put your -setUp and -tearDown there. Then have your test classes inherit from it.

Jon Reid
  • 20,545
  • 2
  • 64
  • 95
0

Since you are using KIF, your setUp and tearDown methods should be the beforeAll and afterAll. I also suggest you to take a look at the sample application and try to understand those tests.

kuglisb
  • 131
  • 2
  • 5