XCTest test fails when test case “failed” when I NSLog from test case

I just started working with XCTest in Xcode 5 ((Xcode Version 5.0.2 [5A3005]). I made a sample test file where I check that true is true. It works and the test passes as expected. A NSLogbefore approval, the test completed failed with the message "test_case did not finish", where "test_case" is my test method name (testTrue in my case).

Here test1.min an unsuccessful case. The only difference between failure and operation is that in the event of failure it matters NSLogin the testing method. (It also fails when I try NSLogin the setUp and / or tearDown methods.)

#import <XCTest/XCTest.h>

@interface test1 : XCTestCase

@end

@implementation test1

- (void)setUp
{
    [super setUp];
    // Put setup code here; it will be run once, before the first test case.
}

- (void)tearDown
{
    // Put teardown code here; it will be run once, after the last test case.
    [super tearDown];
}

- (void)testTrue
{
    // if I comment out following NSLog the test works
    NSLog(@"test1: testTrue");
    XCTAssertTrue(true, @"true is not true");
}

@end

Log Navigator :

Test Suite 'All tests' started at 2014-02-07 21:31:42 +0000
Test Suite 'xct-test1Tests.xctest' started at 2014-02-07 21:31:42 +0000
Test Suite 'test1' started at 2014-02-07 21:31:42 +0000
Test Case '-[test1 testTrue]' started.
testTrue did not finish

, ( NSLog):

Test Suite 'All tests' started at 2014-02-07 21:38:59 +0000
Test Suite 'xct-test1Tests.xctest' started at 2014-02-07 21:38:59 +0000
Test Suite 'test1' started at 2014-02-07 21:38:59 +0000
Test Case '-[test1 testTrue]' started.
Test Case '-[test1 testTrue]' passed (0.000 seconds).
Test Suite 'test1' finished at 2014-02-07 21:38:59 +0000.
Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'xct-test1Tests.xctest' finished at 2014-02-07 21:38:59 +0000.
Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.000) seconds
Test Suite 'All tests' finished at 2014-02-07 21:38:59 +0000.
Executed 1 test, with 0 failures (0 unexpected) in 0.000 (0.001) seconds

, , NSLog ? ...

+3

All Articles