iosswiftunit-testingtddxctest

How do I use XCTests to test for print statements?


I am trying to test whether a function prints out something. How can I do this with XCTests? If this is possible, are there factual reasons to do it and not do it?

Thanks!


Solution

  • I don't know of a way to test a print statement, but I don't think it matters. The output of a print statement is irrelevant to what your app actually does. You should test what data your app changes, what it displays to the user, etc.