Monday, February 11, 2013

My Barcelona Testing Sprint



[edit 14-2: see bottom of article for information that came after the sprint]

The Barcelona Sprint was about Plone's testing. Most of Plone's code is covered by tests, and these tests are automatically run by a Jenkins server, so we know when stuff starts not working anymore.




One focus of the sprint was improving the Jenkins setup, so a commit or pull request that breaks the build triggers an email, irc notification or otherwise to the author. This code now goes by the name of mr.roboto [1].

Another focus area was to get more Robot Framework tests into Plone. RF fires up a real browser, where Javascript also works. This way we can test things like overlays and folder re-ordering.

To show everyone how to use this goodness, we wrote documentation and modified the template for creating new Plone products so the boilerplate is already there.

To go more into detail, the sprint went like this for me:


I spent the first day familiarizing myself with Robot Framework tests, using these links: [2-9]. I set up a basic add-on package that tested if an overlay popped up.

The second day i paired up with Carles Bruguera of UPC University (upc.edu), and we started working on Products.CMFPlone. The great thing about RF is that you can write stuff like:
Scenario: Login overlay:
 Given I am not logged in
  When I click the login button
  Then I should get an overlay with login form

Statements like "I am not logged in" are called keywords, you define these somewhere else in your test. It makes for easy reading, you could (theoretically) even show it to your customer and ask "Is this what it is supposed to do?"