js-test-driver

January 11, 2011 § Leave a comment

I’m still trying to figure out how I can achieve my ideal for JavaScript browser testing using ant.  So far, I have looked at a number of BDD testing kits (e.g., Jasmine), however for browser testing, they require a browser.  I don’t like this because it means for continuous integration tests (i.e., a build box) a browser is required to run stuff.  I know Selenium, a seemingly popular test framework for web apps, works this way, but I’d prefer it to be browser agnostic.

As I think more about this, I realize that my view is probably naive — browser testing should probably happen in browsers where they will run.  To that end, js-test-driver appears to be a great tool.  It establishes a server that you connect to with browsers.  When you run your tests, the test runner tells the server to run the test code on the connected browsers.  The results from all browser tests are available … and the overall outcome is your tests have been run on all the connected browsers.  You can test a variety of browser makes and models this way, even browsers connected from a different computer than where the server process is running!  There was a talk about js-test-driver at GTAC 2009 (Google Test Automation Conference), but I prefer the shorter and more concise video on the js-test-driver web site.

There is also an adapter for js-test-driver to make it run Jasmine tests.

node.js Google Tech Talk

January 8, 2011 § Leave a comment

A presentation by Ryan Dahl, creator of node.js.  This is a great talk explaining the design goals of node.js.  In short, the goal was to easily create servers, but not in C.  The design focuses on asynchronous callbacks so that a single thread event pump can handle all function calls.  All IO is asynchronous as well — there is actually a thread pool that handles IO operations, freeing the event pump to handle function calls as quickly as possible.  Ryan claims node.js can handle 10,000-30,000 simultaneous connections.  Very cool stuff and after tinkering with it, I can say that it is blazingly fast.

 

Douglas Crockford’s Google Talk – JavaScript: The Good Parts

January 8, 2011 § Leave a comment

My notes from Douglas Crockford’s Google Talk based on his book, JavaScript: The Good Parts.

  • JavaScript is misunderstood
  • DOM is source of poor performance, not JS
  • If you’re going to use a language, learn it… JS is easy to use without learning it and that’s a cause for misunderstanding it
  • JS is loosely typed
  • Amount of testing required in Java and JS is about the same… the type checking happens through the tests
  • You don’t have to worry about type checking
  • bad parts:  global variables; + adds and concatenates; semicolon insertion; typeof; with and eval; phony arrays; == and !=; false, null, undefined, NaN
  • arrays are hashtables with indexes as keys
  • always use ===, never use ==
  • if you ask for a property that doesn’t exist, you get undefined
  • bad heritage:  blockless statements; expression statements; floating point arithmetic; ++ and –; switch
  • DC doesn’t use ++ and —
  • good parts: lambda, dynamic objects, loose typing, object literals
  • two schools of inheritance:   classical (most OO languages), prototypal (JS)
  • prototypal inheritance: class free; objects inherit from objects; an object contains a link to object to inherit from
  • “new” operator is required when calling a Constructor function… dangerous and DC doesn’t use it anymore
  • function variable scope, but no block variable scope
  • create objects using closures
  • start block statements on the same line as the declaration… semicolon insertion will rear its ugly head
  • “Working with the Grain”
  • JSON derived from the good parts of JS
  • JS is really based on Scheme
  • JSLint identifies the bad parts — do everything it says, it’s smarter about JS than you are
  • If you avoid the bad parts, JS works really well — it is possible to write good programs in JS

 

nodejs and jasmine-tool

January 8, 2011 § Leave a comment

I’ve been playing around with nodejs and Jasmine today.  Some links that may be of interest:

I was not able to get nodejs v0.3.x to work with jasmine-tool, so I used v0.2.6.  Also, jasmine choked because a nodejs module called ‘jade’ was not installed, so make sure you install it too.

> npm install jade

Where Am I?

You are currently viewing the archives for January, 2011 at Mike Lippold's Blog.