Final Test Case

Test cases should be final

  • Identifier: final_test_case
  • Enabled by default: No
  • Supports autocorrection: Yes
  • Kind: performance
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning
    test_parent_classes [“QuickSpec”, “XCTestCase”]

Non Triggering Examples

final class Test: XCTestCase {}
open class Test: XCTestCase {}
public final class Test: QuickSpec {}
class Test: MyTestCase {}
//
// test_parent_classes: ["MyTestCase", "QuickSpec", "XCTestCase"]
//

struct Test: MyTestCase {}

Triggering Examples

class Test: XCTestCase {}
public class Test: QuickSpec {}
//
// test_parent_classes: ["MyTestCase", "QuickSpec", "XCTestCase"]
//

class Test: MyTestCase {}