David Webb
David Webb

Reputation: 139

UI testing functions within test Class

I am implementing UI testing and I have created a 900 lines test class. This file contains 16 different tests that I would like to have lest separately in the left pane so that I can run specific ones as required. However, when I include the 16 funcs there are no tests listed. When I comment out the 16 funcs, I can see (and run) all the tests as a single line.

Here is the structure of the 16 funcs.

import XCTest
class zeroCounts: XCTestCase {
    override func setUp() {
        super.setUp()
        continueAfterFailure = false
        XCUIApplication().launch()
    }
    override func tearDown() {
        super.tearDown()
    } 

    func tests() {
        testsRun = 0
        currentRow  = 0

    func case_0000() {
        // Do stuff
    }
    func case_0001() {
        // Do stuff
    }
    func case_0010() {
        // Do stuff
    }
    func case_0011() {
        // Do stuff
    }
    func case_0100() {
        // Do stuff
    }
    func case_0101() {
        // Do stuff
    }
    func case_0110() {
        // Do stuff
    }
    func case_0111() {
        // Do stuff
    }
    func case_1000() {
        // Do stuff
    }
    func case_1001() {
        // Do stuff
    }
    func case_1010() {
        // Do stuff
    }
    func case_1011() {
        // Do stuff
    }
    func case_1100() {
        // Do stuff
    }
    func case_1101() {
        // Do stuff
    }
    func case_1110() {
        // Do stuff
    }
    func case_1111() {
        // Do stuff
    }
}

Upvotes: 1

Views: 148

Answers (1)

Price Ringo
Price Ringo

Reputation: 3440

To fix this problem, rename your test functions to begin with test. The test runner will find those functions and show them in the navigation panel just like you want.

func test_1111() {
    // Do stuff
}

Upvotes: 3

Related Questions