Testing javascript with py.test (Samuele Pedroni)ΒΆ

Tags: europython2009, europython

He demonstrated a py.test plugin that can unittest javascript code: open end javascript testing and utility kit. He uses py.test so that the tests can be run automatically without loads of setup. It sports decent error reporting with debugging options. And you can do integration tests.

You can define javascript (unit)tests in javascript files. There are some test fixture setup methods (“give me a plain node to test something on”, for instance). The tests are run inside browsers (those you configure) inside an iframe.

For integration testing, you have to write some python code that implements a WSGI server to provide the javascript tests with mock-up data. You can also run your full server here if you need that.

To test on remote machines (like: testing on linux, but you want to test internet explorer, too), you can run a small program on the remote machine and connect to that from the test runner (using an environment variable).

Testing talk at Europython
blog comments powered by Disqus
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):