PyGrunn: Sphinx plus Robot framework - Pawel Lewicki

Tags: pygrunn, python

(One of the summaries of the one-day 2014 PyGrunn conference in Groningen in the Netherlands).

Pawel Lewicki talks about documention as the result of functional testing.

Sphinx is Python’s standard way of creating documentation from rst files. The second technology he uses is the Robot framework, including the selenium2 plugin for headless browser testing.

Robot framework test files are readable text files. Customers can read it pretty well, the tests contain regular English like “open browser to login page”, “input text id_login demo-user”, “click button css=.primary-action”.

Certain words in those text files are “keywords”: words with special meaning to a test plugin. “Click button” is one of the selenium2 ones, for instance. There’s also a selenium2screenshots plugin with keywords like “add pointy note”. And especially “capture”: capture a screenshot. This gets placed somewhere in the sphinx doc directory and can be included in the documentation. Screenshots that are always up to date!!

He showed some examples. Robot framework code can be included in sphinx, with the proper plugins installed, with a .. code:: robotframework statement, followed by the robot code. A regular .. image:: instruction then includes the screenshot. Adjusting the screenshots regarding viewpoint height and width is possible.

For plone testing you can use and, this makes it easier to use robot. He showed an example of creating a document (through the headless test browser) in plone inside the test and taking a screenshot afterwards. The plone robot extension has extra keywords like “debug”, “log in as test user”, “trigger workflow transition”.

Nice: he also showed jenkins integration. After every test run, sphinx is also run. Including taking all the screenshots! So you’ve got a full historical visual log of your theme development! Nice.

His example code for the demo is at 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):