KIF-Kiwi 1.0

KIF-Kiwi 1.0

测试测试
Lang语言 Obj-CObjective C
许可 MIT
Released最后发布2020年1月

Glen TregoningJan JiroutPaul Zabelin维护。



 
依赖
Kiwi~> 3.0
KIF~> 3.0
 

用 Kiwi 风格编写 KIF 测试!

KIF-Kiwi 是 Keep It Functional 和 Kiwi 框架之间的桥梁。它允许您使用 Kiwi 语法执行 KIF 操作。

安装

KIF-Kiwi 通过 CocoaPods 提供。要安装 KIF-Kiwi,只需将以下行添加到您的 Podfile

pod 'KIF-Kiwi'

然后运行

pod install

使用

在您的 spec 中包含 KIF-Kiwi 并开始使用 Kiwi describe/context 和 it blocks 编写 KIF 测试。参见 TestableSpec.m 示例

#import <KIF-Kiwi.h>

SPEC_BEGIN(MainViewAppSpec)

    describe(@"Main view", ^{

        it(@"should have tappable button", ^{
            [tester tapViewWithAccessibilityLabel:@"Tap me"];
            [tester waitForViewWithAccessibilityLabel:@"Button tapped!"];
        });

    });

SPEC_END

请参阅 KIFKiwi 文档获取有关这些框架的更多信息。

测试

要开始运行示例项目测试,请克隆仓库,然后打开 Example 目录中的 Xcode 工作空间

git clone https://github.com/IndieGoGo/KIF-Kiwi.git
cd KIF-Kiwi/Example/
open KIF-Kiwi.xcworkspace

在 Xcode 中按 ⌘-U 或从菜单中选择 Product->Test 运行测试。

您也可以从命令行运行示例测试

xcodebuild test -workspace KIF-Kiwi.xcworkspace -scheme KIF-Kiwi -sdk iphonesimulator -destination <device on your system>

例如:

xcodebuild test -workspace KIF-Kiwi.xcworkspace -scheme KIF-Kiwi -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=10.1,name=iPhone 6s'

测试输出将显示测试描述

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2014-08-01 02:28:15.661 KIF-Kiwi[14407:70b] + 'Testable, should have working button' [PASSED]
━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
    ✓ -[SampleAppSpec Testable_ShouldHaveWorkingButton] (761 ms)
    1 passed, 0 failed, 0 errored, 1 total (761 ms)

** TEST SUCCEEDED: 1 passed, 0 failed, 0 errored, 1 total ** (13862 ms)

贡献

请报告任何问题。PR 总是受欢迎!

要提交一个 PR

  1. 创建您的功能分支(git checkout -b my-new-feature
  2. 提交您的更改(git commit -am 'Add some feature'
  3. 将分支推送到远程(git push origin my-new-feature
  4. 创建新的 Pull Request

需求

  • Xcode 8.1
  • iOS 8

作者

维护者

贡献者

许可

KIF-Kiwi 采用 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。