How do I trap OCUnit test pass/failure messages/events

前端 未结 2 842
Happy的楠姐
Happy的楠姐 2021-02-06 01:17

I\'m trying to use xcodebuild and OCUnit with my Continuous Integration server (TeamCity).

JetBrains offers test observer implementations for boost::test and CppUnit t

2条回答
  •  醉梦人生
    2021-02-06 01:49

    You can write your own observer by extending the SenTestObserver class and implementing the notification listeners

    • (void) testSuiteDidStart:(NSNotification *) aNotification
    • (void) testSuiteDidStop:(NSNotification *) aNotification
    • (void) testCaseDidStart:(NSNotification *) aNotification
    • (void) testCaseDidStop:(NSNotification *) aNotification
    • (void) testCaseDidFail:(NSNotification *) aNotification

    then add an entry to the info.plist SenTestObserverClass with the name of your class.

    At least in the version of OCUnit i'm familiar with SenTestObserver is equal parts useful/equal parts broken. I just skip it altogether and register for the notifications myself in my own class. (see SenTestSuiteRun.h and SenTestCaseRun.h for the defines of the notification names).

    You can use the test and run properties of the notification to access the SenTestSuite and SenTestSuiteRun instances, and the run instance contains the info needed on the actual results.

提交回复
热议问题