unit testing with SenTestingKit, please hold my hand
unit testing with SenTestingKit, please hold my hand
- Subject: unit testing with SenTestingKit, please hold my hand
- From: Matt Neuburg <email@hidden>
- Date: Tue, 05 Dec 2006 10:53:50 -0800
- Thread-topic: unit testing with SenTestingKit, please hold my hand
Could someone please give me instructions for writing a Cocoa/ObjC unit test
that actually work?
First I followed the instructions in this document:
<http://developer.apple.com/tools/unittest.html>
I added a unit test to the existing TemperatureConverter example, and
everything went great. Okay, fine. On to my own project. I followed the
instructions in this document:
<http://developer.apple.com/documentation/DeveloperTools/Conceptual/UnitTest
ing/Articles/CreatingTests.html>
But nothing worked out correctly.
(1) I created a build target of type Unit Test Bundle.
(2) I decided I wanted it to be independent, so I skipped all the dependency
stuff.
(3) I created a subclass of SenTestCase and gave it a void instance method
called testWholeThing.
(3a) I linked in the SenTestingKit framework (as far as I can tell, Apple's
document completely omits this step!).
(4) I tried to build but things kind of blew up. None of my Cocoa symbols
were being recognized in the ld phase. I added the Cocoa framework to the
unit test target, but I don't understand why I have to; I didn't need to do
this in the TemperatureConverter example.
(5) I added the class I want to test to the testing target.
I build the testing target but nothing happens. The test case class compiles
okay, the Run Script phase is being executed (as I determined by adding an
"echo" to it), but testWholeThing does not run (as confirmed by adding
NSBeep(), logging, breakpoint, anything I could think of - I even put in an
STFail call). The build output is:
Suite All started
Suite All finished
Ran 0 tests, 0 failed.
How do I get my tests to be seen and run?
The thing I *really* don't understand is that I've got two projects, mine
and the TemperatureConverter example, and the former is not working but the
latter is. Yet they appear, as projects, to be structured exactly the same
way (except that, as I mentioned before, I had to add the Cocoa framework to
the test case target in my project, but not in TemperatureConverter).
thx -
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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