Change the future

Fully Test-Driven Web Development with Django and Selenium

Hi Everyone! Am really looking forward to meeting you all, and I hope to be able to impart some of the TDD gospel. Hooray!

It's super, super, super, super, super important to come prepared, so these are the four things you'll need to have installed:

  • Git (and my repo checked out)
  • Firefox
  • Django (1.4 or 1.5)
  • Selenium (the absolute latest version possible)

At the end of this document are some tests (appropriately) that I want you to go through, to check you have these 4 installed.

Git and Firefox

Windows: Just google these if you don't have them already, download and install

MacOS: Firefox is easy, for Git if in any doubt look for the instructions for installing Git on GitHub

Linux: surely you can figure out how to get these from your package manager, whichever it may be?

Django and Selenium

To get these installed, on any platform, you need to get pip. If you don't have that yet, google Python pip, and get it installed. You should then be able to open up a command-line and do a:

pip install --upgrade django
pip install --upgrade selenium

It's important that you have the latest versions. So Django needs to be at least version 1.4, Selenium at least version 2.25

Tests to check everything is installed and work:

If you don't have these things working, you can't do the tutorial.

Django:

Start a project:

django-admin.py startproject mysite

If that doesn't work, check out the Django documentation, and see what is says about installation.

Then run the test server:

cd mysite
python manage.py runserver

Check it works by opening up http://localhost:8001 in your web browser. You should see a big screen saying "It Worked!". If you don't, figure out why!

Selenium

Create a little Python program that does this:

from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://www.google.com')
assert 'google' in browser.title.lower()
print "OK, selenium+firefox works"
browser.quit()

Git

Do a

git clone https://github.com/hjwp/Test-Driven-Django-Tutorial.git

Then cd into the directory it created, and check you see all the tutorial's files, tutorial01.rst, tutorial02.rst etc etc. You'll need this repository during the tutorial, so don't delete the folder. Every so often I get people to do a git checkout of a tag I've pre-prepared so we can skip ahead and move on with the workshop...

That's it! I'm here if you need any help, harry.percival@gmail.com

Here's my website if you want a sneak preview of what we'll be doing: TDD Django Tutorial

I leave you with a picture of a goat up a tree:

A goat up a tree