In my Mac Cocoa unit tests, I would like to output some files as part of the testing process, and delete them when the test is done, but only when there are no failures. How can this be done (and/or what’s the cleanest way to do so)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your question made me curious so I looked into it!
I guess I would override the
failWithException:method in the classSenTestCase(the class your tests run in inherits from this), and set a “keep output files” flag or something before calling thesuper‘s method.Here’s what SenTestCase.h says about that method:
So, provided you only use the SenTest macros to test and/or fail (and chances are this is true in your case), that should cover any test failure.