collective.zombiedoctesting iconcollective.zombiedoctesting 1.1.0

Fast functional JavaScript testing with Zombie.js
Zombie.js is a fast headless browser with all the JavaScript support Node.js provides. collective.zombiedoctesting is package that provides a function decorator, which allows Python doctest-style functional JavaScript testing using Python-like CoffeeScript.

Disclaimer: This may not replace your Selenium-stack, because Zombie.js is just an another browser with its own quirks.


- Node.js must be installed
- npm must be installed
- coffeescript, zombiejs and async packages must be installed using npm
- coffee-executable must be found on the path

Example of use (with

Start with defining a functional testing fixture with ZServer (that will run your Plone on localhost:55001 by default):

from import PLONE_FIXTURE
from import FunctionalTesting

from plone.testing import z2

FUNCTIONAL_TESTING = FunctionalTesting(
 bases=(PLONE_FIXTURE, z2.ZSERVER_FIXTURE), name="PloneFixture:ZServer")

Then write your functional JavaScript tests as a doctest for your testmethod using CoffeeScript instead of Python. Define the context (URL) of your test by using the decorator (@browser) from collective.zombiedoctesting as shown below. You may use all the JavaScript that's provided by your context and the global browser that represents Zombie.js' browser:

import unittest

from import TEST_USER_NAME

from collective.zombiedoctesting import browser

constants = {

class LoginOverlayTest(unittest.TestCase):


 @browser("http://localhost:55001/plone/", mapping=constants)
 def test_login(self):
 Let's start by looking up the login link.

 >>> console.log do $("#personaltools-login").text
 Log in

 Clicking that link should not redirect us anywhere, but give us an
 AJAX overlay with a login form.

 >>> do ($ "#personaltools-login").click
 >>> console.log window.location.href
 ... console.log do ($ ".pb-ajax #login-form").text
 Login Name

 Let's fill that form...

 >>> global.form = ($ ".pb-ajax #login-form")
 ... form.find("#__ac_name").val "%(TEST_USER_NAME)s"
 ... form.find("#__ac_password").val "%(TEST_USER_PASSWORD)s"
 ... console.log do form.find("#__ac_name").val
 ... console.log do form.find("#__ac_password").val

 ... and click the button to log in.

 >>> do form.find("input[type='submit']").click
 >>> console.log window.location.href
 ... console.log browser.text ".documentFirstHeading"
 You are now logged in

last updated on:
April 30th, 2012, 12:55 GMT
developed by:
Asko Soukka
license type:
GPL (GNU General Public License) 
ROOT \ Internet \ HTTP (WWW)


In a hurry? Add it to your Download Basket!

user rating



What's New in This Release:
  • First (hopefully) non-broken release.
read full changelog

Add your review!