The procedure for controlling unit test methods in OCUnit

I am using OCUnit for unit testing in a project. I managed to complete all the setup required for OCUnit in Xcode 4.2 and successfully create my test cases.

How can I control the order (priority) for a test case? I see that the test cases are built in alphabetical order of their name, that is, if I have the test method testA, testB, testC , they will be executed in the same order.

I need the "testC" in the above example to run before "testB", since my method has some settings for the variables and preferences for "testB", as well as entering the main data included in "testC" ,.

+4
source share
1 answer

Either you make your test cases stand-alone so that they can run independently without preconditions, or you name your test methods accordingly, as you mentioned.

 test0First, test1Second 

I would recommend making them self-sufficient. This is a little overhead, but you can implement reusable methods in your test case (that don't start with test ) to make your life easier.

If you need a frame with many features, check out GHUnit

+4
source

Source: https://habr.com/ru/post/1401535/


All Articles