Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Jasmine with iPhone Development?

I'm new to the Jasmine Testing Framework, I want to know how to use this for testing iPhone developments?

How can I integrate with Xcode and use for BDD testing? Will Jasmine only test my JavaScript code?? Then how can I use Jasmine in between my Xcode and call to JavaScript to verify that my JavaScript is valid?

I have already seen many links and examples but all are of these are testing JavaScript. I'm specifically asking only for iPhone. How do you communicate between JavaScript and an XCode Project.

like image 582
DShah Avatar asked Aug 27 '26 02:08

DShah


2 Answers

It is not possible to test Objective-C (iPhone) with Jasmine (JavaScript).

I have used the Appecelerator Titanium to develop an iPhone app -- it allows you to write code in JavaScript which is mapped to a native Objective-C interface. Its the only product so far that actually produces native code (as opposed to PhoneGap and others which run your JS code in an embedded webpage). I used jasmine to test my JavaScript code on the iPhone within my Titanium-built app and it worked great. Even setup was a breeze. I think it was this project that helped: https://github.com/guilhermechapiewski/titanium-jasmine

If you need to test Objective-C code, Cedar (by Pivotal Labs) is your best bet. You can find Cedar here: https://github.com/pivotal/cedar

like image 126
GregT Avatar answered Aug 29 '26 17:08

GregT


Jasmine is a javascript framework and is not easily used for testing objective-c code. However using JS to develop iphone apps is possible. If you are desperate to use Jasmine you should probably checkout JSCocoa If you just want to use a BDD framework you should look at Cedar its similar to Jasmine.

like image 44
Johnno Nolan Avatar answered Aug 29 '26 16:08

Johnno Nolan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!