Plone test development with robotframework and RIDE¶
Running acceptance tests in Plone¶
Test driven development can be a pain. If you are working with Zope and Plone
most of time gets consumed starting up Zope running setUp method and
rolling back transaction in tearDown method.
So why not use a running already set-up instance for test-development? Today I will show you how to reach that goal. It’s not as hard as it seems.
Use buildout¶
Of course we use buildout to get a custom script which we can run through
RIDE. I configured a new pybot script, the basic idea has been implemented
in plone.act [1] module already.
[buildout]
# ...
parts =
# ...
pybot
[pybot]
recipe = zc.recipe.egg
eggs =
plone.act [test]
robotentrypoints
initialization =
import os
os.environ.setdefault("ZSERVER_PORT", "8080")
os.environ.setdefault("PLONE_SITE_ID", "Plone")
os.environ.setdefault("SITE_OWNER_NAME", "admin")
os.environ.setdefault("SITE_OWNER_PASSWORD", "admin")
RIDE¶
RIDE is the frontend for test-development using robotframework library. Setup is a pain if you want to run it on OSX. I saw a click-by-click installation of windows users, but this is not what we want to cover here today…
Note
RIDE requires wxPython 2.8 - it is possible to use 2.9 but it’s not
really stable. You’ll end up in segmentation fault errors. By deleting your
~/.robotframework/ride/settings.cfg file, you can by-pass these errors
with the disadvantage of loosing all your settings. Read more about
setting up RIDE on my previous post here.
- Open your test folder in ride by using the File menu
- Modify
variables.pyto loadSITE_OWNER_NAMEandSITE_OWNER_PASSWORDfrom environment. - Run
bin/pybot --argumentfile src/plone.act/.../keywords.txt --include [tag] [testfile] - Add the same configuration to RIDE custom script.
- Click on the Start Button in RIDE
What is not working¶
RIDE’s configuration Skip tests with these tags and
Only run tests with these tags did not work for me, but you can add
--include or --exclude as arguments for custom script.
| [1] | plone.act was renamed to plone.app.robotframework some time ago. |