• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OCUnit, test application from a bundle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OCUnit, test application from a bundle


  • Subject: Re: OCUnit, test application from a bundle
  • From: Marco Scheurer <email@hidden>
  • Date: Wed, 21 Jan 2004 13:08:40 +0100

On Jan 21, 2004, at 4:30 AM, Sailesh Agrawal wrote:

Hi, I'm trying to setup an unit tests for an application. Ideally I
would like all my unit testing code to be in seprate project compiled
into a bundle. This way if a new file is added to the application's
project you don't have to add it to the unit test project.

Is this possible ? How does the unit test code link to the application's
code ? In the OCUnit distribution the example
Examples/Testable/ApplicationBundle seems to do what I want.

No, this is a different thing: a bundle which includes tests. This is a project that can be tested in isolation. This is also an example from the ProjectBuilder era which has not been ported to Xcode. The easiest way to create a bundle with tests in Xcode is simply to create a new project using the "Cocoa bundle + Test" template.

To do what you want would require, I think, your application to be notified that the bundle executable code is loaded and then launch the tests. So having to instrument your app like this does not seem a good idea if what you want is to completely separate the tests from target. This is what I would do:

- Put your tests in a framework instead of a bundle, say MyTests.framework
- Launch your application from a Terminal, force it to load the test framework, and to launch the tests. For instance, in tcsh:

% setenv DYLD_FRAMEWORK_PATH ~/Developer/Builds
% setenv DYLD_INSERT_LIBRARIES ~/Developer/Builds/MyTests.framework/MyTests
% ~/Developer/Builds/MyApp.app/Contents/MacOS/MyApp -SenTest All

The application will be launched, the tests will run, the application will quit.

We, as most users it seems, prefer to run our tests directly from Xcode after compiling, so we have not updated Shikenjo, our graphical user interface to run tests, and that's why you have to use the Terminal to do this. Upgrading Shikenjo to do so would not be difficult.

Does this help?

marco


Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >OCUnit, test application from a bundle (From: "Sailesh Agrawal" <email@hidden>)

  • Prev by Date: Advertising HTTP-service using RENDEZVOUS
  • Next by Date: [SOLVED] Advertising HTTP-service using RENDEZVOUS
  • Previous by thread: OCUnit, test application from a bundle
  • Next by thread: Filtering Array Controller and Sorting
  • Index(es):
    • Date
    • Thread