Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 4 Unit test: Is it possible to ignore certain test cases?

Is there a way of ignoring a specific test case without commenting it out?

Some tests are written before the implementation exists, so before commiting any code I'd like to first flag these tests to be ignored so it doesn't appal any of my colleagues.

Commenting them out results in loosing track of failing, incomplete tests.

like image 912
Schoob Avatar asked Oct 24 '12 10:10

Schoob


People also ask

How do I skip a test in Xcode?

Adding a different prefix like “skip_” helps you have a visual aid and understand from a method name that this test method will be skipped and you can also quickly search Xcode for all test methods with the prefix “skip_” to enable them back when ready.

Should unit test cover all cases?

It isn't realistic -- or necessary -- to expect 100% code coverage through unit tests. The unit tests you create depend on business needs and the application or applications' complexity. Aim for 95% or higher coverage with unit tests for new application code.

How do you skip test cases in Jasmine?

Excluding Tests / Specs If you want to exclude a specific test, simply use xit() instead of it() . The x means exclude. describe('description', function () { xit('description', function () {}); }); If you want to exclude an entire describe block, use xdescribe() instead of describe() .

How do you run a skipped test?

To skip running the tests for a particular project, set the skipTests property to true. You can also skip the tests via the command line by executing the following command: mvn install -DskipTests.


2 Answers

You can right click on the test in the left panel and select "Disable ".

like image 99
TheObviousRobot Avatar answered Nov 07 '22 23:11

TheObviousRobot


There's no built-in way to annotate tests in OCUnit (SenTestingKit).

One approach is to change the name of the test method. I add 'XXX' to the beginning of a test I want to disable but want it to keep compiling. For example,

- (void)XXXtestSomething

Then I can search for 'XXXtest' to find all disabled test methods.

like image 25
Jon Reid Avatar answered Nov 07 '22 23:11

Jon Reid