Frank:是否可以用 Objective-C 编写步骤定义
如何在 Objective-C 中编写步骤定义?例如:
Given(@"^通讯录为空$", ^{ ABAddressBookRef 地址簿 = ABAddressBookCreate(); CFArrayRef people = ABAddressBookCopyArrayOfAllPeople(addressBook); for (int i = 0; i < CFArrayGetCount(people); i++) { ABAddressBookRemoveRecord(addressBook, CFArrayGetValueAtIndex(people, i), NULL); } });
上面的示例源自 Rob Holland 的博客文章“BDD on iPhone” :iCuke”。
我为什么要做这样的事情?因为,尽管我很喜欢 Ruby,但我更喜欢用 Objective-C 开发 iOS 应用程序,并使用与我正在测试的应用程序相同的语言编写测试。此外,这还允许我做一些低级的事情,比如擦除地址簿或使用 Core Data 编辑其他数据。
我可以用大写“F”将
features
目录命名为Features
吗?
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"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我在此处回复了 Frank 邮件列表中 Matt 的问题
I responded to Matt's question on the Frank mailing list here
我同意;在 Objective-C 中测试您的 Objective-C 应用程序。就我个人而言,我使用 Cedar 来完成此任务,并且会在 Objective-C 中彻底完成(无 cuke),但我意识到这可能不是一个非常有用的答案。不是要劫持你的帖子,但你是否发现 Frank 比 Cedar 更容易设置?
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?
尝试回答你的第二个问题:
默认情况下,我认为 Cucumber 会寻找“features”目录。我不知道它是否区分大小写,但事实上您的询问意味着它可能是区分大小写的。您可以在运行 Cucumber 时指定目录。
例如。我的 Rakefile 中具有非标准位置的黄瓜目标
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