3

Unit tests always show 'succeed' desktop notification when run on device in XCode 6 beta 6 in Swift.

How to recreate:

  • Create new iOS single-view app project with Swift.
  • Go to the existing test and change it to XCTAssert(false) to make it fail.
  • Run the tests on the device - it shows "Test Succeeded" desktop notification.
  • Run the test on the emulator - it shows "Test Failed" notification as it should.

Update

  • There are test error messages in the output window when testing on device. But the desktop notification says "Test Succeeded".
  • When I test on device and set a breakpoint in the test method - it does stop there.
Evgenii
  • 36,389
  • 27
  • 134
  • 170
  • 1
    Set a breakpoint on all exceptions and run it again. Static asserts don't just get optimized away (unless they've been turned off somehow). – CodaFi Aug 20 '14 at 05:03
  • Same problem. I get a sucess notification no matter how I run my tests, but looking at my console logs I clearly see that some tests fail. There aren't any success or failure icons in the tests tab of my project either. – isair Sep 03 '14 at 01:41

2 Answers2

1

Run the test on the emulator - it shows "Test Failed" notification as it should.

Copied from the Question, in case someone doesn't realize there is a way to get them to work (although not on device).

Ali Saeed
  • 1,519
  • 1
  • 16
  • 23
0

(may be helps to someone who will face same issue later)

I made my custom XCTestCase class and test methods in it as Private, following which Xcode wasn't running that test cases and class and was showing "all tests succeeded" output.

Removing Private solved problem.

Komol
  • 1