Since NSInvocation is unavailable in Swift, it is impossible to override +[XCTestCase testInvocations] in a Swift test

Originator:B.Gesiak
Number:rdar://17193218 Date Originated:06-Jun-2014 03:16 PM
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:
 
Summary:
XCTestCase allows subclasses to override +[XCTestCase testInvocations] to return an array of NSInvocations for each test to be run. Since NSInvocation is unavailable in Swift, I cannot create a test case subclass in Swift that only executes a subset of its test methods.

Steps to Reproduce:
1. Create a subclass of XCTestCase in Swift, overriding +[XCTestCase testInvocations]:

class SwiftTestCase: XCTestCase {
    override class func testInvocations() -> AnyObject[]! {
        var invocations: AnyObject[] = []
        // ...
        return invocations
    }
}

2. Attempt to create an NSInvocation:

override class func testInvocations() -> AnyObject[]! {
    var invocations: AnyObject[] = []
    var invocation: NSInvocation
    return invocations
}

Expected Results:
I am able to declare a variable of type NSInvocation. I am able to instantiate that variable with an instance of NSInvocation.

Actual Results:
Xcode displays build error: "'NSInvocation' is unavailable".

Version:
Xcode Version 6.0 (6A215l) & OS X 10.9.3 (13D65)

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!