Skip to content

Testing WebOS Applications Made Easy with jasmine_webos gem

TDD for WebOS applications is still in its early stages, but the guys over at Pivotal Labs have made some great strides in the low level tooling. The Jasmine javascript testing framework provides a dom-less testing implementation which works well in the MVC environment of a WebOS application.

Pivotal is also hard at work at Pockets (not yet released) which provides on emulator testing and integration of Jasmine into your WebOS application. However, as of now (2009/09/21), this has not been released owing to major changes in the debuging environment in the WebOS SDK.

To help with the transition, I have released my initial version of jasmine_webos, which facilitates testing your webos application with Jasmine. Jasmine_webos requires ruby and rubygems as well as the json and thin gems. To install jasmine_webos, simply do:

sudo gem source -a http://gemcutter.org
sudo gem install jasmine_webos

Jasmine_webos provides a generator to create the directories it expects (spec/javascript/spec and spec/javascript/matchers) as well as an example spec so that you can make sure that it is working. This is accessed by running the following from the root of your WebOS Application:
jasmine_webos -g

You can then run the test server (dynamically builds up suites for testing) with:
jasmine_webos -s. You can then run your tests by hitting http://localhost:8888 with any capable browser.

Jasmine_webos server will include any javascript files in your app directory, all matchers in your spec/javascript/matchers, and all tests in your spec/javascript/spec folder. Jasmine_webos keeps the jasmine files contained in the gem so that as new features for jasmine are released, you can get easy access to them by updating the gem. This also keeps you from having to copy jasmine into each of your apps.

In the future I am looking at implementing:
* A config file for additional directories and requirements
* celerity for command line testing / integrated builds
* including mojo framework libraries for fuller stack testing.

Please report any bugs to the github bugs page.

9 Comments

  1. Oliver Ferrigni wrote:

    Awesome ariticle! Thanks so much for posting! Should def post on the yahoo TDD group!

    Monday, September 21, 2009 at 1:43 pm | Permalink
  2. gothy wrote:

    where can jasmine_webos binary found after install?
    ubuntu 9.04

    Tuesday, September 22, 2009 at 7:14 am | Permalink
  3. gaffo wrote:

    @gothy, it’s going to be in your gems directory, which on ubuntu 9.04 I believe is /var/lib/gems/1.8/bin. For some reason Ubuntu doesn’t add this to the path. Maybe for multiruby support. Let me know if that helps.

    Tuesday, September 22, 2009 at 7:35 am | Permalink
  4. gothy wrote:

    @gaffo, thanks! really helped :)

    Wednesday, September 23, 2009 at 1:13 am | Permalink
  5. gothy wrote:

    @gaffo There is a little problem, when server starts in prints all sources that are being loaded, but none of the /javascript/* scripts from root app folder are loaded as I see. I’m trying to edit your scripts, but without ruby knowledge it’s quite hard :) Please, help

    Wednesday, September 23, 2009 at 2:58 am | Permalink
  6. gothy wrote:

    Fixed by myself already :)
    add in source_files:

    other_sources = Dir.glob(File.join(other_src_dir, “*.js”))
    other_sources = other_sources.collect {|f| f.sub(other_src_dir, “/javascripts”)}
    ….

    and to mapping:
    “/javascripts” => other_src_dir,

    and finally describe other_sources a bit lower in server.rb

    def other_src_dir
    File.join(@configuration.application_root, “javascripts”)
    end

    Wednesday, September 23, 2009 at 4:33 am | Permalink
  7. gaffo wrote:

    @Gothy, I just pushed a new version of the app containing your patches. Should be up on gems.github.com any minute. Thanks. If you have any other fixes or suggestions send em to bugs on http://github.com/gaffo/jasmine_webos

    Wednesday, September 23, 2009 at 1:03 pm | Permalink
  8. Steve wrote:

    Ah, fixed it — I needed to run “sudo gem update –system” first to upgrade to a modern RubyGems install. Once I did that, it found your package. Hopefully this will help someone else.

    Wednesday, September 30, 2009 at 11:19 am | Permalink
  9. Dionna wrote:

    I see a lot of interesting content on your blog. You have to spend a lot of time writing, i know how to save
    you a lot of work, there is a tool that creates unique,
    SEO friendly articles in couple of minutes, just search in google
    - laranita’s free content source

    Thursday, July 3, 2014 at 1:11 am | Permalink

Post a Comment

Your email is never published nor shared.