Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Pickle a JQuery BDD Test Library
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
public/javascripts
views
basic_steps.js
changelog
features
pickle.js
pickle.rb
pickle.ru
pickle.user.js
readme.mdown

readme.mdown

Pickle 0.0.6

A BDD Javascript Library that allows you create behavior style features that execute step definitions to develop and test your javascript in a BDD Style.

Features

Pickle('feature', 'basic_steps', function() {
  Scenario('should_see', function() {
    Given('I have an empty page');
    And('I have a link called say hello')
    When('I follow "Say Hello"');
    Then('I should see "Hello World"'); 


  });

  Scenario('Hello Form', function() {
    Given('I have an empty page');
    And('I have a simple form');
    When('I fill in "Name" with "Joe"');
    And('I press "Submit"');
    Then('I should see "Hello Joe!"');
  });
});

Steps

Pickle('step', /^I should see "([^\"]*)"$/, function (a) {
  var rx = new RegExp(RegExp().escape(a));
  if($("body").html().match(rx) == null) {
    return false;
  } else {
    return true;
  }
});

Pickle('step', /^I press "([^\"]*)"$/, function (a) {
  var submit = $('input:submit:[value="?"]'.replace(/\?/, a));
  if(submit.length > 0) {
    submit[0].click();
    return true;
  } else {
    return false;
  }  
});

Requirements

JQuery 1.3.2

Test using Sinatra

git clone git://github.com:twilson63/pickle.git

cd pickle

ruby pickle.rb

firefox http://localhost:4567

# Open Firebug and Run 
Pickle('run');

or

// Just run a particular feature
Pickle('NameOfFeature');

// Just run a particular step
Pickle('NameOfFeature','NameOfStep');

# In the console

Support

http://support.jackrussellsoftware.com

Something went wrong with that request. Please try again.