How could I write step definitions in Objective-C? E.g.:
Given(@"^the address book is empty$", ^{ ABAddressBookRef addressBook = ABAddressBookCreate(); CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook); for (int i = 0; i < CFArrayGetCount(people); i++) { ABAddressBookRemoveRecord(addressBook, CFArrayGetValueAtIndex(people, i), NULL); } });
The example above was derived from Rob Holland's blog post "BDD on iPhone: iCuke".
Why would I want to do such a thing? Because, as much as I love Ruby, I prefer to develop iOS apps in Objective-C and to write tests in the same language as that of the app I'm testing. Also, this would allow me to do low-level things, like erasing the address book or editing other data with Core Data.
Can I name the
features
directoryFeatures
with a capital "F"?
Asked
Active
Viewed 699 times
1

ma11hew28
- 121,420
- 116
- 450
- 651
3 Answers
1
I agree; test your Objective-C applications in Objective-C. Personally, I use Cedar for this and would do it soup-to-nuts in Objective-C (no cuke), but I realize that might not be a very helpful answer. Not to hijack your thread, but did you find Frank to be any easier than Cedar to set up?

Andrew Kitchen
- 56
- 2
-
1Frank and Cedar are really intended for quite different things. Cedar is focused on unit testing, at the level of individual methods in your classes. Frank is focussed on functional/acceptance testing, at the level of end-to-end UI functionality. – Pete Hodgson Mar 10 '11 at 07:57
-
Why no Cuke? I haven't tried Frank yet, but skimming the instructions, I think it's easier to set up than Cedar. iCuke was a one-command install (icuke) and worked great, but development has dwindled, and I got an error trying to install it on Ruby 1.9.2. – ma11hew28 Mar 10 '11 at 12:58
-
Actually, Frank was about just as difficult as Cedar for me to set up. [I'm going to try out UIAutomation for acceptance tests and just leave testing the lower-level Objective-C stuff to Cedar unit tests](http://stackoverflow.com/questions/4114083/ios-tests-specs-tdd-bdd-and-integration-acceptance-testing). – ma11hew28 Mar 20 '11 at 17:46
1
To attempt to answer your second question:
By default I think Cucumber looks for a 'features' directory. I don't know if it is case sensitive, but the fact that your asking means it probably is. You can specify the directory when you run Cucumber.
eg. a cucumber target in my Rakefile with non-standard location
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = ["--format pretty", "FunctionalTests/Frank"]
end

Stew
- 1,901
- 10
- 9
-
Or you can just add the path to your cucumber command: `cucumber Features/` – raidfive Mar 14 '11 at 04:59