Re: otest -- only useful for bundles?
Re: otest -- only useful for bundles?
- Subject: Re: otest -- only useful for bundles?
- From: James Bucanek <email@hidden>
- Date: Tue, 22 Nov 2005 09:41:14 -0700
Chris Hanson wrote on Monday, November 21, 2005:
>On Nov 7, 2005, at 10:57 AM, James Bucanek wrote:
>> I notice that the example code for inserting this code into a
>> Carbon application using a timer does not make this test. Looking
>> at the code, it appears that it runs the tests then always calls
>> QuitApplicationEventLoop(), which will forcibly terminate the
>> application. Is the example code incorrect, or is there something
>> I'm missing.
>
>The Carbon application example in the Unit Testing Guide is correct,
>though as you've discovered you also have to turn off "Symbols Hidden
>by Default" for the Debug configuration of the application target in
>order to be able to link against the application's classes from your
>unit test bundle.
>
>All of the code in the Carbon application example that sets up a
>timer is intended to be part of the test bundle, not the
>application. Thus if no test bundle is injected into the
>application, the application will be have normally. If a test bundle
>is injected into the application, the application will quit after the
>tests in the test bundle are run.
Duh! Of course. That's the detail I completely missed. The static initializer of the timer class "injects" an instance of the timer object into the run-loop of the application being tested, but *only* when the test bundle is also present. This make prefect sense.
So the only time a program of any kind needs to contain custom code to support unit testing is in the case of a C/C++ tool where there is no convienient way for a static initializer in the unit test bundle to intercept its normal execution?
James
--
James Bucanek
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden