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?"


 

 The third day we continued this work. All the while, Laura Perez Mayos (of Iskra, iskra.cat) and Víctor Fernández de Alba (also UPC) were working on the other tests in CMFPlone. By the end of the day we were done [10], and there was beer. Have a look and see what it looks like [11].

Some more information on the sprint will probably seep through coming week. The project page is [12], the twitter hashtag #bcnsprint. The last link you should definitely see is [13].

[1] https://github.com/plone/mr.roboto
[2] http://code.google.com/p/robotframework/wiki/HowToWriteGoodTestCases
[3] http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.7.6
[4] http://robotframework.googlecode.com/hg/doc/libraries/BuiltIn.html?r=2.7.6
[5] http://rtomac.github.com/robotframework-selenium2library/doc/Selenium2Library.html
[6] Reference documentation: http://code.google.com/p/robotframework/
[7] https://github.com/plone/plone.act/blob/master/src/plone/act/keywords.txt
[8] http://datakurre.pandala.org/2012/09/getting-started-with-robotframework-and.html
[9] http://datakurre.pandala.org/2012/09/speed-up-your-plone-add-on-tests-on.html
[10] For a given value of done. As the testrunner will try out different browsers, we might find some failing tests. So far we only tried Firefox and a little of Chrome.
[11] https://github.com/plone/Products.CMFPlone/tree/master/Products/CMFPlone/tests/robot
[12] http://www.coactivate.org/projects/barcelona-sprint/project-home
[13] https://www.youtube.com/watch?v=3cShYbLkhBc

information that came after the sprint:
http://plone.293351.n2.nabble.com/Introducing-mr-roboto-td7563163.html

No comments: