- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 iOS、xcode、KIF 框架和 Objective C 的新手。我的第一个任务是使用 KIF 编写测试代码。如果 KIF 有条件语句,看起来肯定会容易得多。
基本上是这样的:
if ([tester existsViewWithAccessibilityLabel:@"Login"]) {
[self login];
}
// continue with test in a known state
当您一次运行一项测试时,KIF 会在测试后退出应用程序。如果您一次运行所有测试,它不会在测试之间退出 - 要求测试人员非常非常小心应用程序的状态(这非常耗时且不好玩)。
最佳答案
测试框架通常不会实现 if 条件,因为它们已经以其 native 形式存在。
您可以查看测试框架的源代码,了解它是如何进行“If 状态检查”的。这将教会您如何做您可能想做的大多数事情(即使在功能测试期间做这些事情并不总是一个好主意)。您也可以在这里查看:Can I check if a view exists on the screen with KIF?
此外,您的测试在本质上应该是自信的,遵循以下工作流程:
given:
the user has X state setup
(here you write code to assertively setup the state)
It is OK and preferred to isolate your tests and setup
the "given" state (e.g. set login name in the model directly without going
through the UI) as long as you have covered that behavior in another test.
When:
The user tries to do X
(here you tap something etc..)
Then:<br>
The system should respond with Z
(here you verify the system did what you need it)
关于ios - 为什么像 KIF 这样的功能测试框架中没有条件语句?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23790341/
我正在使用 KIF 来测试我的应用程序。我想从命令行开始我的测试,我查看了工具 WaxSim,看起来它是为了在模拟器上运行测试。但是有没有办法在与真实设备的持续集成中使用 KIF 测试。如果我可以从在
我正在使用 KIF 来测试 iOS 应用程序,我想知道是否有办法在当前屏幕中获取所有辅助功能标签。我想获得一个字符串数组,其中每个元素都是此屏幕具有的可访问性标签。 最佳答案 这个函数可以返回 Vie
我正在尝试在示例应用中使用 KIF 学习自动化 UI 测试。我的简单测试不断失败。我的代码: #import #import @interface AutomatedUITestsSampleUI
我计划在以下设置中使用 KIF: 1.自己的静态库 2. 许多使用静态库的“外壳”应用程序。这些应用程序提供内容和配置,但它们都使用公共(public)库来加载基于内容而非配置的内容。 我应该如何整合
这是相当开放的。 有没有人知道如何在 KIF 测试中测试下拉刷新功能? 最佳答案 只需从屏幕顶部向下拖动到屏幕底部即可,对吗? KIF 在 UIView-KIFAdditions 类别中实现了以下方法
我正在使用 KIF做 UI 测试。我要做的第一件事是清理模拟器中可能存在的所有缓存数据。所以我在 -beforeAll 中编写了清理代码我的方法KIFTestCase .但是这个方法是在我的应用程序委
我尝试在 swift 项目中使用 KIF。我在 iPhone 模拟器上运行测试用例。可能我没有正确设置 KIF,因为第一次使用它。我用过这个manual 在这个简单的代码中测试失败 func test
我看了很多,但我无法找到使用 KIF 点击模拟器状态栏区域的方法。我想通过点击那里来测试滚动到表格 View 顶部的情况。 我试过的两种方法: CGFloat middleOfScreen = flo
我正在使用 KIF test framework .目前,我能够通过以下行检测到表不为空: tester().waitForCellAtIndexPath(NSIndexPath(forRow: 0,
我正在尝试编写一个 KIF 测试来检查我应用中两个不同帐户的登录情况。 现在的问题是,我需要从用户第一次登录后看到的 DetailView 中获取数据,并将其与第二次登录后看到的数据进行比较,确认数据
我是 iOS、xcode、KIF 框架和 Objective C 的新手。我的第一个任务是使用 KIF 编写测试代码。如果 KIF 有条件语句,看起来肯定会容易得多。 基本上是这样的: if ([te
我已在 iOS 模拟器中打开辅助功能并尝试运行我的 KIF 测试,但我不断收到以下错误: ** Terminating app due to uncaught exception 'NSInterna
我正在使用 Kif 并尝试使用文本字段和添加按钮创建一些数据 如果我使用此代码一次: - (void)addTextItem { [tester enterText:[NSString str
如何使用 KIF 执行双击? 我试过两次调用 tapViewWithAccessibilityLabel: 并在两次调用之间添加延迟,但没有任何效果。测试没有失败,这意味着 KIF 能够执行单次点击,
我想在 Kif 中截图。我看到了here在 kif 项目的私有(private)类(class)中,这是可能的,但我很难尝试将其转换为一个步骤。谁能帮忙? 最佳答案 这是在 KIF 3.0.4 中添加
我使用了最新版本的 KIF 框架并创建了几个测试用例(KIFTestCase 的子类)。 我可以知道有什么方法可以更改测试运行顺序吗? 例如,我有 testA.m testB.m testC.m ..
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我正在使用 KIF 为一个项目开发测试。我想知道是否可以让 KIF 模拟点击主页按钮?是不是也可以在那个时候模拟其他 Action ,比如调出命令中心或者通知中心? 最佳答案 至少为您提供了部分答案,
我使用 KIF 框架 ( http://github.com/kif-framework/KIF ) 进行 UI 测试我需要模拟定位服务。 问题是位置服务在调用 KIF 方法 -beforeAll 之
我使用 KIF测试持续集成的 UI。当应用程序首次在设备(或 iOS 模拟器)上启动时,系统会显示一些安全警报 View 。 KIF 如何自动确认系统警报以防止测试失败? 最佳答案 最好的方法是使用[
我是一名优秀的程序员,十分优秀!