Unit Tests

Where are they?

Our unit tests are found in ~/Projects/reformedchurcheslocator/rcl/tests.

How do I run them, and why should I?

You can run the unit tests by typing this in the terminal:

cd ~/Projects/reformedchurcheslocator
source ../tg21env/bin/activate
rcl/tests/ will monitor the files in your project and re-run the unit tests every time you change a .py file. Then it will report whether all the unit tests passed. If one or more tests doesn't pass, that is because something you just did introduced a bug into the code which you need to fix. We will write these automated tests for every significant new feature we implement, so we will have an automated means of knowing whether the software works like it should.

Test-driven development

It's best to write a new, failing(!) unit test before you write the code the test is intended to test. That way you know the test fails like it should when your code isn't working yet, then when that test passes, you know your code does what you intend it to do!

This is called "Test-driven development" or "Test-first development."

Last modified 8 years ago Last modified on 09/24/10 06:34:11