如何为 XCUITest 测试用例设置参数为数据驱动测试做准备

How to set parameter to a XCUITest test case do prepare for data driven testing

是否可以为这样的测试用例设置参数:

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 就会将其从测试用例更改为 class 函数。

我需要进行以下调用(或类似的调用):

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

遗憾的是,XCTest 不支持参数化测试。

(这会在今年的 WWDC 上改变吗?我一直希望,每年……)