Running acceptance tests in Plone
Test driven development (TDD) 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.act1 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 macOS. I saw a click-by-click installation of windows users, but this is not what we want to cover here today…
- 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.
plone.act was renamed to plone.app.robotframework some time ago. ↩︎