Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get XCTest to run tests in a particular order?

Tags:

xcode

xctest

I'm just starting to use Apple's new Xcode 5 unit testing framework. I have low-level classes that I would like to test before testing higher level classes that utilize these low-level classes. For instance I have to database control classes that use a special UUID class. It makes no sense to test the DB classes if I have a regression in the UUID system. I would like to run the suite of UUID tests first.

Has anyone found a technique or practice with the XCTest framework to allow this?

like image 409
Bruce1q Avatar asked May 23 '14 22:05

Bruce1q


People also ask

How do I run a specific test in Visual Studio?

Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.

Is XCTest a unit testing framework?

Use the XCTest framework to write unit tests for your Xcode projects that integrate seamlessly with Xcode's testing workflow.


1 Answers

I have tried with success to name the test methods using a numeric scheme, like:

  • -(void)test_1_myFirstTest
  • -(void)test_2_mySecondTest
  • ...
  • -(void)test_n_myNthTest

It seems it works in the desired order, however it is maybe not guaranteed.

Hope this helps.

like image 177
Joe Avatar answered Oct 05 '22 17:10

Joe