Swift 如何为XCUITest测试用例设置参数为数据驱动测试做准备
是否可以为测试用例设置参数,如:Swift 如何为XCUITest测试用例设置参数为数据驱动测试做准备,swift,xctest,Swift,Xctest,是否可以为测试用例设置参数,如: func testExample1(term: String) { XCTContext.runActivity(named: "Search for \(term)") { activity in // Enter text in the search field let textField = XCUIApplication().otherElements.containing(.button, identifier:"Butt
func testExample1(term: String) {
XCTContext.runActivity(named: "Search for \(term)") { activity in
// Enter text in the search field
let textField = XCUIApplication().otherElements.containing(.button, identifier:"Button").children(matching: .textField).element
textField.tap()
textField.typeText(term)
}
只要我更改测试用例以获取参数,XCUItest就会将其从测试用例更改为类函数
我需要打以下电话(或类似的电话):
遗憾的是,XCTest不支持参数化测试
(今年的WWDC会改变这种情况吗?我一直希望,每年都会如此……谢谢你的帮助。这意味着XCTest根本不是数据驱动的。这很奇怪,不幸的是,这不是一个成熟的框架。干杯
xcodebuild test -project MyLib.xcodeproj -scheme MyAppUITests -destination 'platform=iOS Simulator,OS=11.3,name=iPhone 5s' -only-testing:MyAppUITests/MyAppUITests/testExample1("toto")|xcpretty --test --color