【问题标题】:Why is my test failing with true == true为什么我的测试以 true == true 失败
【发布时间】:2015-11-16 18:19:16
【问题描述】:

我正在写一个 XCTest

在我的测试中我有BOOL stam = true;

然后XCTest(stam == true,@"value is expected to be true");

但是,测试失败,我收到此错误消息

((value == true) is true) failed - value is expected to be true

【问题讨论】:

  • 根据 Apple 源文件 XCAbstractTest.h,“XCTest 是用于测试的抽象基类。……大多数开发人员不需要直接继承 XCTest。”各种 XCTAssert() 方法似乎更适合使用。

标签: xctest


【解决方案1】:

您通常需要在测试框架中使用断言方法。

你试过了吗

XCTAssertEqual(stam,true,@"value is expected to be true"); 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-24
    • 2013-02-02
    • 1970-01-01
    相关资源
    最近更新 更多