Xcode runs all tests from a single file twice

Originator:arkadiusz.holko
Number:rdar://35613635 Date Originated:17-Nov-2017 02:53 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Version 9.1 (9B55)
Classification:Serious Bug Reproducible:Always
 
Summary:
There’s an option in Xcode that runs tests depending on the current cursor position. I don’t think it has a name, it’s in Product -> Perform Action -> 4th item from the top. It has a shortcut too: Control-Option-Command-U.

It has the following options:
- when a cursor is inside a test method: it runs only that single test method
- when a cursor is inside an XCTestCase subclass but outside any method: it runs all tests from that subclass
- when a cursor is in a file containing XCTestCase subclass(es): it runs all tests in that file

The problem is with the last option. All tests are ran, but they are ran twice.

Steps to Reproduce:
1. Open a file containing XCTestCase subclass.
2. Put a cursor outside of the class.
3. Click Control-Option-Command-U.

Expected Results:
All tests in the file are ran, each tests once.

Actual Results:
All tests in the file are ran, but twice. Example:

Test Case '-[Example.Example testStripsWhitespaceAtBeginningAndEnd]' started.
Test Case '-[Example.Example testStripsWhitespaceAtBeginningAndEnd]' passed (0.001 seconds).
Test Case '-[Example.Example testStripsWhitespaceAtBeginningAndEnd]' started.
Test Case '-[Example.Example testStripsWhitespaceAtBeginningAndEnd]' passed (0.001 seconds).

etc.


Version:
Version 9.1 (9B55)

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!