www.webOShelp.net

Get the latest on:webOS Developers' RSS FeedwebOS Facebook page webOS Twitter Feed

Home Getting Started with webOS Webcast: Unit Testing in Palm webOS with Christian Sepulveda, Pivotal Labs

Webcast: Unit Testing in Palm webOS with Christian Sepulveda, Pivotal Labs

Back in February, Palm CTO Mitch Allen hosted the first webOS developer webcast, titled "Developing Applications for webOS: A Preview" (see a summary and video of the event). During the webcast, he went over the material in the first chapter of the upcoming Palm webOS book, including Stages, Scenes, UI Widgets, and more, and answered questions from developers during the Q&A period.

Today, Christian Sepulveda, VP of Business Development for Pivotal Labs, hosted a webcast today on Test / Behavior Driven Development (TDD/BDD) through Jasmine, a BDD framework for JavaScript. He was joined by Davis Frank, one of the developers at Pivotal Labs who has been working with the Pockets and Jasmine framework of their webOS apps. Over the course of the hour, he gave a brief intro to unit testing, an overview of Pockets and Jasmine, and unit testing in action.

Watch the full 55-minute webcast (in code-readable HD!)

For those unfamiliar, Jasmine is a unit test framework for JavaScript (not exclusive to webOS), but doesn't require a DOM. Pockets is a set of tools and libraries to facilitate webOS development, including a GUI test runner for webOS Jasmine testing. They have been using Pockets internally and for the pre-release SDK, and is set for a wider launch later this summer. Sepulveda then breifly described testing concepts and the difference between tests and specs.

For the demo, Sepulveda walked us through the code for testing a very basic Twitter app, used to search friends. Fast forward to 7:40 to get right to the demo. Those with basic knowledge of JavaScript, webOS and unit testing should find the webcast quite insightful. You can watch the full HD webcast above. After viewing the demo, how do you feel about the potential for unit testing in webOS, and if you're in the Early Access Program, have you had the opportunity to check out Pockets?

Screenshots from various stages of the testing process are below:

Full summary of the webcast Q&A after the break!

Webcast Q&A:

Where do we find Pockets?

Pocket is only available to members of the Early Access SDK in the Forums, and is to be launched "maybe in a month or so"; as we are waiting to iron out issues with the the latest version of the Mojo SDK.

Does Pockets require Eclipse?

No, it does not require Eclipse, it can be used with any text editor, such as TextMate on Mac OS X.

Were you testing just an API or an actual application (in the webcast)?

First the Twitter API was tested, and in the last part, A Mojo scene was used to call up the actual Twitter API.

When will a proper release of Pockets be released?

Jasmine is already stable, available on Github: https://github.com/pivotal/jasmine/tree/master

Pockets is only available on the Palm Mojo SDK forums, in 2-3 pieces: Libraries to do a testrunner, or test support, and runtime libraries that are independent of testing, but generally useful in webOS (i.e. reduce memory leaks using event manager). Both are stable, although they may add to them later. You should feel confident using them. The third part are tools, which they may rework. These include rate test, sources, deploy to emulator. Tools can only be installed on Mac OS X currently, and the new SDK 0.3.5 is causing some issues. The testrunner is also still being reworked.

Is Jasmine webOS-specific?

No, you can use it on any JavaScript project you want, but you need a testrunner to use it, which is only on webOS currently.

What about CI, TcRB?

Getting better test results out of the Emulator (with later SDKs) is planned to make continuous integration / environments work better. You can run things on the command line, but only with PalmHost right now.

Test code bundled into an appointment?

No, we build up packages both for test and production. Test code is stripped out before an app goes live; no reason for code to be lying around.

Test functions for automentation, screen taps, higher-level integration e-tests?

Hard in the webOS environment, but you can do a little bit; you can verify that correct handlers get called on taps, buttons, from testing assistants. Lacking support at high-level though, and clicking outside of a single app, switching between apps, dashboard taps etc. are not supported as yet.

Running test code on device rather than emulator?

Very little discrepancy between emulator and device. Differences, during their development, have been mostly transparent. A future solution would be for the emulator to also allow you to run a test on the device.

To get test up and running, what do you need to set up?

For full testing, you need Jasmine and Pockets. Easiest in Mac OS X [describes full setup in webcast around 48:00]

Is running isolated tests supported yet?

Jasmine can create an isolated environment, and is very important element in unit testing. You should have all the isolation you need.

Will leaving test code of Pockets add much overhead to an app if left in?

Probably not, but it will add size to your app, and overwriting classes and tests could cause issues. It is not recommended.

Are there instructions packaged in Jasmine for Windows users?

There is a readme file available for Windows and Mac users in Pockets. Linux is not yet supported. [See the readme at 51:20]

Will it remain free?

Yes, it will always be free and open-source. Free open-source libraries will also be distributed, such as tools for app integration with Tweed, their twitter app, as well as other plugins for webOS apps.

Sepulveda and Pivotal Labs will be at in the InsideMobile conference happening later this month, in San Jose on July 26-27th.

 

0 Comments

    Add Comment


      • >:o
      • :-[
      • :'(
      • :-(
      • :-D
      • :-*
      • :-)
      • :P
      • :\
      • 8-)
      • ;-)