XCTest-个别成功时,某些测试用例因其他测试而失败

时间:2019-01-13 12:47:03

标签: ios swift unit-testing xctest xctestcase

与以下问题类似的问题: XCTest pass in isolation

没有有效的答案。

这些是我的tearDownsetup

override func tearDown() {
   window = nil
   window = UIWindow()
   super.tearDown()
 }

override func setUp() {
   super.setUp()
    window = UIWindow()
    let bundle = Bundle.main
    let storyboard = UIStoryboard(name: "Main", bundle: bundle)
    sut = storyboard.instantiateViewController(withIdentifier: 
     "OTPViewController") as? OTPViewController
 }




    //**
  func testDisplayHelpLabel() {

    //Given
    let testText = "testText"
    let attrStr = NSAttributedString(string: testText)
    let attrText = NSMutableAttributedString(attributedString: attrStr)


    //When
    loadView()
   //it changes help Label text with attributed text
    sut.displayHelpLabel(attributedText: attrText)

    //Then'
    XCTAssertEqual(sut.helpLabel.attributedText, attrText, "both must have equal value")
  }

错误: XCTAssertEqual failed - both must have equal value

有什么帮助吗?

0 个答案:

没有答案