django_alfajor icon indicating copy to clipboard operation
django_alfajor copied to clipboard

Django support for Alfajor

= First, install alfajor and read the docs for it. =

= In the project root, create a separate folder for alfajor tests =

jeff@snazz:~/projects/testproject$ mkdir functional

  • then add this to functional/init.py :

from alfajor import WebBrowser browser = WebBrowser() browser.configure_in_scope('self-tests')

= django-nose =

Install django-nose. You'll need to change one line to make it work (until a patch is accepted):

--- a/django_nose/runner.py +++ b/django_nose/runner.py @@ -85,7 +85,7 @@ def _get_options(): cfg_files = nose.core.all_config_files() manager = nose.core.DefaultPluginManager() config = nose.core.Config(env=os.environ, files=cfg_files, plugins=manager)

  • options = config.getParser().option_list
  • options = config.getParser()._get_all_options() django_opts = [opt.dest for opt in BaseCommand.option_list] + ['version'] return tuple(o for o in options if o.dest not in django_opts and o.action != 'help')

= functional/alfajor.ini =

Create an alfajor.ini, using the alfajor/tests/browser/alfajor.ini as

a template, then change the cmd line as seen below:

[self-tests+browser.selenium] cmd = python manage.py testserver --addrport=8001 server_url = http://localhost:8001 ping-address = localhost:8001

= Running =

start the selenium server

java -jar selenium-server.jar

run the tests

./python manage.py test functional -- --browser=firefox

= Errata =

  • Known bug: running functional tests also runs other tests
  • It'd be nice to automatically start up selenium.