Thanks Aaina for pointing the stuff. Yes, we should not have an assertion in the else block for the following reasons:

  • If the value of that attribute is necessary then, it should never be nil
  • As per my code, I am already checking that the attributes should not be nil. So it does not make sense to re-test again when its already is a XCTFailed() case.

So it should be a failed test rather than any other assertions. I have updated the code. :)

Software Developer(iOS), Speaker & Writer at Swift India

Software Developer(iOS), Speaker & Writer at Swift India