UI 在测试中测试函数 Class
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 运行 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 运行) 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
}
}
要解决此问题,请重命名您的测试函数,使其以 test
开头。测试运行器将找到这些功能,并按照您的需要在导航面板中显示它们。
func test_1111() {
// Do stuff
}
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 运行 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 运行) 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
}
}
要解决此问题,请重命名您的测试函数,使其以 test
开头。测试运行器将找到这些功能,并按照您的需要在导航面板中显示它们。
func test_1111() {
// Do stuff
}