0

I have started writing Unit Test cases for my existing application for testing functional flow. I am using OCUnit (SentestingKit.framework). App is client-server based app.

There are five tabs in my app after login screen. My problem is I want to write 6 test classes for each screen. Whereas every tab need to pass login criteria which sets some parameters in while login which needed while requesting any feature in each tab.

So, is there any way to add dependency in these classes so that every time Login test class get executed first & then respective screens will execute their test cases.

One strange thing I observed is that, it runs unit test classes (not test cases) in alphabetical order.

Note:- This approach is my understanding about Unit test which I learned in last two days via different forums. If any other approach worth, then please correct me.

Ameer
  • 705
  • 8
  • 18

1 Answers1

0

I believe this will work but not tested it. Provide a class method called shouldTest in your first test class. If the first test succeeds aand the login works, set a static Boolean to YES or NO. When the next test class runs (and subsequent classes), each test case should poll the first classes shouldTest method, and if no just return immediately.

You can obvious expand on this. If this does not work I have some other ideas so post a comment one way or the other please.

David H
  • 40,852
  • 12
  • 92
  • 138
  • can you please post the other idea :) – Ankit Sachan Apr 01 '14 at 06:17
  • @AnkitSachan That post is a year old. In any case the idea is to use class methods and global data. Now that octest has been replaced by xctest, everything has probably changed. Look, add an initialize method to the class and logs there, also init or the designated inializer, and see what's happening. – David H Apr 01 '14 at 11:20