Xcode iOS testsuite NSLog is missing

I am developing an iOS application using Xcode 6 and trying to run a test suite in Xcode. I can run the test, but I don’t see where my NSLog statements are displayed. They are not in the output panel.

How to find a way out?

 @interface ISTest : XCTestCase @end @implement ISTest - (void) setUp { [super setUp]; } - (void) tearDown { [super tearDown]; } - (void) testExample { NSLog(@"Where does this go???"); } - (void) testPerformanceExample { [self measureBlock^{ }]; } @end 
+7
source share
3 answers

Check the console in the debug area (bottom view) in Xcode. To open this view, click the square button with a blue rectangle at the bottom right of Xcode.

Edit: why downvote? Log statements are displayed in the debug area for me.

Test:

 - (void)testLoginViewControllerViewExists { NSLog(@"Testing Login View Controller"); UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Login" bundle:nil]; CSLoginViewController *loginVC = [storyboard instantiateViewControllerWithIdentifier: @"loginVC"]; XCTAssertNotNil([loginVC view], @"loginVC should contain a view"); } 

Conclusion:

 Test Case '-[AppTests testLoginViewControllerViewExists]' started. 2014-11-06 15:52:00.175 App[14870:2071450] Testing Login View Controller Test Case '-[AppTests testLoginViewControllerViewExists]' passed (0.001 seconds). 
+8
source

Log output in the test does not go to the console.

If you want to see your logs, they are in the output of the assembly.

+5
source

If you want your messages or lines in tests printed on the output console, use printf and not NSLog

Example: printf("%s", [yourNSString UTF8String]);

0
source

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


All Articles