How to write expected failures?

In Xcode, at the end of my unit tests, I get this result:

Test Suite "All Tests" completed on 2012-12-06 10:23:38 +0000

195 tests performed with 0 errors ( 0 unexpected ) in 4.314 (4.485) seconds

I would like to know how I can identify tests with expected failures.

Usually with other testing platforms, I like to simply identify incomplete unit tests as reminders of future work to be done. These tests should only be recorded as warnings, but at the same time get the final result "Success", if everything else is in order

Looking at the output of Xcode, I assume that there is a way to achieve the same. However, I am having trouble finding the right macro to mark incomplete / TODO tests. Also, it seems strange to me that normal failures are reported as:

95 tests completed with 1 failure (0 unexpected) in 2,314 (2,334) seconds

Therefore, any denial of approval of the test seems to be expected. In this case, I am even confused with the value of (0 unexpected) failures.

Can someone explain the meaning of this part of the results of the journal ?, how can it be used? How can I mark incomplete tests?

+8
unit-testing xcode cocoa testing ocunit
source share
2 answers

An “unexpected failure” is a thrown and unhandled exception. Unlike a possible expected failure, which is verified by approval.

OCUnit does not provide a way to mark tests as "do not run." Either comment on them (which does not allow compromising the risk test), or change the name of the method so that it does not have a "test" prefix. For example, rename testSomething to XXXtestSomething. (This leaves the risk that you forget to change it.)

+7
source share

One solution to my problem is to use a warning preprocessor macro to mark the unit tests that need to be completed. Thus, after compiling unit tests, I get a good overview of the future work that needs to be done. This is displayed in the warning panel, so it is much more attractive than just TODO comments.

However, I would prefer to have the total number of incomplete tests and find out always the value “0 of an unexpected” amount of my log reports.

+1
source share

All Articles