Running tests using an external process

Allow to run an external process to test your application

class webtest_casperjs.TestApp(app=None, url=None, timeout=30000, extra_environ=None, relative_to=None, **kwargs)[source]

Run the test application in a separate thread to allow to access it via http


Close WSGI server if needed

webtest_casperjs.casperjs(*args, **kwds)[source]

A context manager to run a test with a webtest.ext.TestApp

Using casperjs to run tests

The js part:

var system = require('system');
var url = system.env['APPLICATION_URL'];

var casper = require('casper').create();
casper.start(url, function() {
    this.test.assertTitle('It Works!');
}); {

The python part:

def test_casperjs():
    app = webtest.TestApp(application)
    with webtest_casperjs.casperjs(app) as run: