ios - 如何将标签/属性添加到 XCUITest(Swift)
问题描述
我想弄清楚我们是否有任何方法可以将标记/属性设置为 Swift 中的测试。在 C# 中,我们使用基于功能和测试类型来标记测试,以帮助我们进行报告。以下是示例:-
[Category("LongRunning"),Category("Workspace")] 公共类 LongRunningTests { ... }
任何帮助表示赞赏。
解决方案
Swift 中没有内置选项可以不注释测试用例和测试类。
您应在自定义 XCTestCase 中添加包含测试名称及其组的 Dictionary,并基于此 Dictionary 覆盖 invokeTest()。
您的注释可能如下所示:
class TestClass: CustomUITestCase {
override var testClassesGrouping: [TestClassesGroups] { return [.positiveScenarios] }
override var testCasesGrouping: [String: [TestCasesGroups]] { return
["testReminderWithNotes": [.testSettingNotes],
"testPastReminder": [.testChangingDate],
"testFutureReminder": [.testChangingDate],
"testFuturePrioritised": [.testChangingDate, .testSettingPriority],
"testPrioritisedReminder": [.testSettingPriority]]
}
...
}
推荐阅读
- amazon-web-services - Terraform 给我 Fileset IDENT 错误
- python - 我正在使用 LBPH 算法,但我的面部识别和考勤功能出现此错误“raise KeyError(key) from err KeyError: 'Id'”
- flutter - 为什么这一行不颤动
- python - Keras 中的组归一化和权重标准化
- ios - 快速隐藏 UIView 动画
- delphi - FMX 旋转位图闪烁
- javascript - localhost express NodeJS服务器上的CORS问题
- javascript - JavaScript:切换非布尔值的简写
- python - 我的仪表板程序中的“IncorrectTypeException”
- python - 排除具有空值的 Python 列表