Javascript

aslakhellesoy edited this page May 25, 2011 · 4 revisions

Here is a simple step definition in Javascript:

Given(/^I have entered (\d+) into the calculator$/, function(n) {
  calculator.push(parseFloat(n));
});

See the Javascript example project for a full example.

The Javascript engine being used is Rhino. Beware that Rhino doesn’t have a web browser environment out of the box. If you need that, consider adding Env.js to the mix.